diff options
Diffstat (limited to 'src/tests/parsertest.cc')
-rw-r--r-- | src/tests/parsertest.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/parsertest.cc b/src/tests/parsertest.cc new file mode 100644 index 0000000..9854074 --- /dev/null +++ b/src/tests/parsertest.cc | |||
@@ -0,0 +1,31 @@ | |||
1 | #include "../FbMenuParser.hh" | ||
2 | |||
3 | #include <iostream> | ||
4 | |||
5 | using namespace std; | ||
6 | |||
7 | |||
8 | int main(int argc, char **argv) { | ||
9 | if (argc < 2) { | ||
10 | cerr<<"you must supply an argument!"<<endl; | ||
11 | exit(0); | ||
12 | } | ||
13 | cerr<<"Loading: "<<argv[1]<<endl; | ||
14 | Parser *p = new FbMenuParser(argv[1]); | ||
15 | if (!p->isLoaded()) { | ||
16 | cerr<<"Couldn't load file: "<<argv[1]<<endl; | ||
17 | delete p; | ||
18 | exit(0); | ||
19 | } | ||
20 | |||
21 | Parser::Item item, item2, item3; | ||
22 | int args = 0; | ||
23 | int last_line_num = 0; | ||
24 | std::string last_line; | ||
25 | std::string type, name, argument; | ||
26 | while (!p->eof()) { | ||
27 | (*p)>>item>>item2>>item3; | ||
28 | cerr<<item.second<<","<<item2.second<<", "<<item3.second<<endl; | ||
29 | } | ||
30 | delete p; | ||
31 | } | ||