Skip to content

Commit

Permalink
Use readStandardInput in the fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Feb 23, 2018
1 parent 2b62c20 commit 4d1b969
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions test/fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Executable for use with AFL <http://lcamtuf.coredump.cx/afl>.
*/

#include <libdevcore/CommonIO.h>
#include <libevmasm/Assembly.h>
#include <libevmasm/ConstantOptimiser.h>
#include <libsolc/libsolc.h>
Expand Down Expand Up @@ -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))
Expand All @@ -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;
Expand Down

0 comments on commit 4d1b969

Please sign in to comment.