Skip to content

Commit

Permalink
tests: kconfig: functions: Add min/max functions
Browse files Browse the repository at this point in the history
Add test case for kconfig min/max functions.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt authored and carlescufi committed Aug 2, 2024
1 parent 2f234c6 commit 555a56f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/kconfig/functions/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,28 @@ config KCONFIG_ARITHMETIC_ADD_INC_1_1
int
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"
10 changes: 10 additions & 0 deletions tests/kconfig/functions/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ ZTEST(test_kconfig_functions, test_arithmetic)
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);

0 comments on commit 555a56f

Please sign in to comment.