Use ASSERT_COMPARE in test_suite_md
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_md.function b/tests/suites/test_suite_md.function
index 584174e..0828fd7 100644
--- a/tests/suites/test_suite_md.function
+++ b/tests/suites/test_suite_md.function
@@ -139,9 +139,7 @@
TEST_EQUAL(0, mbedtls_md(md_info, src, src_len, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
}
/* END_CASE */
@@ -157,9 +155,7 @@
TEST_EQUAL(0, mbedtls_md(md_info, src_str->x, src_str->len, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
}
/* END_CASE */
@@ -192,18 +188,14 @@
TEST_EQUAL(0, mbedtls_md_update(&ctx, src + halfway, src_len - halfway));
TEST_EQUAL(0, mbedtls_md_finish(&ctx, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
/* Test clone */
memset(output, 0x00, sizeof(output));
TEST_EQUAL(0, mbedtls_md_update(&ctx_copy, src + halfway, src_len - halfway));
TEST_EQUAL(0, mbedtls_md_finish(&ctx_copy, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
exit:
mbedtls_md_free(&ctx);
@@ -236,18 +228,14 @@
TEST_EQUAL(0, mbedtls_md_update(&ctx, src_str->x + halfway, src_str->len - halfway));
TEST_EQUAL(0, mbedtls_md_finish(&ctx, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
/* Test clone */
memset(output, 0x00, sizeof(output));
TEST_EQUAL(0, mbedtls_md_update(&ctx_copy, src_str->x + halfway, src_str->len - halfway));
TEST_EQUAL(0, mbedtls_md_finish(&ctx_copy, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
exit:
mbedtls_md_free(&ctx);
@@ -270,8 +258,7 @@
TEST_EQUAL(0, mbedtls_md_hmac(md_info, key_str->x, key_str->len,
src_str->x, src_str->len, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- trunc_size, hash->len) == 0);
+ ASSERT_COMPARE(output, trunc_size, hash->x, hash->len);
}
/* END_CASE */
@@ -298,8 +285,7 @@
TEST_EQUAL(0, mbedtls_md_hmac_update(&ctx, src_str->x + halfway, src_str->len - halfway));
TEST_EQUAL(0, mbedtls_md_hmac_finish(&ctx, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- trunc_size, hash->len) == 0);
+ ASSERT_COMPARE(output, trunc_size, hash->x, hash->len);
/* Test again, for reset() */
memset(output, 0x00, sizeof(output));
@@ -309,8 +295,7 @@
TEST_EQUAL(0, mbedtls_md_hmac_update(&ctx, src_str->x + halfway, src_str->len - halfway));
TEST_EQUAL(0, mbedtls_md_hmac_finish(&ctx, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- trunc_size, hash->len) == 0);
+ ASSERT_COMPARE(output, trunc_size, hash->x, hash->len);
exit:
mbedtls_md_free(&ctx);
@@ -329,8 +314,6 @@
TEST_EQUAL(0, mbedtls_md_file(md_info, filename, output));
- TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
- mbedtls_md_get_size(md_info),
- hash->len) == 0);
+ ASSERT_COMPARE(output, mbedtls_md_get_size(md_info), hash->x, hash->len);
}
/* END_CASE */