Skip to content

Commit 7db3a01

Browse files
committed
Sync exercise tests
1 parent 32fe0da commit 7db3a01

File tree

9 files changed

+110
-14
lines changed

9 files changed

+110
-14
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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
[e162fead-606f-437a-a166-d051915cea8e]
613
description = "stating something"
@@ -64,6 +71,7 @@ description = "alternate silence"
6471

6572
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
6673
description = "multiple line question"
74+
include = false
6775

6876
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
6977
description = "starting with whitespace"
@@ -76,3 +84,7 @@ description = "other whitespace"
7684

7785
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
7886
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/bob/bob_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ TEST_CASE("alternate_silence") {
8181
}
8282

8383
TEST_CASE("multiple_line_question") {
84-
REQUIRE("Whatever." ==
85-
bob::hey("\nDoes this cryogenic chamber make me look fat?\nNo."));
84+
REQUIRE("Sure." ==
85+
bob::hey("\nDoes this cryogenic chamber make\n me look fat?"));
8686
}
8787

8888
TEST_CASE("starting_with_whitespace") {

exercises/practice/matching-brackets/.meta/tests.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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
[81ec11da-38dd-442a-bcf9-3de7754609a5]
613
description = "paired square brackets"
@@ -41,12 +48,21 @@ description = "unpaired and nested brackets"
4148
[a0205e34-c2ac-49e6-a88a-899508d7d68e]
4249
description = "paired and wrong nested brackets"
4350

51+
[1d5c093f-fc84-41fb-8c2a-e052f9581602]
52+
description = "paired and wrong nested brackets but innermost are correct"
53+
4454
[ef47c21b-bcfd-4998-844c-7ad5daad90a8]
4555
description = "paired and incomplete brackets"
4656

4757
[a4675a40-a8be-4fc2-bc47-2a282ce6edbe]
4858
description = "too many closing brackets"
4959

60+
[a345a753-d889-4b7e-99ae-34ac85910d1a]
61+
description = "early unexpected brackets"
62+
63+
[21f81d61-1608-465a-b850-baa44c5def83]
64+
description = "early mismatched brackets"
65+
5066
[99255f93-261b-4435-a352-02bdecc9bdf2]
5167
description = "math expression"
5268

exercises/practice/matching-brackets/matching_brackets_test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ TEST_CASE("unpaired_nested_brackets") {
4242
REQUIRE(!matching_brackets::check("([{])"));
4343
}
4444

45+
TEST_CASE("paired_and_wrong_nested_brackets_but_innermost_are_correct") {
46+
REQUIRE(!matching_brackets::check("[({}])"));
47+
}
48+
49+
TEST_CASE("early_unexpected_brackets") {
50+
REQUIRE(!matching_brackets::check(")()"));
51+
}
52+
53+
TEST_CASE("early_mismatched_brackets") {
54+
REQUIRE(!matching_brackets::check("{)()"));
55+
}
56+
4557
TEST_CASE("paired_wrong_nested_brackets") {
4658
REQUIRE(!matching_brackets::check("[({]})"));
4759
}

exercises/practice/pig-latin/.meta/tests.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ description = "first letter and ay are moved to the end of words that start with
3939
[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71]
4040
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u"
4141

42+
[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]
43+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu"
44+
4245
[c01e049a-e3e2-451c-bf8e-e2abb7e438b8]
4346
description = "some letter clusters are treated like a single consonant -> word beginning with ch"
4447

exercises/practice/pig-latin/pig_latin_test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ TEST_CASE("y is treated like a vowel at the end of a consonant cluster",
9292
REQUIRE("ythmrhay" == pig_latin::translate("rhythm"));
9393
}
9494

95+
TEST_CASE(
96+
"first_letter_and_ay_are_moved_to_the_end_of_words_that_start_with_"
97+
"consonants_->_word_beginning_with_consonant_and_vowel_containing_qu",
98+
"[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]") {
99+
REQUIRE("iquidlay" == pig_latin::translate("liquid"));
100+
}
101+
95102
TEST_CASE("y as second letter in two letter word",
96103
"[29b4ca3d-efe5-4a95-9a54-8467f2e5e59a]") {
97104
REQUIRE("ymay" == pig_latin::translate("my"));

exercises/practice/protein-translation/.meta/tests.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
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.
11+
12+
[2c44f7bf-ba20-43f7-a3bf-f2219c0c3f98]
13+
description = "Empty RNA sequence results in no proteins"
414

515
[96d3d44f-34a2-4db4-84cd-fff523e069be]
616
description = "Methionine RNA sequence"
@@ -53,6 +63,12 @@ description = "STOP codon RNA sequence 2"
5363
[9c2ad527-ebc9-4ace-808b-2b6447cb54cb]
5464
description = "STOP codon RNA sequence 3"
5565

66+
[f4d9d8ee-00a8-47bf-a1e3-1641d4428e54]
67+
description = "Sequence of two protein codons translates into proteins"
68+
69+
[dd22eef3-b4f1-4ad6-bb0b-27093c090a9d]
70+
description = "Sequence of two different protein codons translates into proteins"
71+
5672
[d0f295df-fb70-425c-946c-ec2ec185388e]
5773
description = "Translate RNA strand into correct protein list"
5874

@@ -70,3 +86,6 @@ description = "Translation stops if STOP codon in middle of three-codon sequence
7086

7187
[2c2a2a60-401f-4a80-b977-e0715b23b93d]
7288
description = "Translation stops if STOP codon in middle of six-codon sequence"
89+
90+
[f6f92714-769f-4187-9524-e353e8a41a80]
91+
description = "Sequence of two non-STOP codons does not translate to a STOP codon"

exercises/practice/protein-translation/protein_translation_test.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ TEST_CASE("Translate_RNA_strand_into_correct_protein_list") {
9191
protein_translation::proteins("AUGUUUUGG"));
9292
}
9393

94+
TEST_CASE("Sequence_of_two_protein_codons_translates_into_proteins") {
95+
REQUIRE(vector<string>{"Phenylalanine", "Phenylalanine"} ==
96+
protein_translation::proteins("UUUUUU"));
97+
}
98+
99+
TEST_CASE("Sequence_of_two_different_protein_codons_translates_into_proteins") {
100+
REQUIRE(vector<string>{"Leucine", "Leucine"} ==
101+
protein_translation::proteins("UUAUUG"));
102+
}
103+
104+
TEST_CASE("Empty_RNA_sequence_results_in_no_proteins") {
105+
REQUIRE(vector<string>{} == protein_translation::proteins(""));
106+
}
107+
94108
TEST_CASE("Translation_stops_if_STOP_codon_at_beginning_of_sequence") {
95109
REQUIRE(vector<string>{} == protein_translation::proteins("UAGUGG"));
96110
}
@@ -115,4 +129,10 @@ TEST_CASE("Translation_stops_if_STOP_codon_in_middle_of_six-codon_sequence") {
115129
protein_translation::proteins("UGGUGUUAUUAAUGGUUU"));
116130
}
117131

132+
TEST_CASE(
133+
"Sequence_of_two_non-STOP_codons_does_not_translate_to_a_STOP_codon") {
134+
REQUIRE(vector<string>{"Methionine", "Methionine"} ==
135+
protein_translation::proteins("AUGAUG"));
136+
}
137+
118138
#endif // !EXERCISM_RUN_ALL_TESTS

exercises/practice/reverse-string/.meta/tests.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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
[c3b7d806-dced-49ee-8543-933fd1719b1c]
613
description = "an empty string"

0 commit comments

Comments
 (0)