-
Notifications
You must be signed in to change notification settings - Fork 1
/
statistics_test.go
86 lines (84 loc) · 1.65 KB
/
statistics_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package dcron
import (
"reflect"
"testing"
)
func TestStatistics_Add(t *testing.T) {
type fields struct {
TotalTask int64
PassedTask int64
FailedTask int64
SkippedTask int64
MissedTask int64
TotalRun int64
PassedRun int64
FailedRun int64
RetriedRun int64
}
type args struct {
delta Statistics
}
tests := []struct {
name string
fields fields
args args
want Statistics
}{
{
name: "regular",
fields: fields{
TotalTask: 1,
PassedTask: 2,
FailedTask: 3,
SkippedTask: 4,
MissedTask: 5,
TotalRun: 6,
PassedRun: 7,
FailedRun: 8,
RetriedRun: 9,
},
args: args{
delta: Statistics{
TotalTask: 1,
PassedTask: 2,
FailedTask: 3,
SkippedTask: 4,
MissedTask: 5,
TotalRun: 6,
PassedRun: 7,
FailedRun: 8,
RetriedRun: 9,
},
},
want: Statistics{
TotalTask: 2,
PassedTask: 4,
FailedTask: 6,
SkippedTask: 8,
MissedTask: 10,
TotalRun: 12,
PassedRun: 14,
FailedRun: 16,
RetriedRun: 18,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := Statistics{
TotalTask: tt.fields.TotalTask,
PassedTask: tt.fields.PassedTask,
FailedTask: tt.fields.FailedTask,
SkippedTask: tt.fields.SkippedTask,
MissedTask: tt.fields.MissedTask,
TotalRun: tt.fields.TotalRun,
PassedRun: tt.fields.PassedRun,
FailedRun: tt.fields.FailedRun,
RetriedRun: tt.fields.RetriedRun,
}
if got := s.Add(tt.args.delta); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Add() = %v, want %v", got, tt.want)
}
})
}
}