-
Notifications
You must be signed in to change notification settings - Fork 0
/
util_test.go
53 lines (50 loc) · 1.24 KB
/
util_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package tdigest_test
import (
"testing"
"github.com/ajwerner/tdigest"
"github.com/ajwerner/tdigest/testutils"
"github.com/ajwerner/tdigest/testutils/accuracytest"
)
func TestAccuracy(t *testing.T) {
constructorOps := testutils.CombineOptions(
[]tdigest.Option{
tdigest.BufferFactor(1),
tdigest.BufferFactor(2),
tdigest.BufferFactor(5),
tdigest.BufferFactor(10),
tdigest.BufferFactor(20),
},
[]tdigest.Option{
tdigest.Compression(16),
tdigest.Compression(64),
tdigest.Compression(128),
tdigest.Compression(256),
tdigest.Compression(512),
},
[]tdigest.Option{
tdigest.UseWeightLimit(true),
tdigest.UseWeightLimit(false),
},
)
tests := accuracytest.MakeTests(accuracytest.CombineOptions(
[]accuracytest.Option{accuracytest.N(100000)},
accuracytest.Distributions,
accuracytest.Orders,
append(
accuracytest.Constructors(
"Concurrent",
func(o ...tdigest.Option) tdigest.Sketch {
return tdigest.NewConcurrent(o...)
},
constructorOps),
accuracytest.Constructors(
"TDigest",
func(o ...tdigest.Option) tdigest.Sketch {
return tdigest.New(o...)
},
constructorOps)...),
)...)
for _, at := range tests {
t.Run(at.String(), func(t *testing.T) { at.Run(t) })
}
}