mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-03 20:54:00 +00:00
Add flag for unique combinations in operations
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
parent
6351c7f5f3
commit
bbf0a32d67
@ -77,10 +77,14 @@ class OperationCommon:
|
||||
combined to produce pairs of values.
|
||||
input_cases: List of tuples containing pairs of test case inputs. This
|
||||
can be used to implement specific pairs of inputs.
|
||||
unique_combinations_only: Boolean to select if test case combinations
|
||||
must be unique. If True, only A,B or B,A would be included as a test
|
||||
case. If False, both A,B and B,A would be included.
|
||||
"""
|
||||
symbol = ""
|
||||
input_values = [] # type: List[str]
|
||||
input_cases = [] # type: List[Tuple[str, str]]
|
||||
unique_combinations_only = True
|
||||
|
||||
def __init__(self, val_a: str, val_b: str) -> None:
|
||||
self.arg_a = val_a
|
||||
@ -107,5 +111,12 @@ class OperationCommon:
|
||||
Combinations are first generated from all input values, and then
|
||||
specific cases provided.
|
||||
"""
|
||||
yield from combination_pairs(cls.input_values)
|
||||
if cls.unique_combinations_only:
|
||||
yield from combination_pairs(cls.input_values)
|
||||
else:
|
||||
yield from (
|
||||
(a, b)
|
||||
for a in cls.input_values
|
||||
for b in cls.input_values
|
||||
)
|
||||
yield from cls.input_cases
|
||||
|
@ -97,6 +97,7 @@ class BignumCoreSub(BignumCoreOperation):
|
||||
symbol = "-"
|
||||
test_function = "mpi_core_sub"
|
||||
test_name = "mbedtls_mpi_core_sub"
|
||||
unique_combinations_only = False
|
||||
|
||||
def result(self) -> str:
|
||||
if self.int_a >= self.int_b:
|
||||
|
Loading…
x
Reference in New Issue
Block a user