Day 24: Part 1

Signed-off-by: James Griffin <james@unsupervised.ca>
This commit is contained in:
2020-12-24 11:39:34 -04:00
parent 6584675e5a
commit ed12b06814
5 changed files with 717 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
package twentyfour
import "testing"
func Test_load_instructions(t *testing.T) {
l := lobby{}
l.load("sample.txt")
if len(l.instructions) != 20 {
t.Logf("Expected 20 instructions, found %d", len(l.instructions))
t.Fail()
}
}
func Test_layout_tiles(t *testing.T) {
l := lobby{}
l.load("sample.txt")
if len(l.instructions) != 20 {
t.Logf("Expected 20 instructions, found %d", len(l.instructions))
t.Fail()
}
l.layout()
black, white := l.countTiles()
if black + white != 15 {
t.Logf("Expected 15 tiles, got %d", black+white)
t.Fail()
}
if black != 10 {
t.Logf("Expected 10 black tiles, got %d", black)
t.Fail()
}
if white != 5 {
t.Logf("Expected 5 white tiles, got %d", white)
t.Fail()
}
}