Esempio n. 1
0
 def test_4_two_folds_interleaved(self):
     g = Grid(4)
     array = g.fold("BLBL")
     expected = [3, 15, 14, 2, 6, 10, 11, 7, 8, 12, 9, 5, 1, 13, 16, 4]
     self.assertEqual(array, expected)
Esempio n. 2
0
 def test_4_all_folds_horizontal_then_vertical(self):
     g = Grid(4)
     array = g.fold("RLBT")
     expected = [2, 3, 4, 1, 13, 16, 15, 14, 10, 11, 12, 9, 5, 8, 7, 6]
     self.assertEqual(array, expected)
Esempio n. 3
0
 def test_4_two_folds_grouped(self):
     g = Grid(4)
     array = g.fold("RRTT")
     expected = [9, 12, 11, 10, 6, 7, 8, 5, 1, 4, 3, 2, 14, 15, 16, 13]
     self.assertEqual(array, expected)
Esempio n. 4
0
 def test_4_all_folds_vertical_then_horizontal(self):
     g = Grid(4)
     array = g.fold("TBLR")
     expected = [12, 8, 4, 16, 13, 1, 5, 9, 10, 6, 2, 14, 15, 3, 7, 11]
     self.assertEqual(array, expected)
Esempio n. 5
0
 def test_4_all_folds_clockwise(self):
     g = Grid(4)
     array = g.fold("TRBL")
     expected = [9, 5, 8, 12, 16, 4, 1, 13, 14, 2, 3, 15, 11, 7, 6, 10]
     self.assertEqual(array, expected)
Esempio n. 6
0
 def test_2_fold_horizontal_then_vertical(self):
     g = Grid(2)
     g.fold("RB")
     self.assertEqual(g.grid, [[[3]], [[4]], [[2]], [[1]]])
Esempio n. 7
0
 def test_invalid_character(self):
     g = Grid(16)
     with self.assertRaisesRegex(GridError, "Invalid input character: X"):
         g.fold("TBRLXBRL")
Esempio n. 8
0
 def test_long_input(self):
     g = Grid(16)
     with self.assertRaisesRegex(GridError,
                                 "Invalid input: incorrect input length"):
         g.fold("BTLRBLTRB")