diff --git a/contracts/util/safety.sol b/contracts/util/safety.sol index 93d447c..5f4a2a0 100644 --- a/contracts/util/safety.sol +++ b/contracts/util/safety.sol @@ -1,6 +1,6 @@ contract DSSafeAddSub { function safeToAdd(uint a, uint b) internal returns (bool) { - return (a + b > a); + return (a + b >= a); } function safeAdd(uint a, uint b) internal returns (uint) { if (!safeToAdd(a, b)) throw; diff --git a/contracts/util/safety_test.sol b/contracts/util/safety_test.sol new file mode 100644 index 0000000..24e2c8e --- /dev/null +++ b/contracts/util/safety_test.sol @@ -0,0 +1,10 @@ +import 'dapple/test.sol'; +import 'util/safety.sol'; + +contract SafeAddSubTest is Test, DSSafeAddSub { + function setUp() { + } + function testSafeToAddFix() { + assertTrue(safeToAdd(1, 0)); + } +} diff --git a/dappfile b/dappfile index 815ac97..d405442 100644 --- a/dappfile +++ b/dappfile @@ -1,5 +1,5 @@ name: dappsys -version: 0.1.0 +version: 0.1.1 layout: sol_sources: contracts build_dir: build