From e8e328744af6a37b7f2faebdbc1653b8b653433c Mon Sep 17 00:00:00 2001 From: Dennis Sperzel Date: Mon, 29 Jan 2024 21:17:43 +0100 Subject: [PATCH] testing: addition full adder complete sum without carry --- test/test_addition.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_addition.c b/test/test_addition.c index de01d4f..51a9c46 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -34,4 +34,22 @@ void test_addition_full_adder_nullplusnullgleichnullmituebertrag(void) TEST_ASSERT_EQUAL_INT(expected, result[0]); } +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); + + TEST_ASSERT_EQUAL_INT(expected[0], result[0]); + TEST_ASSERT_EQUAL_INT(expected[1], result[1]); + TEST_ASSERT_EQUAL_INT(expected[2], result[2]); + TEST_ASSERT_EQUAL_INT(expected[3], result[3]); + TEST_ASSERT_EQUAL_INT(expected[4], result[4]); +} + #endif // TEST