-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers_test.go
108 lines (99 loc) · 2.61 KB
/
helpers_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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package main
import (
"reflect"
"testing"
)
func Test_necFormatter(t *testing.T) {
type args struct {
bInfo map[string]interface{}
}
tests := []struct {
name string
args args
want string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := necFormatter(tt.args.bInfo); got != tt.want {
t.Errorf("necFormatter() = %v, want %v", got, tt.want)
}
})
}
}
func Test_split(t *testing.T) {
tests := []struct {
name string
args string
want []string
}{
{"test splitter", "a b", []string{"a", "b"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := split(tt.args); !reflect.DeepEqual(got, tt.want) {
t.Errorf("split() = %v, want %v", got, tt.want)
}
})
}
}
func Test_dispatch(t *testing.T) {
tests := []struct {
name string
args string
want [][]string
}{
{"Test list of three items", "a 10 b 20 b 30", [][]string{{"a", "10"}, {"b", "20"}, {"b", "30"}}},
{"list of one", "a 10", [][]string{{"a", "10"}}},
{"list of three", "04203594959 1 04203594959 1 04203594959 1 ",
[][]string{{"04203594959", "1"}, {"04203594959", "1"}, {"04203594959", "1"}}},
{"Test list of two items", "a 10 b 20", [][]string{{"a", "10"}, {"b", "20"}}},
{"Test list of three items", "a 10 b 20 b 30 c 2000 f 3232 d 11", [][]string{{"a", "10"},
{"b", "20"}, {"b", "30"}, {"c", "2000"}, {"f", "3232"}, {"d", "11"}},
},
{"Test actual data", "04203594959 1 04203594959 1 04203594959 1",
[][]string{{"04203594959", "1"}, {"04203594959", "1"}, {"04203594959", "1"}}},
{"test long input", "04203594959 1 04203594959 1 04203594959 1 04203594959 1 04203594959 1",
[][]string{{"04203594959", "1"}, {"04203594959", "1"}, {"04203594959", "1"}, {"04203594959", "1"}, {"04203594959", "1"}}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := dispatch(tt.args); !reflect.DeepEqual(got, tt.want) {
t.Errorf("dispatch() = %v, want %v", got, tt.want)
}
})
}
}
func Test_generateDate(t *testing.T) {
tests := []struct {
name string
want string
}{
{"32323232", "2323233232"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := generateDate(); got != tt.want {
t.Errorf("generateDate() = %v, want %v", got, tt.want)
}
})
}
}
func Test_isOdd(t *testing.T) {
tests := []struct {
name string
args int
want bool
}{
{"Even number", 4, false},
{"Odd number", 3, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isOdd(tt.args); got != tt.want {
t.Errorf("isOdd() = %v, want %v", got, tt.want)
}
})
}
}