Browse Source

testing: addition read sign out of number

master
Dennis Sperzel 11 months ago
parent
commit
f3ee1a219d
  1. 18
      test/test_addition.c

18
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;

Loading…
Cancel
Save