Browse Source

Implementation of unit tests for isLetterOfAlphabet.

remotes/origin/development
fdai7057 2 years ago
parent
commit
7d7f8f6ace
  1. 1
      test/test_CreateCustomer.c
  2. 1
      test/test_LoginCustomer.c
  3. 30
      test/test_StringManipulation.c

1
test/test_CreateCustomer.c

@ -2,6 +2,7 @@
#include <limits.h>
#include <math.h>
#include "../src/stringManipulation.c"
#include "../src/error.c"
#include "../src/createCustomer.c"
void setUp(){}

1
test/test_LoginCustomer.c

@ -1,6 +1,7 @@
#include <unity.h>
#include "../src/loginCustomer.c"
#include "../src/stringManipulation.c"
#include "../src/error.c"
void setUp(){};
void tearDown(){};
void test_checkLogin()

30
test/test_StringManipulation.c

@ -4,6 +4,36 @@
#include <unity.h>
#include "../src/stringManipulation.c"
void test_isLetterOfAlphabet()
{
/*test block 1*/
char *testStringsToTrue[] = {"adhj","kasdlwq","vbeuqor","kalkwyynmakj","kakswxl","akljlxjkcyxyklj","asdjhuwpwe","xbcvddd","klajksdjkl","ghghgtie","kajsd"};
unsigned int numberOfElements = sizeof(testStringsToTrue) / sizeof(char *);
for(int i=0;i<numberOfElements;++i){
TEST_ASSERT_TRUE(isLetterOfAlphabet(testStringsToTrue[i]));
}
/*test block 2*/
char *testStringsToTrue_2[] = {"bcjyxhkjyxchjqwo","tree","garden","thinker","philosophy","linux","computer","lesson","teacher","table","drink","water","every", "Frank","city","economic","programming","task","smart","smarter","smartest","dumb","wood","animals","forest","display","hot","cold","ice","bear","keyboard","pair","pencil"};
numberOfElements = sizeof(testStringsToTrue_2) / sizeof(char *);
for(int i=0;i<numberOfElements;++i){
TEST_ASSERT_TRUE(isLetterOfAlphabet(testStringsToTrue_2[i]));
}
/*test block 3*/
char *testStringsToFalse[] = {"ashjdkj32123","4213jashj","laskdj2","1sbabjsdh","askjasdkjd0","123932131a","abcd2hutz","81287asjk231jkhs","aslkjasdlkjsd123","cbc451873"};
numberOfElements = sizeof(testStringsToFalse) / sizeof(char *);
for(int i=0;i<numberOfElements;++i){
TEST_ASSERT_FALSE(isLetterOfAlphabet(testStringsToFalse[i]));
}
/*test block 4*/
char *testStringsToFalse_2[] = {"1234","56789","00000010101010","3748927398273498","757575757","1726371238726","19237182937192837","875378612873621","128973192837","99494949499929292929292938382828","1827391237981273","7481263871236782136"};
numberOfElements = sizeof(testStringsToFalse_2) / sizeof(char *);
for(int i=0;i<numberOfElements;++i){
TEST_ASSERT_FALSE(isLetterOfAlphabet(testStringsToFalse_2[i]));
}
}
void test_toUnsignedInteger()
{
/*test block 1*/

Loading…
Cancel
Save