diff --git a/test/test_isogram.c b/test/test_isogram.c index b71405d..c598dbf 100644 --- a/test/test_isogram.c +++ b/test/test_isogram.c @@ -1,36 +1,20 @@ -#include "../src/isogram.h" -#include "vendor/unity.h" -#include -void setUp(){} -void tearDown(){} -// this is a unit test -void test_empty_string(void) { - TEST_ASSERT_TRUE(is_isogram("")); -} +bool is_isogram(const char phrase[]){ -// this is a unit test -void test_short_isograms(void) { - TEST_ASSERT_TRUE(is_isogram("abc")); - TEST_ASSERT_TRUE(is_isogram("opq")); -} + char string [] = "Wort" -void test_short_non_isograms(void) { - TEST_ASSERT_FALSE(is_isogram("abca")); - TEST_ASSERT_FALSE(is_isogram("opqp")); -} + for (char candidate = 'a'; candidate <= 'z'; candidate++){ + int counter = 0; + for (int i=0; string[i] != 0; i++){ //until it is not 0 (/0 is end of string) + if string[i] == candidate{ + counter++; + } + } -int main(void) { - UnityBegin("isIsogram"); + } - RUN_TEST(test_empty_string); - RUN_TEST(test_short_isograms); - RUN_TEST(test_short_non_isograms); - - UnityEnd(); - return 0; -} +} \ No newline at end of file