diff --git a/x/colinearcore/math/vesting_test.go b/x/colinearcore/math/vesting_test.go index 1a53034..6d00525 100644 --- a/x/colinearcore/math/vesting_test.go +++ b/x/colinearcore/math/vesting_test.go @@ -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 {