Skip to content

Commit

Permalink
wip on compare
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidmeister committed Jul 22, 2024
1 parent a09a05b commit cb141f0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/src/LibDecimalFloat.compare.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,24 @@ contract LibDecimalFloatCompareTest is Test {
int256 compare = LibDecimalFloat.compare(0, exponentZero, signedCoefficient, exponent);
assertEq(compare, COMPARE_LESS_THAN);
}

function testCompareGasDifferentSigns() external pure {
LibDecimalFloat.compare(1, 0, -1, 0);
}

function testCompareGasAZero() external pure {
LibDecimalFloat.compare(0, 0, 1, 0);
}

function testCompareGasBZero() external pure {
LibDecimalFloat.compare(1, 0, 0, 0);
}

function testCompareBothZero() external pure {
LibDecimalFloat.compare(0, 0, 0, 0);
}

function testCompareGasExponentDiffOverflow() external pure {
LibDecimalFloat.compare(1, type(int256).max, 1, type(int256).min);
}
}

0 comments on commit cb141f0

Please sign in to comment.