def test_invalid_direction(self): 
     body = SimpleBody(None)  
     body.add_to_map(self.map, 0, 0)   
       
     self.assertFalse(body.can_move(4))  
     self.assertFalse(body.can_move(-1))
     self.assertFalse(body.can_move(None)) 
 def test_can_move(self):
     body = SimpleBody(None)  
     body.add_to_map(self.map, 1, 1)  
     
     self.assertTrue(body.can_move(0))          
     self.assertTrue(body.can_move(1))  
     self.assertTrue(body.can_move(2))  
     self.assertTrue(body.can_move(3))                 
Esempio n. 3
0
 def test_border(self): 
     body = SimpleBody(None)  
     body.add_to_map(self.map, 0, 0)
     
     self.assertFalse(body.move(2))  
     self.assertEqual(body.x, 0)  
     self.assertEqual(body.y, 0)  
     self.assertEqual(body.map, self.map)      
Esempio n. 4
0
 def test_solid_cell(self): 
     body = SimpleBody(None)         
     self.map.get_cell(1, 1).type = self.type1
     
     body.add_to_map(self.map, 1, 0) 
     self.assertFalse(body.move(0))   
     self.assertEqual(body.x, 1)  
     self.assertEqual(body.y, 0)          
Esempio n. 5
0
 def test_invalid_direction(self): 
     body = SimpleBody(None)  
     body.add_to_map(self.map, 0, 0)   
       
     self.assertFalse(body.move(4))  
     self.assertEqual(body.x, 0)  
     self.assertEqual(body.y, 0)  
     self.assertEqual(body.map, self.map) 
 def test_border(self): 
     body = SimpleBody(None)  
     body.add_to_map(self.map, 0, 0)
     
     self.assertFalse(body.can_move(2))  
     self.assertFalse(body.can_move(3))  
     
     body.add_to_map(self.map, 3, 3)  
     
     self.assertFalse(body.can_move(0))  
     self.assertFalse(body.can_move(1))  
 def test_occupied(self):
     body0 = SimpleBody(None)
     body0.object = 1
     body0.add_to_map(self.map, 1, 2)
     
     body1 = SimpleBody(None)
     body1.object = 2
     
     self.assertFalse(body1.add_to_map(self.map, 1, 2))
     self.assertEqual(body1.x, None)  
     self.assertEqual(body1.y, None)  
     self.assertEqual(body1.map, None)  
     self.assertEqual(self.map.get_cell(1, 2).creature, 1) 
Esempio n. 8
0
 def test_occupied(self):
     body0 = SimpleBody(None)   
     body0.object = 1 
     body0.add_to_map(self.map, 1, 1)  
     
     body1 = SimpleBody(None) 
     body1.object = 2              
     body1.add_to_map(self.map, 1, 0) 
     
     self.assertFalse(body1.move(0))   
     self.assertEqual(body1.x, 1)  
     self.assertEqual(body1.y, 0)  
     self.assertEqual(self.map.get_cell(1, 0).creature, 2) 
     
     self.assertEqual(body0.x, 1)  
     self.assertEqual(body0.y, 1)  
     self.assertEqual(self.map.get_cell(1, 1).creature, 1) 
 def test_solid_cell(self):           
     self.map.get_cell(0, 0).type = self.type1
     
     body = SimpleBody(None)
     self.assertFalse(body.add_to_map(self.map, 0, 0)) 
     self.assertEqual(body.x, None)  
     self.assertEqual(body.y, None)  
     self.assertEqual(body.map, None) 
     self.assertEqual(self.map.get_cell(0, 0).creature, None)         
 def test_solid_cell(self): 
     body = SimpleBody(None)         
     self.map.get_cell(1, 1).type = self.type1
     
     body.add_to_map(self.map, 1, 0) 
     self.assertFalse(body.can_move(0))  
     
     body.add_to_map(self.map, 0, 1) 
     self.assertFalse(body.can_move(1))
     
     body.add_to_map(self.map, 1, 2) 
     self.assertFalse(body.can_move(2))
     
     body.add_to_map(self.map, 2, 1) 
     self.assertFalse(body.can_move(3))       
Esempio n. 11
0
 def test_move(self):
     body = SimpleBody(None)  
     body.add_to_map(self.map, 0, 0)  
     
     self.assertTrue(body.move(0))  
     self.assertEqual(body.x, 0)  
     self.assertEqual(body.y, 1)  
     self.assertEqual(body.map, self.map) 
     
     self.assertTrue(body.move(1))  
     self.assertEqual(body.x, 1)  
     self.assertEqual(body.y, 1)  
     self.assertEqual(body.map, self.map) 
     
     self.assertTrue(body.move(2))  
     self.assertEqual(body.x, 1)  
     self.assertEqual(body.y, 0)  
     self.assertEqual(body.map, self.map)      
     
     self.assertTrue(body.move(3))  
     self.assertEqual(body.x, 0)  
     self.assertEqual(body.y, 0)  
     self.assertEqual(body.map, self.map) 
 def test_invalid_cell(self):   
     body = SimpleBody(None)
     self.assertFalse(body.add_to_map(self.map, -1, 0))
     self.assertEqual(body.x, None)  
     self.assertEqual(body.y, None)  
     self.assertEqual(body.map, None)  
 def test_add_to_map(self):   
     body = SimpleBody(None)
     self.assertTrue(body.add_to_map(self.map, 1, 2))
     self.assertEqual(body.x, 1)  
     self.assertEqual(body.y, 2)  
     self.assertEqual(body.map, self.map)