def test_DivideDec(test_data_dir): # Reading test data from the file with open(test_data_dir / "testData_DivideDec", "r") as divideDec_txt: for x in divideDec_txt: decNumber = x.split(",") # Divide two big numbers of arbitrary precision in dec actual_Value = PyBigNumbers.divideFromDec(decNumber[0], decNumber[1]) # Verifying the actual value with expected value assert actual_Value == decNumber[2].rstrip("\n"), "Test failed"
def __truediv__(self, obj): if (self.isDec): if (self.mod is None): divVal = PyBigNumbers.divideFromDec(self.value, obj.value) else: divVal = PyBigNumbers.Div_mod_Dec(self.value, obj.value, self.mod) retVal = BigNum(divVal, self.mod, self.isDec) else: if (self.mod is None): divVal = PyBigNumbers.divideFromHex(self.value, obj.value) else: divVal = PyBigNumbers.Div_mod_Hex(self.value, obj.value, self.mod) retVal = BigNum(divVal, self.mod, self.isDec) return retVal