diff options
author | chriseth <c@ethdev.com> | 2015-11-19 20:16:13 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-19 20:16:13 +0800 |
commit | 8dfc964e7d6dc0ca997e29091f8a7d25e26942cf (patch) | |
tree | f30ff9d4d5845cc6fe13e42b596f6f1ff7c52067 /test | |
parent | 3be0ae6e2cff95239dab9b37c9722d55481e8b26 (diff) | |
parent | 0cf8d022ae7d2e2da347347fdc76ba9529149c35 (diff) | |
download | dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar.gz dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar.bz2 dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar.lz dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar.xz dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.tar.zst dexon-solidity-8dfc964e7d6dc0ca997e29091f8a7d25e26942cf.zip |
Merge pull request #227 from chriseth/addmod
Addmod and mulmod.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f2aa2e8e..20fef48d 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() } |