|
|
@ -17,130 +17,95 @@ void test_SuccessfulLoginEmployee_(void) |
|
|
|
|
|
|
|
//test case : 0 |
|
|
|
|
|
|
|
//Arrange |
|
|
|
char* ExistingEmployee1 = "Atharva"; |
|
|
|
char* ExistingPassword1 = "Atharvafdai7514"; |
|
|
|
|
|
|
|
char* ExistingEmployee2 = "Can"; |
|
|
|
char* ExistingPassword2 = "BlooMaskfdlt3817"; |
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
char* validEmployeesCredentials[][2] = { |
|
|
|
{"Atharva", "Atharvafdai7514"}, |
|
|
|
{"Can", "BlooMaskfdlt3817"}, |
|
|
|
{"Haytham", "TimoDLfdai7207"}, |
|
|
|
{"Julius", "Insertcatfdai7057"}, |
|
|
|
{"Mohamed", "MDfdai6618"}, |
|
|
|
{"Shivam", "Schivam007fdlt3781"} |
|
|
|
}; |
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
char* ExistingEmployee3 = "Haytham"; |
|
|
|
char* ExistingPassword3 = "TimoDLfdai7207"; |
|
|
|
int expected[] = {1,1,1,1,1,1}; |
|
|
|
|
|
|
|
char* ExistingEmployee4 = "Julius"; |
|
|
|
char* ExistingPassword4 = "Insertcatfdai7057"; |
|
|
|
for(int i=0; i<6; i++) |
|
|
|
{ |
|
|
|
|
|
|
|
int result = checkEmployeeCredentials(validEmployeesCredentials[i][0], validEmployeesCredentials[i][1]); |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected[i],result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
char* ExistingEmployee5 = "Mohamed"; |
|
|
|
char* ExistingPassword5 = "MDfdai6618"; |
|
|
|
|
|
|
|
char* ExistingEmployee6 = "Shivam"; |
|
|
|
char* ExistingPassword6 = "Schivam007fdlt3781"; |
|
|
|
|
|
|
|
//Act |
|
|
|
|
|
|
|
int result1 = checkEmployeeCredentials(ExistingEmployee1,ExistingPassword1); |
|
|
|
int result2 = checkEmployeeCredentials(ExistingEmployee2,ExistingPassword2); |
|
|
|
int result3 = checkEmployeeCredentials(ExistingEmployee3,ExistingPassword3); |
|
|
|
int result4 = checkEmployeeCredentials(ExistingEmployee4,ExistingPassword4); |
|
|
|
int result5 = checkEmployeeCredentials(ExistingEmployee5,ExistingPassword5); |
|
|
|
int result6 = checkEmployeeCredentials(ExistingEmployee6,ExistingPassword6); |
|
|
|
|
|
|
|
//Assert |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(1,result1); |
|
|
|
TEST_ASSERT_EQUAL_INT(1,result2); |
|
|
|
TEST_ASSERT_EQUAL_INT(1,result3); |
|
|
|
TEST_ASSERT_EQUAL_INT(1,result4); |
|
|
|
TEST_ASSERT_EQUAL_INT(1,result5); |
|
|
|
TEST_ASSERT_EQUAL_INT(1,result6); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void test_WrongInfosLoginEmployee(void) |
|
|
|
{ |
|
|
|
//test case : 1 |
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
char* wrongEmployeesCredentials[][2] = { |
|
|
|
{"Atharva", "doe"}, |
|
|
|
{"Can", "Bar"}, |
|
|
|
{"Haytham", "buzz"}, |
|
|
|
{"Julius", "fizz"}, |
|
|
|
{"Mohamed", "muster"}, |
|
|
|
{"Shivam", "TimoDL"} |
|
|
|
}; |
|
|
|
|
|
|
|
//Arrange |
|
|
|
char* wrongInfoEmployee1 = "Atharva"; |
|
|
|
char* wrongInfoPassword1 = "doe"; |
|
|
|
|
|
|
|
char* wrongInfoEmployee2 = "Can"; |
|
|
|
char* wrongInfoPassword2 = "Bar"; |
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
char* wrongInfoEmployee3 = "Haytham"; |
|
|
|
char* wrongInfoPassword3 = "buzz"; |
|
|
|
int expected[] = {2,2,2,2,2,2}; |
|
|
|
|
|
|
|
char* wrongInfoEmployee4 = "Julius"; |
|
|
|
char* wrongInfoPassword4 = "Musterpass"; |
|
|
|
for(int i=0; i<6; i++) |
|
|
|
{ |
|
|
|
|
|
|
|
char* wrongInfoEmployee5 = "Mohamed"; |
|
|
|
char* wrongInfoPassword5 = "Irgendwas"; |
|
|
|
int result = checkEmployeeCredentials(wrongEmployeesCredentials[i][0], wrongEmployeesCredentials[i][1]); |
|
|
|
|
|
|
|
char* wrongInfoEmployee6 = "Shivam"; |
|
|
|
char* wrongInfoPassword6 = "John"; |
|
|
|
TEST_ASSERT_EQUAL_INT(expected[i],result); |
|
|
|
|
|
|
|
//Act |
|
|
|
} |
|
|
|
|
|
|
|
int result1 = checkEmployeeCredentials(wrongInfoEmployee1,wrongInfoPassword1); |
|
|
|
int result2 = checkEmployeeCredentials(wrongInfoEmployee2,wrongInfoPassword2); |
|
|
|
int result3 = checkEmployeeCredentials(wrongInfoEmployee3,wrongInfoPassword3); |
|
|
|
int result4 = checkEmployeeCredentials(wrongInfoEmployee4,wrongInfoPassword4); |
|
|
|
int result5 = checkEmployeeCredentials(wrongInfoEmployee5,wrongInfoPassword5); |
|
|
|
int result6 = checkEmployeeCredentials(wrongInfoEmployee6,wrongInfoPassword6); |
|
|
|
|
|
|
|
//Assert |
|
|
|
} |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(2,result1); |
|
|
|
TEST_ASSERT_EQUAL_INT(2,result2); |
|
|
|
TEST_ASSERT_EQUAL_INT(2,result3); |
|
|
|
TEST_ASSERT_EQUAL_INT(2,result4); |
|
|
|
TEST_ASSERT_EQUAL_INT(2,result5); |
|
|
|
TEST_ASSERT_EQUAL_INT(2,result6); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//Arrange |
|
|
|
|
|
|
|
char* missingEmployee1 = "John"; |
|
|
|
char* missingPassword1 = "Doe"; |
|
|
|
|
|
|
|
char* missingEmployee2 = "Jane"; |
|
|
|
char* missingPassword2 = "Doe"; |
|
|
|
|
|
|
|
char* missingEmployee3 = "Foo"; |
|
|
|
char* missingPassword3 = "Bar"; |
|
|
|
|
|
|
|
char* missingEmployee4 = "Mustermann"; |
|
|
|
char* missingPassword4 = "PassMustermann"; |
|
|
|
|
|
|
|
char* missingEmployee5 = "Musterfrau"; |
|
|
|
char* missingPassword5 = "PassMusterfrau"; |
|
|
|
|
|
|
|
char* missingEmployee6 = "Fizz"; |
|
|
|
char* missingPassword6 = "Buzz"; |
|
|
|
|
|
|
|
//Act |
|
|
|
int result1 = checkEmployeeCredentials(missingEmployee1,missingPassword1); |
|
|
|
int result2 = checkEmployeeCredentials(missingEmployee2,missingPassword2); |
|
|
|
int result3 = checkEmployeeCredentials(missingEmployee3,missingPassword3); |
|
|
|
int result4 = checkEmployeeCredentials(missingEmployee4,missingPassword4); |
|
|
|
int result5 = checkEmployeeCredentials(missingEmployee5,missingPassword5); |
|
|
|
int result6 = checkEmployeeCredentials(missingEmployee6,missingPassword6); |
|
|
|
|
|
|
|
//Assert |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result1); |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result2); |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result3); |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result4); |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result5); |
|
|
|
TEST_ASSERT_EQUAL_INT(0,result6); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |