-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdays_test.go
70 lines (65 loc) · 1.33 KB
/
days_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
package test
import (
"fmt"
"os/exec"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
var expectations = map[string]string{
"1-1": "55607",
"1-2": "55291",
"2-1": "2771",
"2-2": "70924",
"3-1": "539713",
"3-2": "84159075",
"4-1": "23941",
"4-2": "5571760",
"5-1": "218513636",
"5-2": "81956384",
"6-1": "1312850",
"6-2": "36749103",
"7-1": "248179786",
"7-2": "247885995",
"8-1": "18113",
"8-2": "12315788159977",
"9-1": "1798691765",
"9-2": "1104",
"10-1": "6864",
"10-2": "349",
"11-1": "10885634",
"11-2": "707505470642",
"12-1": "7753",
"12-2": "280382734828319",
"13-1": "28895",
"13-2": "31603",
"14-1": "109466",
"14-2": "94585",
"15-1": "507291",
"15-2": "296921",
"16-1": "6361",
"16-2": "6701",
"18-1": "76387",
"19-1": "472630",
"20-1": "980457412",
"20-2": "232774988886497",
"21-1": "3699",
"22-1": "457",
"22-2": "79122",
}
func TestDays(t *testing.T) {
for day, expect := range expectations {
expect := expect
day := day
t.Run(day, func(t *testing.T) {
t.Parallel()
runCmd := exec.Command("go", "run", fmt.Sprintf("days/%s/main.go", day))
output, err := runCmd.CombinedOutput()
if err != nil {
fmt.Println(output)
}
assert.NoError(t, err)
assert.Equal(t, expect, strings.TrimRight(string(output), "\n"), fmt.Sprintf("Day %s", day))
})
}
}