From 59dbe0e96e92eca4a202ee72ef6ee9eeb5c401e6 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Thu, 2 Feb 2023 11:03:39 +0100 Subject: [PATCH] Implementation of unit tests for everyCharacterIsDigit(). --- test/test_StringManipulation.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_StringManipulation.c b/test/test_StringManipulation.c index 7da5755..6e0e9eb 100644 --- a/test/test_StringManipulation.c +++ b/test/test_StringManipulation.c @@ -4,10 +4,20 @@ #include #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() { - /*test block 1*/ int testValues[] = {1,2,3,4,5,6,7,8,9,10}; int expectedValues[] = {1,4,9,16,25,36,49,64,81,100};