-
Notifications
You must be signed in to change notification settings - Fork 1
/
operators_test.go
99 lines (74 loc) · 1.2 KB
/
operators_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
package ranges
import "testing"
func TestEq(t *testing.T) {
t.Parallel()
if !Eq(1, 1) {
t.Error("1 == 2 was false")
}
if !Eq("abc", "abc") {
t.Error("abc == abc was false")
}
if Eq("abc", "xyz") {
t.Error("abc == xyz was true")
}
}
func TestLe(t *testing.T) {
t.Parallel()
if !Le(1, 1) {
t.Error("1 <= 1 was false")
}
if !Le(1, 2) {
t.Error("1 <= 2 was false")
}
if Le(2, 1) {
t.Error("2 <= 1 was true")
}
}
func TestLt(t *testing.T) {
t.Parallel()
if Lt(1, 1) {
t.Error("1 < 1 was true")
}
if !Lt(1, 2) {
t.Error("1 < 2 was false")
}
if Lt(2, 1) {
t.Error("2 < 1 was true")
}
}
func TestNeq(t *testing.T) {
t.Parallel()
if Ne(1, 1) {
t.Error("1 != 1 was true")
}
if Ne("abc", "abc") {
t.Error("abc != abc was true")
}
if !Ne("abc", "xyz") {
t.Error("abc != xyz was false")
}
}
func TestGe(t *testing.T) {
t.Parallel()
if !Ge(1, 1) {
t.Error("1 >= 1 was false")
}
if Ge(1, 2) {
t.Error("1 >= 2 was true")
}
if !Ge(2, 1) {
t.Error("2 >= 1 was false")
}
}
func TestGt(t *testing.T) {
t.Parallel()
if Gt(1, 1) {
t.Error("1 > 1 was true")
}
if Gt(1, 2) {
t.Error("1 > 2 was true")
}
if !Gt(2, 1) {
t.Error("2 > 1 was false")
}
}