62957ec09f
Enhance the example-application repository with a configurable, trivial library example and associated test cases. . This implementation appears to make no assumptions. . This implementation was verified by running the following commands in an example-application workspace and verifying all tests passed. 1. `west build -b native_posix -p always example-application/tests/lib/custom_lib/` 2. `./build/zephyr/zephyr.exe` 3. `west build -b native_posix -p always example-application/tests/lib/custom_lib/ -- -DCONFIG_CUSTOM_LIB_GET_VALUE_DEFAULT=6` 4. `./build/zephyr/zephyr.exe` 5. `zephyr/scripts/twister -T example-application/tests/ \ -p qemu_cortex_m0` 6. `cd zephyr/doc && make clean && make` built cleanly. . Note that `twister` does not follow the `zephyr/module.yml:tests` setting to discover tests in modules, so the testcase-root must be explicitly provided. Fixes #35177 Signed-off-by: Gregory Shue <gregory.shue@legrand.us>
25 lines
859 B
C
25 lines
859 B
C
/*
|
|
* Copyright (c) 2021, Legrand North America, LLC.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef EXAMPLE_APPLICATION_INCLUDE_CUSTOM_LIB_CUSTOM_LIB_H_
|
|
#define EXAMPLE_APPLICATION_INCLUDE_CUSTOM_LIB_CUSTOM_LIB_H_
|
|
|
|
/**
|
|
* @brief Return parameter if non-zero, or Kconfig-controlled default
|
|
*
|
|
* Function returns the provided value if non-zero, or a Kconfig-controlled
|
|
* default value if the parameter is zero. This trivial function is
|
|
* provided in order to have a library interface example that is trivial
|
|
* to test.
|
|
*
|
|
* @param return_value_if_nonzero Value to return if non-zero
|
|
* @returns return_value_if_nonzero when the parameter is non-zero
|
|
* @returns CONFIG_CUSTOM_LIB_GET_VALUE_DEFAULT if parameter is zero
|
|
*/
|
|
int custom_lib_get_value(int return_value_if_nonzero);
|
|
|
|
#endif /* EXAMPLE_APPLICATION_INCLUDE_CUSTOM_LIB_CUSTOM_LIB_H_ */
|