From 955c2358fbd8364be5629504cc720e0a9227d630 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Sun, 2 May 2004 21:23:35 +0000 Subject: testing menu parser --- src/tests/parsertest.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/tests/parsertest.cc 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 @@ +#include "../FbMenuParser.hh" + +#include <iostream> + +using namespace std; + + +int main(int argc, char **argv) { + if (argc < 2) { + cerr<<"you must supply an argument!"<<endl; + exit(0); + } + cerr<<"Loading: "<<argv[1]<<endl; + Parser *p = new FbMenuParser(argv[1]); + if (!p->isLoaded()) { + cerr<<"Couldn't load file: "<<argv[1]<<endl; + delete p; + exit(0); + } + + Parser::Item item, item2, item3; + int args = 0; + int last_line_num = 0; + std::string last_line; + std::string type, name, argument; + while (!p->eof()) { + (*p)>>item>>item2>>item3; + cerr<<item.second<<","<<item2.second<<", "<<item3.second<<endl; + } + delete p; +} -- cgit v0.11.2