Replace TEST_ASSERT macro uses

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-06-23 15:12:10 +01:00
parent ac80a66395
commit 3e5585b45d

View file

@ -803,14 +803,14 @@ void mbedtls_x509_dn_get_next( char * name_str, int next_merged, char * expected
out_size = strlen( expected_oids ) + 2; out_size = strlen( expected_oids ) + 2;
ASSERT_ALLOC( out, out_size ); ASSERT_ALLOC( out, out_size );
TEST_ASSERT( mbedtls_x509_string_to_names( &names, name_str ) == 0 ); TEST_EQUAL( mbedtls_x509_string_to_names( &names, name_str ), 0 );
ret = mbedtls_x509_write_names( &c, buf, names ); ret = mbedtls_x509_write_names( &c, buf, names );
TEST_ASSERT( ret > 0 ); TEST_LE_S( 0, ret );
TEST_ASSERT( mbedtls_asn1_get_tag( &c, buf + sizeof( buf ), &len, TEST_EQUAL( mbedtls_asn1_get_tag( &c, buf + sizeof( buf ), &len,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) == 0 ); MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ), 0 );
TEST_ASSERT( mbedtls_x509_get_name( &c, buf + sizeof( buf ), &parsed ) == 0 ); TEST_EQUAL( mbedtls_x509_get_name( &c, buf + sizeof( buf ), &parsed ), 0 );
// Iterate over names and set next_merged nodes // Iterate over names and set next_merged nodes
parsed_cur = &parsed; parsed_cur = &parsed;
@ -825,23 +825,23 @@ void mbedtls_x509_dn_get_next( char * name_str, int next_merged, char * expected
len = 0; len = 0;
for( i = 0; parsed_cur != NULL; i++ ) for( i = 0; parsed_cur != NULL; i++ )
{ {
TEST_ASSERT( mbedtls_oid_get_attr_short_name( &parsed_cur->oid, TEST_EQUAL( mbedtls_oid_get_attr_short_name( &parsed_cur->oid,
&short_name ) == 0 ); &short_name ), 0 );
len += mbedtls_snprintf( (char*) out + len, out_size - len, "%s ", short_name ); len += mbedtls_snprintf( (char*) out + len, out_size - len, "%s ", short_name );
parsed_cur = mbedtls_x509_dn_get_next( parsed_cur ); parsed_cur = mbedtls_x509_dn_get_next( parsed_cur );
} }
out[len-1] = 0; out[len-1] = 0;
TEST_ASSERT( exp_count == i ); TEST_EQUAL( exp_count, i );
TEST_ASSERT( strcmp( (char *) out, expected_oids ) == 0 ); TEST_EQUAL( strcmp( (char *) out, expected_oids ), 0 );
mbedtls_free( out ); mbedtls_free( out );
out = NULL; out = NULL;
out_size = strlen( exp_dn_gets ) + 1; out_size = strlen( exp_dn_gets ) + 1;
ASSERT_ALLOC( out, out_size ); ASSERT_ALLOC( out, out_size );
TEST_ASSERT( mbedtls_x509_dn_gets( (char *) out, out_size, &parsed ) >= 0 ); TEST_LE_S( 0, mbedtls_x509_dn_gets( (char *) out, out_size, &parsed ) );
TEST_ASSERT( strcmp( (char *) out, exp_dn_gets ) == 0 ); TEST_EQUAL( strcmp( (char *) out, exp_dn_gets ), 0 );
exit: exit:
mbedtls_free( out ); mbedtls_free( out );
mbedtls_asn1_free_named_data_list( &names ); mbedtls_asn1_free_named_data_list( &names );