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.

57 lines
1.2 KiB

11 months ago
11 months ago
11 months ago
  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "inputHandling.h"
  4. char halloWelt[]="Hallo Welt";
  5. char halloWelt2[]="Hallo Welt";
  6. char halloWelt3[]="Ha llo W el t ";
  7. char halloWelt4[]="Ha\n\nllo \r W el\r\r t ";
  8. void setUp(void)
  9. {
  10. }
  11. void tearDown(void)
  12. {
  13. }
  14. void test_inputHandling_deleteOneWhiteSpace(void)
  15. {
  16. deleteWhitespace(halloWelt, 10);
  17. TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt);
  18. }
  19. void test_inputHandling_deleteTwoWhiteSpaces(void)
  20. {
  21. deleteWhitespace(halloWelt2, 11);
  22. TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt2);
  23. }
  24. void test_inputHandling_deleteManyWhiteSpaces(void)
  25. {
  26. deleteWhitespace(halloWelt3, 16);
  27. TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt3);
  28. }
  29. void test_inputHandling_deleteAllOtherCharacter(void)
  30. {
  31. deleteWhitespace(halloWelt4, 19);
  32. TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt4);
  33. }
  34. void test_inputHandling_findAddFunctionType(void)
  35. {
  36. op type = opNotSupported;
  37. type = detectFunctionOperator("4+5", 3);
  38. TEST_ASSERT_TRUE(opAdd == type);
  39. }
  40. void test_inputHandling_findSubFunctionType(void)
  41. {
  42. op type = opNotSupported;
  43. type = detectFunctionOperator("4-5", 3);
  44. TEST_ASSERT_TRUE(opSub == type);
  45. }
  46. #endif // TEST