exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

test_isogram.c (1800B)


      1 #include "vendor/unity.h"
      2 #include "../src/isogram.h"
      3 #include <stdlib.h>
      4 
      5 void setUp(void)
      6 {
      7 }
      8 
      9 void tearDown(void)
     10 {
     11 }
     12 
     13 void test_empty_string(void)
     14 {
     15    TEST_ASSERT_TRUE(is_isogram(""));
     16 }
     17 
     18 void test_null(void)
     19 {
     20    TEST_ASSERT_FALSE(is_isogram(NULL));
     21 }
     22 
     23 void test_lower_case_only(void)
     24 {
     25    TEST_ASSERT_TRUE(is_isogram("isogram"));
     26 }
     27 
     28 void test_duplicated_letter(void)
     29 {
     30    TEST_ASSERT_FALSE(is_isogram("eleven"));
     31 }
     32 
     33 void test_duplicated_letter_from_end_of_alphabet(void)
     34 {
     35    TEST_ASSERT_FALSE(is_isogram("zzyzx"));
     36 }
     37 
     38 void test_longest_known_isogram(void)
     39 {
     40    TEST_ASSERT_TRUE(is_isogram("subdermatoglyphic"));
     41 }
     42 
     43 void test_same_first_and_last_characters(void)
     44 {
     45    TEST_ASSERT_FALSE(is_isogram("oreo"));
     46 }
     47 
     48 void test_duplicated_letter_mixed_case(void)
     49 {
     50    TEST_ASSERT_FALSE(is_isogram("Alphabet"));
     51 }
     52 
     53 void test_non_letter_char(void)
     54 {
     55    TEST_ASSERT_TRUE(is_isogram("thumbscrew-japingly"));
     56 }
     57 
     58 void test_duplicated_non_letter_char(void)
     59 {
     60    TEST_ASSERT_TRUE(is_isogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
     61 }
     62 
     63 void test_multiple_whitespace(void)
     64 {
     65    TEST_ASSERT_TRUE(is_isogram("Emily Jung Schwartzkopf"));
     66 }
     67 
     68 void test_duplicated_letter_within_word(void)
     69 {
     70    TEST_ASSERT_FALSE(is_isogram("accentor"));
     71 }
     72 
     73 int main(void)
     74 {
     75    UnityBegin("test/test_isogram.c");
     76 
     77    RUN_TEST(test_empty_string);
     78    RUN_TEST(test_null);
     79    RUN_TEST(test_lower_case_only);
     80    RUN_TEST(test_duplicated_letter);
     81    RUN_TEST(test_same_first_and_last_characters);
     82    RUN_TEST(test_duplicated_letter_from_end_of_alphabet);
     83    RUN_TEST(test_longest_known_isogram);
     84    RUN_TEST(test_duplicated_letter_mixed_case);
     85    RUN_TEST(test_non_letter_char);
     86    RUN_TEST(test_duplicated_non_letter_char);
     87    RUN_TEST(test_multiple_whitespace);
     88    RUN_TEST(test_duplicated_letter_within_word);
     89 
     90    UnityEnd();
     91    return 0;
     92 }