spatial/barneshut: make tests parallel

This commit is contained in:
Egon Elbre
2020-03-14 13:38:05 +02:00
parent 52173e64f5
commit 619455fee7
2 changed files with 8 additions and 0 deletions

View File

@@ -342,6 +342,7 @@ var planeTests = []struct {
}
func TestPlane(t *testing.T) {
t.Parallel()
const tol = 1e-15
for _, test := range planeTests {
@@ -408,6 +409,7 @@ func walkPlane(t *tile, fn func(*tile)) {
}
func TestPlaneForceOn(t *testing.T) {
t.Parallel()
const (
size = 1000
tol = 0.07
@@ -436,7 +438,9 @@ func TestPlaneForceOn(t *testing.T) {
continue
}
for _, theta := range []float64{0, 0.3, 0.6, 0.9} {
theta := theta
t.Run(fmt.Sprintf("%d-body/theta=%v", len(particles), theta), func(t *testing.T) {
t.Parallel()
var ssd, sd float64
var calls int
for i, p := range particles {

View File

@@ -337,6 +337,7 @@ var volumeTests = []struct {
}
func TestVolume(t *testing.T) {
t.Parallel()
const tol = 1e-15
for _, test := range volumeTests {
@@ -405,6 +406,7 @@ func walkVolume(t *bucket, fn func(*bucket)) {
}
func TestVolumeForceOn(t *testing.T) {
t.Parallel()
const (
size = 1000
tol = 1e-3
@@ -433,7 +435,9 @@ func TestVolumeForceOn(t *testing.T) {
continue
}
for _, theta := range []float64{0, 0.3, 0.6, 0.9} {
theta := theta
t.Run(fmt.Sprintf("%d-body/theta=%v", len(particles), theta), func(t *testing.T) {
t.Parallel()
var ssd, sd float64
var calls int
for i, p := range particles {