blob: d6b2e1ff3f61f55c1ed8c17b9edabcf705c13b7a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#include "vendor/unity.h"
#include "../src/pangram.h"
void setUp(void)
{
}
void tearDown(void)
{
}
static void test_null(void)
{
TEST_ASSERT_FALSE(is_pangram(NULL));
}
static void test_empty_sentence(void)
{
const char sentence[] = "";
TEST_ASSERT_FALSE(is_pangram(sentence));
}
static void test_perfect_lower_case(void)
{
const char sentence[] = "abcdefghijklmnopqrstuvwxyz";
TEST_ASSERT_TRUE(is_pangram(sentence));
}
static void test_only_lower_case(void)
{
const char sentence[] = "the quick brown fox jumps over the lazy dog";
TEST_ASSERT_TRUE(is_pangram(sentence));
}
static void test_missing_letter_x(void)
{
const char sentence[] =
"a quick movement of the enemy will jeopardize five gunboats";
TEST_ASSERT_FALSE(is_pangram(sentence));
}
static void test_missing_letter_h(void)
{
const char sentence[] = "five boxing wizards jump quickly at it";
TEST_ASSERT_FALSE(is_pangram(sentence));
}
static void test_with_underscores(void)
{
const char sentence[] = "the_quick_brown_fox_jumps_over_the_lazy_dog";
TEST_ASSERT_TRUE(is_pangram(sentence));
}
static void test_with_numbers(void)
{
const char sentence[] = "the 1 quick brown fox jumps over the 2 lazy dogs";
TEST_ASSERT_TRUE(is_pangram(sentence));
}
static void test_missing_letters_replaced_by_numbers(void)
{
const char sentence[] = "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog";
TEST_ASSERT_FALSE(is_pangram(sentence));
}
static void test_mixed_case_and_punctuation(void)
{
const char sentence[] = "\"Five quacking Zephyrs jolt my wax bed.\"";
TEST_ASSERT_TRUE(is_pangram(sentence));
}
static void test_case_insensitive(void)
{
const char sentence[] = "the quick brown fox jumps over with lazy FX";
TEST_ASSERT_FALSE(is_pangram(sentence));
}
int main(void)
{
UnityBegin("test/test_pangram.c");
RUN_TEST(test_null);
RUN_TEST(test_empty_sentence);
RUN_TEST(test_perfect_lower_case);
RUN_TEST(test_only_lower_case);
RUN_TEST(test_missing_letter_x);
RUN_TEST(test_missing_letter_h);
RUN_TEST(test_with_underscores);
RUN_TEST(test_with_numbers);
RUN_TEST(test_missing_letters_replaced_by_numbers);
RUN_TEST(test_mixed_case_and_punctuation);
RUN_TEST(test_case_insensitive);
return UnityEnd();
}
|