zephyr/tests/bluetooth/host/id/mocks/crypto_expects.c
Ahmed Moheb 8949f3da81 tests: bluetooth: host: Add UT for bt_setup_public_id_addr()
Unit test project for bt_setup_public_id_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00

30 lines
776 B
C

/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "mocks/crypto.h"
#include "mocks/crypto_expects.h"
#include <zephyr/kernel.h>
void expect_single_call_bt_rand(void *buf, size_t len)
{
const char *func_name = "bt_rand";
zassert_equal(bt_rand_fake.call_count, 1, "'%s()' was called more than once", func_name);
zassert_equal(bt_rand_fake.arg0_val, buf, "'%s()' was called with incorrect '%s' value",
func_name, "buf");
zassert_equal(bt_rand_fake.arg1_val, len, "'%s()' was called with incorrect '%s' value",
func_name, "len");
}
void expect_not_called_bt_rand(void)
{
const char *func_name = "bt_rand";
zassert_equal(bt_rand_fake.call_count, 0, "'%s()' was called unexpectedly", func_name);
}