aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-19 00:12:39 +0800
committerchriseth <c@ethdev.com>2015-11-19 00:12:39 +0800
commit0cf8d022ae7d2e2da347347fdc76ba9529149c35 (patch)
tree0193a0e120ed554566e4d11c4af50bce4bf84adb /test
parentb4e666ccf4fe39b0a1fc909b61daf6dc39e77fc4 (diff)
downloaddexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar.gz
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar.bz2
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar.lz
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar.xz
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.tar.zst
dexon-solidity-0cf8d022ae7d2e2da347347fdc76ba9529149c35.zip
Addmod and mulmod.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 81543356..21917627 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5831,6 +5831,24 @@ BOOST_AUTO_TEST_CASE(memory_overwrite)
BOOST_CHECK(callContractFunction("f()") == encodeDyn(string("b23a5")));
}
+BOOST_AUTO_TEST_CASE(addmod_mulmod)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function test() returns (uint) {
+ // Note that this only works because computation on literals is done using
+ // unbounded integers.
+ if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7))
+ return 1;
+ if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7))
+ return 2;
+ return 0;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callContractFunction("test()") == encodeArgs(u256(0)));
+}
BOOST_AUTO_TEST_SUITE_END()
}