def test_cant_move_left(self): mapa = [[2, 4, 8, 16], [2, 4, 8, 16], [2, 4, 8, 16], [2, 4, 8, 16]] res = [[2, 4, 8, 16], [2, 4, 8, 16], [2, 4, 8, 16], [2, 4, 8, 16]] assert move_left(mapa) == (res, False)
def test_still_can_move_left_with_sum(self): mapa = [[2, 2, 4, 4], [8, 8, 4, 2], [4, 4, 4, 4], [2, 4, 4, 8]] res = [[4, 8, 0, 0], [16, 4, 2, 0], [8, 8, 0, 0], [2, 8, 8, 0]] assert move_left(mapa) == (res, True)
def test_move_left(self): mapa = [[2, 2, 0, 0], [0, 0, 2, 2], [4, 4, 0, 0], [0, 4, 4, 0]] res = [[4, 0, 0, 0], [4, 0, 0, 0], [8, 0, 0, 0], [8, 0, 0, 0]] assert move_left(mapa) == (res, True)
def test_move_left_with_sum(self): mapa = [[2, 2, 4, 4], [8, 0, 4, 0], [0, 4, 0, 0], [2, 4, 4, 8]] res = [[4, 8, 0, 0], [8, 4, 0, 0], [4, 0, 0, 0], [2, 8, 8, 0]] assert move_left(mapa) == (res, True)
def test_move_left(self): left_col_pos = 0 right_col_pos = 8 self.assertEqual(move_left(left_col_pos), 0) self.assertEqual(move_left(right_col_pos), 7)