-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-day
More file actions
executable file
·85 lines (67 loc) · 1.27 KB
/
make-day
File metadata and controls
executable file
·85 lines (67 loc) · 1.27 KB
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
#!/bin/bash
YEAR=2025
mkdir -p ./$YEAR/day$1
cat << EOF >> ./$YEAR/day$1/main.go
package main
import (
"fmt"
"log"
"github.com/nkzk/adventofcode/utils"
)
func main() {
var input []string
err := utils.ReadFile("./$YEAR/day$1/input", &input)
if err != nil {
log.Panicf("failed to read file: %v", err)
}
part1 := Part1(input)
fmt.Printf("part 1: %d\n", part1)
part2 := Part2(input)
fmt.Printf("part 2: %d\n", part2)
}
EOF
cat << EOF >> ./$YEAR/day$1/part1.go
package main
func Part1(input []string) int {
var sum int
return sum
}
EOF
cat << EOF >> ./$YEAR/day$1/part2.go
package main
func Part2(input []string) int {
var sum int
return sum
}
EOF
cat << EOF >> ./$YEAR/day$1/main_test.go
package main
import (
"log"
"testing"
"github.com/nkzk/adventofcode/utils"
)
func Test(t *testing.T) {
var input []string
err := utils.ReadFile("test-input", &input)
if err != nil {
log.Panicf("failed to read file: %v", err)
}
t.Run("Part 1 ", func(t *testing.T) {
got := Part1(input)
want := 0
if got != want {
t.Errorf("got %d want %d", got, want)
}
})
t.Run("Part 2 ", func(t *testing.T) {
got := Part2(input)
want := 0
if got != want {
t.Errorf("got %d want %d", got, want)
}
})
}
EOF
touch ./$YEAR/day$1/input
touch ./$YEAR/day$1/test-input