diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-24 17:49:41 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-23 16:05:04 +0800 |
commit | 4d1b969543c51be1188d792398e028fcbc3d85cf (patch) | |
tree | edfad5a7644a6157f508613f408538dd6c3c5ee2 | |
parent | 2b62c201be166222f05acfa8422b1968f2cf924a (diff) | |
download | dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar.gz dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar.bz2 dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar.lz dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar.xz dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.tar.zst dexon-solidity-4d1b969543c51be1188d792398e028fcbc3d85cf.zip |
Use readStandardInput in the fuzzer
-rw-r--r-- | test/fuzzer.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/test/fuzzer.cpp b/test/fuzzer.cpp index c61410b6..45738baa 100644 --- a/test/fuzzer.cpp +++ b/test/fuzzer.cpp @@ -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> @@ -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; |