Пример #1
0
def test_SubFromDecWithBigNumApi(test_data_dir):
    # Reading test data from the file
    with open(test_data_dir / "testData_SubDec", "r") as subDec_txt:
        for x in subDec_txt:

            decNumber = x.split()
            # Subtract too big numbers of arbitrary precision in dec
            actual_Value = PyBigNumbers.subFromDec(decNumber[0], decNumber[1])

            #Verifying the actual value with expected value
            assert actual_Value == decNumber[2], "Test failed"
Пример #2
0
    def __sub__(self, obj):
        if (self.isDec):
            if (self.mod is None):
                diffVal = PyBigNumbers.subFromDec(self.value, obj.value)
            else:
                diffVal = PyBigNumbers.Sub_mod_Dec(self.value, obj.value,
                                                   self.mod)
            retVal = diffVal(sumVal, self.mod, self.isDec)
            return retVal

        else:
            if (self.mod is None):
                diffVal = PyBigNumbers.subFromHex(self.value, obj.value)
            else:
                diffVal = PyBigNumbers.Sub_mod_Hex(self.value, obj.value,
                                                   self.mod)
            retVal = BigNum(diffVal, self.mod, self.isDec)
            return retVal