示例#1
0
 def test_update(self):
     data = [1, 1, 1]
     got = Robot(data)
     expected_origin = [0, 0, 0]
     self.assertEqual(expected_origin, got.mines.get())
     got.updatecoor()
     self.assertEqual(data, got.mines.get())
示例#2
0
 def test_integrate(self):
     data_o = [1, 1, 1]
     robot = Robot(data_o)
     expected_origin = [0, 0, 0]
     self.assertEqual(expected_origin, robot.mines.get())
     self.assertEqual(data_o, robot.direcc.get())
     mess = robot.sendcoordinates()
     expected = Message(1, data_o)
     self.assertEqual(expected.get(), mess.get())
     robot.updatecoor()
     self.assertEqual(data_o, robot.mines.get())
     new_coor = [300, 3, -1]
     robot.changedirecc(new_coor)
     mess = robot.sendcoordinates()
     self.assertEqual(new_coor, robot.direcc.get())
     robot.updatecoor()
     self.assertEqual(new_coor, robot.mines.get())
示例#3
0
 def test_sendingmess(self):
     data = [1, 1, 1]
     got = Robot(data)
     mess = got.sendcoordinates()
     expected = Message(1, data)
     self.assertEqual(expected.get(), mess.get())
示例#4
0
 def test_sendingmess2(self):
     data = [-600, -100, 4]
     got = Robot(data)
     mess = got.sendcoordinates()
     expected = [0]
     self.assertEqual(expected, mess.get())
示例#5
0
 def test_direcnotOk(self):
     data = [-600, -100, 4]
     expected = False
     got = Robot(data)
     self.assertEqual(expected, got.controller())
示例#6
0
 def test_direcOK2(self):
     data = [-4, -100, 4]
     expected = True
     got = Robot(data)
     self.assertEqual(expected, got.controller())
示例#7
0
 def test_direcOK(self):
     data = [1, 1, 1]
     expected = True
     got = Robot(data)
     self.assertEqual(expected, got.controller())
示例#8
0
 def test_changedirecc(self):
     data = [1, 1, 1]
     got = Robot(data)
     new = [2, 2, 2]
     got.changedirecc(new)
     self.assertEqual(new, got.direcc.get())
示例#9
0
 def test_newrobot(self):
     data = [1, 1, 1]
     got = Robot(data)
     self.assertEqual([0, 0, 0], got.mines.get())