File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,38 @@ def st_comp_no_com_fac(draw):
207207HYP_SLOW_SETTINGS ["max_examples" ] = 10
208208
209209
210+ class TestIsPrime (unittest .TestCase ):
211+ def test_very_small_prime (self ):
212+ assert is_prime (23 )
213+
214+ def test_very_small_composite (self ):
215+ assert not is_prime (22 )
216+
217+ def test_small_prime (self ):
218+ assert is_prime (123456791 )
219+
220+ def test_special_composite (self ):
221+ assert not is_prime (10261 )
222+
223+ def test_medium_prime_1 (self ):
224+ # nextPrime[2^256]
225+ assert is_prime (2 ** 256 + 0x129 )
226+
227+ def test_medium_prime_2 (self ):
228+ # nextPrime(2^256+0x129)
229+ assert is_prime (2 ** 256 + 0x12D )
230+
231+ def test_medium_trivial_composite (self ):
232+ assert not is_prime (2 ** 256 + 0x130 )
233+
234+ def test_medium_non_trivial_composite (self ):
235+ assert not is_prime (2 ** 256 + 0x12F )
236+
237+ def test_large_prime (self ):
238+ # nextPrime[2^2048]
239+ assert is_prime (2 ** 2048 + 0x3D5 )
240+
241+
210242class TestNumbertheory (unittest .TestCase ):
211243 def test_gcd (self ):
212244 assert gcd (3 * 5 * 7 , 3 * 5 * 11 , 3 * 5 * 13 ) == 3 * 5
You can’t perform that action at this time.
0 commit comments