diff options
Diffstat (limited to 'src/pkg/math/big/nat_test.go')
-rw-r--r-- | src/pkg/math/big/nat_test.go | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/pkg/math/big/nat_test.go b/src/pkg/math/big/nat_test.go index 1d4dfe80d..a2ae53385 100644 --- a/src/pkg/math/big/nat_test.go +++ b/src/pkg/math/big/nat_test.go @@ -437,20 +437,11 @@ func BenchmarkStringPiParallel(b *testing.B) { if x.decimalString() != pi { panic("benchmark incorrect: conversion failed") } - n := runtime.GOMAXPROCS(0) - m := b.N / n // n*m <= b.N due to flooring, but the error is neglibible (n is not very large) - c := make(chan int, n) - for i := 0; i < n; i++ { - go func() { - for j := 0; j < m; j++ { - x.decimalString() - } - c <- 0 - }() - } - for i := 0; i < n; i++ { - <-c - } + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + x.decimalString() + } + }) } func BenchmarkScan10Base2(b *testing.B) { ScanHelper(b, 2, 10, 10) } @@ -723,6 +714,12 @@ var expNNTests = []struct { x, y, m string out string }{ + {"0", "0", "0", "1"}, + {"0", "0", "1", "0"}, + {"1", "1", "1", "0"}, + {"2", "1", "1", "0"}, + {"2", "2", "1", "0"}, + {"10", "100000000000", "1", "0"}, {"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"}, {"0x8000000000000000", "2", "6719", "4944"}, {"0x8000000000000000", "3", "6719", "5447"}, @@ -750,7 +747,7 @@ func TestExpNN(t *testing.T) { z := nat(nil).expNN(x, y, m) if z.cmp(out) != 0 { - t.Errorf("#%d got %v want %v", i, z, out) + t.Errorf("#%d got %s want %s", i, z.decimalString(), out.decimalString()) } } } |