def test_vectors_cross_product_return_correct_vector(self): v1 = geo.Vector3d(1, 2, 3) v2 = geo.Vector3d(4, 5, 6) v3 = v1**v2 self.assertEqual(v3.nx, -3) self.assertEqual(v3.ny, 6) self.assertEqual(v3.nz, -3)
def test_vectors_substraction_return_correct_vector(self): v1 = geo.Vector3d(1, 1, 1) v2 = geo.Vector3d(2, 2, 2) v3 = v1 - v2 self.assertEqual(v3.nx, -1) self.assertEqual(v3.ny, -1) self.assertEqual(v3.nz, -1)
def test_points_substraction_return_correct_vector(self): p1 = geo.Point3d(1, 1, 1) p2 = geo.Point3d(3, 3, 3) v1 = p2 - p1 v2 = geo.Vector3d(2, 2, 2) self.assertEqual(v1.nx, v2.nx) self.assertEqual(v1.ny, v2.ny) self.assertEqual(v1.nz, v2.nz)
def test_vector_length_is_correct(self): v1 = geo.Vector3d(2, 2, 1) self.assertEqual(v1.length(), 3)
def test_vectors_dot_product_return_correct_number(self): v1 = geo.Vector3d(1, 1, 1) v2 = geo.Vector3d(2, 2, 2) num = v1 * v2 self.assertEqual(num, 6)
def test_vectors_dot_product_return_number(self): v1 = geo.Vector3d(1, 1, 1) v2 = geo.Vector3d(2, 2, 2) num = v1 * v2 self.assertIsInstance(num, int or float)
def test_vectors_substraction_return_vector(self): v1 = geo.Vector3d(1, 1, 1) v2 = geo.Vector3d(2, 2, 2) v = v1 - v2 self.assertIsInstance(v, geo.Vector3d)
def test_vectors_cross_product_return_vector(self): v1 = geo.Vector3d(1, 1, 1) v2 = geo.Vector3d(2, 2, 2) v = v1**v2 self.assertIsInstance(v, geo.Vector3d)
def test_vector_instance_is_correct(self): v = geo.Vector3d(2, 2, 2) self.assertEqual(v.nx, 2) self.assertEqual(v.ny, 2) self.assertEqual(v.nz, 2)
def test_vector_instance(self): v = geo.Vector3d(2, 2, 2) self.assertIsInstance(v, geo.Vector3d)