From f5a5e45ed1eceb45f9c537c200d592b48d8237af Mon Sep 17 00:00:00 2001 From: Steven Cooreman Date: Mon, 8 Jun 2020 18:53:13 +0200 Subject: [PATCH] Refactor equality-testing asserts in SE driver tests to TEST_EQUAL Signed-off-by: Steven Cooreman --- .../test_suite_psa_crypto_se_driver_hal.function | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function index ead8b5ab2..80c50e329 100644 --- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function +++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function @@ -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 ); }