-
Notifications
You must be signed in to change notification settings - Fork 1
/
avg_test.go
50 lines (45 loc) · 898 Bytes
/
avg_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
package avg
import (
"testing"
)
var (
pic = []string{
"0123456789",
"ABCDEFGHJK",
"LMNPQRSTUV",
"WXYZabcdef",
"ghjklmnpqr",
"stuvwxyz",
}
pic1 = []string{
"0..0....1....3..",
"......1...1.....",
"0..0....1.......",
"....7....4...5..",
".........7..9...",
}
pic2 = []string{
"0..0...1....",
".....1...1..",
"0..0...1....",
"2..3....A..A",
"......4....9",
"6..5........",
}
)
func Test1(t *testing.T) {
fig := ToFig(pic)
if len(fig) != 1 {
t.Errorf("expected %d, got %d:\n%v", len(pic), len(fig), fig)
}
fig = ToFig(pic1)
t.Logf("%v", fig)
if len(fig) != 5 {
t.Errorf("expected %d, got %d:\n%v", len(pic), len(fig), fig)
}
fig = ToFig(pic2)
t.Logf("%v", fig)
if len(fig) != 5 {
t.Errorf("expected %d, got %d:\n%v", len(pic), len(fig), fig)
}
}