Example #1
0
 def test_decode_zero_one_one(self):
     symbols = decode([Brick(0), Brick(1), Brick(1)])
     self.assertEqual(symbols, r"\||")
Example #2
0
 def test_decode_two_one_one(self):
     symbols = decode([Brick(2), Brick(1), Brick(1)])
     self.assertEqual(symbols, r"/||")
Example #3
0
 def test_brick_previous_state_both_falling_different_directions(self):
     brick = Brick(1, 2, 0)
     brick.previous_state()
     self.assertEqual(brick.state, 1)
Example #4
0
 def test_decode_all_ones(self):
     symbols = decode([Brick(1), Brick(1), Brick(1)])
     self.assertEqual(symbols, r"|||")
Example #5
0
 def test_brick_create(self):
     brick = Brick(1, 2, 0)
     self.assertEqual(brick.state, 1)
     self.assertEqual(brick.previous, 2)
     self.assertEqual(brick.next, 0)
Example #6
0
 def test_brick_previous_state_none_falling(self):
     brick = Brick(1, 1, 1)
     brick.previous_state()
     self.assertEqual(brick.state, 1)
Example #7
0
 def test_brick_previous_state_falling_left(self):
     brick = Brick(0, 1, 0)
     brick.previous_state()
     self.assertEqual(brick.state, 1)
Example #8
0
 def test_brick_previous_state_falling_right(self):
     brick = Brick(2, 2, 1)
     brick.previous_state()
     self.assertEqual(brick.state, 1)
Example #9
0
 def test_brick_previous_state_all_falling_left(self):
     brick = Brick(2, 2, 2)
     brick.previous_state()
     self.assertEqual(brick.state, 2)
Example #10
0
 def test_brick_previous_state_all_falling_right(self):
     brick = Brick(0, 0, 0)
     brick.previous_state()
     self.assertEqual(brick.state, 0)
Example #11
0
 def test_brick_next_state_both_falling(self):
     brick = Brick(1, 2, 0)
     brick.next_state()
     self.assertEqual(brick.state, 1)
Example #12
0
 def test_brick_next_state_right_falling(self):
     brick = Brick(1, 1, 0)
     brick.next_state()
     self.assertEqual(brick.state, 0)
Example #13
0
 def test_brick_next_state_left_falling(self):
     brick = Brick(1, 2, 1)
     brick.next_state()
     self.assertEqual(brick.state, 2)
Example #14
0
 def test_brick_next_state_none_falling(self):
     brick = Brick(1, 1, 1)
     brick.next_state()
     self.assertEqual(brick.state, 1)
Example #15
0
 def test_decode_two_zero_two(self):
     symbols = decode([Brick(2), Brick(0), Brick(2)])
     self.assertEqual(symbols, r"/\/")