from forza4 import *

def test_create_empty_board():
    assert create_empty_board(0,0) == []
    assert create_empty_board(0, 10) == []
    assert create_empty_board(2, 5) == [ [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
    assert create_empty_board(2, 0) == [ [], [] ]

def test_create_empty_board2():
    m = create_empty_board(2,3)
    m[0][0] = 1
    assert m == [ [1, 0, 0], [0, 0, 0] ]

def test_check_move():
    board = [ [0, 1, 0], [1, -1, -1] ]
    assert check_move(board, 0)
    assert not check_move(board, 1)
    assert not check_move(board, -1)
    assert not check_move(board, 3)

def test_move():
    board = [ [0, 1, 0], [0, 1, -1], [-1, 1, 1] ]
    move(board, 0, -1)
    assert board == [ [0, 1, 0], [-1, 1, -1], [-1, 1, 1] ]
    move(board, 2, 1)
    assert board == [ [0, 1, 1], [-1, 1, -1], [-1, 1, 1] ]
