Split the high nesting of BignumModRawConvertRep.generate_function_tests
Pylint complains about the nesting. It's not wrong. No behavior change. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
636809f2b9
commit
6d40e54db0
1 changed files with 15 additions and 10 deletions
|
@ -131,22 +131,27 @@ class BignumModRawConvertRep(bignum_common.ModOperationCommon,
|
||||||
mod_with_rep = 'mod({})'.format(self.rep.name)
|
mod_with_rep = 'mod({})'.format(self.rep.name)
|
||||||
return base.replace('mod', mod_with_rep, 1)
|
return base.replace('mod', mod_with_rep, 1)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def test_cases_for_values(cls, rep: bignum_common.ModulusRepresentation,
|
||||||
|
n: str, a: str) -> Iterator[test_case.TestCase]:
|
||||||
|
for bil in cls.limb_sizes:
|
||||||
|
test_object = cls(n, a, bits_in_limb=bil)
|
||||||
|
test_object.set_representation(rep)
|
||||||
|
#Filters out the duplicate
|
||||||
|
if rep == bignum_common.ModulusRepresentation.OPT_RED:
|
||||||
|
test_object.dependencies= []
|
||||||
|
if bil == 64:
|
||||||
|
continue
|
||||||
|
if test_object.is_valid:
|
||||||
|
yield test_object.create_test_case()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_function_tests(cls) -> Iterator[test_case.TestCase]:
|
def generate_function_tests(cls) -> Iterator[test_case.TestCase]:
|
||||||
|
|
||||||
for rep in bignum_common.ModulusRepresentation.supported_representations():
|
for rep in bignum_common.ModulusRepresentation.supported_representations():
|
||||||
for n in cls.moduli:
|
for n in cls.moduli:
|
||||||
for a in cls.input_values:
|
for a in cls.input_values:
|
||||||
for bil in cls.limb_sizes:
|
yield from cls.test_cases_for_values(rep, n, a)
|
||||||
test_object = cls(n, a, bits_in_limb=bil)
|
|
||||||
test_object.set_representation(rep)
|
|
||||||
#Filters out the duplicate
|
|
||||||
if rep == bignum_common.ModulusRepresentation.OPT_RED:
|
|
||||||
test_object.dependencies= []
|
|
||||||
if bil == 64:
|
|
||||||
continue
|
|
||||||
if test_object.is_valid:
|
|
||||||
yield test_object.create_test_case()
|
|
||||||
|
|
||||||
class BignumModRawCanonicalToModulusRep(BignumModRawConvertRep):
|
class BignumModRawCanonicalToModulusRep(BignumModRawConvertRep):
|
||||||
"""Test cases for mpi_mod_raw_canonical_to_modulus_rep."""
|
"""Test cases for mpi_mod_raw_canonical_to_modulus_rep."""
|
||||||
|
|
Loading…
Reference in a new issue