Skip to content

Commit

Permalink
Update test functions visibility
Browse files Browse the repository at this point in the history
Several test function definitions in `NPMCaller.t.sol`, `BitMath.t.sol`, `FullMath.t.sol` and `Base.t.sol` were updated. They were changed from `public` to either `public view` or `public pure` to correctly reflect that they don't modify any state. This will help prevent confusion during code reviews and audits.
  • Loading branch information
shuhuiluo committed Mar 23, 2024
1 parent 7842c56 commit 4fca88b
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 116 deletions.
200 changes: 100 additions & 100 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,127 +1,127 @@
BitMathTest:testFuzz_LSB(uint256) (runs: 65536, μ: 14911, ~: 14909)
BitMathTest:testFuzz_MSB(uint256) (runs: 65536, μ: 14771, ~: 14796)
BitMathTest:testGas_LSB() (gas: 193393)
BitMathTest:testFuzz_LSB(uint256) (runs: 65536, μ: 17687, ~: 17685)
BitMathTest:testFuzz_MSB(uint256) (runs: 65536, μ: 17547, ~: 17572)
BitMathTest:testGas_LSB() (gas: 195427)
BitMathTest:testGas_LSB_Og() (gas: 291088)
BitMathTest:testGas_MSB() (gas: 208372)
BitMathTest:testGas_MSB() (gas: 210406)
BitMathTest:testGas_MSB_Og() (gas: 274437)
FullMathTest:testFuzz_MulDiv96(uint256,uint256) (runs: 65536, μ: 3601, ~: 3585)
FullMathTest:testFuzz_MulDivUp_OZ(uint256,uint256,uint256) (runs: 65536, μ: 4391, ~: 4237)
FullMathTest:testFuzz_MulDivUp_Og(uint256,uint256,uint256) (runs: 65536, μ: 9579, ~: 9416)
FullMathTest:testFuzz_MulDiv_OZ(uint256,uint256,uint256) (runs: 65536, μ: 4031, ~: 3914)
FullMathTest:testFuzz_MulDiv_Og(uint256,uint256,uint256) (runs: 65536, μ: 9464, ~: 9326)
FullMathTest:testFuzz_Sqrt(uint256) (runs: 65536, μ: 1651, ~: 1661)
LiquidityAmountsTest:testFuzz_GetAmount0ForLiquidity(uint160,uint160,uint128) (runs: 65536, μ: 17075, ~: 17121)
LiquidityAmountsTest:testFuzz_GetAmount1ForLiquidity(uint160,uint160,uint128) (runs: 65536, μ: 16513, ~: 16543)
LiquidityAmountsTest:testFuzz_GetAmountsForLiquidity(uint160,uint160,uint160,uint128) (runs: 65536, μ: 18704, ~: 18540)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmount0(uint160,uint160,uint256) (runs: 65536, μ: 18602, ~: 19288)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmount1(uint160,uint160,uint256) (runs: 65536, μ: 18390, ~: 19240)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmounts(uint160,uint160,uint160,uint256,uint256) (runs: 65536, μ: 20252, ~: 20564)
FullMathTest:testFuzz_MulDiv96(uint256,uint256) (runs: 65536, μ: 3951, ~: 3936)
FullMathTest:testFuzz_MulDivUp_OZ(uint256,uint256,uint256) (runs: 65536, μ: 4736, ~: 4588)
FullMathTest:testFuzz_MulDivUp_Og(uint256,uint256,uint256) (runs: 65536, μ: 9920, ~: 9764)
FullMathTest:testFuzz_MulDiv_OZ(uint256,uint256,uint256) (runs: 65536, μ: 4378, ~: 4265)
FullMathTest:testFuzz_MulDiv_Og(uint256,uint256,uint256) (runs: 65536, μ: 9807, ~: 9674)
FullMathTest:testFuzz_Sqrt(uint256) (runs: 65536, μ: 4510, ~: 4517)
LiquidityAmountsTest:testFuzz_GetAmount0ForLiquidity(uint160,uint160,uint128) (runs: 65536, μ: 19821, ~: 19867)
LiquidityAmountsTest:testFuzz_GetAmount1ForLiquidity(uint160,uint160,uint128) (runs: 65536, μ: 19259, ~: 19289)
LiquidityAmountsTest:testFuzz_GetAmountsForLiquidity(uint160,uint160,uint160,uint128) (runs: 65536, μ: 21746, ~: 21583)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmount0(uint160,uint160,uint256) (runs: 65536, μ: 19513, ~: 19476)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmount1(uint160,uint160,uint256) (runs: 65536, μ: 19249, ~: 19204)
LiquidityAmountsTest:testFuzz_GetLiquidityForAmounts(uint160,uint160,uint160,uint256,uint256) (runs: 65536, μ: 20790, ~: 20704)
LiquidityAmountsTest:testGas_GetAmountsForLiquidity() (gas: 216208)
LiquidityAmountsTest:testGas_GetAmountsForLiquidity_Og() (gas: 231471)
LiquidityAmountsTest:testGas_GetLiquidityForAmounts() (gas: 221029)
LiquidityAmountsTest:testGas_GetLiquidityForAmounts() (gas: 223221)
LiquidityAmountsTest:testGas_GetLiquidityForAmounts_Og() (gas: 258436)
LiquidityMathTest:testFuzz_AddDelta(uint128,int128) (runs: 65536, μ: 11038, ~: 14938)
LiquidityMathTest:testGas_AddDelta() (gas: 113817)
LiquidityMathTest:testFuzz_AddDelta(uint128,int128) (runs: 65536, μ: 12318, ~: 14938)
LiquidityMathTest:testGas_AddDelta() (gas: 115133)
LiquidityMathTest:testGas_AddDelta_Og() (gas: 129492)
LiquidityMathTest:testRevert_LA() (gas: 9042)
LiquidityMathTest:testRevert_LS() (gas: 8876)
NPMCallerTest:testFuzz_BalanceOf(address) (runs: 16, μ: 15142, ~: 15142)
NPMCallerTest:testFuzz_GetApproved(uint256) (runs: 16, μ: 18471, ~: 18472)
NPMCallerTest:testFuzz_IsApprovedForAll(uint256) (runs: 16, μ: 75168, ~: 75179)
NPMCallerTest:testFuzz_OwnerOf(uint256) (runs: 16, μ: 20981, ~: 20992)
NPMCallerTest:testFuzz_Positions(uint256) (runs: 16, μ: 35527, ~: 35528)
NPMCallerTest:testFuzz_PositionsFull(uint256) (runs: 16, μ: 36136, ~: 36137)
NPMCallerTest:testFuzz_TokenOfOwnerByIndex(uint256) (runs: 16, μ: 79122, ~: 42674)
LiquidityMathTest:testRevert_LA() (gas: 9025)
LiquidityMathTest:testRevert_LS() (gas: 8859)
NPMCallerTest:testFuzz_BalanceOf(address) (runs: 16, μ: 15496, ~: 15496)
NPMCallerTest:testFuzz_GetApproved(uint256) (runs: 16, μ: 21530, ~: 21531)
NPMCallerTest:testFuzz_IsApprovedForAll(uint256) (runs: 16, μ: 76326, ~: 76303)
NPMCallerTest:testFuzz_OwnerOf(uint256) (runs: 16, μ: 24040, ~: 24051)
NPMCallerTest:testFuzz_Positions(uint256) (runs: 16, μ: 41639, ~: 41650)
NPMCallerTest:testFuzz_PositionsFull(uint256) (runs: 16, μ: 41668, ~: 41679)
NPMCallerTest:testFuzz_TokenOfOwnerByIndex(uint256) (runs: 16, μ: 49988, ~: 42914)
NPMCallerTest:testRevert_GetApproved() (gas: 14216)
NPMCallerTest:testRevert_OwnerOf() (gas: 14407)
NPMCallerTest:testRevert_Positions() (gas: 24241)
NPMCallerTest:test_Approve() (gas: 126679)
NPMCallerTest:test_Burn() (gas: 907456)
NPMCallerTest:test_Collect() (gas: 850767)
NPMCallerTest:test_DecreaseLiquidity() (gas: 771094)
NPMCallerTest:test_Factory() (gas: 10194)
NPMCallerTest:test_IncreaseLiquidity() (gas: 1004686)
NPMCallerTest:test_IsApprovedForAll() (gas: 21253)
NPMCallerTest:test_Mint() (gas: 562723)
NPMCallerTest:test_Permit() (gas: 647428)
NPMCallerTest:test_SetApprovalForAll() (gas: 56330)
NPMCallerTest:test_TotalSupply() (gas: 11953)
PoolAddressTest:testFuzz_ComputeAddress(address,address,uint24) (runs: 65536, μ: 12175, ~: 12161)
PoolAddressTest:testFuzz_ComputeAddressCalldata(address,address,uint24) (runs: 65536, μ: 10260, ~: 10247)
PoolAddressTest:testFuzz_ComputeAddressFromKey(address,address,uint24) (runs: 65536, μ: 12465, ~: 12451)
PoolAddressTest:testFuzz_VerifyCallback(address,address,uint24) (runs: 65536, μ: 11510, ~: 11497)
PoolAddressTest:testFuzz_VerifyCallbackCalldata(address,address,uint24) (runs: 65536, μ: 10752, ~: 10739)
NPMCallerTest:test_Approve() (gas: 127289)
NPMCallerTest:test_Burn() (gas: 947218)
NPMCallerTest:test_Collect() (gas: 890533)
NPMCallerTest:test_DecreaseLiquidity() (gas: 810230)
NPMCallerTest:test_Factory() (gas: 13304)
NPMCallerTest:test_IncreaseLiquidity() (gas: 1100561)
NPMCallerTest:test_IsApprovedForAll() (gas: 24392)
NPMCallerTest:test_Mint() (gas: 601856)
NPMCallerTest:test_Permit() (gas: 687780)
NPMCallerTest:test_SetApprovalForAll() (gas: 59452)
NPMCallerTest:test_TotalSupply() (gas: 14810)
PoolAddressTest:testFuzz_ComputeAddress(address,address,uint24) (runs: 65536, μ: 12527, ~: 12542)
PoolAddressTest:testFuzz_ComputeAddressCalldata(address,address,uint24) (runs: 65536, μ: 10602, ~: 10618)
PoolAddressTest:testFuzz_ComputeAddressFromKey(address,address,uint24) (runs: 65536, μ: 12817, ~: 12832)
PoolAddressTest:testFuzz_VerifyCallback(address,address,uint24) (runs: 65536, μ: 11511, ~: 11497)
PoolAddressTest:testFuzz_VerifyCallbackCalldata(address,address,uint24) (runs: 65536, μ: 10744, ~: 10731)
PoolAddressTest:testGas_ComputeAddress() (gas: 7766)
PoolAddressTest:testGas_ComputeAddress_Og() (gas: 8464)
PoolCallerTest:testFuzz_LiquidityNet(int24) (runs: 16, μ: 18777, ~: 18777)
PoolCallerTest:testFuzz_Observations(uint256) (runs: 16, μ: 18957, ~: 19049)
PoolCallerTest:testFuzz_Positions(bytes32) (runs: 16, μ: 19317, ~: 19317)
PoolCallerTest:testFuzz_Swap(bool,uint256,bytes) (runs: 16, μ: 283842, ~: 261944)
PoolCallerTest:testFuzz_TickBitmap(int16) (runs: 16, μ: 11022, ~: 11022)
PoolCallerTest:testFuzz_Ticks(int24) (runs: 16, μ: 20800, ~: 20800)
PoolCallerTest:testFuzz_LiquidityNet(int24) (runs: 16, μ: 21897, ~: 21897)
PoolCallerTest:testFuzz_Observations(uint256) (runs: 16, μ: 23891, ~: 23983)
PoolCallerTest:testFuzz_Positions(bytes32) (runs: 16, μ: 24855, ~: 24855)
PoolCallerTest:testFuzz_Swap(bool,uint256,bytes) (runs: 16, μ: 336225, ~: 334652)
PoolCallerTest:testFuzz_TickBitmap(int16) (runs: 16, μ: 14142, ~: 14142)
PoolCallerTest:testFuzz_Ticks(int24) (runs: 16, μ: 28127, ~: 28127)
PoolCallerTest:testRevert_AS_Swap() (gas: 35416)
PoolCallerTest:testRevert_SPL_Swap() (gas: 38043)
PoolCallerTest:test_Fee() (gas: 8713)
PoolCallerTest:test_FeeGrowthGlobal0X128() (gas: 10376)
PoolCallerTest:test_FeeGrowthGlobal1X128() (gas: 10930)
PoolCallerTest:test_Liquidity() (gas: 10639)
PoolCallerTest:test_LiquidityNet() (gas: 22551)
PoolCallerTest:test_ProtocolFees() (gas: 11065)
PoolCallerTest:test_Slot0() (gas: 13447)
PoolCallerTest:test_SqrtPriceX96AndTick() (gas: 9767)
PoolCallerTest:test_Swap() (gas: 340090)
PoolCallerTest:test_TickSpacing() (gas: 8257)
SafeCastTest:testRevert_ToInt128() (gas: 3384)
SafeCastTest:testRevert_ToInt256() (gas: 3032)
SafeCastTest:testRevert_ToUint128() (gas: 3406)
SafeCastTest:testRevert_ToUint160() (gas: 3186)
SafeCastTest:testToInt128() (gas: 555)
SafeCastTest:testToInt128(int256) (runs: 65536, μ: 1475, ~: 496)
SafeCastTest:testToInt128(uint256) (runs: 65536, μ: 1245, ~: 258)
SafeCastTest:testToInt256() (gas: 181)
SafeCastTest:testToInt256(uint256) (runs: 65536, μ: 1179, ~: 686)
SafeCastTest:testToUint128(uint256) (runs: 65536, μ: 1529, ~: 538)
SafeCastTest:testToUint160(uint256) (runs: 65536, μ: 1191, ~: 318)
SqrtPriceMathTest:testFuzz_GetAmount0Delta(uint160,uint160,int128) (runs: 65536, μ: 12860, ~: 12606)
SqrtPriceMathTest:testFuzz_GetAmount0Delta(uint160,uint160,uint128,bool) (runs: 65536, μ: 12535, ~: 12258)
SqrtPriceMathTest:testFuzz_GetAmount1Delta(uint160,uint160,int128) (runs: 65536, μ: 12507, ~: 12426)
SqrtPriceMathTest:testFuzz_GetAmount1Delta(uint160,uint160,uint128,bool) (runs: 65536, μ: 12535, ~: 12563)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromAmount0RoundingUp(uint160,uint128,uint256,bool) (runs: 65536, μ: 16547, ~: 16401)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromAmount1RoundingDown(uint160,uint128,uint256,bool) (runs: 65536, μ: 19151, ~: 18700)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromInput(uint160,uint128,uint256,bool) (runs: 65536, μ: 13309, ~: 12857)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromOutput(uint160,uint128,uint256,bool) (runs: 65536, μ: 14061, ~: 14705)
SqrtPriceMathTest:testGas_GetAmount0Delta() (gas: 256572)
PoolCallerTest:test_Fee() (gas: 11827)
PoolCallerTest:test_FeeGrowthGlobal0X128() (gas: 13484)
PoolCallerTest:test_FeeGrowthGlobal1X128() (gas: 14038)
PoolCallerTest:test_Liquidity() (gas: 13747)
PoolCallerTest:test_LiquidityNet() (gas: 25671)
PoolCallerTest:test_ProtocolFees() (gas: 14787)
PoolCallerTest:test_Slot0() (gas: 20183)
PoolCallerTest:test_SqrtPriceX96AndTick() (gas: 13489)
PoolCallerTest:test_Swap() (gas: 417791)
PoolCallerTest:test_TickSpacing() (gas: 11370)
SafeCastTest:testRevert_ToInt128() (gas: 3406)
SafeCastTest:testRevert_ToInt256() (gas: 3044)
SafeCastTest:testRevert_ToUint128() (gas: 3428)
SafeCastTest:testRevert_ToUint160() (gas: 3203)
SafeCastTest:testToInt128() (gas: 3471)
SafeCastTest:testToInt128(int256) (runs: 65536, μ: 3378, ~: 3380)
SafeCastTest:testToInt128(uint256) (runs: 65536, μ: 3108, ~: 3129)
SafeCastTest:testToInt256() (gas: 3087)
SafeCastTest:testToInt256(uint256) (runs: 65536, μ: 3577, ~: 3583)
SafeCastTest:testToUint128(uint256) (runs: 65536, μ: 3425, ~: 3433)
SafeCastTest:testToUint160(uint256) (runs: 65536, μ: 3201, ~: 3208)
SqrtPriceMathTest:testFuzz_GetAmount0Delta(uint160,uint160,int128) (runs: 65536, μ: 15450, ~: 15300)
SqrtPriceMathTest:testFuzz_GetAmount0Delta(uint160,uint160,uint128,bool) (runs: 65536, μ: 15128, ~: 15100)
SqrtPriceMathTest:testFuzz_GetAmount1Delta(uint160,uint160,int128) (runs: 65536, μ: 15353, ~: 15274)
SqrtPriceMathTest:testFuzz_GetAmount1Delta(uint160,uint160,uint128,bool) (runs: 65536, μ: 15386, ~: 15414)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromAmount0RoundingUp(uint160,uint128,uint256,bool) (runs: 65536, μ: 18094, ~: 18127)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromAmount1RoundingDown(uint160,uint128,uint256,bool) (runs: 65536, μ: 20637, ~: 20532)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromInput(uint160,uint128,uint256,bool) (runs: 65536, μ: 15271, ~: 15221)
SqrtPriceMathTest:testFuzz_GetNextSqrtPriceFromOutput(uint160,uint128,uint256,bool) (runs: 65536, μ: 15117, ~: 14839)
SqrtPriceMathTest:testGas_GetAmount0Delta() (gas: 261269)
SqrtPriceMathTest:testGas_GetAmount0Delta_Og() (gas: 280254)
SqrtPriceMathTest:testGas_GetAmount1Delta() (gas: 209212)
SqrtPriceMathTest:testGas_GetAmount1Delta() (gas: 213909)
SqrtPriceMathTest:testGas_GetAmount1Delta_Og() (gas: 268385)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromInput() (gas: 227868)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromInput() (gas: 232112)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromInput_Og() (gas: 243885)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromOutput() (gas: 213109)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromOutput() (gas: 217203)
SqrtPriceMathTest:testGas_GetNextSqrtPriceFromOutput_Og() (gas: 225117)
SwapMathTest:testFuzz_ComputeSwapStep(uint160,uint160,uint128,int256,uint24) (runs: 65536, μ: 22131, ~: 22231)
SwapMathTest:testFuzz_ComputeSwapStepExactIn(uint160,uint160,uint128,uint256,uint24) (runs: 65536, μ: 23616, ~: 23636)
SwapMathTest:testFuzz_ComputeSwapStepExactOut(uint160,uint160,uint128,uint256,uint24) (runs: 65536, μ: 22959, ~: 22846)
SwapMathTest:testFuzz_ComputeSwapStep(uint160,uint160,uint128,int256,uint24) (runs: 65536, μ: 25475, ~: 25574)
SwapMathTest:testFuzz_ComputeSwapStepExactIn(uint160,uint160,uint128,uint256,uint24) (runs: 65536, μ: 27719, ~: 27739)
SwapMathTest:testFuzz_ComputeSwapStepExactOut(uint160,uint160,uint128,uint256,uint24) (runs: 65536, μ: 27062, ~: 26949)
SwapMathTest:testGas_ComputeSwapStep() (gas: 384720)
SwapMathTest:testGas_ComputeSwapStepExactIn() (gas: 394759)
SwapMathTest:testGas_ComputeSwapStepExactIn_Og() (gas: 515722)
SwapMathTest:testGas_ComputeSwapStepExactOut() (gas: 370755)
SwapMathTest:testGas_ComputeSwapStepExactOut_Og() (gas: 510266)
SwapMathTest:testGas_ComputeSwapStep_Og() (gas: 526558)
TickBitmapTest:testFuzz_Compress(int24,int24) (runs: 65536, μ: 8348, ~: 8393)
TickBitmapTest:testFuzz_FlipTick(int24) (runs: 65536, μ: 108389, ~: 108698)
TickBitmapTest:testFuzz_NextInitializedTickWithinOneWord(int24,uint8,bool) (runs: 65536, μ: 110546, ~: 110490)
TickBitmapTest:testFuzz_Position(int24) (runs: 65536, μ: 498, ~: 498)
TickBitmapTest:testGas_NextInitializedTickWithinOneWord() (gas: 12246459)
TickBitmapTest:testGas_NextInitializedTickWithinOneWord_Og() (gas: 12527620)
TickBitmapTest:test_NextInitializedTickWithinOneWord_GT() (gas: 203148)
TickBitmapTest:test_NextInitializedTickWithinOneWord_LTE() (gas: 204586)
TickBitmapTest:test_NextInitializedTick_GT() (gas: 342054)
TickBitmapTest:test_NextInitializedTick_LTE() (gas: 388455)
TickMathTest:testFuzz_GetSqrtRatioAtTick(int24) (runs: 65536, μ: 16522, ~: 16817)
TickMathTest:testFuzz_GetTickAtSqrtRatio(uint160) (runs: 65536, μ: 13125, ~: 13145)
TickMathTest:testGas_GetSqrtRatioAtTick() (gas: 146478)
TickBitmapTest:testFuzz_Compress(int24,int24) (runs: 65536, μ: 8624, ~: 8669)
TickBitmapTest:testFuzz_FlipTick(int24) (runs: 65536, μ: 111488, ~: 111797)
TickBitmapTest:testFuzz_NextInitializedTickWithinOneWord(int24,uint8,bool) (runs: 65536, μ: 111505, ~: 111431)
TickBitmapTest:testFuzz_Position(int24) (runs: 65536, μ: 3714, ~: 3714)
TickBitmapTest:testGas_NextInitializedTickWithinOneWord() (gas: 12286447)
TickBitmapTest:testGas_NextInitializedTickWithinOneWord_Og() (gas: 12567608)
TickBitmapTest:test_NextInitializedTickWithinOneWord_GT() (gas: 186046)
TickBitmapTest:test_NextInitializedTickWithinOneWord_LTE() (gas: 191340)
TickBitmapTest:test_NextInitializedTick_GT() (gas: 327621)
TickBitmapTest:test_NextInitializedTick_LTE() (gas: 376331)
TickMathTest:testFuzz_GetSqrtRatioAtTick(int24) (runs: 65536, μ: 17189, ~: 17478)
TickMathTest:testFuzz_GetTickAtSqrtRatio(uint160) (runs: 65536, μ: 15923, ~: 15948)
TickMathTest:testGas_GetSqrtRatioAtTick() (gas: 147574)
TickMathTest:testGas_GetSqrtRatioAtTick_Og() (gas: 168547)
TickMathTest:testGas_GetTickAtSqrtRatio() (gas: 251177)
TickMathTest:testGas_GetTickAtSqrtRatio() (gas: 252268)
TickMathTest:testGas_GetTickAtSqrtRatio_Og() (gas: 307790)
TickMathTest:testRevert_GetSqrtRatioAtTick() (gas: 10445)
TickMathTest:testRevert_GetTickAtSqrtRatio() (gas: 10522)
2 changes: 1 addition & 1 deletion test/Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ abstract contract BaseTest is Test {
return TickBitmap.compress(tick, _tickSpacing) * _tickSpacing;
}

