Skip to content

Commit

Permalink
fix testing compiler warnings (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds authored Jul 31, 2024
1 parent 0f03176 commit f38a66f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions test/libraries/CalldataDecoder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract CalldataDecoderTest is Test {
PositionConfig calldata _config,
uint256 _liquidity,
bytes calldata _hookData
) public {
) public view {
bytes memory params = abi.encode(_tokenId, _config, _liquidity, _hookData);
(uint256 tokenId, PositionConfig memory config, uint256 liquidity, bytes memory hookData) =
decoder.decodeModifyLiquidityParams(params);
Expand All @@ -31,6 +31,7 @@ contract CalldataDecoderTest is Test {

function test_fuzz_decodeBurnParams(uint256 _tokenId, PositionConfig calldata _config, bytes calldata _hookData)
public
view
{
bytes memory params = abi.encode(_tokenId, _config, _hookData);
(uint256 tokenId, PositionConfig memory config, bytes memory hookData) = decoder.decodeBurnParams(params);
Expand All @@ -45,7 +46,7 @@ contract CalldataDecoderTest is Test {
uint256 _liquidity,
address _owner,
bytes calldata _hookData
) public {
) public view {
bytes memory params = abi.encode(_config, _liquidity, _owner, _hookData);
(PositionConfig memory config, uint256 liquidity, address owner, bytes memory hookData) =
decoder.decodeMintParams(params);
Expand All @@ -56,22 +57,22 @@ contract CalldataDecoderTest is Test {
_assertEq(_config, config);
}

function test_fuzz_decodeCurrencyAndAddress(Currency _currency, address __address) public {
function test_fuzz_decodeCurrencyAndAddress(Currency _currency, address __address) public view {
bytes memory params = abi.encode(_currency, __address);
(Currency currency, address _address) = decoder.decodeCurrencyAndAddress(params);

assertEq(Currency.unwrap(currency), Currency.unwrap(_currency));
assertEq(_address, __address);
}

function test_fuzz_decodeCurrency(Currency _currency) public {
function test_fuzz_decodeCurrency(Currency _currency) public view {
bytes memory params = abi.encode(_currency);
(Currency currency) = decoder.decodeCurrency(params);

assertEq(Currency.unwrap(currency), Currency.unwrap(_currency));
}

function _assertEq(PositionConfig memory config1, PositionConfig memory config2) internal {
function _assertEq(PositionConfig memory config1, PositionConfig memory config2) internal pure {
assertEq(Currency.unwrap(config1.poolKey.currency0), Currency.unwrap(config2.poolKey.currency0));
assertEq(Currency.unwrap(config1.poolKey.currency1), Currency.unwrap(config2.poolKey.currency1));
assertEq(config1.poolKey.fee, config2.poolKey.fee);
Expand Down
2 changes: 1 addition & 1 deletion test/libraries/PositionConfig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {PositionConfig, PositionConfigLibrary} from "../../src/libraries/Positio
contract PositionConfigTest is Test {
using PositionConfigLibrary for PositionConfig;

function test_fuzz_toId(PositionConfig calldata config) public {
function test_fuzz_toId(PositionConfig calldata config) public pure {
bytes32 expectedId = keccak256(
abi.encodePacked(
config.poolKey.currency0,
Expand Down

0 comments on commit f38a66f

Please sign in to comment.