Bignum tests: improve mod descriptions

There are no semantic changes to the generated tests.

Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
Janos Follath 2022-11-19 15:05:19 +00:00
parent 284672ccfb
commit 8ae7a657ac
2 changed files with 22 additions and 13 deletions

View file

@ -168,9 +168,14 @@ class OperationCommon(test_data_generation.BaseTest):
generated to provide some context to the test case.
"""
if not self.case_description:
self.case_description = "{:x} {} {:x}".format(
self.int_a, self.symbol, self.int_b
)
if self.arity == 1:
self.case_description = "{} {:x}".format(
self.symbol, self.int_a
)
elif self.arity == 2:
self.case_description = "{:x} {} {:x}".format(
self.int_a, self.symbol, self.int_b
)
return super().description()
@property
@ -232,7 +237,6 @@ class OperationCommon(test_data_generation.BaseTest):
)
class ModOperationCommon(OperationCommon):
#pylint: disable=abstract-method
"""Target for bignum mod_raw test case generation."""
@ -278,6 +282,17 @@ class ModOperationCommon(OperationCommon):
return False
return True
def description(self) -> str:
"""Generate a description for the test case.
It uses the form A `symbol` B mod N, where symbol is used to represent
the operation.
"""
if not self.case_description:
return super().description() + " mod {:x}".format(self.int_n)
return super().description()
@classmethod
def input_cases_args(cls) -> Iterator[Tuple[Any, Any, Any]]:
if cls.arity == 1: