diff --git a/test/test_addition.c b/test/test_addition.c index 89ddcd2..0d97725 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -133,6 +133,24 @@ void test_addition_addition_allunsignedinteger(void) TEST_ASSERT_EQUAL_UINT(expected[4], result[4]); } +void test_addition_signnumber(void) { + unsigned int result[2]; + unsigned int expected[2] = { 0, 1 }; + union { + float f; + unsigned int i; + }a; + + a.f = 1; + result[0] = s(a.i); + + a.f = -1; + result[1] = s(a.i); + + TEST_ASSERT_EQUAL_UINT(expected[0], result[0]); + TEST_ASSERT_EQUAL_UINT(expected[1], result[1]); +} + void test_addition_addition_float_0plus0gleich0(void) { float result; float expected = 0.0;