Refactor equality-testing asserts in SE driver tests to TEST_EQUAL

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman 2020-06-08 18:53:13 +02:00
parent de18338865
commit f5a5e45ed1

View File

@ -620,7 +620,7 @@ static int check_no_persistent_data( psa_key_location_t location )
struct psa_storage_info_t info;
int ok = 0;
TEST_ASSERT( psa_its_get_info( uid, &info ) == PSA_ERROR_DOES_NOT_EXIST );
TEST_EQUAL( psa_its_get_info( uid, &info ), PSA_ERROR_DOES_NOT_EXIST );
ok = 1;
exit:
@ -900,7 +900,7 @@ void key_creation_import_export( int lifetime_arg, int min_slot, int restart )
}
/* Test that the key was created in the expected slot. */
TEST_ASSERT( ram_slots[min_slot].type == PSA_KEY_TYPE_RAW_DATA );
TEST_EQUAL( ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA );
/* Maybe restart, to check that the information is saved correctly. */
if( restart )
@ -938,7 +938,7 @@ void key_creation_import_export( int lifetime_arg, int min_slot, int restart )
}
/* Test that the key was created in the expected slot. */
TEST_ASSERT( ram_slots[min_slot].type == PSA_KEY_TYPE_RAW_DATA );
TEST_EQUAL( ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA );
/* Test the key attributes, including the reported slot number. */
psa_set_key_bits( &attributes,
@ -964,7 +964,7 @@ void key_creation_import_export( int lifetime_arg, int min_slot, int restart )
PSA_ERROR_DOES_NOT_EXIST );
/* Test that the key has been erased from the designated slot. */
TEST_ASSERT( ram_slots[min_slot].type == 0 );
TEST_EQUAL( ram_slots[min_slot].type, 0 );
exit:
PSA_DONE( );
@ -1318,7 +1318,7 @@ void sign_verify( int flow,
* generate material, store the desired result of generation in
* the mock secure element storage. */
PSA_ASSERT( psa_get_key_attributes( drv_handle, &drv_attributes ) );
TEST_ASSERT( key_material->len == PSA_BITS_TO_BYTES( bits ) );
TEST_EQUAL( key_material->len, PSA_BITS_TO_BYTES( bits ) );
memcpy( ram_slots[ram_min_slot].content, key_material->x,
key_material->len );
}