Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
fff_extensions.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2023 Legrand North America, LLC.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
13#ifndef ZEPHYR_SUBSYS_TESTSUITE_INCLUDE_ZEPHYR_FFF_EXTENSIONS_H_
14#define ZEPHYR_SUBSYS_TESTSUITE_INCLUDE_ZEPHYR_FFF_EXTENSIONS_H_
15
16#include <zephyr/fff.h>
17#include <zephyr/sys/util.h> /* for CONTAINER_OF */
18
79#define RETURN_HANDLED_CONTEXT(FUNCNAME, \
80 CONTEXTTYPE, RESULTFIELD, CONTEXTPTRNAME, HANDLERBODY) \
81 if (FUNCNAME##_fake.return_val_seq_len) { \
82 CONTEXTTYPE * const contexts = \
83 CONTAINER_OF(FUNCNAME##_fake.return_val_seq, \
84 CONTEXTTYPE, RESULTFIELD); \
85 size_t const seq_idx = (FUNCNAME##_fake.return_val_seq_idx < \
86 FUNCNAME##_fake.return_val_seq_len) ? \
87 FUNCNAME##_fake.return_val_seq_idx++ :\
88 FUNCNAME##_fake.return_val_seq_idx - 1;\
89 CONTEXTTYPE * const CONTEXTPTRNAME = &contexts[seq_idx]; \
90 HANDLERBODY; \
91 } \
92 return FUNCNAME##_fake.return_val
93
98#endif /* ZEPHYR_SUBSYS_TESTSUITE_INCLUDE_ZEPHYR_FFF_EXTENSIONS_H_ */
Misc utilities.