Skip to content

Commit

Permalink
Included zero and -zero tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-t-0 committed Mar 28, 2024
1 parent 57140fe commit 3ebacb6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Foo.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ contract FooTest is PRBTest, StdCheats {
assertEq(foo.id(x), x, "value mismatch");
}

/// @dev Basic test. Run it with `forge test -vvv` to see the console log.
function test_zero_input() external {
uint256 x = 0;
assertEq(foo.id(x), x, "value mismatch");
}

/// @dev Basic test. Run it with `forge test -vvv` to see the console log.
function test_negative_zero_input() external {
uint256 x = -0;
assertEq(foo.id(x), x, "value mismatch");
}

/// @dev Fuzz test that provides random values for an unsigned integer, but which rejects zero as an input.
/// If you need more sophisticated input validation, you should use the `bound` utility instead.
/// See https://twitter.com/PaulRBerg/status/1622558791685242880
Expand Down

0 comments on commit 3ebacb6

Please sign in to comment.