Beispiel #1
0
def test_GenerateRandPrimeDec():

    #Generating prime decimal numbers with input parameter
    for x in range(10, 1000, 10):

        # Generate Random Prime Number of arbitary precision in dec
        primeDec_Value = PyBigNumbers.GenerateRandPrimeDec(x)

        # Verifying the actual value as prime number or not
        assert PyBigNumbers.isPrimeDec(primeDec_Value), "Test failed"
Beispiel #2
0
def test_GenerateRandPrimeDecWithSeed():

    seed = "moKDVMpSuLxh3tS2baDvmM4XmfTugpctBX"

    #Generating prime decimal numbers with input parameter
    for x in range(10, 100, 10):

        # Generate Random Prime Number of arbitary precision in dec with seed (specified as a string)
        primeDec_Value = PyBigNumbers.GenerateRandPrimeDecWithSeed(seed, x)

        # Verifying the actual value as prime number or not
        assert PyBigNumbers.isPrimeDec(primeDec_Value), "Test failed"
Beispiel #3
0
def test_IsPrimeDec(test_data_dir):

    # Reading test data from the file
    with open(test_data_dir / "testData_PrimeDec", "r") as primeDec_txt:
        for x in primeDec_txt:

            decNumber = x.split(",")
            # Check if Dec big number is a prime
            actual_Value = PyBigNumbers.isPrimeDec(decNumber[0].rstrip("\n"))

            # Verifying the actual value with expected value
            assert actual_Value == int(decNumber[1]), "Test failed"