diff options
author | John Wiegley <johnw@newartisans.com> | 2006-08-21 02:39:33 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:32 -0400 |
commit | db0ef2e25731a824aa728315f2f7f6e8a41a5ddf (patch) | |
tree | 073a4ffe44699413d97e56bae001e2f69a8b9a04 /tests/parser.h | |
parent | bec5f1c07af7948eb26a7cbafc6d191cfbb77d97 (diff) | |
download | fork-ledger-db0ef2e25731a824aa728315f2f7f6e8a41a5ddf.tar.gz fork-ledger-db0ef2e25731a824aa728315f2f7f6e8a41a5ddf.tar.bz2 fork-ledger-db0ef2e25731a824aa728315f2f7f6e8a41a5ddf.zip |
*** empty log message ***
Diffstat (limited to 'tests/parser.h')
-rw-r--r-- | tests/parser.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/parser.h b/tests/parser.h new file mode 100644 index 00000000..65acadb5 --- /dev/null +++ b/tests/parser.h @@ -0,0 +1,65 @@ +#ifndef __TESTFILEFORMAT_H +#define __TESTFILEFORMAT_H + +#include <cxxtest/TestSuite.h> + +#include <textual.h> +#include <xml.h> +#include <binary.h> +#include <gnucash.h> +#include <qif.h> + +using namespace std; +using namespace ledger; + +class TestFileFormat : public CxxTest::TestSuite +{ +public: + void testEmptyFileIsTextualFile() + { + stringstream emptyStream(stringstream::in); + textual_parser_t textualParser; + TS_ASSERT(textualParser.test(emptyStream)); + TS_ASSERT(emptyStream.good()); + TS_ASSERT_EQUALS(0, emptyStream.tellg()); + } + + void testEmptyFileIsNotXMLFile() + { + stringstream emptyStream(stringstream::in); + xml_parser_t xmlParser; + TS_ASSERT(!xmlParser.test(emptyStream)); + TS_ASSERT(emptyStream.good()); + TS_ASSERT_EQUALS(0, emptyStream.tellg()); + } + + void testEmptyFileIsNotBinaryFile() + { + stringstream emptyStream(stringstream::in); + binary_parser_t binaryParser; + TS_ASSERT(!binaryParser.test(emptyStream)); + TS_ASSERT(emptyStream.good()); + TS_ASSERT_EQUALS(0, emptyStream.tellg()); + } + + void testEmptyFileIsNotGnuCashFile() + { + stringstream emptyStream(stringstream::in); + gnucash_parser_t gnucashParser; + TS_ASSERT(!gnucashParser.test(emptyStream)); + TS_ASSERT(emptyStream.good()); + TS_ASSERT_EQUALS(0, emptyStream.tellg()); + } + + void testEmptyFileIsNotQIFFile() + { + stringstream emptyStream(stringstream::in); + qif_parser_t qifParser; + TS_ASSERT(!qifParser.test(emptyStream)); + TS_ASSERT(emptyStream.good()); + TS_ASSERT_EQUALS(0, emptyStream.tellg()); + } + +}; + +#endif // __TESTFILEFORMAT_H |