浏览代码

Fix fuzzing coverage (#3716)

Francisco 3 年之前
父节点
当前提交
8f0d4d4a41
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      test/utils/math/Math.t.sol

+ 10 - 0
test/utils/math/Math.t.sol

@@ -24,6 +24,10 @@ contract MathTest is Test {
             assertFalse(rounding == Math.Rounding.Up);
             assertTrue(_squareBigger(result + 1, input));
         }
+        // input is perfect square
+        else {
+            assertEq(result * result, input);
+        }
     }
 
     function _squareBigger(uint256 value, uint256 ref) private pure returns (bool) {
@@ -49,6 +53,8 @@ contract MathTest is Test {
         } else if (_powerOf2Smaller(result, input)) {
             assertFalse(rounding == Math.Rounding.Up);
             assertTrue(_powerOf2Bigger(result + 1, input));
+        } else {
+            assertEq(2**result, input);
         }
     }
 
@@ -74,6 +80,8 @@ contract MathTest is Test {
         } else if (_powerOf10Smaller(result, input)) {
             assertFalse(rounding == Math.Rounding.Up);
             assertTrue(_powerOf10Bigger(result + 1, input));
+        } else {
+            assertEq(10**result, input);
         }
     }
 
@@ -99,6 +107,8 @@ contract MathTest is Test {
         } else if (_powerOf256Smaller(result, input)) {
             assertFalse(rounding == Math.Rounding.Up);
             assertTrue(_powerOf256Bigger(result + 1, input));
+        } else {
+            assertEq(256**result, input);
         }
     }