From acc3fd487da39e38c0d50e6e1e2240d8d4401598 Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 14:57:51 +0100 Subject: [PATCH] Create simple test for depositMoney --- tests/test_depositMoney.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/test_depositMoney.c diff --git a/tests/test_depositMoney.c b/tests/test_depositMoney.c new file mode 100644 index 0000000..39a8b33 --- /dev/null +++ b/tests/test_depositMoney.c @@ -0,0 +1,39 @@ +#ifdef TEST + +#include "unity.h" +#include "depositMoney.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_depositSpecificAmount(void) { + + /* Arrange */ + + int length = 5; + int userIDs[] = {1234,1235,1236,1237,1238}; + float amountToDeposit[] = {200.5, 340, 244.5, 340, 1200}; + + bool result[length]; + + /* Act */ + + for (int i = 0; i < length; i++) { + result[i] = depositSpecificAmount( userIDs[i], amountToDeposit[i] ); + } + + /* Assert */ + + for (int i = 0; i < length; i++) { + TEST_ASSERT_TRUE(result[i]); + } + +} + + +#endif // TEST