diff --git a/remix-tests/tests/examples_1/simple_storage_test.sol b/remix-tests/tests/examples_1/simple_storage_test.sol index 35063a4179..a22ef9e504 100644 --- a/remix-tests/tests/examples_1/simple_storage_test.sol +++ b/remix-tests/tests/examples_1/simple_storage_test.sol @@ -26,5 +26,4 @@ contract MyTest { function shouldTriggerOnePass() public { Assert.equal(uint(1), uint(1), "the test 3 fails"); } - } diff --git a/remix-tests/tests/examples_2/simple_storage.sol b/remix-tests/tests/examples_2/simple_storage.sol index bc74b55c00..278155d1f1 100644 --- a/remix-tests/tests/examples_2/simple_storage.sol +++ b/remix-tests/tests/examples_2/simple_storage.sol @@ -13,5 +13,4 @@ contract SimpleStorage { function get() public view returns (uint retVal) { return storedData; } - } diff --git a/remix-tests/tests/examples_4/SafeMath.sol b/remix-tests/tests/examples_4/SafeMath.sol index 72a618504e..3fa42ea119 100644 --- a/remix-tests/tests/examples_4/SafeMath.sol +++ b/remix-tests/tests/examples_4/SafeMath.sol @@ -1,6 +1,6 @@ // Copyright (c) 2016 Smart Contract Solutions, Inc. -pragma solidity ^0.4.24; +pragma solidity >=0.4.22 <0.6.0; /** diff --git a/remix-tests/tests/examples_4/SafeMathProxy.sol b/remix-tests/tests/examples_4/SafeMathProxy.sol index 5b8828c0b6..96b88b8e9b 100644 --- a/remix-tests/tests/examples_4/SafeMathProxy.sol +++ b/remix-tests/tests/examples_4/SafeMathProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.24; +pragma solidity >=0.4.22 <0.6.0; import "./SafeMath.sol"; /* @@ -9,23 +9,23 @@ https://truffleframework.com/tutorials/testing-for-throws-in-solidity-tests contract SafeMathProxy { using SafeMath for uint; - function divProxy(uint256 a, uint256 b) returns (uint256) { + function divProxy(uint256 a, uint256 b) public pure returns (uint256) { return a.div(b); } - function mulProxy(uint256 a, uint256 b) returns (uint256) { + function mulProxy(uint256 a, uint256 b) public pure returns (uint256) { return a.mul(b); } - function subProxy(uint256 a, uint256 b) returns (uint256) { + function subProxy(uint256 a, uint256 b) public pure returns (uint256) { return a.sub(b); } - function addProxy(uint256 a, uint256 b) returns (uint256) { + function addProxy(uint256 a, uint256 b) public pure returns (uint256) { return a.add(b); } - function modProxy(uint256 a, uint256 b) returns (uint256) { + function modProxy(uint256 a, uint256 b) public pure returns (uint256) { return a.mod(b); } } diff --git a/remix-tests/tests/examples_4/SafeMath_test.sol b/remix-tests/tests/examples_4/SafeMath_test.sol index bf4534c913..9953ee8f62 100644 --- a/remix-tests/tests/examples_4/SafeMath_test.sol +++ b/remix-tests/tests/examples_4/SafeMath_test.sol @@ -1,16 +1,16 @@ -pragma solidity ^0.4.24; -import "./remix_tests.sol"; +pragma solidity >=0.4.22 <0.6.0; +import "remix_tests.sol"; import "./SafeMath.sol"; import "./SafeMathProxy.sol"; contract SafeMathTest { SafeMathProxy safemathproxy; - function beforeAll() { + function beforeAll() public { safemathproxy = new SafeMathProxy(); } - function unsafeMultiplicationShouldOverflow() public view returns (bool) { + function unsafeMultiplicationShouldOverflow() public returns (bool) { uint256 a = 4; uint256 b = 2 ** 256 - 1; return Assert.equal( @@ -20,27 +20,29 @@ contract SafeMathTest { ); } - function safeMultiplicationShouldRevert() public view returns (bool) { + function safeMultiplicationShouldRevert() public returns (bool) { uint256 a = 4; uint256 b = 2 ** 256 - 1; + (bool success, bytes memory data) = address(safemathproxy).call.gas(40000).value(0)(abi.encode("mulProxy, [a, b]")); return Assert.equal( - address(safemathproxy).call.gas(40000).value(0)("mulProxy",[a, b]), + success, false, "safe multiplication did not revert" ); } - function safeDivisionByZeroShouldRevert() public view returns (bool) { + function safeDivisionByZeroShouldRevert() public returns (bool) { uint256 a = 4; uint256 b = 0; + (bool success, bytes memory data) = address(safemathproxy).call.gas(40000).value(0)(abi.encode("divProxy, [a, b]")); return Assert.equal( - address(safemathproxy).call.gas(40000).value(0)("divProxy", [a, b]), + success, false, "safe division did not revert" ); } - function unsafeSubtractShouldUnderflow() public view returns (bool) { + function unsafeSubtractShouldUnderflow() public returns (bool) { uint256 a = 0; uint256 b = a - 1; return Assert.equal( @@ -50,35 +52,38 @@ contract SafeMathTest { ); } - function safeSubtractShouldRevert() public constant returns (bool) { + function safeSubtractShouldRevert() public returns (bool) { + (bool success, bytes memory data) = address(safemathproxy).call.gas(40000).value(0)(abi.encode("subProxy, [0, 1]")); return Assert.equal( - address(safemathproxy).call.gas(40000).value(0)("subProxy", [0, 1]), + success, false, "safe subtract should revert" ); } - function unsafeAdditionShouldOverflow() public constant returns (bool) { + function unsafeAdditionShouldOverflow() public returns (bool) { uint256 a = 1; uint256 b = 2 ** 256 - 1; return Assert.equal(a + b, 0, "unsafe addition did not overflow"); } - function safeAdditionShouldRevert() public constant returns (bool) { + function safeAdditionShouldRevert() public returns (bool) { uint256 a = 1; uint256 b = 2 ** 256 - 1; + (bool success, bytes memory data) = address(safemathproxy).call.gas(40000).value(0)(abi.encode("addProxy, [a, b]")); return Assert.equal( - address(safemathproxy).call.gas(40000).value(0)("addProxy", [a, b]), + success, false, "safe addition should revert" ); } - function safeModulusShouldRevert() public constant returns (bool) { + function safeModulusShouldRevert() public returns (bool) { uint256 a = 1; uint256 b = 0; + (bool success, bytes memory data) = address(safemathproxy).call.gas(40000).value(0)(abi.encode("modProxy, [a, b]")); return Assert.equal( - address(safemathproxy).call.gas(40000).value(0)("modProxy", [a, b]), + success, false, "safe modulus did not revert" );