prysm-pulse/shared/math_helper_test.go
Nishant Das 3dfbec9d3c
Update Rewards to Align with Spec (#596)
* Adding integer square root and other changes to spec

* adding doc

* fixing tests

* fix spec

* fix rewards

* Remove failing test

* fix test

* lint
2018-10-04 12:49:18 +08:00

43 lines
579 B
Go

package shared
import (
"testing"
)
type numbertTest struct {
number uint64
root uint64
}
func TestIntegerSquareRoot(t *testing.T) {
tt := []numbertTest{
{
number: 20,
root: 4,
},
{
number: 200,
root: 14,
},
{
number: 1987,
root: 44,
},
{
number: 34989843,
root: 5915,
},
{
number: 97282,
root: 311,
},
}
for _, testVals := range tt {
root := IntegerSquareRoot(testVals.number)
if testVals.root != root {
t.Fatalf("expected root and computed root are not equal %d, %d", testVals.root, root)
}
}
}