-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path03_test.go
85 lines (79 loc) · 1.6 KB
/
03_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
package main
import "testing"
func TestAOC2022031(t *testing.T) {
var tests = []struct {
input string
item rune
priority int
}{
{
input: "vJrwpWtwJgWrhcsFMMfFFhFp",
item: 'p',
priority: 16,
},
{
input: "jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL",
item: 'L',
priority: 38,
},
{
input: "PmmdzqPrVvPwwTWBwg",
item: 'P',
priority: 42,
},
{
input: "wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn",
item: 'v',
priority: 22,
},
{
input: "ttgJtRGJQctTZtZT",
item: 't',
priority: 20,
},
{
input: "CrZsJsPPZsGzwwsLwLmpwMDw",
item: 's',
priority: 19,
},
}
for _, test := range tests {
got := AOC202203Item(test.input)
if got != test.item {
t.Errorf("AOC202203Round(%s) missmatch:\nwant: %v\ngot: %v", test.input, test.item, got)
}
prio := AOC202203Priority(test.item)
if prio != test.priority {
t.Errorf("AOC202203Priority(%v) missmatch:\nwant: %d\ngot: %d", test.item, test.priority, prio)
}
}
}
func TestAOC2022032(t *testing.T) {
var tests = []struct {
input []string
output rune
}{
{
input: []string{
"vJrwpWtwJgWrhcsFMMfFFhFp",
"jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL",
"PmmdzqPrVvPwwTWBwg",
},
output: 'r',
},
{
input: []string{
"wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn",
"ttgJtRGJQctTZtZT",
"CrZsJsPPZsGzwwsLwLmpwMDw",
},
output: 'Z',
},
}
for _, test := range tests {
out := AOC202203Multiitem(test.input[0], test.input[1], test.input[2])
if out != test.output {
t.Errorf("AOC202203Item3() missmatch:\nwant: %v\ngot: %v", test.output, out)
}
}
}