Split generate_tests to reduce code complexity
Previous implementation mixed the test case generation and the
recursive generation calls together. A separate method is added to
generate test cases for the current class' test function. This reduces
the need to override generate_tests().
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
diff --git a/tests/scripts/generate_bignum_tests.py b/tests/scripts/generate_bignum_tests.py
index 3f556ce..1f64485 100755
--- a/tests/scripts/generate_bignum_tests.py
+++ b/tests/scripts/generate_bignum_tests.py
@@ -160,14 +160,10 @@
yield from cls.input_cases
@classmethod
- def generate_tests(cls) -> Iterator[test_case.TestCase]:
- if cls.test_function:
- # Generate tests for the current class
- for l_value, r_value in cls.get_value_pairs():
- cur_op = cls(l_value, r_value)
- yield cur_op.create_test_case()
- # Once current class completed, check descendants
- yield from super().generate_tests()
+ def generate_function_tests(cls) -> Iterator[test_case.TestCase]:
+ for l_value, r_value in cls.get_value_pairs():
+ cur_op = cls(l_value, r_value)
+ yield cur_op.create_test_case()
class BignumCmp(BignumOperation):