def test_DivModHex(test_data_dir): #Reading test data from the file with open(test_data_dir / "testData_DivModHex", "r") as divModHex_txt: for x in divModHex_txt: hexNumber = x.split(",") #Divide modulo of big numbers of arbitrary precision in hex actual_value = PyBigNumbers.Div_mod_Hex(hexNumber[0], hexNumber[1], hexNumber[2]) expected_value = hexNumber[3].rstrip("\n") #verifying the actual value with the expected value assert actual_value.lstrip( "0") == expected_value.upper(), "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