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.
 
 
 
 

111 lines
2.4 KiB

#ifdef TEST
#include "unity.h"
#include "employeeLogin.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_SuccessfulLoginEmployee_(void)
{
//test case : 0
/*Arrange*/
char* validEmployeesCredentials[][2] = {
{"Atharva", "Atharvafdai7514"},
{"Can", "BlooMaskfdlt3817"},
{"Haytham", "TimoDLfdai7207"},
{"Julius", "Insertcatfdai7057"},
{"Mohamed", "MDfdai6618"},
{"Shivam", "Schivam007fdlt3781"}
};
/*Act and Assert*/
int expected[] = {1,1,1,1,1,1};
for(int i=0; i<6; i++)
{
int result = checkEmployeeCredentials(validEmployeesCredentials[i][0], validEmployeesCredentials[i][1]);
TEST_ASSERT_EQUAL_INT(expected[i],result);
}
}
void test_WrongInfosLoginEmployee(void)
{
//test case : 1
/*Arrange*/
char* wrongEmployeesCredentials[][2] = {
{"Atharva", "doe"},
{"Can", "Bar"},
{"Haytham", "buzz"},
{"Julius", "fizz"},
{"Mohamed", "muster"},
{"Shivam", "TimoDL"}
};
/*Act and Assert*/
int expected[] = {2,2,2,2,2,2};
for(int i=0; i<6; i++)
{
int result = checkEmployeeCredentials(wrongEmployeesCredentials[i][0], wrongEmployeesCredentials[i][1]);
TEST_ASSERT_EQUAL_INT(expected[i],result);
}
}
void test_MissingLoginEmployee(void)
{
//test case : 2
/*Arrange*/
char* missingEmployeesCredentials[][2] = {
{"John", "doe"},
{"Jane", "Doe"},
{"Foo", "Bar"},
{"Fizz", "Buzz"},
{"Musterman", "Mustermanpassword"},
{"Musterfrau", "Musterfraupassword"}
};
int expected[] = {0,0,0,0,0,0};
/*Act and Assert*/
for(int i=0; i<6; i++)
{
int result = checkEmployeeCredentials(missingEmployeesCredentials[i][0], missingEmployeesCredentials[i][1]);
TEST_ASSERT_EQUAL_INT(expected[i],result);
}
}
#endif // TEST