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
|
#!/usr/bin/env raku
use Test;
use JSON::Fast;
use lib $?FILE.IO.dirname;
use Pangram;
plan 10;
my @test-cases = from-json($=pod.pop.contents).List;
for @test-cases -> %case {
subtest %case<description>, {
plan 2;
isa-ok ( my $result := is-pangram %case<input><sentence> ), Bool;
is-deeply $result, %case<expected>, 'Result matches expected';
}
}
=head2 Test Cases
=begin code
[
{
"description": "empty sentence",
"expected": false,
"input": {
"sentence": ""
},
"property": "isPangram"
},
{
"description": "perfect lower case",
"expected": true,
"input": {
"sentence": "abcdefghijklmnopqrstuvwxyz"
},
"property": "isPangram"
},
{
"description": "only lower case",
"expected": true,
"input": {
"sentence": "the quick brown fox jumps over the lazy dog"
},
"property": "isPangram"
},
{
"description": "missing the letter 'x'",
"expected": false,
"input": {
"sentence": "a quick movement of the enemy will jeopardize five gunboats"
},
"property": "isPangram"
},
{
"description": "missing the letter 'h'",
"expected": false,
"input": {
"sentence": "five boxing wizards jump quickly at it"
},
"property": "isPangram"
},
{
"description": "with underscores",
"expected": true,
"input": {
"sentence": "the_quick_brown_fox_jumps_over_the_lazy_dog"
},
"property": "isPangram"
},
{
"description": "with numbers",
"expected": true,
"input": {
"sentence": "the 1 quick brown fox jumps over the 2 lazy dogs"
},
"property": "isPangram"
},
{
"description": "missing letters replaced by numbers",
"expected": false,
"input": {
"sentence": "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"
},
"property": "isPangram"
},
{
"description": "mixed case and punctuation",
"expected": true,
"input": {
"sentence": "\"Five quacking Zephyrs jolt my wax bed.\""
},
"property": "isPangram"
},
{
"description": "case insensitive",
"expected": false,
"input": {
"sentence": "the quick brown fox jumps over with lazy FX"
},
"property": "isPangram"
}
]
=end code
|