Day 12: Part 1 and 2

Signed-off-by: James Griffin <james@unsupervised.ca>
This commit is contained in:
2020-12-12 16:31:22 -04:00
parent 6029eed213
commit a346b4b5b6
5 changed files with 1027 additions and 3 deletions

36
twelve/day_twelve_test.go Normal file
View File

@@ -0,0 +1,36 @@
package twelve
import "testing"
func Test_load_boat(t *testing.T) {
b, err := loadBoat("sample.txt")
if err != nil {
t.Logf(err.Error())
t.FailNow()
}
if len(b.orders) != 5 {
t.Logf("Expected 5 orders, got %d", len(b.orders))
t.FailNow()
}
}
func Test_boat_navigate(t *testing.T) {
b, _ := loadBoat("sample.txt")
result := b.navigate()
if result != 25 {
t.Logf("Expected a navigation result of 25, got %d", result)
t.FailNow()
}
}
func Test_waypoint_navigate(t *testing.T) {
b, _ := loadBoat("sample.txt")
result := b.waypointNavigate()
if result != 286 {
t.Logf("Expected a navigation result of 286, got %d", result)
t.FailNow()
}
}