tests: kconfig: functions: Add min/max functions
Add test case for kconfig min/max functions. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
parent
2f234c627c
commit
555a56f262
2 changed files with 34 additions and 0 deletions
|
@ -89,4 +89,28 @@ config KCONFIG_ARITHMETIC_ADD_INC_1_1
|
||||||
int
|
int
|
||||||
default $(add, $(inc, 1, 1))
|
default $(add, $(inc, 1, 1))
|
||||||
|
|
||||||
|
config KCONFIG_MIN_10
|
||||||
|
int
|
||||||
|
default $(min, 10)
|
||||||
|
|
||||||
|
config KCONFIG_MIN_10_3
|
||||||
|
int
|
||||||
|
default $(min, 10, 3)
|
||||||
|
|
||||||
|
config KCONFIG_MIN_10_3_2
|
||||||
|
int
|
||||||
|
default $(min, 10, 3, 2)
|
||||||
|
|
||||||
|
config KCONFIG_MAX_10
|
||||||
|
int
|
||||||
|
default $(max, 10)
|
||||||
|
|
||||||
|
config KCONFIG_MAX_10_3
|
||||||
|
int
|
||||||
|
default $(max, 10, 3)
|
||||||
|
|
||||||
|
config KCONFIG_MAX_10_3_2
|
||||||
|
int
|
||||||
|
default $(max, 10, 3, 2)
|
||||||
|
|
||||||
source "Kconfig.zephyr"
|
source "Kconfig.zephyr"
|
||||||
|
|
|
@ -35,4 +35,14 @@ ZTEST(test_kconfig_functions, test_arithmetic)
|
||||||
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_INC_1_1, (1 + 1) + (1 + 1));
|
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_INC_1_1, (1 + 1) + (1 + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZTEST(test_kconfig_functions, test_min_max)
|
||||||
|
{
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MIN_10, 10);
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MIN_10_3, MIN(10, 3));
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MIN_10_3_2, MIN(MIN(10, 3), 2));
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MAX_10, 10);
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MAX_10_3, MAX(10, 3));
|
||||||
|
zassert_equal(CONFIG_KCONFIG_MAX_10_3_2, MAX(MAX(10, 3), 2));
|
||||||
|
}
|
||||||
|
|
||||||
ZTEST_SUITE(test_kconfig_functions, NULL, NULL, NULL, NULL, NULL);
|
ZTEST_SUITE(test_kconfig_functions, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue