mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-23 09:41:08 +00:00
Minor docstring improvements
No behavior change.
This commit is contained in:
parent
69f93b5040
commit
4408dfd0fc
|
@ -61,6 +61,7 @@ class read_file_lines:
|
||||||
|
|
||||||
class Inputs:
|
class Inputs:
|
||||||
"""Accumulate information about macros to test.
|
"""Accumulate information about macros to test.
|
||||||
|
|
||||||
This includes macro names as well as information about their arguments
|
This includes macro names as well as information about their arguments
|
||||||
when applicable.
|
when applicable.
|
||||||
"""
|
"""
|
||||||
|
@ -101,6 +102,7 @@ class Inputs:
|
||||||
|
|
||||||
def gather_arguments(self):
|
def gather_arguments(self):
|
||||||
"""Populate the list of values for macro arguments.
|
"""Populate the list of values for macro arguments.
|
||||||
|
|
||||||
Call this after parsing all the inputs.
|
Call this after parsing all the inputs.
|
||||||
"""
|
"""
|
||||||
self.arguments_for['hash_alg'] = sorted(self.hash_algorithms)
|
self.arguments_for['hash_alg'] = sorted(self.hash_algorithms)
|
||||||
|
@ -118,6 +120,7 @@ class Inputs:
|
||||||
|
|
||||||
def distribute_arguments(self, name):
|
def distribute_arguments(self, name):
|
||||||
"""Generate macro calls with each tested argument set.
|
"""Generate macro calls with each tested argument set.
|
||||||
|
|
||||||
If name is a macro without arguments, just yield "name".
|
If name is a macro without arguments, just yield "name".
|
||||||
If name is a macro with arguments, yield a series of
|
If name is a macro with arguments, yield a series of
|
||||||
"name(arg1,...,argN)" where each argument takes each possible
|
"name(arg1,...,argN)" where each argument takes each possible
|
||||||
|
@ -305,15 +308,21 @@ int main(void)
|
||||||
NORMALIZE_STRIP_RE = re.compile(r'\s+')
|
NORMALIZE_STRIP_RE = re.compile(r'\s+')
|
||||||
def normalize(expr):
|
def normalize(expr):
|
||||||
"""Normalize the C expression so as not to care about trivial differences.
|
"""Normalize the C expression so as not to care about trivial differences.
|
||||||
|
|
||||||
Currently "trivial differences" means whitespace.
|
Currently "trivial differences" means whitespace.
|
||||||
"""
|
"""
|
||||||
return re.sub(NORMALIZE_STRIP_RE, '', expr)
|
return re.sub(NORMALIZE_STRIP_RE, '', expr)
|
||||||
|
|
||||||
def do_test(options, inputs, type_word, names):
|
def do_test(options, inputs, type_word, names):
|
||||||
"""Test psa_constant_names for the specified type.
|
"""Test psa_constant_names for the specified type.
|
||||||
|
|
||||||
Run program on names.
|
Run program on names.
|
||||||
Use inputs to figure out what arguments to pass to macros that
|
Use inputs to figure out what arguments to pass to macros that
|
||||||
take arguments.
|
take arguments.
|
||||||
|
|
||||||
|
Return ``(count, errors)`` where ``count`` is the number of expressions
|
||||||
|
that have been tested and ``errors`` is the list of errors that were
|
||||||
|
encountered.
|
||||||
"""
|
"""
|
||||||
expressions = sorted(inputs.generate_expressions(names))
|
expressions = sorted(inputs.generate_expressions(names))
|
||||||
values = run_c(options, type_word, expressions)
|
values = run_c(options, type_word, expressions)
|
||||||
|
@ -332,6 +341,7 @@ def report_errors(errors):
|
||||||
|
|
||||||
def run_tests(options, inputs):
|
def run_tests(options, inputs):
|
||||||
"""Run psa_constant_names on all the gathered inputs.
|
"""Run psa_constant_names on all the gathered inputs.
|
||||||
|
|
||||||
Return a tuple (count, errors) where count is the total number of inputs
|
Return a tuple (count, errors) where count is the total number of inputs
|
||||||
that were tested and errors is the list of cases where the output was
|
that were tested and errors is the list of cases where the output was
|
||||||
not as expected.
|
not as expected.
|
||||||
|
|
Loading…
Reference in a new issue