aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-09 23:27:23 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-10 21:29:17 +0800
commit8429c03f2ab81ad5fe077df6f69f6dbe88609779 (patch)
tree301d045f84550f80f366dc138ca6385a95c6bc8d /test/libsolidity/SolidityEndToEndTest.cpp
parentf8461e9e31b96e6656b8dcabd73de2e5176e6fe3 (diff)
downloaddexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar.gz
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar.bz2
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar.lz
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar.xz
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.tar.zst
dexon-solidity-8429c03f2ab81ad5fe077df6f69f6dbe88609779.zip
Add tests for assert()
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 4924b55d..e49db34e 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9077,6 +9077,25 @@ 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_SUITE_END()
}