cell_test.go (849B)
1 package cell 2 3 import ( 4 "testing" 5 6 "code.dwrz.net/src/pkg/minotaur/maze/direction" 7 ) 8 9 func TestSetDirection(t *testing.T) { 10 var c Cell 11 t.Logf("start: %08b", c) 12 13 c.SetDirection(direction.Right) 14 t.Logf("set right: %08b", c) 15 16 c.SetDirection(direction.Down) 17 t.Logf("set down: %08b", c) 18 19 var ( 20 hasRight = c.HasDirection(direction.Right) 21 hasDown = c.HasDirection(direction.Down) 22 hasLeft = c.HasDirection(direction.Left) 23 hasUp = c.HasDirection(direction.Up) 24 ) 25 26 t.Logf("has right: %v", hasRight) 27 t.Logf("has down: %v", hasDown) 28 t.Logf("has left: %v", hasLeft) 29 t.Logf("has up: %v", hasUp) 30 31 if !hasRight { 32 t.Errorf("expected cell to have right") 33 } 34 if !hasDown { 35 t.Errorf("expected cell to have down") 36 } 37 if hasLeft { 38 t.Errorf("expected cell to not have left") 39 } 40 if hasUp { 41 t.Errorf("expected cell to not have up") 42 } 43 }