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

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "employeeLogin.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_SuccessfulLoginEmployee_(void)
  11. {
  12. //test case : 0
  13. /*Arrange*/
  14. char* validEmployeesCredentials[][2] = {
  15. {"Atharva", "Atharvafdai7514"},
  16. {"Can", "BlooMaskfdlt3817"},
  17. {"Haytham", "TimoDLfdai7207"},
  18. {"Julius", "Insertcatfdai7057"},
  19. {"Mohamed", "MDfdai6618"},
  20. {"Shivam", "Schivam007fdlt3781"}
  21. };
  22. /*Act and Assert*/
  23. int expected[] = {1,1,1,1,1,1};
  24. for(int i=0; i<6; i++)
  25. {
  26. int result = checkEmployeeCredentials(validEmployeesCredentials[i][0], validEmployeesCredentials[i][1]);
  27. TEST_ASSERT_EQUAL_INT(expected[i],result);
  28. }
  29. }
  30. void test_WrongInfosLoginEmployee(void)
  31. {
  32. //test case : 1
  33. /*Arrange*/
  34. char* wrongEmployeesCredentials[][2] = {
  35. {"Atharva", "doe"},
  36. {"Can", "Bar"},
  37. {"Haytham", "buzz"},
  38. {"Julius", "fizz"},
  39. {"Mohamed", "muster"},
  40. {"Shivam", "TimoDL"}
  41. };
  42. /*Act and Assert*/
  43. int expected[] = {2,2,2,2,2,2};
  44. for(int i=0; i<6; i++)
  45. {
  46. int result = checkEmployeeCredentials(wrongEmployeesCredentials[i][0], wrongEmployeesCredentials[i][1]);
  47. TEST_ASSERT_EQUAL_INT(expected[i],result);
  48. }
  49. }
  50. void test_MissingLoginEmployee(void)
  51. {
  52. //test case : 2
  53. /*Arrange*/
  54. char* missingEmployeesCredentials[][2] = {
  55. {"John", "doe"},
  56. {"Jane", "Doe"},
  57. {"Foo", "Bar"},
  58. {"Fizz", "Buzz"},
  59. {"Musterman", "Mustermanpassword"},
  60. {"Musterfrau", "Musterfraupassword"}
  61. };
  62. int expected[] = {0,0,0,0,0,0};
  63. /*Act and Assert*/
  64. for(int i=0; i<6; i++)
  65. {
  66. int result = checkEmployeeCredentials(missingEmployeesCredentials[i][0], missingEmployeesCredentials[i][1]);
  67. TEST_ASSERT_EQUAL_INT(expected[i],result);
  68. }
  69. }
  70. #endif // TEST