From 80b26f2a6dba01794228bf6653ae191eaf111683 Mon Sep 17 00:00:00 2001 From: fdai7207 Date: Tue, 7 Feb 2023 23:09:08 +0100 Subject: [PATCH] implement unit tests for the new function isvalidName(). --- src/createEmployeeAccount.c | 19 ++++++++++++ src/createEmployeeAccount.h | 1 + tests/test_createEmployeeAccount.c | 50 +++++++++++++++++++++++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/createEmployeeAccount.c b/src/createEmployeeAccount.c index 47c6eb9..b298929 100644 --- a/src/createEmployeeAccount.c +++ b/src/createEmployeeAccount.c @@ -48,6 +48,24 @@ bool isValidPassword( char *password, int minimumLength) } +bool isValidName(char* name, int minimalLength) +{ + if(strlen(name) < minimalLength) + { + return false; + } + + for(int i = 0;i