diff --git a/scripts/mbedtls_dev/test_generation.py b/scripts/mbedtls_dev/test_generation.py index 2981a7470..e833008b5 100644 --- a/scripts/mbedtls_dev/test_generation.py +++ b/scripts/mbedtls_dev/test_generation.py @@ -35,7 +35,8 @@ T = TypeVar('T') #pylint: disable=invalid-name class BaseTarget(metaclass=ABCMeta): """Base target for test case generation. - This should be derived from for file Targets. + Derive directly from this class when adding new file Targets, setting + `target_basename`. Attributes: count: Counter for test cases from this class. @@ -113,7 +114,7 @@ class BaseTarget(metaclass=ABCMeta): """Generate test cases for the class and its subclasses. In classes with `test_function` set, `generate_function_tests()` is - used to generate test cases first. + called to generate test cases first. In all classes, this method will iterate over its subclasses, and yield from `generate_tests()` in each. Calling this method on a class X diff --git a/tests/scripts/generate_bignum_tests.py b/tests/scripts/generate_bignum_tests.py index 4486d4958..8a8425e1c 100755 --- a/tests/scripts/generate_bignum_tests.py +++ b/tests/scripts/generate_bignum_tests.py @@ -24,7 +24,8 @@ from abstract and concrete classes). Adding test case generation for a function: A subclass representing the test function should be added, deriving from a -file Target. This test class must set/implement the following: +file Target such as BignumTarget. This test class must set/implement the +following: - test_function: the function name from the associated .function file. - test_name: a descriptive name or brief summary to refer to the test function. @@ -128,8 +129,8 @@ class BignumOperation(BignumTarget, metaclass=ABCMeta): def result(self) -> str: """Get the result of the operation. - This may be calculated during initialization and stored as `_result`, - or calculated when the method is called. + This could be calculated during initialization and stored as `_result` + and then returned, or calculated when the method is called. """ raise NotImplementedError @@ -137,8 +138,8 @@ class BignumOperation(BignumTarget, metaclass=ABCMeta): def value_description(val) -> str: """Generate a description of the argument val. - This produces a simple description of the value, which are used in test - case naming, to add context. + This produces a simple description of the value, which is used in test + case naming to add context. """ if val == "": return "0 (null)" @@ -231,7 +232,7 @@ class BignumAdd(BignumOperation): class BignumTestGenerator(test_generation.TestGenerator): - """Test generator subclass setting bignum targets.""" + """Test generator subclass, for bignum file Targets.""" TARGETS = { subclass.target_basename: subclass.generate_tests for subclass in test_generation.BaseTarget.__subclasses__()