From 8d1d25864eb8ef63771056855fe003c6050fb982 Mon Sep 17 00:00:00 2001 From: jagdish-15 Date: Fri, 10 Jan 2025 00:09:27 +0530 Subject: [PATCH] Updating tests for Protein-Translation (#1034) --- .../practice/protein-translation/.meta/config.json | 3 +++ .../practice/protein-translation/.meta/tests.toml | 4 ++++ .../protein-translation/test_protein_translation.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/exercises/practice/protein-translation/.meta/config.json b/exercises/practice/protein-translation/.meta/config.json index 14d6e347..f0b97f51 100644 --- a/exercises/practice/protein-translation/.meta/config.json +++ b/exercises/practice/protein-translation/.meta/config.json @@ -2,6 +2,9 @@ "authors": [ "ryanplusplus" ], + "contributors": [ + "jagdish-15" + ], "files": { "solution": [ "protein_translation.c", diff --git a/exercises/practice/protein-translation/.meta/tests.toml b/exercises/practice/protein-translation/.meta/tests.toml index 5fb18907..b465aed2 100644 --- a/exercises/practice/protein-translation/.meta/tests.toml +++ b/exercises/practice/protein-translation/.meta/tests.toml @@ -87,11 +87,15 @@ 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" + [1e75ea2a-f907-4994-ae5c-118632a1cb0f] description = "Non-existing codon can't translate" [9eac93f3-627a-4c90-8653-6d0a0595bc6f] description = "Unknown amino acids, not part of a codon, can't translate" +reimplements = "1e75ea2a-f907-4994-ae5c-118632a1cb0f" [9d73899f-e68e-4291-b1e2-7bf87c00f024] description = "Incomplete RNA sequence can't translate" diff --git a/exercises/practice/protein-translation/test_protein_translation.c b/exercises/practice/protein-translation/test_protein_translation.c index f5611759..fe42cf8d 100644 --- a/exercises/practice/protein-translation/test_protein_translation.c +++ b/exercises/practice/protein-translation/test_protein_translation.c @@ -333,6 +333,19 @@ test_translation_stops_if_stop_codon_in_middle_of_six_codon_sequence(void) assert_proteins_match(expected, actual); } +static void +test_seuence_of_two_non_stop_codons_does_not_translate_to_a_stop_codon(void) +{ + TEST_IGNORE(); + proteins_t expected = { + .valid = true, + .count = 2, + .proteins = { Methionine, Methionine }, + }; + proteins_t actual = proteins("AUGAUG"); + assert_proteins_match(expected, actual); +} + static void test_non_existing_codon_cant_translate(void) { TEST_IGNORE(); @@ -407,6 +420,7 @@ int main(void) RUN_TEST(test_translation_stops_if_stop_codon_at_end_of_three_codon_sequence); RUN_TEST(test_translation_stops_if_stop_codon_in_middle_of_three_codon_sequence); RUN_TEST(test_translation_stops_if_stop_codon_in_middle_of_six_codon_sequence); + RUN_TEST(test_seuence_of_two_non_stop_codons_does_not_translate_to_a_stop_codon); RUN_TEST(test_non_existing_codon_cant_translate); RUN_TEST(test_unknown_amino_acids_not_part_of_a_codon_cant_translate); RUN_TEST(test_invalid_codon_cant_translate);