diff --git a/tests/bluetooth/host/crypto/prng_init/CMakeLists.txt b/tests/bluetooth/host/crypto/prng_init/CMakeLists.txt index 3ecc28beabb..8fd8d7ec965 100644 --- a/tests/bluetooth/host/crypto/prng_init/CMakeLists.txt +++ b/tests/bluetooth/host/crypto/prng_init/CMakeLists.txt @@ -2,10 +2,12 @@ cmake_minimum_required(VERSION 3.20.0) -FILE(GLOB SOURCES src/*.c) +set(SOURCES + src/main.c + src/test_suite_invalid_inputs.c +) project(prng_init) -add_compile_definitions(test_unit_name="${PROJECT_NAME}") find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) diff --git a/tests/bluetooth/host/crypto/prng_init/prj.conf b/tests/bluetooth/host/crypto/prng_init/prj.conf index c0dad049caf..542d140aa56 100644 --- a/tests/bluetooth/host/crypto/prng_init/prj.conf +++ b/tests/bluetooth/host/crypto/prng_init/prj.conf @@ -7,7 +7,3 @@ CONFIG_ASSERT=y CONFIG_ASSERT_LEVEL=2 CONFIG_ASSERT_VERBOSE=y CONFIG_ASSERT_ON_ERRORS=y - -CONFIG_LOG=n -CONFIG_BT_DEBUG_LOG=n -CONFIG_TEST_LOGGING_DEFAULTS=n diff --git a/tests/bluetooth/host/crypto/prng_init/src/main.c b/tests/bluetooth/host/crypto/prng_init/src/main.c index 146c94cbe61..2270aea1f13 100644 --- a/tests/bluetooth/host/crypto/prng_init/src/main.c +++ b/tests/bluetooth/host/crypto/prng_init/src/main.c @@ -4,14 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include -#include +#include "mocks/crypto_help_utils.h" #include "mocks/hci_core.h" #include "mocks/hci_core_expects.h" #include "mocks/hmac_prng.h" #include "mocks/hmac_prng_expects.h" -#include "mocks/crypto_help_utils.h" + +#include +#include + +#include DEFINE_FFF_GLOBALS; @@ -52,5 +54,5 @@ ZTEST(prng_init, test_prng_init_succeeds) expect_single_call_tc_hmac_prng_init(hmac_prng, 8); expect_single_call_tc_hmac_prng_reseed(hmac_prng, 32, sizeof(int64_t)); - zassert_ok(err, "'%s()' returned unexpected error code %d", test_unit_name, err); + zassert_ok(err, "Unexpected error code '%d' was returned", err); } diff --git a/tests/bluetooth/host/crypto/prng_init/src/test_suite_invalid_inputs.c b/tests/bluetooth/host/crypto/prng_init/src/test_suite_invalid_inputs.c index 4c8ebf66191..fa25017c23e 100644 --- a/tests/bluetooth/host/crypto/prng_init/src/test_suite_invalid_inputs.c +++ b/tests/bluetooth/host/crypto/prng_init/src/test_suite_invalid_inputs.c @@ -4,14 +4,16 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include "host_mocks/assert.h" +#include "mocks/crypto_help_utils.h" #include "mocks/hci_core.h" #include "mocks/hci_core_expects.h" #include "mocks/hmac_prng.h" #include "mocks/hmac_prng_expects.h" -#include "mocks/crypto_help_utils.h" -#include "host_mocks/assert.h" + +#include + +#include ZTEST_SUITE(prng_init_invalid_cases, NULL, NULL, NULL, NULL, NULL); @@ -35,7 +37,7 @@ ZTEST(prng_init_invalid_cases, test_bt_hci_le_rand_fails) expect_call_count_bt_hci_le_rand(1, expected_args_history); - zassert_true(err < 0, "'%s()' returned unexpected error code %d", test_unit_name, err); + zassert_true(err < 0, "Unexpected error code '%d' was returned", err); } /* @@ -62,7 +64,7 @@ ZTEST(prng_init_invalid_cases, test_tc_hmac_prng_init_fails) expect_call_count_bt_hci_le_rand(1, expected_args_history); expect_single_call_tc_hmac_prng_init(hmac_prng, 8); - zassert_true(err == -EIO, "'%s()' returned unexpected error code %d", test_unit_name, err); + zassert_true(err == -EIO, "Unexpected error code '%d' was returned", err); } /* @@ -92,5 +94,5 @@ ZTEST(prng_init_invalid_cases, test_prng_reseed_fails) expect_single_call_tc_hmac_prng_init(hmac_prng, 8); expect_single_call_tc_hmac_prng_reseed(hmac_prng, 32, sizeof(int64_t)); - zassert_true(err == -EIO, "'%s()' returned unexpected error code %d", test_unit_name, err); + zassert_true(err == -EIO, "Unexpected error code '%d' was returned", err); }