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.
 
 
 
 

93 lines
1.7 KiB

#ifdef TEST
#include "unity.h"
#include "createEmployeeAccount.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_isValidEmployeeID(void)
{
/*Arrange*/
char* validEmployeeId [] = {"Atharva","Can","Haytham","Julius","Mohamed","Shivam","Fizz","Buzz","JohnDoe","Foobar","waz","Objectoriented","INSTITUTIONALISATIOL","Intercommunicational","1234","1.6"};
bool validEmployeeIdResult[15];
/*Act*/
for(int i=0; i<15; i++)
{
validEmployeeIdResult[i] = isValidEmployeeID(validEmployeeId[i]);
}
/*Assert*/
for(int i =0; i<15;i++)
{
TEST_ASSERT_TRUE(validEmployeeIdResult[i]);
}
}
void test_isNotValidEmployeeID(void)
{
/*Arrange*/
char* invalidEmployeeId [] = {"Atha rva","Ca n","Geschwindigkeitsbegrenzungen","1234 15","John Doe","fizz Fuzz"};
bool invalidEmployeeIdResult[6];
/*Act*/
for(int i=0; i<6; i++)
{
invalidEmployeeIdResult[i] = isValidEmployeeID(invalidEmployeeId[i]);
}
/*Assert*/
for(int i =0; i<6;i++)
{
TEST_ASSERT_FALSE(invalidEmployeeIdResult[i]);
}
}
void test_employeeCreatedSuccessfully(void)
{
/*Arrange*/
char* potentialEmployees[][2] = {
{"John", "Doe"},
{"Fizz", "Buzz"},
{"Jane", "Doe"},
{"Foo", "Bar"},
{"MusterMann", "MusterManPassword"},
{"MusterFrau", "MusterFrauPassword"}
};
bool expected[6] = {true,true,true,true,true,true};
bool result[6];
/*Act*/
for(int i=0; i<6;i++)
{
result[i] = createNewEmployee(potentialEmployees[i][0],potentialEmployees[i][1]);
}
/*Assert*/
for(int i=0; i<6;i++)
{
TEST_ASSERT_EQUAL(expected[i],result[i]);
}
}
#endif // TEST