Skip to content

Commit 00cd471

Browse files
self sub test
1 parent 1f50603 commit 00cd471

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

.gas-snapshot

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ LibDecimalFloatImplementationPow10Test:testExactLookups() (gas: 1281984)
195195
LibDecimalFloatImplementationPow10Test:testExactPows() (gas: 1260129)
196196
LibDecimalFloatImplementationPow10Test:testInterpolatedLookupsPower() (gas: 1282922)
197197
LibDecimalFloatImplementationPow10Test:testNoRevert(int224,int32) (runs: 5103, μ: 1258761, ~: 1259054)
198-
LibDecimalFloatImplementationSubTest:testSubIsAdd(int256,int256,int256,int256) (runs: 5109, μ: 15686, ~: 15706)
199-
LibDecimalFloatImplementationSubTest:testSubMinSignedValue(int256,int256,int256) (runs: 5109, μ: 14809, ~: 14755)
200-
LibDecimalFloatImplementationSubTest:testSubOneFromMax() (gas: 5460)
198+
LibDecimalFloatImplementationSubTest:testSubIsAdd(int256,int256,int256,int256) (runs: 5109, μ: 15665, ~: 15684)
199+
LibDecimalFloatImplementationSubTest:testSubMinSignedValue(int256,int256,int256) (runs: 5109, μ: 14792, ~: 14735)
200+
LibDecimalFloatImplementationSubTest:testSubOneFromMax() (gas: 6435)
201+
LibDecimalFloatImplementationSubTest:testSubSelf(int224,int32) (runs: 5109, μ: 5346, ~: 5449)
201202
LibDecimalFloatImplementationWithTargetExponentTest:testWithTargetExponentExamples() (gas: 13429)
202203
LibDecimalFloatImplementationWithTargetExponentTest:testWithTargetExponentLargerExponentOverflowRescaleRevert(int256,int256,int256) (runs: 5101, μ: 14426, ~: 14395)
203204
LibDecimalFloatImplementationWithTargetExponentTest:testWithTargetExponentLargerExponentVeryLargeDiffRevert(int256,int256,int256) (runs: 5109, μ: 13307, ~: 13527)

test/src/lib/implementation/LibDecimalFloatImplementation.sub.t.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,11 @@ contract LibDecimalFloatImplementationSubTest is Test {
6464
function testSubOneFromMax() external pure {
6565
checkSub(type(int224).max, type(int32).max, 1, 0, int256(type(int224).max) * 1e8, type(int32).max - 8);
6666
}
67+
68+
function testSubSelf(int224 signedCoefficientA, int32 exponentA) external pure {
69+
(int256 signedCoefficient, int256 exponent) =
70+
LibDecimalFloatImplementation.sub(signedCoefficientA, exponentA, signedCoefficientA, exponentA);
71+
(exponent);
72+
assertEq(signedCoefficient, 0, "LibDecimalFloatImplementation.sub self coefficient");
73+
}
6774
}

0 commit comments

Comments
 (0)