def test_find_jumper_8bit(self): """ Verify the correctness of the modulus finder process, for 8bit modulus. :return: None """ BITS = 8 MODULUS = 127 modulus = modulus_finder.find_modulus(BITS) self.assertEqual(MODULUS, modulus, "Modulus (8 bit) not correct.")
def test_find_jumper_64bit(self): """ Verify the correctness of the modulus finder process, for 64bit modulus. :return: None """ BITS = 64 MODULUS = 9223372036854775783 modulus = modulus_finder.find_modulus(BITS) self.assertEqual(MODULUS, modulus, "Modulus (64 bit) not correct.")
def run(bits, outdir=DEFAULT_OUTDIR): """ Find a modulus for the given number of bits. :param bits: (int) number of bits; must be positive. :param outdir: (str) path to the output directory. """ logger.info("Computing modulus for Bits {}".format(bits)) filename = path.join(outdir, "mod{}.txt".format(bits)) modulus = modulus_finder.find_modulus(bits) # Report r = SimpleReport("MODULUS") r.add("General", "Bits", bits) r.add("Result", "Modulus", modulus) r.save_txt(filename) print(r)