From 3ebacb63bae9aed0c907494c17b3080f8c357fbd Mon Sep 17 00:00:00 2001 From: a-t-0 Date: Thu, 28 Mar 2024 17:44:39 +0100 Subject: [PATCH] Included zero and -zero tests. --- test/Foo.t.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/Foo.t.sol b/test/Foo.t.sol index 2f23c7f..9bc93bd 100644 --- a/test/Foo.t.sol +++ b/test/Foo.t.sol @@ -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