-
Notifications
You must be signed in to change notification settings - Fork 0
/
slice_test.go
129 lines (105 loc) · 2.76 KB
/
slice_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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package assert_test
import (
"testing"
. "github.com/pierrre/assert"
"github.com/pierrre/assert/asserttest"
)
func TestSliceNil(t *testing.T) {
ok := SliceNil(t, []int(nil))
True(t, ok)
}
func TestSliceNilFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNil(t, []int{}, Report(report))
False(t, ok)
}
func TestSliceNotNil(t *testing.T) {
ok := SliceNotNil(t, []int{})
True(t, ok)
}
func TestSliceNotNilFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNotNil(t, []int(nil), Report(report))
False(t, ok)
}
func TestSliceEmpty(t *testing.T) {
ok := SliceEmpty(t, []int{})
True(t, ok)
}
func TestSliceEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceEmpty(t, []int{1}, Report(report))
False(t, ok)
}
func TestSliceNotEmpty(t *testing.T) {
ok := SliceNotEmpty(t, []int{1})
True(t, ok)
}
func TestSliceNotEmptyFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNotEmpty(t, []int{}, Report(report))
False(t, ok)
}
func TestSliceLen(t *testing.T) {
ok := SliceLen(t, []int{1}, 1)
True(t, ok)
}
func TestSliceLenFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceLen(t, []int{1}, 2, Report(report))
False(t, ok)
}
func TestSliceEqual(t *testing.T) {
ok := SliceEqual(t, []int{1}, []int{1})
True(t, ok)
}
func TestSliceEqualFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceEqual(t, []int{1}, []int{2}, Report(report))
False(t, ok)
}
func TestSliceNotEqual(t *testing.T) {
ok := SliceNotEqual(t, []int{1}, []int{2})
True(t, ok)
}
func TestSliceNotEqualFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNotEqual(t, []int{1}, []int{1}, Report(report))
False(t, ok)
}
func TestSliceContains(t *testing.T) {
ok := SliceContains(t, []int{1, 2}, 1)
True(t, ok)
}
func TestSliceContainsFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceContains(t, []int{1, 2}, 3, Report(report))
False(t, ok)
}
func TestSliceNotContains(t *testing.T) {
ok := SliceNotContains(t, []int{1, 2}, 3)
True(t, ok)
}
func TestSliceNotContainsFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNotContains(t, []int{1, 2}, 1, Report(report))
False(t, ok)
}
func TestSliceContainsAll(t *testing.T) {
ok := SliceContainsAll(t, []int{1, 2}, []int{1})
True(t, ok)
}
func TestSliceContainsAllFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceContainsAll(t, []int{1, 2}, []int{3}, Report(report))
False(t, ok)
}
func TestSliceNotContainsAll(t *testing.T) {
ok := SliceNotContainsAll(t, []int{1, 2}, []int{3})
True(t, ok)
}
func TestSliceNotContainsAllFail(t *testing.T) {
report := asserttest.NewReportAuto(t)
ok := SliceNotContainsAll(t, []int{1, 2}, []int{1}, Report(report))
False(t, ok)
}