Skip to content

Commit 233cf9e

Browse files
authored
Fix missing tests (#472)
[no important files changed] * wordy: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * triangle: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * space-age: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * roman-numerals: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * reverse-string: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * queen-attack: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * protein-translation: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * pig-latin: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * largest-series-product, reverse-string: add missing and reimplement tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * flatten-array, knapsack: add missing and reimplement tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * dominoes: fix missing tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * custom-set: add missing test Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * complex-numbers, crypto-square: add missing and reimplement tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * change: add missing test Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * anagram: add missing test Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * bob: add reimplement tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * space-age: ignore error tests Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> * space-age: revert reference solution Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com> --------- Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com>
1 parent ce265c4 commit 233cf9e

30 files changed

Lines changed: 242 additions & 3 deletions

File tree

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,42 @@ description = "detects anagrams using case-insensitive possible matches"
4545

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

4954
[9878a1c9-d6ea-4235-ae51-3ea2befd6842]
5055
description = "anagrams must use all letters exactly once"
5156

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

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

exercises/practice/anagram/anagram_tests.plt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ pending :-
6363
test(does_not_detect_a_anagram_if_the_original_word_is_repeated, condition(pending)) :-
6464
anagram("go", ["go Go GO"], Anagrams),
6565
Anagrams == [].
66+
67+
test(does_not_detect_a_anagram_if_the_original_word_is_repeated_without_whitespace, condition(pending)) :-
68+
anagram("go", ["goGoGO"], Anagrams),
69+
Anagrams == [].
6670

6771
test(anagrams_must_use_all_letters_exactly_once, condition(pending)) :-
6872
anagram("tapper", ["patter"], Anagrams),
@@ -80,4 +84,12 @@ pending :-
8084
anagram("BANANA", ["Banana"], Anagrams),
8185
Anagrams == [].
8286

87+
test(word_other_than_itself_can_be_anagram, condition(pending)) :-
88+
anagram("LISTEN", ["Listen","Silent","LISTEN"], Anagrams),
89+
Anagrams == ["Silent"].
90+
91+
test(handles_greek_letters_cases, condition(pending)) :-
92+
anagram("ΑΒΓ", ["ΒΓΑ", "ΒΓΔ", "γβα", "αβγ"], Anagrams),
93+
Anagrams == ["ΒΓΑ", "γβα"].
94+
8395
:- end_tests(anagram).

exercises/practice/bob/.meta/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ description = "alternate silence"
7171

7272
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
7373
description = "multiple line question"
74+
include = false
7475

7576
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
7677
description = "starting with whitespace"
@@ -83,3 +84,7 @@ description = "other whitespace"
8384

8485
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8586
description = "non-question ending with whitespace"
87+
88+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89+
description = "multiple line question"
90+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"

exercises/practice/change/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ description = "possible change without unit coins available"
3333
[9a166411-d35d-4f7f-a007-6724ac266178]
3434
description = "another possible change without unit coins available"
3535

36+
[ce0f80d5-51c3-469d-818c-3e69dbd25f75]
37+
description = "a greedy approach is not optimal"
38+
3639
[bbbcc154-e9e9-4209-a4db-dd6d81ec26bb]
3740
description = "no coins make 0 change"
3841

exercises/practice/change/change_tests.plt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ pending :-
4242
fewest_coins([1, 5, 10, 21, 25], 0, Change),
4343
Change == [].
4444

45+
test(greedy_approach_is_not_always_optimal, condition(pending)) :-
46+
fewest_coins([1, 10, 11], 20, Change),
47+
Change == [10, 10].
48+
4549
test(error_testing_for_change_smaller_than_the_smallest_of_coins, [fail, condition(pending)]) :-
4650
fewest_coins([5, 10], 3, _).
4751

exercises/practice/complex-numbers/.meta/tests.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,55 @@ description = "Complex conjugate -> Conjugate a number with real and imaginary p
9292

9393
[6d96d4c6-2edb-445b-94a2-7de6d4caaf60]
9494
description = "Complex exponential function -> Euler's identity/formula"
95+
include = false
96+
comment = "missing exponential implementation"
9597

9698
[2d2c05a0-4038-4427-a24d-72f6624aa45f]
9799
description = "Complex exponential function -> Exponential of 0"
100+
include = false
101+
comment = "missing exponential implementation"
98102

99103
[ed87f1bd-b187-45d6-8ece-7e331232c809]
100104
description = "Complex exponential function -> Exponential of a purely real number"
105+
include = false
106+
comment = "missing exponential implementation"
101107

102108
[08eedacc-5a95-44fc-8789-1547b27a8702]
103109
description = "Complex exponential function -> Exponential of a number with real and imaginary part"
110+
comment = "missing exponential implementation"
111+
112+
[d2de4375-7537-479a-aa0e-d474f4f09859]
113+
description = "Complex exponential function -> Exponential resulting in a number with real and imaginary part"
114+
include = false
115+
116+
[06d793bf-73bd-4b02-b015-3030b2c952ec]
117+
description = "Operations between real numbers and complex numbers -> Add real number to complex number"
118+
include = false
119+
120+
[d77dbbdf-b8df-43f6-a58d-3acb96765328]
121+
description = "Operations between real numbers and complex numbers -> Add complex number to real number"
122+
include = false
123+
124+
[20432c8e-8960-4c40-ba83-c9d910ff0a0f]
125+
description = "Operations between real numbers and complex numbers -> Subtract real number from complex number"
126+
include = false
127+
128+
[b4b38c85-e1bf-437d-b04d-49bba6e55000]
129+
description = "Operations between real numbers and complex numbers -> Subtract complex number from real number"
130+
include = false
131+
132+
[dabe1c8c-b8f4-44dd-879d-37d77c4d06bd]
133+
description = "Operations between real numbers and complex numbers -> Multiply complex number by real number"
134+
include = false
135+
136+
[6c81b8c8-9851-46f0-9de5-d96d314c3a28]
137+
description = "Operations between real numbers and complex numbers -> Multiply real number by complex number"
138+
include = false
139+
140+
[8a400f75-710e-4d0c-bcb4-5e5a00c78aa0]
141+
description = "Operations between real numbers and complex numbers -> Divide complex number by real number"
142+
include = false
143+
144+
[9a867d1b-d736-4c41-a41e-90bd148e9d5e]
145+
description = "Operations between real numbers and complex numbers -> Divide real number by complex number"
146+
include = false

exercises/practice/crypto-square/.meta/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ description = "8 character plaintext results in 3 chunks, the last one with a tr
3232

3333
[fbcb0c6d-4c39-4a31-83f6-c473baa6af80]
3434
description = "54 character plaintext results in 7 chunks, the last two with trailing spaces"
35+
include = false
36+
37+
[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6]
38+
description = "54 character plaintext results in 8 chunks, the last two with trailing spaces"
39+
reimplements = "fbcb0c6d-4c39-4a31-83f6-c473baa6af80"

exercises/practice/custom-set/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ description = "Difference (or Complement) of a set is a set of all elements that
114114
[c5ac673e-d707-4db5-8d69-7082c3a5437e]
115115
description = "Difference (or Complement) of a set is a set of all elements that are only in the first set -> difference of two non-empty sets is a set of elements that are only in the first set"
116116

117+
[20d0a38f-7bb7-4c4a-ac15-90c7392ecf2b]
118+
description = "Difference (or Complement) of a set is a set of all elements that are only in the first set -> difference removes all duplicates in the first set"
119+
117120
[c45aed16-5494-455a-9033-5d4c93589dc6]
118121
description = "Union returns a set of all elements in either set -> union of empty sets is an empty set"
119122

exercises/practice/custom-set/custom_set_tests.plt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ pending :-
197197
create_set([1, 3], Expected),
198198
Difference == Expected.
199199

200+
test(difference_removes_all_duplicates, condition(pending)) :-
201+
create_set([1, 1], Set1),
202+
create_set([1], Set2),
203+
difference(Set1, Set2, Difference),
204+
create_set([], Expected),
205+
Difference == Expected.
206+
200207
test(union_of_empty_sets_is_an_empty_set, condition(pending)) :-
201208
create_set(Set1),
202209
create_set(Set2),

exercises/practice/dominoes/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ description = "separate loops"
4444

4545
[cd061538-6046-45a7-ace9-6708fe8f6504]
4646
description = "nine elements"
47+
48+
[44704c7c-3adb-4d98-bd30-f45527cf8b49]
49+
description = "separate three-domino loops"

0 commit comments

Comments
 (0)