diff --git a/tests/unittests/tests-core/tests-core-macros.c b/tests/unittests/tests-core/tests-core-macros.c index 76b5b4554f..9cbcd67085 100644 --- a/tests/unittests/tests-core/tests-core-macros.c +++ b/tests/unittests/tests-core/tests-core-macros.c @@ -12,6 +12,25 @@ #include "embUnit.h" #include "tests-core.h" #include "macros/math.h" +#include "macros/utils.h" + +static void test_max(void) +{ + TEST_ASSERT_EQUAL_INT(10, MAX(5, 10)); + TEST_ASSERT_EQUAL_INT(10, MAX(10, 5)); + + // prove it works with non-integer types + TEST_ASSERT(22.1 == MAX(22.1, 5.5)); +} + +static void test_min(void) +{ + TEST_ASSERT_EQUAL_INT(5, MIN(5, 10)); + TEST_ASSERT_EQUAL_INT(5, MIN(10, 5)); + + // prove it works with non-integer types + TEST_ASSERT(5.5 == MIN(22.1, 5.5)); +} static void test_math_signof(void) { @@ -81,6 +100,8 @@ static void test_math_div_round_inf(void) Test *tests_core_macros_tests(void) { EMB_UNIT_TESTFIXTURES(fixtures) { + new_TestFixture(test_max), + new_TestFixture(test_min), new_TestFixture(test_math_signof), new_TestFixture(test_math_div_round), new_TestFixture(test_math_div_round_up),