go:make_board: Added Unit Test
This commit is contained in:
parent
93e5494f70
commit
672cbdfb99
24
go/make_board/main_test.go
Normal file
24
go/make_board/main_test.go
Normal file
@ -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!")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user