From 7db3a01b90614f3e7fc12ebcab9d288cb1f9c5f0 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Mon, 24 Mar 2025 11:56:24 -0700 Subject: [PATCH] Sync exercise tests --- exercises/practice/bob/.meta/tests.toml | 18 ++++++++++--- exercises/practice/bob/bob_test.cpp | 4 +-- .../matching-brackets/.meta/tests.toml | 22 +++++++++++++--- .../matching_brackets_test.cpp | 12 +++++++++ exercises/practice/pig-latin/.meta/tests.toml | 3 +++ .../practice/pig-latin/pig_latin_test.cpp | 7 ++++++ .../protein-translation/.meta/tests.toml | 25 ++++++++++++++++--- .../protein_translation_test.cpp | 20 +++++++++++++++ .../practice/reverse-string/.meta/tests.toml | 13 +++++++--- 9 files changed, 110 insertions(+), 14 deletions(-) diff --git a/exercises/practice/bob/.meta/tests.toml b/exercises/practice/bob/.meta/tests.toml index 630485579..5299e2895 100644 --- a/exercises/practice/bob/.meta/tests.toml +++ b/exercises/practice/bob/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [e162fead-606f-437a-a166-d051915cea8e] description = "stating something" @@ -64,6 +71,7 @@ description = "alternate silence" [66953780-165b-4e7e-8ce3-4bcb80b6385a] description = "multiple line question" +include = false [5371ef75-d9ea-4103-bcfa-2da973ddec1b] description = "starting with whitespace" @@ -76,3 +84,7 @@ description = "other whitespace" [12983553-8601-46a8-92fa-fcaa3bc4a2a0] description = "non-question ending with whitespace" + +[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] +description = "multiple line question" +reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" diff --git a/exercises/practice/bob/bob_test.cpp b/exercises/practice/bob/bob_test.cpp index 9a9c07328..cf7a94024 100644 --- a/exercises/practice/bob/bob_test.cpp +++ b/exercises/practice/bob/bob_test.cpp @@ -81,8 +81,8 @@ TEST_CASE("alternate_silence") { } TEST_CASE("multiple_line_question") { - REQUIRE("Whatever." == - bob::hey("\nDoes this cryogenic chamber make me look fat?\nNo.")); + REQUIRE("Sure." == + bob::hey("\nDoes this cryogenic chamber make\n me look fat?")); } TEST_CASE("starting_with_whitespace") { diff --git a/exercises/practice/matching-brackets/.meta/tests.toml b/exercises/practice/matching-brackets/.meta/tests.toml index cc9e471a4..35a98a042 100644 --- a/exercises/practice/matching-brackets/.meta/tests.toml +++ b/exercises/practice/matching-brackets/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [81ec11da-38dd-442a-bcf9-3de7754609a5] description = "paired square brackets" @@ -41,12 +48,21 @@ description = "unpaired and nested brackets" [a0205e34-c2ac-49e6-a88a-899508d7d68e] description = "paired and wrong nested brackets" +[1d5c093f-fc84-41fb-8c2a-e052f9581602] +description = "paired and wrong nested brackets but innermost are correct" + [ef47c21b-bcfd-4998-844c-7ad5daad90a8] description = "paired and incomplete brackets" [a4675a40-a8be-4fc2-bc47-2a282ce6edbe] description = "too many closing brackets" +[a345a753-d889-4b7e-99ae-34ac85910d1a] +description = "early unexpected brackets" + +[21f81d61-1608-465a-b850-baa44c5def83] +description = "early mismatched brackets" + [99255f93-261b-4435-a352-02bdecc9bdf2] description = "math expression" diff --git a/exercises/practice/matching-brackets/matching_brackets_test.cpp b/exercises/practice/matching-brackets/matching_brackets_test.cpp index c0b4f715a..a0d76dfeb 100644 --- a/exercises/practice/matching-brackets/matching_brackets_test.cpp +++ b/exercises/practice/matching-brackets/matching_brackets_test.cpp @@ -42,6 +42,18 @@ TEST_CASE("unpaired_nested_brackets") { REQUIRE(!matching_brackets::check("([{])")); } +TEST_CASE("paired_and_wrong_nested_brackets_but_innermost_are_correct") { + REQUIRE(!matching_brackets::check("[({}])")); +} + +TEST_CASE("early_unexpected_brackets") { + REQUIRE(!matching_brackets::check(")()")); +} + +TEST_CASE("early_mismatched_brackets") { + REQUIRE(!matching_brackets::check("{)()")); +} + TEST_CASE("paired_wrong_nested_brackets") { REQUIRE(!matching_brackets::check("[({]})")); } diff --git a/exercises/practice/pig-latin/.meta/tests.toml b/exercises/practice/pig-latin/.meta/tests.toml index c29168c5e..d524305b4 100644 --- a/exercises/practice/pig-latin/.meta/tests.toml +++ b/exercises/practice/pig-latin/.meta/tests.toml @@ -39,6 +39,9 @@ description = "first letter and ay are moved to the end of words that start with [bce94a7a-a94e-4e2b-80f4-b2bb02e40f71] description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u" +[e59dbbe8-ccee-4619-a8e9-ce017489bfc0] +description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu" + [c01e049a-e3e2-451c-bf8e-e2abb7e438b8] description = "some letter clusters are treated like a single consonant -> word beginning with ch" diff --git a/exercises/practice/pig-latin/pig_latin_test.cpp b/exercises/practice/pig-latin/pig_latin_test.cpp index 646723a4e..d8e1f79e5 100644 --- a/exercises/practice/pig-latin/pig_latin_test.cpp +++ b/exercises/practice/pig-latin/pig_latin_test.cpp @@ -92,6 +92,13 @@ TEST_CASE("y is treated like a vowel at the end of a consonant cluster", REQUIRE("ythmrhay" == pig_latin::translate("rhythm")); } +TEST_CASE( + "first_letter_and_ay_are_moved_to_the_end_of_words_that_start_with_" + "consonants_->_word_beginning_with_consonant_and_vowel_containing_qu", + "[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]") { + REQUIRE("iquidlay" == pig_latin::translate("liquid")); +} + TEST_CASE("y as second letter in two letter word", "[29b4ca3d-efe5-4a95-9a54-8467f2e5e59a]") { REQUIRE("ymay" == pig_latin::translate("my")); diff --git a/exercises/practice/protein-translation/.meta/tests.toml b/exercises/practice/protein-translation/.meta/tests.toml index 02a54c344..a5e66047e 100644 --- a/exercises/practice/protein-translation/.meta/tests.toml +++ b/exercises/practice/protein-translation/.meta/tests.toml @@ -1,6 +1,16 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[2c44f7bf-ba20-43f7-a3bf-f2219c0c3f98] +description = "Empty RNA sequence results in no proteins" [96d3d44f-34a2-4db4-84cd-fff523e069be] description = "Methionine RNA sequence" @@ -53,6 +63,12 @@ description = "STOP codon RNA sequence 2" [9c2ad527-ebc9-4ace-808b-2b6447cb54cb] description = "STOP codon RNA sequence 3" +[f4d9d8ee-00a8-47bf-a1e3-1641d4428e54] +description = "Sequence of two protein codons translates into proteins" + +[dd22eef3-b4f1-4ad6-bb0b-27093c090a9d] +description = "Sequence of two different protein codons translates into proteins" + [d0f295df-fb70-425c-946c-ec2ec185388e] description = "Translate RNA strand into correct protein list" @@ -70,3 +86,6 @@ description = "Translation stops if STOP codon in middle of three-codon sequence [2c2a2a60-401f-4a80-b977-e0715b23b93d] description = "Translation stops if STOP codon in middle of six-codon sequence" + +[f6f92714-769f-4187-9524-e353e8a41a80] +description = "Sequence of two non-STOP codons does not translate to a STOP codon" diff --git a/exercises/practice/protein-translation/protein_translation_test.cpp b/exercises/practice/protein-translation/protein_translation_test.cpp index 76bb9a83a..54e28aa7b 100644 --- a/exercises/practice/protein-translation/protein_translation_test.cpp +++ b/exercises/practice/protein-translation/protein_translation_test.cpp @@ -91,6 +91,20 @@ TEST_CASE("Translate_RNA_strand_into_correct_protein_list") { protein_translation::proteins("AUGUUUUGG")); } +TEST_CASE("Sequence_of_two_protein_codons_translates_into_proteins") { + REQUIRE(vector{"Phenylalanine", "Phenylalanine"} == + protein_translation::proteins("UUUUUU")); +} + +TEST_CASE("Sequence_of_two_different_protein_codons_translates_into_proteins") { + REQUIRE(vector{"Leucine", "Leucine"} == + protein_translation::proteins("UUAUUG")); +} + +TEST_CASE("Empty_RNA_sequence_results_in_no_proteins") { + REQUIRE(vector{} == protein_translation::proteins("")); +} + TEST_CASE("Translation_stops_if_STOP_codon_at_beginning_of_sequence") { REQUIRE(vector{} == protein_translation::proteins("UAGUGG")); } @@ -115,4 +129,10 @@ TEST_CASE("Translation_stops_if_STOP_codon_in_middle_of_six-codon_sequence") { protein_translation::proteins("UGGUGUUAUUAAUGGUUU")); } +TEST_CASE( + "Sequence_of_two_non-STOP_codons_does_not_translate_to_a_STOP_codon") { + REQUIRE(vector{"Methionine", "Methionine"} == + protein_translation::proteins("AUGAUG")); +} + #endif // !EXERCISM_RUN_ALL_TESTS diff --git a/exercises/practice/reverse-string/.meta/tests.toml b/exercises/practice/reverse-string/.meta/tests.toml index 2113a5336..0b04c4cd7 100644 --- a/exercises/practice/reverse-string/.meta/tests.toml +++ b/exercises/practice/reverse-string/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [c3b7d806-dced-49ee-8543-933fd1719b1c] description = "an empty string"