Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vgorkavenko committed Dec 20, 2023
1 parent b9784b4 commit 818ec76
Showing 1 changed file with 0 additions and 144 deletions.
144 changes: 0 additions & 144 deletions test/CSAccounting.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -231,150 +231,6 @@ abstract contract CSAccountingBondStateBaseTest is
function test_WithMissingBondAndOneWithdrawnValidator() public virtual;
}

contract CSAccountingGetExcessBondTest is CSAccountingBondStateBaseTest {
function test_default() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 33 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 1 ether, 1 wei);
}

function test_WithCurve() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 33 ether });
_curve(defaultCurve);
assertApproxEqAbs(accounting.getExcessBond(0), 16 ether, 1 wei);
}

function test_WithLocked() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 33 ether });
_lock({ id: 0, amount: 1 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 0 ether, 1 wei);
}

function test_WithCurveAndLocked() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 33 ether });
_curve(defaultCurve);
_lock({ id: 0, amount: 1 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 15 ether, 1 wei);
}

function test_WithOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 32 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 2 ether, 1 wei);
}

function test_WithBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 32 ether });
assertEq(accounting.getExcessBond(0), 0);
}

function test_WithBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 32 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 2 ether, 1 wei);
}

function test_WithExcessBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 64 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 32 ether, 1 wei);
}

function test_WithExcessBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 64 ether });
assertApproxEqAbs(accounting.getExcessBond(0), 34 ether, 1 wei);
}

function test_WithMissingBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 16 ether });
assertEq(accounting.getExcessBond(0), 0);
}

function test_WithMissingBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 16 ether });
assertEq(accounting.getExcessBond(0), 0);
}
}

contract CSAccountingGetMissingBondTest is CSAccountingBondStateBaseTest {
function test_default() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 16 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 16 ether, 1 wei);
}

function test_WithCurve() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 16 ether });
_curve(defaultCurve);
assertApproxEqAbs(accounting.getMissingBond(0), 1 ether, 1 wei);
}

function test_WithLocked() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 16 ether });
_lock({ id: 0, amount: 1 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 17 ether, 1 wei);
}

function test_WithCurveAndLocked() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 16 ether });
_curve(defaultCurve);
_lock({ id: 0, amount: 1 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 2 ether, 1 wei);
}

function test_WithOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 16 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 14 ether, 1 wei);
}

function test_WithBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 32 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 0, 1 wei);
}

function test_WithBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 32 ether });
assertEq(accounting.getMissingBond(0), 0 ether);
}

function test_WithExcessBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 64 ether });
assertEq(accounting.getMissingBond(0), 0);
}

function test_WithExcessBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 64 ether });
assertEq(accounting.getMissingBond(0), 0);
}

function test_WithMissingBond() public override {
_operator({ ongoing: 16, withdrawn: 0 });
_deposit({ bond: 8 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 24 ether, 2 wei);
}

function test_WithMissingBondAndOneWithdrawnValidator() public override {
_operator({ ongoing: 16, withdrawn: 1 });
_deposit({ bond: 8 ether });
assertApproxEqAbs(accounting.getMissingBond(0), 22 ether, 2 wei);
}
}

contract CSAccountingGetUnbondedKeysCountTest is CSAccountingBondStateBaseTest {
function test_default() public override {
_operator({ ongoing: 16, withdrawn: 0 });
Expand Down

0 comments on commit 818ec76

Please sign in to comment.