From f1948736400453fed59078051298b55e49a7b725 Mon Sep 17 00:00:00 2001 From: fdai7207 Date: Fri, 10 Feb 2023 03:16:09 +0100 Subject: [PATCH] implement unit tests for the isValidAdress() function. --- src/createEmployeeAccount.c | 13 ++++----- src/createEmployeeAccount.h | 7 +++-- tests/test_createEmployeeAccount.c | 47 +++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/src/createEmployeeAccount.c b/src/createEmployeeAccount.c index c7fac7c..39f2bac 100644 --- a/src/createEmployeeAccount.c +++ b/src/createEmployeeAccount.c @@ -80,20 +80,20 @@ bool isValidPhoneNumber(char *phoneNumber) return true; } -bool isValidAdress(char *street,int houseNumber,char* city,int postalCode) +bool isValidAdress(char *street,char* city,int houseNumber,int postalCode) { - int maximalLength = 20; - int minimalLength = 3; + int lengthMax = 20; + int LengthMin = 3; bool validStreet = true; bool validHouseNumber = true; bool validCity = true; bool validpostalCode = true; - if(strlen(street)>20 || strlen(street)<3) + if(strlen(street)>lengthMax || strlen(street)20 || strlen(city)<3) + if(strlen(city)>lengthMax || strlen(city)