Day 3: Part 1 and 2
This commit is contained in:
33
three/day_three_test.go
Normal file
33
three/day_three_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package three
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_forest_load(t *testing.T) {
|
||||
forest := forest{}
|
||||
if err := forest.load("sample.txt"); err != nil {
|
||||
t.Log(err)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if forest.rows != 11 {
|
||||
t.Logf("Expected 11 rows, Got %d rows", forest.rows)
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
if forest.width != 11 {
|
||||
t.Logf("Expected 11 columns, Got %d columns", forest.rows)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func Test_forest_toboggan(t *testing.T) {
|
||||
forest := forest{}
|
||||
forest.load("sample.txt")
|
||||
|
||||
impacts := forest.toboggan(3, 1)
|
||||
|
||||
if impacts != 7 {
|
||||
t.Logf("Expected 7 tree hits, actually hit %d trees", impacts)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user