mirror of
https://github.com/Threnklyn/advent-of-code-go.git
synced 2026-06-07 12:45:10 +02:00
2015-day22: memoized battle simulator, lots of states to sift through
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/alexchao26/advent-of-code-go/util"
|
||||
)
|
||||
|
||||
func Test_part1(t *testing.T) {
|
||||
func Test_wizardSimulator(t *testing.T) {
|
||||
type args struct {
|
||||
input string
|
||||
myHP int
|
||||
@@ -23,13 +23,13 @@ func Test_part1(t *testing.T) {
|
||||
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},
|
||||
{"part1 actual", args{util.ReadFile("input.txt"), 50, 500, 1}, 953},
|
||||
{"part2 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.args.input, tt.args.myHP, tt.args.myMana, tt.args.part); got != tt.want {
|
||||
t.Errorf("part1() = %v, want %v", got, tt.want)
|
||||
if got := wizardSimulator(tt.args.input, tt.args.myHP, tt.args.myMana, tt.args.part); got != tt.want {
|
||||
t.Errorf("wizardSimulator() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user