Exemple #1
0
	def test_3_validity(self):
		"""
		Verify that 10 random points can be converted to and from every other
		coordinate system without losing information or corruption.
		"""
		self.assertTrue(self._point_a().valid())
		self.assertTrue(Point.infinity().valid())
		self.assertTrue(EtecPoint.infinity().valid())
		self.assertTrue(ProjPoint.infinity().valid())

		for _ in range(0, 10):
			p = self._point_r()
			self._verify_via_all(p)
Exemple #2
0
	def test_9_zero(self):
		"""
		Verify that operations on infinity result in infinity
		"""
		zero = Point.infinity()
		etec_zero = EtecPoint.infinity()
		proj_zero = ProjPoint.infinity()

		self.assertEqual(zero.as_etec(), etec_zero)
		self.assertEqual(zero.as_proj(), proj_zero)

		self.assertEqual(etec_zero.as_point(), zero)
		self.assertEqual(etec_zero.as_proj(), proj_zero)

		self.assertEqual(proj_zero.as_point(), zero)
		self.assertEqual(proj_zero.as_etec(), etec_zero)

		self.assertEqual(zero.add(zero), zero)
		self.assertEqual(etec_zero.add(etec_zero), etec_zero)
		self.assertEqual(proj_zero.add(proj_zero), proj_zero)

		self.assertEqual(zero.double(), zero)
		self.assertEqual(etec_zero.double(), etec_zero)
		self.assertEqual(proj_zero.double(), proj_zero)