From 4c09114c32349689e9ff3726150fe370502fd797 Mon Sep 17 00:00:00 2001 From: Rich Evans Date: Mon, 2 Feb 2015 12:04:10 +0000 Subject: [PATCH] add macro definition of assert using polarssl_exit --- tests/suites/helpers.function | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 4e1bac1ee..3ae9a40a3 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -15,10 +15,16 @@ typedef UINT32 uint32_t; #include #endif -#include #include #include +#define assert(a) if( !( a ) ) \ +{ \ + polarssl_fprintf( stderr, "Assertion Failed at %s:%d - %s\n", \ + __FILE__, __LINE__, #a ); \ + polarssl_exit( 1 ); \ +} + /* * 32-bit integer manipulation macros (big endian) */ @@ -42,13 +48,13 @@ typedef UINT32 uint32_t; } #endif -static int unhexify(unsigned char *obuf, const char *ibuf) +static int unhexify( unsigned char *obuf, const char *ibuf ) { unsigned char c, c2; - int len = strlen(ibuf) / 2; - assert( strlen(ibuf) % 2 == 0 ); // must be even number of bytes + int len = strlen( ibuf ) / 2; + assert( strlen( ibuf ) % 2 == 0 ); // must be even number of bytes - while (*ibuf != 0) + while( *ibuf != 0 ) { c = *ibuf++; if( c >= '0' && c <= '9' )