Browse Source

Add Whitespace Test with many Spaces

fix Whitespace function
remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
00423f02e1
  1. 1
      src/inputHandling.c
  2. 11
      test/test_inputHandling.c

1
src/inputHandling.c

@ -26,6 +26,7 @@ void deleteWhitespace(char* formulaString, int length){
for (int j=stringPos; j < length; j++){
formulaString[j]=formulaString[j + 1];
}
stringPos--;
}
}
}

11
test/test_inputHandling.c

@ -5,6 +5,7 @@
#include "inputHandling.h"
char halloWelt[]="Hallo Welt";
char halloWelt2[]="Hallo Welt";
char halloWelt3[]="Ha llo W el t ";
void setUp(void)
{
@ -22,8 +23,14 @@ void test_inputHandling_deleteOneWhiteSpace(void)
void test_inputHandling_deleteTwoWhiteSpaces(void)
{
deleteWhitespace(halloWelt, 11);
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt);
deleteWhitespace(halloWelt2, 11);
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt2);
}
void test_inputHandling_deleteManyWhiteSpaces(void)
{
deleteWhitespace(halloWelt3, 16);
TEST_ASSERT_EQUAL_STRING("HalloWelt", halloWelt3);
}
#endif // TEST
Loading…
Cancel
Save