blob: 8ed3b61efbb0d883a35ba6e5b4b9dc75318e1c31 [file] [log] [blame]
Paul Bakker33b43f12013-08-20 11:48:36 +02001/* BEGIN_HEADER */
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +00002#include "mbedtls/error.h"
Paul Bakker33b43f12013-08-20 11:48:36 +02003/* END_HEADER */
Paul Bakker9d781402011-05-09 16:17:09 +00004
Paul Bakker33b43f12013-08-20 11:48:36 +02005/* BEGIN_DEPENDENCIES
6 * depends_on:POLARSSL_ERROR_C
7 * END_DEPENDENCIES
8 */
Paul Bakker5690efc2011-05-26 13:16:06 +00009
Paul Bakker33b43f12013-08-20 11:48:36 +020010/* BEGIN_CASE */
11void error_strerror( int code, char *result_str )
Paul Bakker9d781402011-05-09 16:17:09 +000012{
13 char buf[500];
14
Manuel Pégourié-Gonnard52a555c2014-03-27 18:49:32 +010015 memset( buf, 0, sizeof( buf ) );
16
Manuel Pégourié-Gonnardf8669da2013-10-27 14:11:32 +010017 polarssl_strerror( code, buf, 500 );
Paul Bakker9d781402011-05-09 16:17:09 +000018
Paul Bakker33b43f12013-08-20 11:48:36 +020019 TEST_ASSERT( strcmp( buf, result_str ) == 0 );
Manuel Pégourié-Gonnard52a555c2014-03-27 18:49:32 +010020
21#if defined(POLARSSL_ERROR_STRERROR_BC)
22 memset( buf, 0, sizeof( buf ) );
23
24 error_strerror( code, buf, 500 );
25
26 TEST_ASSERT( strcmp( buf, result_str ) == 0 );
27#endif
Paul Bakker9d781402011-05-09 16:17:09 +000028}
Paul Bakker33b43f12013-08-20 11:48:36 +020029/* END_CASE */