aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/rsa/py3/tests/test_parallel.py
blob: 1a69e9ece626680008e91494fee44dc21b018bc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Test for multiprocess prime generation."""

import unittest

import rsa.prime
import rsa.parallel
import rsa.common


class ParallelTest(unittest.TestCase):
    """Tests for multiprocess prime generation."""

    def test_parallel_primegen(self):
        p = rsa.parallel.getprime(1024, 3)

        self.assertFalse(rsa.prime.is_prime(p - 1))
        self.assertTrue(rsa.prime.is_prime(p))
        self.assertFalse(rsa.prime.is_prime(p + 1))

        self.assertEqual(1024, rsa.common.bit_size(p))