-
Notifications
You must be signed in to change notification settings - Fork 0
/
hand_test.go
46 lines (43 loc) · 1.02 KB
/
hand_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
package card
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRemove(t *testing.T) {
tcs := []struct {
description string
hand Hand
card Card
expectedResult Hand
}{
{
description: "assert hand unchanged if card not present",
card: CA,
hand: []Card{C2, C3, C4},
expectedResult: []Card{C2, C3, C4},
},
{
description: "assert card removed from front of hand",
card: C2,
hand: []Card{C2, C3, C4},
expectedResult: []Card{C3, C4},
},
{
description: "assert card removed from middle of hand",
card: C3,
hand: []Card{C2, C3, C4},
expectedResult: []Card{C2, C4},
},
{
description: "assert card removed from back of hand",
card: C4,
hand: []Card{C2, C3, C4},
expectedResult: []Card{C2, C3},
},
}
for _, tc := range tcs {
t.Run(tc.description, func(t *testing.T) {
assert.Equal(t, tc.expectedResult, tc.hand.Remove(tc.card))
})
}
}