Ejemplo n.º 1
0
 def test_get_distance(self):
     for tup in self.dot_value:
         checked_vector = Vector(tup[0])
         helping_vector = Vector(tup[1])
         result = checked_vector.get_distance(helping_vector)
         self.assertAlmostEqual(
             sqrt((tup[0][0] - tup[1][0])**2 + (tup[0][1] - tup[1][1])**2),
             result)
Ejemplo n.º 2
0
 def test_change_state(self):
     for tup in self.init_value:
         checked_vector = Vector(tup)
         checked_vector.change_state(tup)
         self.assertAlmostEqual(tup[1] * 2, checked_vector.y)
         self.assertAlmostEqual(tup[0] * 2, checked_vector.x)
Ejemplo n.º 3
0
 def test_dot(self):
     for tup in self.dot_value:
         checked_vector = Vector(tup[0])
         helping_vector = Vector(tup[1])
         result = checked_vector.dot(helping_vector)
         self.assertAlmostEqual(tup[2], result)