From ff41706679b7a2adf973b5ef3743e969d3b62054 Mon Sep 17 00:00:00 2001 From: J08nY Date: Sun, 8 Mar 2020 18:27:55 +0100 Subject: Add raw output from scopes. --- test/ec/test_point.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'test/ec/test_point.py') 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 -- cgit v1.2.3-70-g09d2