示例#1
0
 def test_perceive(self, case):
     """
     Tests the correctness of perceptual matrix when neighbors are
     within or outside of perceptual range
     """
     b = Boids(**case[INIT])
     b.state = np.asarray(case[ARGS])
     self.assertEqual(np.asarray(case[EXPECTED]),
                      b._perceive())
示例#2
0
 def test_align(self, case):
     b = Boids(**case[INIT])
     b.state = np.asarray(case[INIT_STATE])
     self.assertEqual(np.asarray(case[EXPECTED]),
                      b.align(np.asarray(case[ARGS]))) 
示例#3
0
 def test_update_loc(self, case):
     b = Boids(**case[INIT])
     b.state = np.asarray(case[ARGS], dtype=float)
     b._update_loc()
     self.assertEqual(np.asarray(case[EXPECTED]), b.state)
示例#4
0
 def test_update_acc(self, case):
     b = Boids(**case[INIT])
     b.state = np.asarray(case[INIT_STATE], dtype=float)
     b._update_acc(np.asarray(case[ARGS]["acc_delta"]), case[ARGS]["coeff"])
     self.assertEqual(np.asarray(case[EXPECTED]), b.state)