Esempio n. 1
0
 def test_vector_to_degrees(self):
     self.assertEqual(Vector(1, 0).degrees(), float(0))
     self.assertEqual(Vector(1, 1).degrees(), float(45))
     self.assertEqual(Vector(0, 1).degrees(), float(90))
     self.assertEqual(Vector(-1, 1).degrees(), float(135))
     self.assertEqual(Vector(-1, 0).degrees(), float(180))
     self.assertEqual(Vector(-1, -1).degrees(), float(225))
     self.assertEqual(Vector(0, -1).degrees(), float(270))
     self.assertEqual(Vector(1, -1).degrees(), float(315))
Esempio n. 2
0
 def test_vector_broken_2(self):
     computed_vector = Vector.compute(Position(0, 1), Position(1, 5))
     computed_vector_2 = Vector.compute(Position(0, 1), Position(3, 8))
     self.assertTrue(computed_vector != computed_vector_2)
Esempio n. 3
0
 def test_vector_broken(self):
     computed_vector = Vector.compute(Position(3, 4), Position(2, 2))
     computed_vector_2 = Vector.compute(Position(3, 4), Position(1, 0))
     self.assertTrue(computed_vector != computed_vector_2)
Esempio n. 4
0
 def test_vector_more_complex_path(self):
     computed_vector = Vector.compute(Position(1, 1), Position(4, 3))
     self.assertTrue(
         Vector.compute(Position(1, 1), Position(4, 3)) == Vector(-2, 3))
Esempio n. 5
0
 def test_vector_no_y_change(self):
     computed_vector = Vector.compute(Position(0, 0), Position(2, 0))
     self.assertTrue(
         Vector.compute(Position(0, 0), Position(2, 0)) == Vector(0, 1))
Esempio n. 6
0
 def test_vector_is_reduced(self):
     computed_vector = Vector.compute(Position(0, 0), Position(2, 2))
     self.assertTrue(computed_vector == Vector(-1, 1))
Esempio n. 7
0
 def test_vector(self):
     computed_vector = Vector.compute(Position(0, 0), Position(2, 3))
     self.assertTrue(computed_vector == Vector(-3, 2))