-
Notifications
You must be signed in to change notification settings - Fork 548
/
zigzag-conversion_test.go
executable file
·87 lines (79 loc) · 1.15 KB
/
zigzag-conversion_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
package Problem0006
import (
"testing"
"github.com/stretchr/testify/assert"
)
type para struct {
one string
two int
}
type ans struct {
one string
}
type question struct {
p para
a ans
}
func Test_OK(t *testing.T) {
ast := assert.New(t)
qs := []question{
question{
p: para{
one: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
two: 1,
},
a: ans{
one: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
},
},
question{
p: para{
one: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
two: 2,
},
a: ans{
one: "ACEGIKMOQSUWYBDFHJLNPRTVXZ",
},
},
question{
p: para{
one: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
two: 3,
},
a: ans{
one: "AEIMQUYBDFHJLNPRTVXZCGKOSW",
},
},
question{
p: para{
one: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
two: 4,
},
a: ans{
one: "AGMSYBFHLNRTXZCEIKOQUWDJPV",
},
},
question{
p: para{
one: "ABCDEFGHIJKLMNOPQRSTUVWX",
two: 5,
},
a: ans{
one: "AIQBHJPRXCGKOSWDFLNTVEMU",
},
},
question{
p: para{
one: "A",
two: 3,
},
a: ans{
one: "A",
},
},
}
for _, q := range qs {
a, p := q.a, q.p
ast.Equal(a.one, convert(p.one, p.two), "输入:%v", p)
}
}