mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-06-07 12:45:10 +02:00
look at this ugly function with 9 params :)
This commit is contained in:
+19
-22
@@ -2,38 +2,35 @@ package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/alexchao26/advent-of-code-go/util"
|
||||
)
|
||||
|
||||
func Test_part1(t *testing.T) {
|
||||
type args struct {
|
||||
input string
|
||||
myHP int
|
||||
myMana int
|
||||
part int
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want int
|
||||
name string
|
||||
args args
|
||||
want int
|
||||
}{
|
||||
// {"actual", util.ReadFile("input.txt"), ACTUAL_ANSWER},
|
||||
{
|
||||
name: "example",
|
||||
args: args{"Hit Points: 13\nDamage: 8", 10, 250, 1},
|
||||
want: spellsMap["Poison"].cost + spellsMap["Magic Missile"].cost,
|
||||
},
|
||||
{"actual", args{util.ReadFile("input.txt"), 50, 500, 1}, 953},
|
||||
{"actual", args{util.ReadFile("input.txt"), 50, 500, 2}, 1289},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := part1(tt.input); got != tt.want {
|
||||
if got := part1(tt.args.input, tt.args.myHP, tt.args.myMana, tt.args.part); 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
|
||||
}{
|
||||
// {"actual", util.ReadFile("input.txt"), ACTUAL_ANSWER},
|
||||
}
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user