Skip to content

Commit

Permalink
WIP: Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmichalis committed Feb 28, 2024
1 parent a6b41e1 commit 3fdbc5c
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions test/FeeCalculator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ contract FeeCalculatorTest is Test {
// Assert
assertEq(feeDistribution.recipients.length, feeDistribution.shares.length, "array length mismatch");
assertEq(recipients[0], feeRecipient);
assertEq(fees[0], 9718378209069523938);
assertEq(fees[0], 12811562752294360125);
}

function testCalculateRedemptionFeesNormalCase() public {
Expand Down Expand Up @@ -187,9 +187,9 @@ contract FeeCalculatorTest is Test {
// Assert
assertEq(recipients[0], feeRecipient1);
assertEq(recipients[1], feeRecipient2);
assertEq(fees.sumOf(), 9718378209069523938);
assertEq(fees[0], 9718378209069523938 / 2);
assertEq(fees[1], 9718378209069523938 / 2);
assertEq(fees.sumOf(), 12811562752294360125);
assertEq(fees[0], uint256(12811562752294360125) / 2 + 1);
assertEq(fees[1], uint256(12811562752294360125) / 2);
}

function testCalculateDepositFeesNormalCase_TwoFeeRecipientsSplit30To70() public {
Expand Down Expand Up @@ -220,9 +220,9 @@ contract FeeCalculatorTest is Test {
// Assert
assertEq(recipients[0], feeRecipient1);
assertEq(recipients[1], feeRecipient2);
assertEq(fees.sumOf(), 9718378209069523938);
assertEq(fees[0], uint256(9718378209069523938) * 30 / 100 + 1); //first recipient gets rest from division
assertEq(fees[1], uint256(9718378209069523938) * 70 / 100);
assertEq(fees.sumOf(), 12811562752294360125);
assertEq(fees[0], uint256(12811562752294360125) * 30 / 100 + 1); //first recipient gets rest from division
assertEq(fees[1], uint256(12811562752294360125) * 70 / 100);
}

function testCalculateDepositFeesComplicatedCase() public {
Expand All @@ -242,7 +242,7 @@ contract FeeCalculatorTest is Test {

// Assert
assertEq(recipients[0], feeRecipient);
assertEq(fees[0], 46413457506542766270);
assertEq(fees[0], 53013879215838797358);
}

function testCalculateDepositFees_DepositOfOneWei_ShouldThrowException() public {
Expand Down Expand Up @@ -293,7 +293,7 @@ contract FeeCalculatorTest is Test {

// Assert
assertEq(recipients[0], feeRecipient);
assertEq(fees[0], 158800759314);
assertEq(fees[0], 170744712050);
}

function testCalculateDepositFees_DepositOfOne_NormalFee() public {
Expand All @@ -313,7 +313,7 @@ contract FeeCalculatorTest is Test {

// Assert
assertEq(recipients[0], feeRecipient);
assertEq(fees[0], 15880809772898785);
assertEq(fees[0], 17075278992520605);
}

function testCalculateDepositFees_DepositOfOne_NormalFee_FiveRecipientsEqualSplit() public {
Expand Down Expand Up @@ -356,12 +356,12 @@ contract FeeCalculatorTest is Test {
assertEq(recipients[2], feeRecipient3);
assertEq(recipients[3], feeRecipient4);
assertEq(recipients[4], feeRecipient5);
assertEq(fees.sumOf(), 15880809772898785);
assertEq(fees[0], uint256(15880809772898785) * 20 / 100);
assertEq(fees[1], uint256(15880809772898785) * 20 / 100);
assertEq(fees[2], uint256(15880809772898785) * 20 / 100);
assertEq(fees[3], uint256(15880809772898785) * 20 / 100);
assertEq(fees[4], uint256(15880809772898785) * 20 / 100);
assertEq(fees.sumOf(), 17075278992520605);
assertEq(fees[0], uint256(17075278992520605) * 20 / 100);
assertEq(fees[1], uint256(17075278992520605) * 20 / 100);
assertEq(fees[2], uint256(17075278992520605) * 20 / 100);
assertEq(fees[3], uint256(17075278992520605) * 20 / 100);
assertEq(fees[4], uint256(17075278992520605) * 20 / 100);
}

function testCalculateDepositFees_DepositOfOne_NormalFee_FiveRecipientsComplicatedSplit() public {
Expand Down

0 comments on commit 3fdbc5c

Please sign in to comment.