diff options
author | chriseth <c@ethdev.com> | 2016-09-30 19:09:45 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-09-30 19:10:17 +0800 |
commit | a5810e3793bd58de95e656e50f1784fddfe886a5 (patch) | |
tree | 975e11f030e601bd00019ebef6921f74a0659f16 | |
parent | c06ba01136e9594648a2d362f2767b967f2d0c1f (diff) | |
download | dexon-solidity-a5810e3793bd58de95e656e50f1784fddfe886a5.tar.gz dexon-solidity-a5810e3793bd58de95e656e50f1784fddfe886a5.tar.zst dexon-solidity-a5810e3793bd58de95e656e50f1784fddfe886a5.zip |
Add script to extract test cases.
-rwxr-xr-x | scripts/isolateTests.py | 23 |
1 files changed, 23 insertions, 0 deletions
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]) |