From a5810e3793bd58de95e656e50f1784fddfe886a5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 30 Sep 2016 13:09:45 +0200 Subject: Add script to extract test cases. --- scripts/isolateTests.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/isolateTests.py (limited to 'scripts') diff --git a/scripts/isolateTests.py b/scripts/isolateTests.py new file mode 100755 index 00000000..0290d13e --- /dev/null +++ b/scripts/isolateTests.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +# +# This script reads C++ source files and writes all +# multi-line strings into individual files. +# This can be used to extract the Solidity test cases +# into files for e.g. fuzz testing. + +import sys +lines = sys.stdin.read().split('\n') +inside = False +tests = [] +for l in lines: + if inside: + if l.strip().endswith(')";'): + inside = False + else: + tests[-1] += l + '\n' + else: + if l.strip().endswith('R"('): + inside = True + tests += [''] +for i in range(len(tests)): + open('test%d.sol' % i, 'w').write(tests[i]) -- cgit v1.2.3 From ff18c7404a6ecbfb72569fd66a74674083b70b0a Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 10 Oct 2016 22:04:11 +0200 Subject: Extend comment. --- scripts/isolateTests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/isolateTests.py b/scripts/isolateTests.py index 0290d13e..fed779d3 100755 --- a/scripts/isolateTests.py +++ b/scripts/isolateTests.py @@ -3,7 +3,8 @@ # This script reads C++ source files and writes all # multi-line strings into individual files. # This can be used to extract the Solidity test cases -# into files for e.g. fuzz testing. +# into files for e.g. fuzz testing as +# scripts/isolateTests.py tests/libsolidity/SolidityEndToEndTest.cpp import sys lines = sys.stdin.read().split('\n') -- cgit v1.2.3