From 6ba44193daf7c6b6ee7e59218117e7ef575c53e1 Mon Sep 17 00:00:00 2001 From: Dennis Sperzel Date: Mon, 29 Jan 2024 21:26:48 +0100 Subject: [PATCH] refactoring: full adder preparation for using nextcarry --- test/test_addition.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_addition.c b/test/test_addition.c index 51a9c46..3678b7f 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -4,7 +4,7 @@ #include "addition.h" -int* nullcarry = NULL; +int carry[1]; void setUp(void) { @@ -19,7 +19,7 @@ void test_addition_full_adder_nullplusnullgleichnull(void) int result[1]; int expected = 0; - full_adder(result, nullcarry, 0, 0, 0); + full_adder(result, carry, 0, 0, 0); TEST_ASSERT_EQUAL_INT(expected, result[0]); } @@ -29,7 +29,7 @@ void test_addition_full_adder_nullplusnullgleichnullmituebertrag(void) int result[1]; int expected = 1; - full_adder(result, nullcarry, 0, 0, 1); + full_adder(result, carry, 0, 0, 1); TEST_ASSERT_EQUAL_INT(expected, result[0]); } @@ -39,11 +39,11 @@ void test_addition_full_adder_zahlpluszahlgleichsummeohneuebertrag(void) int result[5]; int expected[5] = { 0, 1, 1, 1, 1}; - full_adder((result+0), nullcarry, 1, 0, 1); - full_adder((result+1), nullcarry, 0, 1, 0); - full_adder((result+2), nullcarry, 1, 0, 0); - full_adder((result+3), nullcarry, 0, 0, 1); - full_adder((result+4), nullcarry, 1, 1, 1); + full_adder((result+0), carry, 1, 0, 1); + full_adder((result+1), carry, 0, 1, 0); + full_adder((result+2), carry, 1, 0, 0); + full_adder((result+3), carry, 0, 0, 1); + full_adder((result+4), carry, 1, 1, 1); TEST_ASSERT_EQUAL_INT(expected[0], result[0]); TEST_ASSERT_EQUAL_INT(expected[1], result[1]);