Esempio n. 1
0
// TestRefereeBoard tests that mancala.Referee::Board returns the mancala.
// Referee's current mancala.Board.
func TestRefereeBoard(t *testing.T) {
	t.Parallel()
	actual := mancala.NewReferee().Board()
	expected := mancala.NewBoard()
	if actual != expected {
		t.Errorf(
			"NewReferee().Board() = \n%v, want \n%v",
			actual,
			expected,
		)
	}
}
Esempio n. 2
0
// testOutOfBoundsMove is a simulateTestCaseGenerator which generates a test
// case where the current mancala.Player tries to sow from a house with which is
// out of bounds.
func testOutOfBoundsMove(player mancala.PlayerIndex) simulateTestCase {
	return simulateTestCase{
		referee:       mancala.NewReferee(),
		move:          -1,
		expectedBoard: mancala.NewBoard(),
		expectedErr: fmt.Errorf(
			"move at house %d is out of range [%d, %d]",
			-1,
			0,
			mancala.RowWidth-1,
		),
	}
}