boosttest/src/script_parser.cpp

34 lines
717 B
C++
Raw Normal View History

2022-01-13 19:04:38 +08:00
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
2022-01-14 14:40:45 +08:00
#include <script_parser.h>
2022-01-13 19:04:38 +08:00
using namespace std;
2022-01-14 16:48:43 +08:00
using namespace boost::unit_test;
2022-01-13 19:04:38 +08:00
int parseScript(const char* path) {
ifstream script(path, ios::in);
2022-01-14 16:48:43 +08:00
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 << "+";
2022-01-14 14:40:45 +08:00
}
2022-01-14 16:48:43 +08:00
cout << endl;
2022-01-13 19:04:38 +08:00
}
2022-01-14 16:48:43 +08:00
script.close();
BOOST_TEST(true);
2022-01-13 19:04:38 +08:00
return 0;
}
#ifdef TEST
int main(int argc, char** argv) {
parseScript(argv[1]);
}
#endif