コード例 #1
0
 def test_in_bounds_p_no_zero(self, p: ElementModP):
     self.assertTrue(p.is_in_bounds_no_zero())
     self.assertFalse(ZERO_MOD_P.is_in_bounds_no_zero())
     self.assertFalse(
         int_to_p_unchecked(p.to_int() + P).is_in_bounds_no_zero())
     self.assertFalse(
         int_to_p_unchecked(p.to_int() - P).is_in_bounds_no_zero())
コード例 #2
0
 def test_in_bounds_p(self, p: ElementModP):
     self.assertTrue(p.is_in_bounds())
     too_big = p.to_int() + P
     too_small = p.to_int() - P
     self.assertFalse(int_to_p_unchecked(too_big).is_in_bounds())
     self.assertFalse(int_to_p_unchecked(too_small).is_in_bounds())
     self.assertEqual(None, int_to_p(too_big))
     self.assertEqual(None, int_to_p(too_small))