Skip to content

Commit

Permalink
Merge pull request #73 from terra-project/dokwon-patch-1
Browse files Browse the repository at this point in the history
Fix spelling error in ballot_test.go
  • Loading branch information
yun-yeo authored Apr 8, 2019
2 parents 4be2a91 + 9470f9b commit 4374213
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions x/oracle/ballot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ func checkFloatEquality(a sdk.Dec, b float64, precision int) bool {
func TestPBStdDev(t *testing.T) {
_, addrs, _, _ := mock.CreateGenAccounts(1, sdk.Coins{})

for i := 0; i < 100; i ++ {
prices, weights := generateRandomTestCase()
pb := PriceBallot{}
for i, price := range prices {
weight := sdk.NewDec(int64(weights[i])).TruncateInt()
vote := NewPriceVote(sdk.NewDecWithPrec(int64(price*10000), 4), "", weight, addrs[0])
pb = append(pb, vote)
}
prices, weights := generateRandomTestCase()
pb := PriceBallot{}
for i, price := range prices {
weight := sdk.NewDec(int64(weights[i])).TruncateInt()
vote := NewPriceVote(sdk.NewDecWithPrec(int64(price*10000), 4), "", weight, addrs[0])
pb = append(pb, vote)
}

match := checkFloatEquality(pb.stdDev(), stat.StdDev(prices, weights), 2)
require.True(t, match)
Expand Down

0 comments on commit 4374213

Please sign in to comment.