mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-06-06 04:08:27 +02:00
65 lines
876 B
Go
65 lines
876 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/alexchao26/advent-of-code-go/util"
|
|
)
|
|
|
|
var tests1 = []struct {
|
|
name string
|
|
want int
|
|
input string
|
|
// add extra args if needed
|
|
}{
|
|
{"example 2", 2, `0,0,0,0
|
|
3,0,0,0
|
|
0,3,0,0
|
|
0,0,3,0
|
|
0,0,0,3
|
|
0,0,0,6
|
|
9,0,0,0
|
|
12,0,0,0`},
|
|
{"example 3", 3, `1,-1,0,1
|
|
2,0,-1,0
|
|
3,2,-1,0
|
|
0,0,3,1
|
|
0,0,-1,-1
|
|
2,3,-2,0
|
|
-2,2,0,0
|
|
2,-2,0,-1
|
|
1,-1,0,-1
|
|
3,2,0,2`},
|
|
{"example 4", 4, `-1,2,2,0
|
|
0,0,2,-2
|
|
0,0,0,-2
|
|
-1,2,0,0
|
|
-2,-2,-2,2
|
|
3,0,2,-1
|
|
-1,3,2,2
|
|
-1,0,-1,0
|
|
0,2,1,-2
|
|
3,0,0,0`},
|
|
{"example 8", 8, `1,-1,-1,-2
|
|
-2,-2,0,1
|
|
0,2,1,3
|
|
-2,3,-2,1
|
|
0,2,3,-2
|
|
-1,-1,1,-2
|
|
0,-2,-1,0
|
|
-2,2,3,-1
|
|
1,2,2,0
|
|
-1,-2,0,-2`},
|
|
{"actual", 422, util.ReadFile("input.txt")},
|
|
}
|
|
|
|
func TestPart1(t *testing.T) {
|
|
for _, tt := range tests1 {
|
|
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)
|
|
}
|
|
})
|
|
}
|
|
}
|