boosttest/src/script_parser.cpp

40 lines
787 B
C++
Raw Normal View History

#ifdef TEST
#else
2022-01-13 19:04:38 +08:00
#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
#endif
2022-01-13 19:04:38 +08:00
#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;
int parseScript(const char* path) {
ifstream script(path, ios::in);
if (!script.is_open()) {
perror(path);
return ENOENT;
} else {
2022-01-14 14:40:45 +08:00
string line;
while(getline(script, line, '\n')) {
// cout << line <<endl;
string word;
istringstream iss(line);
while(getline(iss, word, ' ')) {
cout << word << "+";
}
cout << endl;
2022-01-14 14:40:45 +08:00
}
script.close();
2022-01-13 19:04:38 +08:00
}
return 0;
}
#ifdef TEST
int main(int argc, char** argv) {
parseScript(argv[1]);
}
#endif