update vest-calc tests with a short 20sec period
parent
72757b3c18
commit
f3ddfca045
|
@ -60,7 +60,7 @@ func TestLinearVesting(t *testing.T) {
|
||||||
// Total: 1000 tokens
|
// Total: 1000 tokens
|
||||||
// Time: end
|
// Time: end
|
||||||
// Claimed: 1000
|
// Claimed: 1000
|
||||||
// Expected: 1000
|
// Expected: 0
|
||||||
if res, err := CalcAmountVestableLinear(
|
if res, err := CalcAmountVestableLinear(
|
||||||
big.NewInt(1000),
|
big.NewInt(1000),
|
||||||
big.NewInt(0),
|
big.NewInt(0),
|
||||||
|
@ -105,8 +105,24 @@ func TestLinearVesting(t *testing.T) {
|
||||||
expectEq(res, 416)
|
expectEq(res, 416)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Total: 1000 tokens
|
||||||
|
// Time: 20 sec in of a 3700sec lease
|
||||||
|
// Claimed: 1000
|
||||||
|
// Expected: 0
|
||||||
|
if res, err := CalcAmountVestableLinear(
|
||||||
|
big.NewInt(1000),
|
||||||
|
big.NewInt(1000),
|
||||||
|
time.Now(),
|
||||||
|
time.Unix(time.Now().Unix()-20, 0),
|
||||||
|
time.Unix(time.Now().Unix()+3680, 0),
|
||||||
|
); err != nil {
|
||||||
|
panic(err)
|
||||||
|
} else {
|
||||||
|
expectEq(res, 5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compare a bigint output to its expected int value
|
||||||
func expectEq(a *big.Int, b int) {
|
func expectEq(a *big.Int, b int) {
|
||||||
a2 := int(a.Uint64())
|
a2 := int(a.Uint64())
|
||||||
if a2 != b {
|
if a2 != b {
|
||||||
|
|
Loading…
Reference in New Issue