diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/cmdlineTests.sh | 17 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 42 |
2 files changed, 41 insertions, 18 deletions
diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index cb714efe..e2ee6a5e 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -50,9 +50,26 @@ echo "Testing library checksum..." echo '' | "$SOLC" --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222 ! echo '' | "$SOLC" --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 2>/dev/null +echo "Testing long library names..." +echo '' | "$SOLC" --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222 + +echo "Testing overwriting files" +TMPDIR=$(mktemp -d) +( + set -e + # First time it works + echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null + # Second time it fails + ! echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null + # Unless we force + echo 'contract C {} ' | "$SOLC" --overwrite --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null +) +rm -rf "$TMPDIR" + echo "Testing soljson via the fuzzer..." TMPDIR=$(mktemp -d) ( + set -e cd "$REPO_ROOT" REPO_ROOT=$(pwd) # make it absolute cd "$TMPDIR" diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 831840e2..a4fab721 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9184,24 +9184,30 @@ BOOST_AUTO_TEST_CASE(invalid_instruction) BOOST_CHECK(callContractFunction("f()") == encodeArgs()); } -//BOOST_AUTO_TEST_CASE(assert) -//{ -// char const* sourceCode = R"( -// contract C { -// function f() { -// assert(false); -// } -// function g(bool val) returns (bool) { -// assert(val == true); -// return true; -// } -// } -// )"; -// compileAndRun(sourceCode, 0, "C"); -// BOOST_CHECK(callContractFunction("f()") == encodeArgs()); -// BOOST_CHECK(callContractFunction("g(bool)", false) == encodeArgs()); -// BOOST_CHECK(callContractFunction("g(bool)", true) == encodeArgs(true)); -//} +BOOST_AUTO_TEST_CASE(assert_require) +{ + char const* sourceCode = R"( + contract C { + function f() { + assert(false); + } + function g(bool val) returns (bool) { + assert(val == true); + return true; + } + function h(bool val) returns (bool) { + require(val); + return true; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs()); + BOOST_CHECK(callContractFunction("g(bool)", false) == encodeArgs()); + BOOST_CHECK(callContractFunction("g(bool)", true) == encodeArgs(true)); + BOOST_CHECK(callContractFunction("h(bool)", false) == encodeArgs()); + BOOST_CHECK(callContractFunction("h(bool)", true) == encodeArgs(true)); +} BOOST_AUTO_TEST_CASE(revert) { |