diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-08-24 06:19:29 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-08-25 05:09:51 +0800 |
commit | 7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8 (patch) | |
tree | 9711ad39a1ed8d1827f0d8c234e0a8cce07f2d12 /packages/contracts/src | |
parent | 6734f2f1bcdab8f0d50524a26195707da00bd8ed (diff) | |
download | dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar.gz dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar.bz2 dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar.lz dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar.xz dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.tar.zst dexon-sol-tools-7f78d7da9dd13d1f0068a292bcd1ee3c5439d5a8.zip |
Add tests
Diffstat (limited to 'packages/contracts/src')
-rw-r--r-- | packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol | 19 | ||||
-rw-r--r-- | packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol | 34 |
2 files changed, 52 insertions, 1 deletions
diff --git a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol b/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol index 239dd10a8..5e2ae2f0e 100644 --- a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol +++ b/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol @@ -96,7 +96,7 @@ contract TestExchangeInternals is return getPartialAmountCeil(numerator, denominator, target); } - /// @dev Checks if rounding error > 0.1%. + /// @dev Checks if rounding error >= 0.1%. /// @param numerator Numerator. /// @param denominator Denominator. /// @param target Value to multiply with numerator/denominator. @@ -112,6 +112,23 @@ contract TestExchangeInternals is { return isRoundingError(numerator, denominator, target); } + + /// @dev Checks if rounding error >= 0.1%. + /// @param numerator Numerator. + /// @param denominator Denominator. + /// @param target Value to multiply with numerator/denominator. + /// @return Rounding error is present. + function publicIsRoundingErrorCeil( + uint256 numerator, + uint256 denominator, + uint256 target + ) + public + pure + returns (bool isError) + { + return isRoundingErrorCeil(numerator, denominator, target); + } /// @dev Updates state with results of a fill order. /// @param order that was filled. diff --git a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol index 4a99dd9c1..8c3d12226 100644 --- a/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol +++ b/packages/contracts/src/2.0.0/test/TestLibs/TestLibs.sol @@ -66,6 +66,23 @@ contract TestLibs is return partialAmount; } + function publicGetPartialAmountCeil( + uint256 numerator, + uint256 denominator, + uint256 target + ) + public + pure + returns (uint256 partialAmount) + { + partialAmount = getPartialAmountCeil( + numerator, + denominator, + target + ); + return partialAmount; + } + function publicIsRoundingError( uint256 numerator, uint256 denominator, @@ -83,6 +100,23 @@ contract TestLibs is return isError; } + function publicIsRoundingErrorCeil( + uint256 numerator, + uint256 denominator, + uint256 target + ) + public + pure + returns (bool isError) + { + isError = isRoundingErrorCeil( + numerator, + denominator, + target + ); + return isError; + } + function publicGetOrderHash(Order memory order) public view |