Day 22: Part 1

Signed-off-by: James Griffin <james@unsupervised.ca>
This commit is contained in:
2020-12-22 11:02:33 -04:00
parent 25727f6d20
commit be72f3e8ce
5 changed files with 205 additions and 3 deletions

View File

@@ -0,0 +1,30 @@
package twentytwo
import "testing"
func Test_load_combat(t *testing.T) {
c := combat{}
if err := c.load("sample.txt"); err != nil {
t.Logf(err.Error())
t.FailNow()
}
if len(c.one.deck) != 5 || len(c.two.deck) != 5 {
t.Logf("Expected decks of 5 and 5, got %d and %d", len(c.one.deck), len(c.two.deck))
}
}
func Test_combat_play(t *testing.T) {
c := combat{}
if err := c.load("sample.txt"); err != nil {
t.Logf(err.Error())
t.FailNow()
}
c.play()
if c.one.score() != 0 || c.two.score() != 306 {
t.Logf("Expected score of 0-306, got %d-%d", c.one.score(), c.two.score())
t.Fail()
}
}