コード例 #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))
コード例 #3
0
 def test_div_p(self, p: ElementModQ):
     as_int = div_p(p, 1)
     as_elem = div_p(p, ElementModP(1))
     self.assertEqual(as_int, as_elem)