diff --git a/scripts/mbedtls_dev/bignum_common.py b/scripts/mbedtls_dev/bignum_common.py index b20fe815db..7857dd65c5 100644 --- a/scripts/mbedtls_dev/bignum_common.py +++ b/scripts/mbedtls_dev/bignum_common.py @@ -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 diff --git a/scripts/mbedtls_dev/bignum_core.py b/scripts/mbedtls_dev/bignum_core.py index a8d6ec216f..f2e3db74b1 100644 --- a/scripts/mbedtls_dev/bignum_core.py +++ b/scripts/mbedtls_dev/bignum_core.py @@ -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: