practice/go/make_board/main_test.go

25 lines
398 B
Go

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!")
}
}