refile test build.
This commit is contained in:
parent
8070c241b5
commit
747574948a
2
Makefile
2
Makefile
@ -12,4 +12,4 @@ 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}
|
||||
g++ -DTEST src/script_parser.cpp -o test.exe ${INC} ${LIB}
|
@ -1,34 +1,28 @@
|
||||
#ifdef TEST
|
||||
#else
|
||||
#include <boost/test/unit_test.hpp>
|
||||
using namespace boost::unit_test;
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <script_parser.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::unit_test;
|
||||
|
||||
int parseScript(const char* path) {
|
||||
ifstream script(path, ios::in);
|
||||
if (!script.is_open()) {
|
||||
perror(path);
|
||||
return ENOENT;
|
||||
} else {
|
||||
string line;
|
||||
while(getline(script, line, '\n')) {
|
||||
// cout << line <<endl;
|
||||
string word;
|
||||
istringstream iss(line);
|
||||
while(getline(iss, word, ' ')) {
|
||||
cout << word << "+";
|
||||
}
|
||||
cout << endl;
|
||||
BOOST_TEST_REQUIRE(script.is_open(), "open script file failed!");
|
||||
|
||||
string line;
|
||||
while(getline(script, line, '\n')) {
|
||||
// cout << line <<endl;
|
||||
string word;
|
||||
istringstream iss(line);
|
||||
while(getline(iss, word, ' ')) {
|
||||
cout << word << "+";
|
||||
}
|
||||
script.close();
|
||||
cout << endl;
|
||||
}
|
||||
script.close();
|
||||
BOOST_TEST(true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user