blob: 2c4d2fed7aaa43a3a86e414d665d8075eadb7c48 [file] [log] [blame]
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/buf.h>
#include <host/hci_core.h>
#include "mocks/net_buf.h"
#include "mocks/net_buf_expects.h"
#include "mocks/buf_help_utils.h"
/* Rows count equals number of events x 2 */
#define TEST_PARAMETERS_LUT_ROWS_COUNT 4
/* LUT containing testing parameters that will be used
* during each iteration to cover different scenarios
*/
static const struct testing_params testing_params_lut[] = {
TEST_PARAM_PAIR_DEFINE(BT_HCI_EVT_CMD_COMPLETE),
TEST_PARAM_PAIR_DEFINE(BT_HCI_EVT_CMD_STATUS)
};
BUILD_ASSERT(ARRAY_SIZE(testing_params_lut) == TEST_PARAMETERS_LUT_ROWS_COUNT);
/* Return the memory pool used for event memory allocation
* based on compilation flags
*/
static struct net_buf_pool *get_memory_pool(void)
{
struct net_buf_pool *memory_pool;
if ((IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL))) {
memory_pool = bt_buf_get_evt_pool();
} else {
memory_pool = bt_buf_get_hci_rx_pool();
}
return memory_pool;
}