diff --git a/go/make_board/main_test.go b/go/make_board/main_test.go new file mode 100644 index 0000000..19fa233 --- /dev/null +++ b/go/make_board/main_test.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "reflect" + "testing" +) + +func TestMakeBoard(t *testing.T) { + board := makeBoard(2, 2, "_") + + testBoard := [][]string{ + []string{"_", "_"}, + []string{"_", "_"}, + } + + if !reflect.DeepEqual(board, testBoard) { + fmt.Printf("Expected:\n") + printBoard(testBoard) + fmt.Printf("\nGot:\n") + printBoard(board) + t.Error("Failed: Arrays are different! See above!") + } +}