Skip to content

Commit 44e5ab0

Browse files
authored
Sync test cases for 30 exercises (#488)
* sync allergies tests * sync anagram tests * sync bank-account tests * sync bob tests * sync collatz-conjecture tests * sync dnd-character tests * sync gigasecond tests * sync hamming tests * sync high-scores tests * sync isbn-verifier tests * sync isogram tests * sync largest-series-product tests * sync linked-list tests * sync luhn tests * sync matching-brackets tests * sync pangram tests * sync phone-number tests * sync pig-latin tests * sync prime-factors tests * sync protein-translation tests * sync resistor-color-duo tests * sync resistor-color-trio tests; bump difficulty * sync reverse-string tests; exclude grapheme cluster tests * sync roman-numerals tests * sync series tests * sync space-age tests * sync triangle tests * sync word-count tests * sync flatten-array tests * sync armstrong-numbers tests; exclude bigint tests * reverse-string: windows does not like the wide characters test
1 parent d853c2c commit 44e5ab0

File tree

68 files changed

+1710
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1710
-347
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
"uuid": "169de5ae-6d7d-4ba3-bfb7-2ad75b17db93",
244244
"practices": [],
245245
"prerequisites": [],
246-
"difficulty": 2,
246+
"difficulty": 4,
247247
"topics": [
248248
"arrays",
249249
"strings"
Lines changed: 62 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,160 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[17fc7296-2440-4ac4-ad7b-d07c321bc5a0]
6-
description = "not allergic to anything"
13+
description = "testing for eggs allergy -> not allergic to anything"
714

815
[07ced27b-1da5-4c2e-8ae2-cb2791437546]
9-
description = "allergic only to eggs"
16+
description = "testing for eggs allergy -> allergic only to eggs"
1017

1118
[5035b954-b6fa-4b9b-a487-dae69d8c5f96]
12-
description = "allergic to eggs and something else"
19+
description = "testing for eggs allergy -> allergic to eggs and something else"
1320

1421
[64a6a83a-5723-4b5b-a896-663307403310]
15-
description = "allergic to something, but not eggs"
22+
description = "testing for eggs allergy -> allergic to something, but not eggs"
1623

1724
[90c8f484-456b-41c4-82ba-2d08d93231c6]
18-
description = "allergic to everything"
25+
description = "testing for eggs allergy -> allergic to everything"
1926

2027
[d266a59a-fccc-413b-ac53-d57cb1f0db9d]
21-
description = "not allergic to anything"
28+
description = "testing for peanuts allergy -> not allergic to anything"
2229

2330
[ea210a98-860d-46b2-a5bf-50d8995b3f2a]
24-
description = "allergic only to peanuts"
31+
description = "testing for peanuts allergy -> allergic only to peanuts"
2532

2633
[eac69ae9-8d14-4291-ac4b-7fd2c73d3a5b]
27-
description = "allergic to peanuts and something else"
34+
description = "testing for peanuts allergy -> allergic to peanuts and something else"
2835

2936
[9152058c-ce39-4b16-9b1d-283ec6d25085]
30-
description = "allergic to something, but not peanuts"
37+
description = "testing for peanuts allergy -> allergic to something, but not peanuts"
3138

3239
[d2d71fd8-63d5-40f9-a627-fbdaf88caeab]
33-
description = "allergic to everything"
40+
description = "testing for peanuts allergy -> allergic to everything"
3441

3542
[b948b0a1-cbf7-4b28-a244-73ff56687c80]
36-
description = "not allergic to anything"
43+
description = "testing for shellfish allergy -> not allergic to anything"
3744

3845
[9ce9a6f3-53e9-4923-85e0-73019047c567]
39-
description = "allergic only to shellfish"
46+
description = "testing for shellfish allergy -> allergic only to shellfish"
4047

4148
[b272fca5-57ba-4b00-bd0c-43a737ab2131]
42-
description = "allergic to shellfish and something else"
49+
description = "testing for shellfish allergy -> allergic to shellfish and something else"
4350

4451
[21ef8e17-c227-494e-8e78-470a1c59c3d8]
45-
description = "allergic to something, but not shellfish"
52+
description = "testing for shellfish allergy -> allergic to something, but not shellfish"
4653

4754
[cc789c19-2b5e-4c67-b146-625dc8cfa34e]
48-
description = "allergic to everything"
55+
description = "testing for shellfish allergy -> allergic to everything"
4956

5057
[651bde0a-2a74-46c4-ab55-02a0906ca2f5]
51-
description = "not allergic to anything"
58+
description = "testing for strawberries allergy -> not allergic to anything"
5259

5360
[b649a750-9703-4f5f-b7f7-91da2c160ece]
54-
description = "allergic only to strawberries"
61+
description = "testing for strawberries allergy -> allergic only to strawberries"
5562

5663
[50f5f8f3-3bac-47e6-8dba-2d94470a4bc6]
57-
description = "allergic to strawberries and something else"
64+
description = "testing for strawberries allergy -> allergic to strawberries and something else"
5865

5966
[23dd6952-88c9-48d7-a7d5-5d0343deb18d]
60-
description = "allergic to something, but not strawberries"
67+
description = "testing for strawberries allergy -> allergic to something, but not strawberries"
6168

6269
[74afaae2-13b6-43a2-837a-286cd42e7d7e]
63-
description = "allergic to everything"
70+
description = "testing for strawberries allergy -> allergic to everything"
6471

6572
[c49a91ef-6252-415e-907e-a9d26ef61723]
66-
description = "not allergic to anything"
73+
description = "testing for tomatoes allergy -> not allergic to anything"
6774

6875
[b69c5131-b7d0-41ad-a32c-e1b2cc632df8]
69-
description = "allergic only to tomatoes"
76+
description = "testing for tomatoes allergy -> allergic only to tomatoes"
7077

7178
[1ca50eb1-f042-4ccf-9050-341521b929ec]
72-
description = "allergic to tomatoes and something else"
79+
description = "testing for tomatoes allergy -> allergic to tomatoes and something else"
7380

7481
[e9846baa-456b-4eff-8025-034b9f77bd8e]
75-
description = "allergic to something, but not tomatoes"
82+
description = "testing for tomatoes allergy -> allergic to something, but not tomatoes"
7683

7784
[b2414f01-f3ad-4965-8391-e65f54dad35f]
78-
description = "allergic to everything"
85+
description = "testing for tomatoes allergy -> allergic to everything"
7986

8087
[978467ab-bda4-49f7-b004-1d011ead947c]
81-
description = "not allergic to anything"
88+
description = "testing for chocolate allergy -> not allergic to anything"
8289

8390
[59cf4e49-06ea-4139-a2c1-d7aad28f8cbc]
84-
description = "allergic only to chocolate"
91+
description = "testing for chocolate allergy -> allergic only to chocolate"
8592

8693
[b0a7c07b-2db7-4f73-a180-565e07040ef1]
87-
description = "allergic to chocolate and something else"
94+
description = "testing for chocolate allergy -> allergic to chocolate and something else"
8895

8996
[f5506893-f1ae-482a-b516-7532ba5ca9d2]
90-
description = "allergic to something, but not chocolate"
97+
description = "testing for chocolate allergy -> allergic to something, but not chocolate"
9198

9299
[02debb3d-d7e2-4376-a26b-3c974b6595c6]
93-
description = "allergic to everything"
100+
description = "testing for chocolate allergy -> allergic to everything"
94101

95102
[17f4a42b-c91e-41b8-8a76-4797886c2d96]
96-
description = "not allergic to anything"
103+
description = "testing for pollen allergy -> not allergic to anything"
97104

98105
[7696eba7-1837-4488-882a-14b7b4e3e399]
99-
description = "allergic only to pollen"
106+
description = "testing for pollen allergy -> allergic only to pollen"
100107

101108
[9a49aec5-fa1f-405d-889e-4dfc420db2b6]
102-
description = "allergic to pollen and something else"
109+
description = "testing for pollen allergy -> allergic to pollen and something else"
103110

104111
[3cb8e79f-d108-4712-b620-aa146b1954a9]
105-
description = "allergic to something, but not pollen"
112+
description = "testing for pollen allergy -> allergic to something, but not pollen"
106113

107114
[1dc3fe57-7c68-4043-9d51-5457128744b2]
108-
description = "allergic to everything"
115+
description = "testing for pollen allergy -> allergic to everything"
109116

110117
[d3f523d6-3d50-419b-a222-d4dfd62ce314]
111-
description = "not allergic to anything"
118+
description = "testing for cats allergy -> not allergic to anything"
112119

113120
[eba541c3-c886-42d3-baef-c048cb7fcd8f]
114-
description = "allergic only to cats"
121+
description = "testing for cats allergy -> allergic only to cats"
115122

116123
[ba718376-26e0-40b7-bbbe-060287637ea5]
117-
description = "allergic to cats and something else"
124+
description = "testing for cats allergy -> allergic to cats and something else"
118125

119126
[3c6dbf4a-5277-436f-8b88-15a206f2d6c4]
120-
description = "allergic to something, but not cats"
127+
description = "testing for cats allergy -> allergic to something, but not cats"
121128

122129
[1faabb05-2b98-4995-9046-d83e4a48a7c1]
123-
description = "allergic to everything"
130+
description = "testing for cats allergy -> allergic to everything"
124131

125132
[f9c1b8e7-7dc5-4887-aa93-cebdcc29dd8f]
126-
description = "no allergies"
133+
description = "list when: -> no allergies"
127134

128135
[9e1a4364-09a6-4d94-990f-541a94a4c1e8]
129-
description = "just eggs"
136+
description = "list when: -> just eggs"
130137

131138
[8851c973-805e-4283-9e01-d0c0da0e4695]
132-
description = "just peanuts"
139+
description = "list when: -> just peanuts"
133140

134141
[2c8943cb-005e-435f-ae11-3e8fb558ea98]
135-
description = "just strawberries"
142+
description = "list when: -> just strawberries"
136143

137144
[6fa95d26-044c-48a9-8a7b-9ee46ec32c5c]
138-
description = "eggs and peanuts"
145+
description = "list when: -> eggs and peanuts"
139146

140147
[19890e22-f63f-4c5c-a9fb-fb6eacddfe8e]
141-
description = "more than eggs but not peanuts"
148+
description = "list when: -> more than eggs but not peanuts"
142149

143150
[4b68f470-067c-44e4-889f-c9fe28917d2f]
144-
description = "lots of stuff"
151+
description = "list when: -> lots of stuff"
145152

146153
[0881b7c5-9efa-4530-91bd-68370d054bc7]
147-
description = "everything"
154+
description = "list when: -> everything"
148155

149156
[12ce86de-b347-42a0-ab7c-2e0570f0c65b]
150-
description = "no allergen score parts"
157+
description = "list when: -> no allergen score parts"
158+
159+
[93c2df3e-4f55-4fed-8116-7513092819cd]
160+
description = "list when: -> no allergen score parts without highest valid score"

exercises/practice/allergies/src/test/groovy/AllergiesSpec.groovy

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,14 @@ class AllergiesSpec extends Specification {
251251
'cats']
252252
}
253253

254-
}
254+
@Ignore
255+
def "No allergen score parts without highest valid score"() {
256+
given:
257+
int score = 257
258+
def allergies = new Allergies(score)
259+
260+
expect:
261+
allergies.list() == ['eggs']
262+
}
263+
264+
}

exercises/practice/anagram/.meta/tests.toml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[dd40c4d2-3c8b-44e5-992a-f42b393ec373]
613
description = "no matches"
714

815
[b3cca662-f50a-489e-ae10-ab8290a09bdc]
916
description = "detects two anagrams"
17+
include = false
18+
19+
[03eb9bbe-8906-4ea0-84fa-ffe711b52c8b]
20+
description = "detects two anagrams"
21+
reimplements = "b3cca662-f50a-489e-ae10-ab8290a09bdc"
1022

1123
[a27558ee-9ba0-4552-96b1-ecf665b06556]
1224
description = "does not detect anagram subsets"
@@ -34,12 +46,41 @@ description = "detects anagrams using case-insensitive possible matches"
3446

3547
[7cc195ad-e3c7-44ee-9fd2-d3c344806a2c]
3648
description = "does not detect an anagram if the original word is repeated"
49+
include = false
50+
51+
[630abb71-a94e-4715-8395-179ec1df9f91]
52+
description = "does not detect an anagram if the original word is repeated"
53+
reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c"
3754

3855
[9878a1c9-d6ea-4235-ae51-3ea2befd6842]
3956
description = "anagrams must use all letters exactly once"
4057

4158
[85757361-4535-45fd-ac0e-3810d40debc1]
4259
description = "words are not anagrams of themselves (case-insensitive)"
60+
include = false
61+
62+
[68934ed0-010b-4ef9-857a-20c9012d1ebf]
63+
description = "words are not anagrams of themselves"
64+
reimplements = "85757361-4535-45fd-ac0e-3810d40debc1"
65+
66+
[589384f3-4c8a-4e7d-9edc-51c3e5f0c90e]
67+
description = "words are not anagrams of themselves even if letter case is partially different"
68+
reimplements = "85757361-4535-45fd-ac0e-3810d40debc1"
69+
70+
[ba53e423-7e02-41ee-9ae2-71f91e6d18e6]
71+
description = "words are not anagrams of themselves even if letter case is completely different"
72+
reimplements = "85757361-4535-45fd-ac0e-3810d40debc1"
4373

4474
[a0705568-628c-4b55-9798-82e4acde51ca]
4575
description = "words other than themselves can be anagrams"
76+
include = false
77+
78+
[33d3f67e-fbb9-49d3-a90e-0beb00861da7]
79+
description = "words other than themselves can be anagrams"
80+
reimplements = "a0705568-628c-4b55-9798-82e4acde51ca"
81+
82+
[a6854f66-eec1-4afd-a137-62ef2870c051]
83+
description = "handles case of greek letters"
84+
85+
[fd3509e5-e3ba-409d-ac3d-a9ac84d13296]
86+
description = "different characters may have the same bytes"

exercises/practice/anagram/src/test/groovy/AnagramSpec.groovy

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AnagramSpec extends Specification {
1818

1919
where:
2020
subject | candidates || expected
21-
'master' | ['stream', 'pigeon', 'maters'] || ['stream', 'maters']
21+
'solemn' | ['lemons', 'cherry', 'melons'] || ['lemons', 'melons']
2222
}
2323

2424
@Ignore
@@ -114,8 +114,8 @@ class AnagramSpec extends Specification {
114114
new Anagram(subject).find(candidates) == expected
115115

116116
where:
117-
subject | candidates || expected
118-
'go' | ['go Go GO'] || []
117+
subject | candidates || expected
118+
'go' | ['goGoGO'] || []
119119
}
120120

121121
@Ignore
@@ -129,13 +129,33 @@ class AnagramSpec extends Specification {
129129
}
130130

131131
@Ignore
132-
def "Words are not anagrams of themselves (case-insensitive)"() {
132+
def "Words are not anagrams of themselves"() {
133133
expect:
134134
new Anagram(subject).find(candidates) == expected
135135

136136
where:
137-
subject | candidates || expected
138-
'BANANA' | ['BANANA', 'Banana', 'banana'] || []
137+
subject | candidates || expected
138+
'BANANA' | ['BANANA'] || []
139+
}
140+
141+
@Ignore
142+
def "Words are not anagrams of themselves even if the letter case is partially different"() {
143+
expect:
144+
new Anagram(subject).find(candidates) == expected
145+
146+
where:
147+
subject | candidates || expected
148+
'BANANA' | ['Banana'] || []
149+
}
150+
151+
@Ignore
152+
def "Words are not anagrams of themselves even if the letter case is completely different"() {
153+
expect:
154+
new Anagram(subject).find(candidates) == expected
155+
156+
where:
157+
subject | candidates || expected
158+
'BANANA' | ['banana'] || []
139159
}
140160

141161
@Ignore
@@ -144,8 +164,28 @@ class AnagramSpec extends Specification {
144164
new Anagram(subject).find(candidates) == expected
145165

146166
where:
147-
subject | candidates || expected
148-
'LISTEN' | ['Listen', 'Silent', 'LISTEN'] || ['Silent']
167+
subject | candidates || expected
168+
'LISTEN' | ['Listen', 'Silent'] || ['Silent']
169+
}
170+
171+
@Ignore
172+
def "Handles case of greek letters"() {
173+
expect:
174+
new Anagram(subject).find(candidates) == expected
175+
176+
where:
177+
subject | candidates || expected
178+
'ΑΒΓ' | ['ΒΓΑ', 'ΒΓΔ', 'γβα', 'αβγ'] || ['ΒΓΑ', 'γβα']
179+
}
180+
181+
@Ignore
182+
def "Different characters may have the same bytes"() {
183+
expect:
184+
new Anagram(subject).find(candidates) == expected
185+
186+
where:
187+
subject | candidates || expected
188+
'a⬂' | ['€a'] || []
149189
}
150190

151-
}
191+
}

0 commit comments

Comments
 (0)