Skip to content

Commit

Permalink
Updating tests for Protein-Translation (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdish-15 authored Jan 9, 2025
1 parent d203f01 commit 8d1d258
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exercises/practice/protein-translation/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"authors": [
"ryanplusplus"
],
"contributors": [
"jagdish-15"
],
"files": {
"solution": [
"protein_translation.c",
Expand Down
4 changes: 4 additions & 0 deletions exercises/practice/protein-translation/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions exercises/practice/protein-translation/test_protein_translation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8d1d258

Please sign in to comment.