From fd34e19f46e958b822d6f3c751bdd51aa62d0072 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Sat, 14 Mar 2020 12:59:14 +0200 Subject: [PATCH] mathext: make tests parallel --- mathext/airy_test.go | 1 + mathext/beta_test.go | 2 ++ mathext/betainc_test.go | 1 + mathext/digamma_test.go | 1 + mathext/ell_carlson_test.go | 2 ++ mathext/ell_complete_test.go | 2 ++ mathext/erf_test.go | 1 + mathext/gamma_inc_test.go | 4 ++++ mathext/internal/amos/amos_test.go | 9 +++++++++ mathext/mvgamma_test.go | 1 + mathext/prng/mt19937_64_test.go | 3 +++ mathext/prng/mt19937_test.go | 3 +++ mathext/prng/prng_di_unimi_test.go | 8 ++++++++ mathext/zeta_test.go | 1 + 14 files changed, 39 insertions(+) diff --git a/mathext/airy_test.go b/mathext/airy_test.go index c167997d..0c97bbba 100644 --- a/mathext/airy_test.go +++ b/mathext/airy_test.go @@ -10,6 +10,7 @@ import ( ) func TestAiry(t *testing.T) { + t.Parallel() for _, test := range []struct { z, ans complex128 }{ diff --git a/mathext/beta_test.go b/mathext/beta_test.go index d40eb6ab..a8fe9ef4 100644 --- a/mathext/beta_test.go +++ b/mathext/beta_test.go @@ -84,6 +84,7 @@ var betaTests = []struct { } func TestBeta(t *testing.T) { + t.Parallel() for i, test := range betaTests { v := mathext.Beta(test.p, test.q) testOK := func(x float64) bool { @@ -142,6 +143,7 @@ func BenchmarkBeta2(b *testing.B) { } func TestLbeta(t *testing.T) { + t.Parallel() for i, test := range betaTests { want := math.Log(test.want) v := mathext.Lbeta(test.p, test.q) diff --git a/mathext/betainc_test.go b/mathext/betainc_test.go index 7d930590..6ba39aad 100644 --- a/mathext/betainc_test.go +++ b/mathext/betainc_test.go @@ -11,6 +11,7 @@ import ( ) func TestIncBeta(t *testing.T) { + t.Parallel() tol := 1e-14 tol2 := 1e-10 // Test against values from scipy diff --git a/mathext/digamma_test.go b/mathext/digamma_test.go index 15f158e5..f5484a7d 100644 --- a/mathext/digamma_test.go +++ b/mathext/digamma_test.go @@ -14,6 +14,7 @@ import ( var result float64 func TestDigamma(t *testing.T) { + t.Parallel() const tol = 1e-10 for i, test := range []struct { diff --git a/mathext/ell_carlson_test.go b/mathext/ell_carlson_test.go index 2c064daa..6306ad5c 100644 --- a/mathext/ell_carlson_test.go +++ b/mathext/ell_carlson_test.go @@ -13,6 +13,7 @@ import ( // Testing EllipticF (and EllipticRF) using the addition theorems from http://dlmf.nist.gov/19.11.i func TestEllipticF(t *testing.T) { + t.Parallel() const tol = 1.0e-14 rnd := rand.New(rand.NewSource(1)) @@ -59,6 +60,7 @@ func TestEllipticF(t *testing.T) { // Testing EllipticE (and EllipticRF, EllipticRD) using the addition theorems from http://dlmf.nist.gov/19.11.i func TestEllipticE(t *testing.T) { + t.Parallel() const tol = 1.0e-14 rnd := rand.New(rand.NewSource(1)) diff --git a/mathext/ell_complete_test.go b/mathext/ell_complete_test.go index f4d58d43..153e0424 100644 --- a/mathext/ell_complete_test.go +++ b/mathext/ell_complete_test.go @@ -12,6 +12,7 @@ import ( // TestCompleteKE checks if the Legendre's relation for m=0.0001(0.0001)0.9999 // is satisfied with accuracy 1e-14. func TestCompleteKE(t *testing.T) { + t.Parallel() const tol = 1.0e-14 for m := 1; m <= 9999; m++ { @@ -34,6 +35,7 @@ func TestCompleteKE(t *testing.T) { // K(m) = B(m) + D(m), // E(m) = B(m) + (1-m)D(m). func TestCompleteBD(t *testing.T) { + t.Parallel() const tol = 1.0e-14 for m := 1; m <= 9999; m++ { diff --git a/mathext/erf_test.go b/mathext/erf_test.go index 8f940c12..246678dd 100644 --- a/mathext/erf_test.go +++ b/mathext/erf_test.go @@ -11,6 +11,7 @@ import ( ) func TestNormalQuantile(t *testing.T) { + t.Parallel() // Values from https://www.johndcook.com/blog/normal_cdf_inverse/ p := []float64{ 0.0000001, diff --git a/mathext/gamma_inc_test.go b/mathext/gamma_inc_test.go index e59021cd..35e3b3c9 100644 --- a/mathext/gamma_inc_test.go +++ b/mathext/gamma_inc_test.go @@ -10,6 +10,7 @@ import ( ) func TestGammaIncReg(t *testing.T) { + t.Parallel() for i, test := range []struct { a, x, want float64 }{ @@ -42,6 +43,7 @@ func TestGammaIncReg(t *testing.T) { } func TestGammaIncRegComp(t *testing.T) { + t.Parallel() for i, test := range []struct { a, x, want float64 }{ @@ -74,6 +76,7 @@ func TestGammaIncRegComp(t *testing.T) { } func TestGammaIncRegInv(t *testing.T) { + t.Parallel() for i, test := range []struct { a, x, want float64 }{ @@ -106,6 +109,7 @@ func TestGammaIncRegInv(t *testing.T) { } func TestGammaIncRegCompInv(t *testing.T) { + t.Parallel() for i, test := range []struct { a, x, want float64 }{ diff --git a/mathext/internal/amos/amos_test.go b/mathext/internal/amos/amos_test.go index ee2e16af..0fbfb465 100644 --- a/mathext/internal/amos/amos_test.go +++ b/mathext/internal/amos/amos_test.go @@ -62,6 +62,7 @@ func randInput(rnd *rand.Rand) input { const nInputs = 100000 func TestAiry(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -70,6 +71,7 @@ func TestAiry(t *testing.T) { } func TestZacai(t *testing.T) { + t.Parallel() switch runtime.GOARCH { case "arm64": t.Skipf("skipping on GOARCH=%s", runtime.GOARCH) @@ -82,6 +84,7 @@ func TestZacai(t *testing.T) { } func TestZbknu(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -90,6 +93,7 @@ func TestZbknu(t *testing.T) { } func TestZasyi(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -98,6 +102,7 @@ func TestZasyi(t *testing.T) { } func TestZseri(t *testing.T) { + t.Parallel() switch runtime.GOARCH { case "arm64": t.Skipf("skipping on GOARCH=%s", runtime.GOARCH) @@ -110,6 +115,7 @@ func TestZseri(t *testing.T) { } func TestZmlri(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -118,6 +124,7 @@ func TestZmlri(t *testing.T) { } func TestZkscl(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -126,6 +133,7 @@ func TestZkscl(t *testing.T) { } func TestZuchk(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) @@ -134,6 +142,7 @@ func TestZuchk(t *testing.T) { } func TestZs1s2(t *testing.T) { + t.Parallel() rnd := rand.New(rand.NewSource(1)) for i := 0; i < nInputs; i++ { in := randInput(rnd) diff --git a/mathext/mvgamma_test.go b/mathext/mvgamma_test.go index a77816b6..d9a48978 100644 --- a/mathext/mvgamma_test.go +++ b/mathext/mvgamma_test.go @@ -10,6 +10,7 @@ import ( ) func TestMvLgamma(t *testing.T) { + t.Parallel() // Values compared with scipy for i, test := range []struct { v float64 diff --git a/mathext/prng/mt19937_64_test.go b/mathext/prng/mt19937_64_test.go index 3e1c8222..d3de7a55 100644 --- a/mathext/prng/mt19937_64_test.go +++ b/mathext/prng/mt19937_64_test.go @@ -17,6 +17,7 @@ var _ rand.Source = (*MT19937_64)(nil) // with or without an initial seed array. func TestMT19937_64(t *testing.T) { + t.Parallel() want := []uint64{ 14514284786278117030, 4620546740167642908, 13109570281517897720, 17462938647148434322, 355488278567739596, 7469126240319926998, 4635995468481642529, 418970542659199878, 9604170989252516556, 6358044926049913402, @@ -38,6 +39,7 @@ func TestMT19937_64(t *testing.T) { } func TestMT19937_64SeedFromKeys(t *testing.T) { + t.Parallel() want := []uint64{ 7266447313870364031, 4946485549665804864, 16945909448695747420, 16394063075524226720, 4873882236456199058, 14877448043947020171, 6740343660852211943, 13857871200353263164, 5249110015610582907, 10205081126064480383, @@ -60,6 +62,7 @@ func TestMT19937_64SeedFromKeys(t *testing.T) { } func TestMT19937_64RoundTrip(t *testing.T) { + t.Parallel() var src MT19937_64 src.Seed(uint64(time.Now().Unix())) diff --git a/mathext/prng/mt19937_test.go b/mathext/prng/mt19937_test.go index e63e67fe..709e1b25 100644 --- a/mathext/prng/mt19937_test.go +++ b/mathext/prng/mt19937_test.go @@ -17,6 +17,7 @@ var _ rand.Source = (*MT19937)(nil) // with or without an initial seed array. func TestMT19937(t *testing.T) { + t.Parallel() want := []uint32{ 3499211612, 581869302, 3890346734, 3586334585, 545404204, 4161255391, 3922919429, 949333985, 2715962298, 1323567403, @@ -38,6 +39,7 @@ func TestMT19937(t *testing.T) { } func TestMT19937SeedFromKeys(t *testing.T) { + t.Parallel() want := []uint32{ 1067595299, 955945823, 477289528, 4107218783, 4228976476, 3344332714, 3355579695, 227628506, 810200273, 2591290167, @@ -60,6 +62,7 @@ func TestMT19937SeedFromKeys(t *testing.T) { } func TestMT19937RoundTrip(t *testing.T) { + t.Parallel() var src MT19937 src.Seed(uint64(time.Now().Unix())) diff --git a/mathext/prng/prng_di_unimi_test.go b/mathext/prng/prng_di_unimi_test.go index f6e6f399..21d5987a 100644 --- a/mathext/prng/prng_di_unimi_test.go +++ b/mathext/prng/prng_di_unimi_test.go @@ -16,6 +16,7 @@ import ( var _ rand.Source = (*SplitMix64)(nil) func TestSplitMix64(t *testing.T) { + t.Parallel() want := []uint64{ 10451216379200822465, 13757245211066428519, 17911839290282890590, 8196980753821780235, 8195237237126968761, 14072917602864530048, 16184226688143867045, 9648886400068060533, 5266705631892356520, 14646652180046636950, @@ -37,6 +38,7 @@ func TestSplitMix64(t *testing.T) { } func TestSplitMix64RoundTrip(t *testing.T) { + t.Parallel() var src SplitMix64 src.Seed(uint64(time.Now().Unix())) @@ -65,6 +67,7 @@ func TestSplitMix64RoundTrip(t *testing.T) { var _ rand.Source = (*Xoshiro256plus)(nil) func TestXoshiro256plus(t *testing.T) { + t.Parallel() want := []uint64{ 201453059313051084, 16342930563397888806, 2922809869868169223, 13315230553875954649, 6410977891529050008, 2721661332018190285, 3769995280709464022, 17208995829377771030, 16938999919058283733, 8307416726322109393, @@ -86,6 +89,7 @@ func TestXoshiro256plus(t *testing.T) { } func TestXoshiro256plusRoundTrip(t *testing.T) { + t.Parallel() var src Xoshiro256plus src.Seed(uint64(time.Now().Unix())) @@ -116,6 +120,7 @@ func TestXoshiro256plusRoundTrip(t *testing.T) { var _ rand.Source = (*Xoshiro256plusplus)(nil) func TestXoshiro256plusplus(t *testing.T) { + t.Parallel() want := []uint64{ 14971601782005023387, 13781649495232077965, 1847458086238483744, 13765271635752736470, 3406718355780431780, 10892412867582108485, 18204613561675945223, 9655336933892813345, 1781989159761824720, 2477283028068920342, @@ -137,6 +142,7 @@ func TestXoshiro256plusplus(t *testing.T) { } func TestXoshiro256plusplusRoundTrip(t *testing.T) { + t.Parallel() var src Xoshiro256plusplus src.Seed(uint64(time.Now().Unix())) @@ -167,6 +173,7 @@ func TestXoshiro256plusplusRoundTrip(t *testing.T) { var _ rand.Source = (*Xoshiro256starstar)(nil) func TestXoshiro256starstar(t *testing.T) { + t.Parallel() want := []uint64{ 12966619160104079557, 9600361134598540522, 10590380919521690900, 7218738570589545383, 12860671823995680371, 2648436617965840162, 1310552918490157286, 7031611932980406429, 15996139959407692321, 10177250653276320208, @@ -188,6 +195,7 @@ func TestXoshiro256starstar(t *testing.T) { } func TestXoshiro256starstarRoundTrip(t *testing.T) { + t.Parallel() var src Xoshiro256starstar src.Seed(uint64(time.Now().Unix())) diff --git a/mathext/zeta_test.go b/mathext/zeta_test.go index dd40bc12..a6b55efc 100644 --- a/mathext/zeta_test.go +++ b/mathext/zeta_test.go @@ -10,6 +10,7 @@ import ( ) func TestZeta(t *testing.T) { + t.Parallel() for i, test := range []struct { x, q, want float64 }{