add test.exe to support fast validation.

This commit is contained in:
wangjiacai 2022-01-14 15:39:15 +08:00
parent 5acc341171
commit 8070c241b5
2 changed files with 24 additions and 4 deletions

View File

@ -10,3 +10,6 @@ obj/boosttest.o: src/boosttest.cpp
obj/script_parser.o: src/script_parser.cpp include/script_parser.h
g++ -o obj/script_parser.o src/script_parser.cpp -c ${INC}
test.exe: src/script_parser.cpp
g++ -DTEST src/script_parser.cpp -o test.exe ${INC}

View File

@ -1,9 +1,14 @@
#ifdef TEST
#else
#include <boost/test/unit_test.hpp>
#include <fstream>
using namespace boost::unit_test;
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include <script_parser.h>
using namespace boost::unit_test;
using namespace std;
int parseScript(const char* path) {
@ -14,10 +19,22 @@ int parseScript(const char* path) {
} else {
string line;
while(getline(script, line, '\n')) {
cout << line <<endl;
// cout << line <<endl;
string word;
istringstream iss(line);
while(getline(iss, word, ' ')) {
cout << word << "+";
}
cout << endl;
}
script.close();
}
return 0;
}
#ifdef TEST
int main(int argc, char** argv) {
parseScript(argv[1]);
}
#endif