summaryrefslogtreecommitdiff
path: root/tests/textual.h
blob: adf24c77cf616d83b4274d45cfd66e8a04634795 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __TESTTEXTUALJOURNAL_H
#define __TESTTEXTUALJOURNAL_H

#include <cxxtest/TestSuite.h>

#include <textual.h>
#include <config.h>

using namespace std;
using namespace ledger;

class TestTextualJournal : public CxxTest::TestSuite
{
public:
    void testEmptyFileIsTextualFile()
    {
	stringstream j(stringstream::in);

	j << "2005/10/15 Something" << endl;
	j << "  A $ 42" << endl;
	j << "  B" << endl;

	textual_parser_t textualParser;
	TS_ASSERT(textualParser.test(j));
	TS_ASSERT(j.good());
	TS_ASSERT_EQUALS(0, j.tellg());

	config_t config;
	std::auto_ptr<journal_t> journal(new journal_t);
	textualParser.parse(j, config, journal.get());
    }
};

#endif // __TESTTEXTUALJOURNAL_H