-
Notifications
You must be signed in to change notification settings - Fork 2
/
card_test.go
142 lines (127 loc) · 3.17 KB
/
card_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
130
131
132
133
134
135
136
137
138
139
140
141
142
package main
import "testing"
func TestGetValueIndex(t *testing.T) {
card := &Card{"9", "♦"}
got := card.getValueIndex()
expected := 3
if got != expected {
t.Errorf("getValueIndex expected: %v, got: %v", expected, got)
}
}
func TestGtFalse(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"10", "♠"}
got := card.gt(otherCard)
expected := false
if got != expected {
t.Errorf("TestGtFalse expected: %v, got: %v", expected, got)
}
}
func TestGtTrue(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"8", "♦"}
got := card.gt(otherCard)
expected := true
if got != expected {
t.Errorf("TestGtTrue expected: %v, got: %v", expected, got)
}
}
func TestGtWithEqual(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"9", "♠"}
got := card.gt(otherCard)
expected := false
if got != expected {
t.Errorf("TestGtWithEqual expected: %v, got: %v", expected, got)
}
}
func TestGte(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"9", "♦"}
got := card.gte(otherCard)
expected := true
if got != expected {
t.Errorf("TestGte expected: %v, got: %v", expected, got)
}
}
func TestGteFalse(t *testing.T) {
card := &Card{"J", "♦"}
otherCard := &Card{"Q", "♠"}
got := card.gte(otherCard)
expected := false
if got != expected {
t.Errorf("TestGteFalse expected: %v, got: %v", expected, got)
}
}
func TestLtFalse(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"10", "♦"}
got := card.lt(otherCard)
expected := true
if got != expected {
t.Errorf("TestLtFalse expected: %v, got: %v", expected, got)
}
}
func TestLtTrue(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"8", "♠"}
got := card.lt(otherCard)
expected := false
if got != expected {
t.Errorf("TestLtTrue expected: %v, got: %v", expected, got)
}
}
func TestLtWithEqual(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"9", "♠"}
got := card.lt(otherCard)
expected := false
if got != expected {
t.Errorf("TestLtWithEqual expected: %v, got: %v", expected, got)
}
}
func TestLte(t *testing.T) {
card := &Card{"9", "♦"}
otherCard := &Card{"9", "♦"}
got := card.lte(otherCard)
expected := true
if got != expected {
t.Errorf("TestLte expected: %v, got: %v", expected, got)
}
}
func TestLteFalse(t *testing.T) {
card := &Card{"K", "♦"}
otherCard := &Card{"Q", "♠"}
got := card.lte(otherCard)
expected := false
if got != expected {
t.Errorf("TestLteFalse expected: %v, got: %v", expected, got)
}
}
func TestEqual(t *testing.T) {
card := &Card{"K", "♦"}
otherCard := &Card{"K", "♦"}
got := card.equals(otherCard)
expected := true
if got != expected {
t.Errorf("TestEqual expected: %v, got: %v", expected, got)
}
}
func TestNotEqualByValue(t *testing.T) {
card := &Card{"K", "♦"}
otherCard := &Card{"Q", "♦"}
got := card.equals(otherCard)
expected := false
if got != expected {
t.Errorf("TestNotEqualByValue expected: %v, got: %v", expected, got)
}
}
func TestNotEqualBySuit(t *testing.T) {
card := &Card{"K", "♦"}
otherCard := &Card{"K", "♠"}
got := card.equals(otherCard)
expected := false
if got != expected {
t.Errorf("TestNotEqualBySuit expected: %v, got: %v", expected, got)
}
}