aboutsummaryrefslogtreecommitdiff
path: root/tests/src/helpers.c
diff options
context:
space:
mode:
authorChris Jones <christopher.jones@arm.com>2021-04-22 15:28:56 +0100
committerChris Jones <christopher.jones@arm.com>2021-04-22 15:28:56 +0100
commite11e81413d46577503d20a93ce7e791bf4324d2b (patch)
tree7dfb5d2266c9ffc6fef6bd5d604d051537452689 /tests/src/helpers.c
parentfdb588b3a775751ce9a132bfe0ce1f5ef5026ffc (diff)
downloadmbedtls-e11e81413d46577503d20a93ce7e791bf4324d2b.zip
mbedtls-e11e81413d46577503d20a93ce7e791bf4324d2b.tar.gz
mbedtls-e11e81413d46577503d20a93ce7e791bf4324d2b.tar.bz2
Improve documentation for error code checking
Improve comments explaining error code checking, fix incorrect comments and make a small formatting fix. Signed-off-by: Chris Jones <christopher.jones@arm.com>
Diffstat (limited to 'tests/src/helpers.c')
-rw-r--r--tests/src/helpers.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index b546611..4923e3c 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -298,22 +298,34 @@ void mbedtls_test_err_add_check( int high, int low,
* h = high level error code (includes high and module error codes).
* l = low level error code.
*/
- if ( high > -0x1000 && high != 0 ) // high < 0001000000000000
+ if ( high > -0x1000 && high != 0 )
+ /* high < 0001000000000000
+ * No high level error bits are set.
+ */
{
mbedtls_test_fail( "'high' is not a high-level error code",
line, file );
}
- else if ( high < -0x7F80 ) // high > 0111111110000000
+ else if ( high < -0x7F80 )
+ /* high > 0111111110000000
+ * Error code is larger than the greatest high + module level error.
+ */
{
mbedtls_test_fail( "'high' error code is greater than 15 bits",
line, file );
}
- else if ( ( high & 0x7F ) != 0 ) // high & 0000000001111111
+ else if ( ( high & 0x7F ) != 0 )
+ /* high & 0000000001111111
+ * Error code contains low level error code bits.
+ */
{
mbedtls_test_fail( "'high' contains a low-level error code",
line, file );
}
- else if ( low < -0x007F ) // low > 0000000001111111
+ else if ( low < -0x007F )
+ /* low > 0000000001111111
+ * Error code contains high or module level error code bits.
+ */
{
mbedtls_test_fail( "'low' error code is greater than 7 bits",
line, file );