diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-07-02 17:14:28 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-07-03 00:58:44 +0800 |
commit | 9d23fd80130ca1d020cf3ba494751fd5e3aa5fde (patch) | |
tree | c392fe25bfc32af41f69744309df9b541953a002 /test/compilationTests/gnosis/Utils | |
parent | 469dc7bbe72c3ac1c32d46a233e4bf0b36451c22 (diff) | |
download | dexon-solidity-9d23fd80130ca1d020cf3ba494751fd5e3aa5fde.tar.gz dexon-solidity-9d23fd80130ca1d020cf3ba494751fd5e3aa5fde.tar.zst dexon-solidity-9d23fd80130ca1d020cf3ba494751fd5e3aa5fde.zip |
Update compilation tests.
Diffstat (limited to 'test/compilationTests/gnosis/Utils')
-rw-r--r-- | test/compilationTests/gnosis/Utils/Math.sol | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 95d95346..93456c33 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -22,7 +22,7 @@ library Math { /// @return e**x function exp(int x) public - constant + pure returns (uint) { // revert if x is > MAX_POWER, where @@ -107,7 +107,7 @@ library Math { /// @return ln(x) function ln(uint x) public - constant + pure returns (int) { require(x > 0); @@ -157,7 +157,7 @@ library Math { /// @return logarithmic value function floorLog2(uint x) public - constant + pure returns (int lo) { lo = -64; @@ -178,7 +178,7 @@ library Math { /// @return Maximum number function max(int[] nums) public - constant + pure returns (int max) { require(nums.length > 0); @@ -194,7 +194,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(uint a, uint b) public - constant + pure returns (bool) { return a + b >= a; @@ -206,7 +206,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(uint a, uint b) public - constant + pure returns (bool) { return a >= b; @@ -218,7 +218,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(uint a, uint b) public - constant + pure returns (bool) { return b == 0 || a * b / b == a; @@ -230,7 +230,7 @@ library Math { /// @return Sum function add(uint a, uint b) public - constant + pure returns (uint) { require(safeToAdd(a, b)); @@ -243,7 +243,7 @@ library Math { /// @return Difference function sub(uint a, uint b) public - constant + pure returns (uint) { require(safeToSub(a, b)); @@ -256,7 +256,7 @@ library Math { /// @return Product function mul(uint a, uint b) public - constant + pure returns (uint) { require(safeToMul(a, b)); @@ -269,7 +269,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a + b >= a) || (b < 0 && a + b < a); @@ -281,7 +281,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a - b <= a) || (b < 0 && a - b > a); @@ -293,7 +293,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(int a, int b) public - constant + pure returns (bool) { return (b == 0) || (a * b / b == a); @@ -305,7 +305,7 @@ library Math { /// @return Sum function add(int a, int b) public - constant + pure returns (int) { require(safeToAdd(a, b)); @@ -318,7 +318,7 @@ library Math { /// @return Difference function sub(int a, int b) public - constant + pure returns (int) { require(safeToSub(a, b)); @@ -331,7 +331,7 @@ library Math { /// @return Product function mul(int a, int b) public - constant + pure returns (int) { require(safeToMul(a, b)); |