test_parallel.py 501 B

1234567891011121314151617181920
  1. """Test for multiprocess prime generation."""
  2. import unittest
  3. import rsa.prime
  4. import rsa.parallel
  5. import rsa.common
  6. class ParallelTest(unittest.TestCase):
  7. """Tests for multiprocess prime generation."""
  8. def test_parallel_primegen(self):
  9. p = rsa.parallel.getprime(1024, 3)
  10. self.assertFalse(rsa.prime.is_prime(p - 1))
  11. self.assertTrue(rsa.prime.is_prime(p))
  12. self.assertFalse(rsa.prime.is_prime(p + 1))
  13. self.assertEqual(1024, rsa.common.bit_size(p))