Skip to content

Instantly share code, notes, and snippets.

@sevvie
Created September 23, 2012 04:30
Show Gist options
  • Save sevvie/3768875 to your computer and use it in GitHub Desktop.
Save sevvie/3768875 to your computer and use it in GitHub Desktop.
Tests for "Having Fun with Go and the Gracious Benefactor"
package doomed
import("testing"; "fmt")
func TestNewBoard(t *testing.T) {
b := NewBoard(17, 17)
if len(b.grid) != 17 { t.Errorf("Board size is wrong!") }
}
func TestGenerator(t *testing.T) {
b := NewBoard(17, 17)
b.Generate()
for y := range b.grid {
for x := range b.grid[y] {
switch {
case y % 2 == 0:
fmt.Printf("%d ", b.grid[y][x].terrain)
case y % 2 != 0:
fmt.Printf(" %d", b.grid[y][x].terrain)
}
}
fmt.Printf("\n")
}
}
func ExampleHexChessBoard(t *testing.T) {
b := NewBoard(17, 17)
b.Generate()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment