aboutsummaryrefslogtreecommitdiff
path: root/test/ec/test_point.py
diff options
context:
space:
mode:
authorJ08nY2020-03-08 18:27:55 +0100
committerJ08nY2020-03-08 18:27:55 +0100
commitff41706679b7a2adf973b5ef3743e969d3b62054 (patch)
treeae2c9d576666938dd70b3da1847ba8971c2fa0c4 /test/ec/test_point.py
parent38d04f0d19059b2d8c6ad8fc46a9eec67946fffe (diff)
downloadpyecsca-ff41706679b7a2adf973b5ef3743e969d3b62054.tar.gz
pyecsca-ff41706679b7a2adf973b5ef3743e969d3b62054.tar.zst
pyecsca-ff41706679b7a2adf973b5ef3743e969d3b62054.zip
Diffstat (limited to 'test/ec/test_point.py')
-rw-r--r--test/ec/test_point.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/ec/test_point.py b/test/ec/test_point.py
index 76e1103..a8b9fd7 100644
--- a/test/ec/test_point.py
+++ b/test/ec/test_point.py
@@ -64,14 +64,14 @@ class PointTests(TestCase):
X=Mod(0x2, self.secp128r1.curve.prime),
Y=Mod(0x3, self.secp128r1.curve.prime),
Z=Mod(1, self.secp128r1.curve.prime))
- assert pt.equals(other)
+ self.assertTrue(pt.equals(other))
self.assertNotEqual(pt, other)
- assert not pt.equals(2)
+ self.assertFalse(pt.equals(2))
self.assertNotEqual(pt, 2)
infty_one = InfinityPoint(self.coords)
infty_other = InfinityPoint(self.coords)
- assert infty_one.equals(infty_other)
+ self.assertTrue(infty_one.equals(infty_other))
self.assertEqual(infty_one, infty_other)
mont = MontgomeryModel()
@@ -79,5 +79,13 @@ class PointTests(TestCase):
X=Mod(0x64daccd2656420216545e5f65221eb,
0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa),
Z=Mod(1, 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa))
- assert not pt.equals(different)
+ self.assertFalse(pt.equals(different))
self.assertNotEqual(pt, different)
+
+ def test_bytes(self):
+ pt = Point(self.coords,
+ X=Mod(0x4, self.secp128r1.curve.prime),
+ Y=Mod(0x6, self.secp128r1.curve.prime),
+ Z=Mod(2, self.secp128r1.curve.prime))
+ self.assertEqual(bytes(pt), b"\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02")
+ self.assertEqual(bytes(InfinityPoint(self.coords)), b"\x00") \ No newline at end of file