diff --git a/Makefile b/Makefile index affabf5..f00d25a 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ -DIR=E:\code\src\boost_1_74_0 -INC=-I${DIR} -LIB=-L${DIR}\stage\lib -lboost_test_exec_monitor-mgw8-mt-x64-1_74 +DIR=E:/code/src/boost_1_74_0 +INC=-I${DIR} -Iinclude +LIB=-L${DIR}/stage/lib -lboost_test_exec_monitor-mgw8-mt-x64-1_74 -boosttest.exe: obj/boosttest.o - g++ -o boosttest obj\boosttest.o ${LIB} +boosttest.exe: obj/boosttest.o obj/script_parser.o + g++ -o boosttest obj/boosttest.o obj/script_parser.o ${LIB} -obj/boosttest.o: src\boosttest.cpp - g++ -o obj\boosttest.o src\boosttest.cpp -c ${INC} +obj/boosttest.o: src/boosttest.cpp + g++ -o obj/boosttest.o src/boosttest.cpp -c ${INC} +obj/script_parser.o: src/script_parser.cpp include/script_parser.h + g++ -o obj/script_parser.o src/script_parser.cpp -c ${INC} diff --git a/include/script_parser.h b/include/script_parser.h new file mode 100644 index 0000000..bfdd6db --- /dev/null +++ b/include/script_parser.h @@ -0,0 +1 @@ +int parseScript(const char* path); \ No newline at end of file diff --git a/src/boosttest.cpp b/src/boosttest.cpp index b67e67b..d8b74ab 100644 --- a/src/boosttest.cpp +++ b/src/boosttest.cpp @@ -1,6 +1,19 @@ #define BOOST_TEST_MODULE "test" #include #include +#include +#include +using namespace boost::unit_test; +using namespace std; BOOST_AUTO_TEST_SUITE(script) +BOOST_AUTO_TEST_CASE(script) { + int argc = boost::unit_test::framework::master_test_suite().argc; + char** argv = boost::unit_test::framework::master_test_suite().argv; + BOOST_TEST_REQUIRE(argc >= 2); + + cout << "script path: " << argv[1] << endl; + parseScript(argv[1]); + +} BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file diff --git a/src/script_parser.cpp b/src/script_parser.cpp new file mode 100644 index 0000000..af06282 --- /dev/null +++ b/src/script_parser.cpp @@ -0,0 +1,23 @@ +#include + +#include +#include +#include + +using namespace boost::unit_test; +using namespace std; + +int parseScript(const char* path) { + ifstream script(path, ios::in); + if (!script.is_open()) { + perror(path); + return ENOENT; + } else { + std::stringstream strbuf; + strbuf << script.rdbuf(); + std::string contents(strbuf.str()); + cout << contents << endl; + } + + return 0; +} \ No newline at end of file