mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
math/big: move exhaustive tests behind -long flag
This way you can still run 'go test' or 'go bench -run Foo' without wondering why it is taking so very long. Change-Id: Icfa097a6deb1d6682acb7be9f34729215c29eabb Reviewed-on: https://go-review.googlesource.com/30707 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
2756d56c89
commit
9a8832f142
|
@ -5,6 +5,7 @@
|
|||
package big
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
|
@ -1495,12 +1496,14 @@ func TestFloatQuo(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
var long = flag.Bool("long", false, "run very long tests")
|
||||
|
||||
// TestFloatQuoSmoke tests all divisions x/y for values x, y in the range [-n, +n];
|
||||
// it serves as a smoke test for basic correctness of division.
|
||||
func TestFloatQuoSmoke(t *testing.T) {
|
||||
n := 1000
|
||||
if testing.Short() {
|
||||
n = 10
|
||||
n := 10
|
||||
if *long {
|
||||
n = 1000
|
||||
}
|
||||
|
||||
const dprec = 3 // max. precision variation
|
||||
|
|
|
@ -382,9 +382,9 @@ func TestFloat32Distribution(t *testing.T) {
|
|||
9,
|
||||
11,
|
||||
}
|
||||
var winc, einc = uint64(1), 1 // soak test (~1.5s on x86-64)
|
||||
var winc, einc = uint64(5), 15 // quick test (~60ms on x86-64)
|
||||
if testing.Short() {
|
||||
winc, einc = 5, 15 // quick test (~60ms on x86-64)
|
||||
winc, einc = uint64(1), 1 // soak test (~1.5s on x86-64)
|
||||
}
|
||||
|
||||
for _, sign := range "+-" {
|
||||
|
@ -430,9 +430,9 @@ func TestFloat64Distribution(t *testing.T) {
|
|||
9,
|
||||
11,
|
||||
}
|
||||
var winc, einc = uint64(1), 1 // soak test (~75s on x86-64)
|
||||
if testing.Short() {
|
||||
winc, einc = 10, 500 // quick test (~12ms on x86-64)
|
||||
var winc, einc = uint64(10), 500 // quick test (~12ms on x86-64)
|
||||
if *long {
|
||||
winc, einc = uint64(1), 1 // soak test (~75s on x86-64)
|
||||
}
|
||||
|
||||
for _, sign := range "+-" {
|
||||
|
|
|
@ -144,7 +144,7 @@ func TestFloatString(t *testing.T) {
|
|||
}
|
||||
|
||||
// Test inputs to Rat.SetString. The prefix "long:" causes the test
|
||||
// to be skipped in --test.short mode. (The threshold is about 500us.)
|
||||
// to be skipped except in -long mode. (The threshold is about 500us.)
|
||||
var float64inputs = []string{
|
||||
// Constants plundered from strconv/testfp.txt.
|
||||
|
||||
|
@ -350,7 +350,7 @@ func isFinite(f float64) bool {
|
|||
func TestFloat32SpecialCases(t *testing.T) {
|
||||
for _, input := range float64inputs {
|
||||
if strings.HasPrefix(input, "long:") {
|
||||
if testing.Short() {
|
||||
if !*long {
|
||||
continue
|
||||
}
|
||||
input = input[len("long:"):]
|
||||
|
@ -406,7 +406,7 @@ func TestFloat32SpecialCases(t *testing.T) {
|
|||
func TestFloat64SpecialCases(t *testing.T) {
|
||||
for _, input := range float64inputs {
|
||||
if strings.HasPrefix(input, "long:") {
|
||||
if testing.Short() {
|
||||
if !*long {
|
||||
continue
|
||||
}
|
||||
input = input[len("long:"):]
|
||||
|
|
Loading…
Reference in a new issue