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.

75 lines
1.6 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "createEmployeeAccount.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_isValidEmployeeID(void)
  11. {
  12. /*Arrange*/
  13. char* validEmployeeId [] = {"Atharva","Can","Haytham","Julius","Mohamed","Shivam","Fizz","Buzz","JohnDoe","Foobar","waz","Objectoriented","INSTITUTIONALISATIOL","Intercommunicational","1234","1.6"};
  14. bool validEmployeeIdExpected = true;
  15. /*Act and Assert*/
  16. for(int i=0; i<15; i++)
  17. {
  18. bool validEmployeeIdResult = isValidEmployeeID(validEmployeeId[i]);
  19. TEST_ASSERT_EQUAL(validEmployeeIdExpected,validEmployeeIdResult);
  20. }
  21. }
  22. void test_isNotValidEmployeeID(void)
  23. {
  24. /*Arrange*/
  25. char* invalidEmployeeId [] = {"Atha rva","Ca n","Geschwindigkeitsbegrenzungen","1234 15","John Doe","fizz Fuzz"};
  26. bool invalidEmployeeIdExpected = false;
  27. /*Act and Assert*/
  28. for(int i=0; i<6; i++)
  29. {
  30. bool invalidEmployeeIdResult = isValidEmployeeID(invalidEmployeeId[i]);
  31. TEST_ASSERT_EQUAL(invalidEmployeeIdExpected,invalidEmployeeIdResult);
  32. }
  33. }
  34. void test_employeeCreatedSuccessfully(void)
  35. {
  36. /*Arrange*/
  37. char* potentialEmployees[][2] = {
  38. {"John", "Doe"},
  39. {"Fizz", "Buzz"},
  40. {"Jane", "Doe"},
  41. {"Foo", "Bar"},
  42. {"MusterMann", "MusterManPassword"},
  43. {"MusterFrau", "MusterFrauPassword"}
  44. };
  45. bool expected = true;
  46. bool result;
  47. /*Act and Assert*/
  48. for(int i=0; i<6;i++)
  49. {
  50. result = createNewEmployee(potentialEmployees[i][0],potentialEmployees[i][1]);
  51. TEST_ASSERT_EQUAL(expected,result);
  52. }
  53. }
  54. #endif // TEST