You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#ifdef TEST
#include "unity.h"
#include "../src/updateCustomerAccountBalance.c"
void setUp(void) { }
void tearDown(void) { }
void test_updateAvailableAccountBalanceSuccess(void){
/*
int id1 = 1234; int id2 = 1327; int id3 = 1666;
int newBalance1=500; int newBalance2=800; int newBalance3=700;
bool results1=updateAvailableAccountBalance(id1,newBalance1); bool results2=updateAvailableAccountBalance(id2,newBalance2); bool results3=updateAvailableAccountBalance(id3,newBalance3);
TEST_ASSERT_TRUE(results1); TEST_ASSERT_TRUE(results2); TEST_ASSERT_TRUE(results3); */ /* Arrange */
int length = 5;
float amountToUpdate[] = {200.5, 340, 244.5, 340, 1200}; int userIDs[] = {1234,1235,1236,1237,1238};
float expectedValue[length]; bool result[length];
/* Act */
for (int i = 0; i < length; i++) { result[i] = updateAvailableAccountBalance(userIDs[i],amountToUpdate[i]); }
/* Assert */
for (int i = 0; i < length; i++) { TEST_ASSERT_TRUE(result[i]); } } void test_failOpenFile(void) {
/* Act and assert */
FILE *file = fopen("false_file_name", "r");
TEST_ASSERT_FALSE(file);
} #endif
|