Browse Source

Implementation of unit tests for everyCharacterIsDigit().

remotes/origin/development
fdai7057 2 years ago
parent
commit
59dbe0e96e
  1. 12
      test/test_StringManipulation.c

12
test/test_StringManipulation.c

@ -4,10 +4,20 @@
#include <unity.h> #include <unity.h>
#include "../src/stringManipulation.c" #include "../src/stringManipulation.c"
void test_everyCharacterIsDigit()
{
/*test values*/
char str_1[] = "1234", str_2[] = "hey123", str_3[] = "good evening!", str_4[] = "äöü";
/*assertions*/
TEST_ASSERT_TRUE(everyCharacterIsDigit(str_1));
TEST_ASSERT_FALSE(everyCharacterIsDigit(str_2));
TEST_ASSERT_FALSE(everyCharacterIsDigit(str_3));
TEST_ASSERT_FALSE(everyCharacterIsDigit(str_4));
}
void test_power() void test_power()
{ {
/*test block 1*/ /*test block 1*/
int testValues[] = {1,2,3,4,5,6,7,8,9,10}; int testValues[] = {1,2,3,4,5,6,7,8,9,10};
int expectedValues[] = {1,4,9,16,25,36,49,64,81,100}; int expectedValues[] = {1,4,9,16,25,36,49,64,81,100};

Loading…
Cancel
Save