def test_get_neighbors_boundary_skinny(): num_of_nodes_x = 2 num_of_nodes_y = 3 result_neighbors = [[1, 2, 3], [0, 2, 3], [0, 1, 3, 4, 5], [0, 1, 2, 4, 5], [2, 3, 5], [2, 3, 4]] neighbors = [] for i in range(num_of_nodes_x * num_of_nodes_y): neighbors.append(util.get_neighbors_boundary(i, num_of_nodes_x, num_of_nodes_y)) assert cmp(neighbors, result_neighbors) == 0
def test_get_neighbors_boundary_square(): num_of_nodes_x = 3 num_of_nodes_y = 3 result_neighbors = [[1, 3, 4], [0, 2, 3, 4, 5], [1, 4, 5], [0, 1, 4, 6, 7], [0, 1, 2, 3, 5, 6, 7, 8], [1, 2, 4, 7, 8], [3, 4, 7], [3, 4, 5, 6, 8], [4, 5, 7]] neighbors = [] for i in range(num_of_nodes_x * num_of_nodes_y): neighbors.append(util.get_neighbors_boundary(i, num_of_nodes_x, num_of_nodes_y)) assert cmp(neighbors, result_neighbors) == 0