Beispiel #1
0
 def test_move_down_when_value_has_to_move_all_the_way_down(self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 4], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]])
     self.assertEqual(
         [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 4]],
         g.move_down())
Beispiel #2
0
 def test_move_down_when_has_two_different_merges_then_merged(self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 4], [0, 0, 0, 4], [0, 0, 0, 2], [0, 0, 0, 2]])
     self.assertEqual(
         [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 8], [0, 0, 0, 4]],
         g.move_down())
Beispiel #3
0
 def test_move_down_when_has_one_value_and_not_possible_then_error_raised(
         self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 2]])
     with self.assertRaises(ValueError):
         g.move_down()
Beispiel #4
0
 def test_move_down_when_has_merge_and_shouldnt_merge_then_one_merged(self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 4], [0, 0, 0, 2], [0, 0, 0, 2], [0, 0, 0, 0]])
     self.assertEqual(
         [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 4], [0, 0, 0, 4]],
         g.move_down())
Beispiel #5
0
 def test_move_down_when_has_merge_but_not_together_then_merged(self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 2], [0, 0, 0, 0], [0, 0, 0, 2], [0, 0, 0, 0]])
     self.assertEqual(
         [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 4]],
         g.move_down())
Beispiel #6
0
 def test_move_down_when_right_row_populated_and_not_possible_then_error_raised(
         self):
     g = TwoThousandFortyEight(
         board=[[0, 0, 0, 4], [0, 0, 0, 2], [0, 0, 0, 4], [0, 0, 0, 2]])
     with self.assertRaises(ValueError):
         g.move_down()