Move the PSA_ASSERT macro to the common helpers file

It's potentially useful in all PSA test suites, of which there are now
several.
This commit is contained in:
Gilles Peskine 2018-12-17 23:26:01 +01:00
parent f055ad7512
commit 0174be2c17
2 changed files with 8 additions and 2 deletions

View File

@ -90,6 +90,14 @@ typedef struct data_tag
} \ } \
} while( 0 ) } while( 0 )
/** Evaluate an expression and fail the test case if it returns an error.
*
* \param expr The expression to evaluate. This is typically a call
* to a \c psa_xxx function that returns a value of type
* #psa_status_t.
*/
#define PSA_ASSERT( expr ) TEST_ASSERT( ( expr ) == PSA_SUCCESS )
/** Allocate memory dynamically and fail the test case if this fails. /** Allocate memory dynamically and fail the test case if this fails.
* *
* You must set \p pointer to \c NULL before calling this macro and * You must set \p pointer to \c NULL before calling this macro and

View File

@ -8,8 +8,6 @@
#include "psa_crypto_storage.h" #include "psa_crypto_storage.h"
#define PSA_ASSERT( expr ) TEST_ASSERT( ( expr ) == PSA_SUCCESS )
typedef enum typedef enum
{ {
CLOSE_BY_CLOSE, CLOSE_BY_CLOSE,