mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 00:04:26 -08:00
update vest-calc tests with a short 20sec period
This commit is contained in:
@@ -60,7 +60,7 @@ func TestLinearVesting(t *testing.T) {
|
||||
// Total: 1000 tokens
|
||||
// Time: end
|
||||
// Claimed: 1000
|
||||
// Expected: 1000
|
||||
// Expected: 0
|
||||
if res, err := CalcAmountVestableLinear(
|
||||
big.NewInt(1000),
|
||||
big.NewInt(0),
|
||||
@@ -105,8 +105,24 @@ func TestLinearVesting(t *testing.T) {
|
||||
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) {
|
||||
a2 := int(a.Uint64())
|
||||
if a2 != b {
|
||||
|
||||
Reference in New Issue
Block a user