aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 0611e71d..4d20f4f5 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -7459,6 +7459,33 @@ BOOST_AUTO_TEST_CASE(addmod_mulmod)
ABI_CHECK(callContractFunction("test()"), encodeArgs(u256(0)));
}
+BOOST_AUTO_TEST_CASE(addmod_mulmod_zero)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() pure returns (uint) {
+ addmod(1, 2, 0);
+ return 2;
+ }
+ function g() pure returns (uint) {
+ mulmod(1, 2, 0);
+ return 2;
+ }
+ function h() pure returns (uint) {
+ mulmod(0, 1, 2);
+ mulmod(1, 0, 2);
+ addmod(0, 1, 2);
+ addmod(1, 0, 2);
+ return 2;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("f()"), encodeArgs());
+ ABI_CHECK(callContractFunction("g()"), encodeArgs());
+ ABI_CHECK(callContractFunction("h()"), encodeArgs(2));
+}
+
BOOST_AUTO_TEST_CASE(divisiod_by_zero)
{
char const* sourceCode = R"(