From 672cbdfb993b95eb8d3dbea3f0544b8456c11e8f Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Tue, 3 Oct 2017 01:51:49 -0700 Subject: [PATCH] go:make_board: Added Unit Test --- go/make_board/main_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 go/make_board/main_test.go 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!") + } +}