diff --git a/test/fuzzer.cpp b/test/fuzzer.cpp index c61410b69..45738baab 100644 --- a/test/fuzzer.cpp +++ b/test/fuzzer.cpp @@ -18,6 +18,7 @@ * Executable for use with AFL . */ +#include #include #include #include @@ -82,23 +83,12 @@ void testConstantOptimizer() } } -string readInput() -{ - string input; - while (!cin.eof()) - { - string s; - getline(cin, s); - input += s + '\n'; - } - return input; -} - void testStandardCompiler() { if (!quiet) cout << "Testing compiler via JSON interface." << endl; - string input = readInput(); + string input = readStandardInput(); + string outputString(compileStandard(input.c_str(), NULL)); Json::Value output; if (!jsonParseStrict(outputString, output)) @@ -125,7 +115,7 @@ void testCompiler(bool optimize) { if (!quiet) cout << "Testing compiler " << (optimize ? "with" : "without") << " optimizer." << endl; - string input = readInput(); + string input = readStandardInput(); string outputString(compileJSON(input.c_str(), optimize)); Json::Value outputJson;