From a5a800dce0ab23c2be1ab0cc3384ff4293ea5e7e Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 21 Apr 2021 20:04:24 +0200 Subject: [PATCH] More informative message on invalid classification flags Signed-off-by: Gilles Peskine --- tests/suites/test_suite_psa_crypto_metadata.function | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto_metadata.function b/tests/suites/test_suite_psa_crypto_metadata.function index fc7eb6673..a80482fdc 100644 --- a/tests/suites/test_suite_psa_crypto_metadata.function +++ b/tests/suites/test_suite_psa_crypto_metadata.function @@ -60,8 +60,15 @@ * flag is the name of the classification macro without the PSA_ prefix. */ #define KEY_LIFETIME_IS_VOLATILE ( 1u << 0 ) -#define TEST_CLASSIFICATION_MACRO( flag, alg, flags ) \ - TEST_ASSERT( PSA_##flag( alg ) == !! ( ( flags ) & flag ) ) +#define TEST_CLASSIFICATION_MACRO( flag, alg, flags ) \ + do \ + { \ + if( ( flags ) & ( flag ) ) \ + TEST_ASSERT( PSA_##flag( alg ) ); \ + else \ + TEST_ASSERT( ! PSA_##flag( alg ) ); \ + } \ + while( 0 ) /* Check the parity of value. *