-
Notifications
You must be signed in to change notification settings - Fork 40
/
runner_test.go
48 lines (41 loc) · 981 Bytes
/
runner_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
package gopter
import "testing"
func TestRunnerSingleWorker(t *testing.T) {
parameters := DefaultTestParameters()
testRunner := &runner{
parameters: parameters,
worker: func(num int, shouldStop shouldStop) *TestResult {
return &TestResult{
Status: Passed,
Succeeded: 1,
Discarded: 0,
}
},
}
result := testRunner.runWorkers()
if result.Status != Passed ||
result.Succeeded != 1 ||
result.Discarded != 0 {
t.Errorf("Invalid result: %#v", result)
}
}
func TestRunnerParallelWorkers(t *testing.T) {
parameters := DefaultTestParameters()
parameters.Workers = 50
testRunner := &runner{
parameters: parameters,
worker: func(num int, shouldStop shouldStop) *TestResult {
return &TestResult{
Status: Passed,
Succeeded: 10,
Discarded: 1,
}
},
}
result := testRunner.runWorkers()
if result.Status != Passed ||
result.Succeeded != 500 ||
result.Discarded != 50 {
t.Errorf("Invalid result: %#v", result)
}
}