function boundUint160(uint160 x) internal view returns (uint160) {
function boundUint160(uint160 x) internal pure returns (uint160) {
return uint160(bound(x, TickMath.MIN_SQRT_RATIO, TickMath.MAX_SQRT_RATIO));
}

Expand Down
4 changes: 2 additions & 2 deletions test/BitMath.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ contract BitMathTest is BaseTest {
wrapper = new BitMathWrapper();
}

function testFuzz_MSB(uint256 x) public {
function testFuzz_MSB(uint256 x) public view {
x = bound(x, 1, type(uint256).max);
assertEq(wrapper.mostSignificantBit(x), ogWrapper.mostSignificantBit(x));
}

function testFuzz_LSB(uint256 x) public {
function testFuzz_LSB(uint256 x) public view {
x = bound(x, 1, type(uint256).max);
assertEq(wrapper.leastSignificantBit(x), ogWrapper.leastSignificantBit(x));
}
Expand Down
12 changes: 6 additions & 6 deletions test/FullMath.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,41 @@ contract FullMathTest is BaseTest {
}

/// @notice Test `mulDiv` against the original Uniswap library.
function testFuzz_MulDiv_Og(uint256 a, uint256 b, uint256 denominator) public {
function testFuzz_MulDiv_Og(uint256 a, uint256 b, uint256 denominator) public view {
assumeNoOverflow(a, b, denominator);
assertEq(FullMath.mulDiv(a, b, denominator), wrapper.mulDiv(a, b, denominator));
}

/// @notice Test `mulDiv` against OpenZeppelin's.
function testFuzz_MulDiv_OZ(uint256 a, uint256 b, uint256 denominator) public {
function testFuzz_MulDiv_OZ(uint256 a, uint256 b, uint256 denominator) public pure {
assumeNoOverflow(a, b, denominator);
assertEq(FullMath.mulDiv(a, b, denominator), Math.mulDiv(a, b, denominator));
}

/// @notice Test `mulDivRoundingUp` against the original Uniswap library.
function testFuzz_MulDivUp_Og(uint256 a, uint256 b, uint256 denominator) public {
function testFuzz_MulDivUp_Og(uint256 a, uint256 b, uint256 denominator) public view {
assumeNoOverflow(a, b, denominator);
if (Math.mulDiv(a, b, denominator) < type(uint256).max) {
assertEq(FullMath.mulDivRoundingUp(a, b, denominator), wrapper.mulDivRoundingUp(a, b, denominator));
}
}

/// @notice Test `mulDivRoundingUp` against OpenZeppelin's.
function testFuzz_MulDivUp_OZ(uint256 a, uint256 b, uint256 denominator) public {
function testFuzz_MulDivUp_OZ(uint256 a, uint256 b, uint256 denominator) public pure {
assumeNoOverflow(a, b, denominator);
if (Math.mulDiv(a, b, denominator) < type(uint256).max) {
assertEq(FullMath.mulDivRoundingUp(a, b, denominator), Math.mulDiv(a, b, denominator, Math.Rounding.Ceil));
}
}

/// @notice Test `mulDiv96` against `mulDiv` with a denominator of `Q96`.
function testFuzz_MulDiv96(uint256 a, uint256 b) public {
function testFuzz_MulDiv96(uint256 a, uint256 b) public pure {
assumeNoOverflow(a, b, FixedPoint96.Q96);
assertEq(FullMath.mulDiv96(a, b), Math.mulDiv(a, b, FixedPoint96.Q96));
}

/// @notice Test `sqrt` against OpenZeppelin's.
function testFuzz_Sqrt(uint256 x) public {
function testFuzz_Sqrt(uint256 x) public pure {
assertEq(FullMath.sqrt(x), Math.sqrt(x));
}
}
Loading

0 comments on commit 4fca88b

Please sign in to comment.