diff --git a/CppTester.h b/CppTester.h index dfef84e..f5c1c87 100644 --- a/CppTester.h +++ b/CppTester.h @@ -75,7 +75,6 @@ class CppTester { } else if(subtype == "extract") { result["type"] = "GROUP"; result["result"]["columns"] = json(); - } smatch match; bool first = true; @@ -109,12 +108,13 @@ class CppTester { } } else if(test_type == "search") { result["type"] = "GROUP"; + result["result"]["columns"] = json::array(); smatch match; bool first = true; for(string test_string: test_strings) { json groups_list; - groups_list["list"] = json(); + groups_list["list"] = json::array(); string temp_string = test_string; while(regex_search(temp_string, match, pattern, (match_flag_type) match_flags)) { diff --git a/Dockerfile b/Dockerfile index f778bf4..0157fed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,19 @@ FROM regexpress/base:latest COPY CppTester.cpp /root - +COPY CppTester.h /root COPY CppTesterTest.cpp /root +COPY json.hpp /root RUN apk update && \ apk add --no-cache --virtual .build-deps g++=5.3.0-r0 && \ cd /root && \ g++ -std=c++11 CppTester.cpp -o CppTester && \ g++ -std=c++11 CppTesterTest.cpp -o CppTesterTest && \ - echo "arg=();for var in \"\$@\";do arg+=(\$(echo -n \"\$var\" | base64 -d)); done; ./CppTester \"\${arg[@]}\"" > run.sh && \ + echo "arg=();for var in \"\$@\";do arg+=(\"\$(echo -n \"\$var\" | base64 -d)\"); done; /root/CppTester \"\${arg[@]}\"" > run.sh && \ chmod 755 run.sh && \ - apk del .build-deps + apk del .build-deps && \ + apk add --no-cache libstdc++ && \ rm -rf /tmp/* ENTRYPOINT ["/bin/bash", "/root/run.sh"] \ No newline at end of file diff --git a/run.sh b/run.sh deleted file mode 100644 index 1474fd4..0000000 --- a/run.sh +++ /dev/null @@ -1 +0,0 @@ -arg=();for var in "$@";do arg+=($(echo -n "$var" | base64 -d)); done; node /root/JavascriptTester.js "${arg[@]}"