-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
76 lines (54 loc) · 1.49 KB
/
main_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
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
var _ = testing.AllocsPerRun
func TestOpenGame_CheckKeys_Letters_True(t *testing.T) {
game := &OpenGame{}
BoardSize := 9
assert.True(t, game.CheckKey('a', BoardSize))
assert.True(t, game.CheckKey('f', BoardSize))
assert.True(t, game.CheckKey('i', BoardSize))
}
func TestOpenGame_CheckKeys_LetteresToBig_False(t *testing.T) {
game := &OpenGame{}
BoardSize := 9
assert.False(t, game.CheckKey('j', BoardSize))
assert.False(t, game.CheckKey('z', BoardSize))
}
func TestOpenGame_CheckKeys_Numbers_True(t *testing.T) {
game := &OpenGame{}
BoardSize := 9
assert.True(t, game.CheckKey('1', BoardSize))
assert.True(t, game.CheckKey('2', BoardSize))
}
func TestOpenGame_CheckKeys_NumbersToBig_false(t *testing.T) {
game := &OpenGame{}
BoardSize := 9
assert.False(t, game.CheckKey('0', BoardSize))
}
func TestOpenGame_convertValue_A2_Ok(t *testing.T) {
game := &OpenGame{}
x, y := game.convertValue("A2")
assert.Equal(t, 1, x)
assert.Equal(t, 2, y)
}
func TestOpenGame_convertValue_a2_Ok(t *testing.T) {
game := &OpenGame{}
x, y := game.convertValue("a2")
assert.Equal(t, 1, x)
assert.Equal(t, 2, y)
}
func TestOpenGame_convertValue_B3_Ok(t *testing.T) {
game := &OpenGame{}
x, y := game.convertValue("B3")
assert.Equal(t, 2, x)
assert.Equal(t, 3, y)
}
func TestOpenGame_convertValue_AA23_Ok(t *testing.T) {
game := &OpenGame{}
x, y := game.convertValue("AA23")
assert.Equal(t, 1, x)
assert.Equal(t, 23, y)
}