mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:52:44 +01:00
tests/unittests: add tests for MAX()/MIN() macros
This commit is contained in:
parent
45c1441e4d
commit
8e3bbca8b5
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user