|
@ -17,129 +17,94 @@ void test_SuccessfulLoginEmployee_(void) |
|
|
|
|
|
|
|
|
//test case : 0 |
|
|
//test case : 0 |
|
|
|
|
|
|
|
|
//Arrange |
|
|
|
|
|
char* ExistingEmployee1 = "Atharva"; |
|
|
|
|
|
char* ExistingPassword1 = "Atharvafdai7514"; |
|
|
|
|
|
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
|
char* ExistingEmployee2 = "Can"; |
|
|
|
|
|
char* ExistingPassword2 = "BlooMaskfdlt3817"; |
|
|
|
|
|
|
|
|
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++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
char* ExistingEmployee5 = "Mohamed"; |
|
|
|
|
|
char* ExistingPassword5 = "MDfdai6618"; |
|
|
|
|
|
|
|
|
int result = checkEmployeeCredentials(validEmployeesCredentials[i][0], validEmployeesCredentials[i][1]); |
|
|
|
|
|
|
|
|
char* ExistingEmployee6 = "Shivam"; |
|
|
|
|
|
char* ExistingPassword6 = "Schivam007fdlt3781"; |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected[i],result); |
|
|
|
|
|
|
|
|
//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) |
|
|
void test_WrongInfosLoginEmployee(void) |
|
|
{ |
|
|
{ |
|
|
//test case : 1 |
|
|
//test case : 1 |
|
|
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
|
//Arrange |
|
|
|
|
|
char* wrongInfoEmployee1 = "Atharva"; |
|
|
|
|
|
char* wrongInfoPassword1 = "doe"; |
|
|
|
|
|
|
|
|
char* wrongEmployeesCredentials[][2] = { |
|
|
|
|
|
{"Atharva", "doe"}, |
|
|
|
|
|
{"Can", "Bar"}, |
|
|
|
|
|
{"Haytham", "buzz"}, |
|
|
|
|
|
{"Julius", "fizz"}, |
|
|
|
|
|
{"Mohamed", "muster"}, |
|
|
|
|
|
{"Shivam", "TimoDL"} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
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) |
|
|
void test_MissingLoginEmployee(void) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
//test case : 2 |
|
|
//test case : 2 |
|
|
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
|
//Arrange |
|
|
|
|
|
|
|
|
|
|
|
char* missingEmployee1 = "John"; |
|
|
|
|
|
char* missingPassword1 = "Doe"; |
|
|
|
|
|
|
|
|
char* missingEmployeesCredentials[][2] = { |
|
|
|
|
|
{"John", "doe"}, |
|
|
|
|
|
{"Jane", "Doe"}, |
|
|
|
|
|
{"Foo", "Bar"}, |
|
|
|
|
|
{"Fizz", "Buzz"}, |
|
|
|
|
|
{"Musterman", "Mustermanpassword"}, |
|
|
|
|
|
{"Musterfrau", "Musterfraupassword"} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
char* missingEmployee2 = "Jane"; |
|
|
|
|
|
char* missingPassword2 = "Doe"; |
|
|
|
|
|
|
|
|
int expected[] = {0,0,0,0,0,0}; |
|
|
|
|
|
|
|
|
char* missingEmployee3 = "Foo"; |
|
|
|
|
|
char* missingPassword3 = "Bar"; |
|
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
|
char* missingEmployee4 = "Mustermann"; |
|
|
|
|
|
char* missingPassword4 = "PassMustermann"; |
|
|
|
|
|
|
|
|
for(int i=0; i<6; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
char* missingEmployee5 = "Musterfrau"; |
|
|
|
|
|
char* missingPassword5 = "PassMusterfrau"; |
|
|
|
|
|
|
|
|
int result = checkEmployeeCredentials(missingEmployeesCredentials[i][0], missingEmployeesCredentials[i][1]); |
|
|
|
|
|
|
|
|
char* missingEmployee6 = "Fizz"; |
|
|
|
|
|
char* missingPassword6 = "Buzz"; |
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected[i],result); |
|
|
|
|
|
|
|
|
//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); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|