This commit is contained in:
alexchao26
2024-07-29 00:10:37 -04:00
parent 906ed8a9ff
commit 0d9ea17b6f
2 changed files with 189 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
package main
import (
"testing"
)
var example = `0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45`
func Test_part1(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{
name: "example",
input: example,
want: 114,
},
{
name: "actual",
input: input,
want: 1782868781,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part1(tt.input); got != tt.want {
t.Errorf("part1() = %v, want %v", got, tt.want)
}
})
}
}
func Test_part2(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{
name: "example",
input: example,
want: 2,
},
{
name: "actual",
input: input,
want: 1057,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part2(tt.input); got != tt.want {
t.Errorf("part2() = %v, want %v", got, tt.want)
}
})
}
}