diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e38561f..3065d75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ on: branches: - "main" +jobs: build: runs-on: "ubuntu-latest" steps: diff --git a/src/Foo.sol b/src/Foo.sol index 466b911..8e5e34e 100644 --- a/src/Foo.sol +++ b/src/Foo.sol @@ -2,6 +2,16 @@ pragma solidity >=0.8.23; contract Foo { + /** + * @notice This returns the value that it is given. + * @dev The current dev does not yet know what the permissible range of the + * uint256 values may be, nor how this function handles a None/void/null + * input if those exist in Solidity. Nor do I know how it handles with an + * overflow input value, if that is possible. + * @param value An integer that is assumed to be stored in a 256 bit memory. + * @return The value that it receives as input. The developer does not yet + * know whether Solidity passes uint256 variables by value or by reference. + */ function id(uint256 value) external pure returns (uint256) { return value; } 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