This refactors the code to use exact copy of bt_gatt_attr_read instead of mock, as the implementation might call the function with stack allocated value. Using mock would require deep copy of the value for further verification. As the buffer where the value is about to placed is one of the attr->read() parameters, the test may call the read() callback with stack allocated buffer of defined size and read the value from the buffer. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
23 lines
470 B
C
23 lines
470 B
C
/*
|
|
* Copyright (c) 2023 Codecoup
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef MOCKS_GATT_H_
|
|
#define MOCKS_GATT_H_
|
|
|
|
#include <zephyr/fff.h>
|
|
#include <zephyr/bluetooth/gatt.h>
|
|
|
|
void mock_bt_gatt_init(void);
|
|
void mock_bt_gatt_cleanup(void);
|
|
|
|
DECLARE_FAKE_VALUE_FUNC(int, mock_bt_gatt_notify_cb, struct bt_conn *,
|
|
struct bt_gatt_notify_params *);
|
|
|
|
void bt_gatt_notify_cb_reset(void);
|
|
uint16_t bt_gatt_get_mtu(struct bt_conn *conn);
|
|
|
|
#endif /* MOCKS_GATT_H_ */
|