core: update claimable GAS calculation

This commit is contained in:
Evgenii Stratonikov 2020-08-26 12:07:30 +03:00
parent 1ff1cd797e
commit 7d90d79ae6
8 changed files with 191 additions and 69 deletions

View file

@ -108,3 +108,20 @@ func TestNEO_Vote(t *testing.T) {
require.NotEqual(t, candidates[0], pubs[i])
}
}
func TestNEO_CalculateBonus(t *testing.T) {
bc := newTestChain(t)
defer bc.Close()
neo := bc.contracts.NEO
ic := bc.newInteropContext(trigger.System, bc.dao, nil, nil)
t.Run("Invalid", func(t *testing.T) {
_, err := neo.CalculateBonus(ic, new(big.Int).SetInt64(-1), 0, 1)
require.Error(t, err)
})
t.Run("Zero", func(t *testing.T) {
res, err := neo.CalculateBonus(ic, big.NewInt(0), 0, 100)
require.NoError(t, err)
require.EqualValues(t, 0, res.Int64())
})
}