-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sync docs * sync tests * implement tests
- Loading branch information
1 parent
058660d
commit 0675a7e
Showing
3 changed files
with
179 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 125 additions & 23 deletions
148
exercises/practice/protein-translation/test/protein_translation_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,138 @@ | ||
(ns protein-translation-test | ||
(:require [clojure.test :refer [deftest is are]] | ||
(:require [clojure.test :refer [deftest testing is]] | ||
protein-translation)) | ||
|
||
(deftest AUG-translates-to-Methionine | ||
(is (= "Methionine" (protein-translation/translate-codon "AUG")))) | ||
(deftest empty-rna-sequence-results-in-no-protein | ||
(testing "Empty RNA sequence results in no protein" | ||
(is (= [] (protein-translation/translate-rna ""))))) | ||
|
||
(deftest UGG-translates-to-Tryptophan | ||
(is (= "Tryptophan" (protein-translation/translate-codon "UGG")))) | ||
(deftest methionine-RNA-sequence | ||
(testing "Methionine RNA sequence" | ||
(is (= ["Methionine"] | ||
(protein-translation/translate-rna "AUG"))))) | ||
|
||
(deftest identifies-Phenylalanine-codons | ||
(are [codon] (= "Phenylalanine" (protein-translation/translate-codon codon)) "UUU" "UUC")) | ||
(deftest phenylalanine-RNA-sequence-1 | ||
(testing "Phenylalanine RNA sequence 1" | ||
(is (= ["Phenylalanine"] | ||
(protein-translation/translate-rna "UUU"))))) | ||
|
||
(deftest identifies-Leucine-codons | ||
(are [codon] (= "Leucine" (protein-translation/translate-codon codon)) "UUA" "UUG")) | ||
(deftest phenylalanine-RNA-sequence-2 | ||
(testing "Phenylalanine RNA sequence 2" | ||
(is (= ["Phenylalanine"] | ||
(protein-translation/translate-rna "UUC"))))) | ||
|
||
(deftest identiefies-Serine-codons | ||
(are [codon] (= "Serine" (protein-translation/translate-codon codon)) "UCU" "UCC" "UCA" "UCG")) | ||
(deftest leucine-RNA-sequence-1 | ||
(testing "Leucine RNA sequence 1" | ||
(is (= ["Leucine"] | ||
(protein-translation/translate-rna "UUA"))))) | ||
|
||
(deftest identiefies-Tyrosine-codons | ||
(are [codon] (= "Tyrosine" (protein-translation/translate-codon codon)) "UAU" "UAC")) | ||
(deftest leucine-RNA-sequence-2 | ||
(testing "Leucine RNA sequence 2" | ||
(is (= ["Leucine"] | ||
(protein-translation/translate-rna "UUG"))))) | ||
|
||
(deftest identifies-Cysteine-codons | ||
(are [codon] (= "Cysteine" (protein-translation/translate-codon codon)) "UGU" "UGC")) | ||
(deftest serine-RNA-sequence-1 | ||
(testing "Serine RNA sequence 1" | ||
(is (= ["Serine"] | ||
(protein-translation/translate-rna "UCU"))))) | ||
|
||
(deftest identifies-stop-codons | ||
(are [codon] (= "STOP" (protein-translation/translate-codon codon)) "UAA" "UAG" "UGA")) | ||
(deftest serine-RNA-sequence-2 | ||
(testing "Serine RNA sequence 2" | ||
(is (= ["Serine"] | ||
(protein-translation/translate-rna "UCC"))))) | ||
|
||
(deftest translates-rna-strand-into-correct-protein | ||
(is (= ["Methionine" "Phenylalanine" "Tryptophan"] (protein-translation/translate-rna "AUGUUUUGG")))) | ||
(deftest serine-RNA-sequence-3 | ||
(testing "Serine RNA sequence 3" | ||
(is (= ["Serine"] | ||
(protein-translation/translate-rna "UCA"))))) | ||
|
||
(deftest stops-translation-if-stop-codon-present | ||
(is (= ["Methionine" "Phenylalanine"] (protein-translation/translate-rna "AUGUUUUAA")))) | ||
(deftest serine-RNA-sequence-4 | ||
(testing "Serine RNA sequence 4" | ||
(is (= ["Serine"] | ||
(protein-translation/translate-rna "UCG"))))) | ||
|
||
(deftest stops-translation-of-longer-strand | ||
(is (= ["Tryptophan" "Cysteine" "Tyrosine"] (protein-translation/translate-rna "UGGUGUUAUUAAUGGUUU")))) | ||
(deftest tyrosine-RNA-sequence-1 | ||
(testing "Tyrosine RNA sequence 1" | ||
(is (= ["Tyrosine"] | ||
(protein-translation/translate-rna "UAU"))))) | ||
|
||
(deftest tyrosine-RNA-sequence-2 | ||
(testing "Tyrosine RNA sequence 2" | ||
(is (= ["Tyrosine"] | ||
(protein-translation/translate-rna "UAC"))))) | ||
|
||
(deftest cysteine-RNA-sequence-1 | ||
(testing "Cysteine RNA sequence 1" | ||
(is (= ["Cysteine"] | ||
(protein-translation/translate-rna "UGU"))))) | ||
|
||
(deftest cysteine-RNA-sequence-2 | ||
(testing "Cysteine RNA sequence 2" | ||
(is (= ["Cysteine"] | ||
(protein-translation/translate-rna "UGC"))))) | ||
|
||
(deftest tryptophan-RNA-sequence | ||
(testing "Tryptophan RNA sequence" | ||
(is (= ["Tryptophan"] | ||
(protein-translation/translate-rna "UGG"))))) | ||
|
||
(deftest STOP-codon-RNA-sequence-1 | ||
(testing "STOP codon RNA sequence 1" | ||
(is (= [] (protein-translation/translate-rna "UAA"))))) | ||
|
||
(deftest STOP-codon-RNA-sequence-2 | ||
(testing "STOP codon RNA sequence 2" | ||
(is (= [] (protein-translation/translate-rna "UAG"))))) | ||
|
||
(deftest STOP-codon-RNA-sequence-3 | ||
(testing "STOP codon RNA sequence 3" | ||
(is (= [] (protein-translation/translate-rna "UGA"))))) | ||
|
||
(deftest sequence-of-two-protein-codons-translates-into-proteins | ||
(testing "Sequence of two protein codons translates into proteins" | ||
(is (= ["Phenylalanine", "Phenylalanine"] | ||
(protein-translation/translate-rna "UUUUUU"))))) | ||
|
||
(deftest sequence-of-two-different-protein-codons-translates-into-proteins | ||
(testing "Sequence of two different protein codons translates into proteins" | ||
(is (= ["Leucine", "Leucine"] | ||
(protein-translation/translate-rna "UUAUUG"))))) | ||
|
||
(deftest translate-RNA-strand-into-correct-protein-list | ||
(testing "Translate RNA strand into correct protein list" | ||
(is (= ["Methionine", "Phenylalanine", "Tryptophan"] | ||
(protein-translation/translate-rna "AUGUUUUGG"))))) | ||
|
||
(deftest translation-stops-if-STOP-codon-at-beginning-of-sequence | ||
(testing "Translation stops if STOP codon at beginning of sequence" | ||
(is (= [] (protein-translation/translate-rna "UAGUGG"))))) | ||
|
||
(deftest translation-stops-if-STOP-codon-at-end-of-two-codon-sequence | ||
(testing "Translation stops if STOP codon at end of two-codon sequence" | ||
(is (= ["Tryptophan"] | ||
(protein-translation/translate-rna "UGGUAG"))))) | ||
|
||
(deftest translation-stops-if-STOP-codon-at-end-of-three-codon-sequence | ||
(testing "Translation stops if STOP codon at end of three-codon sequence" | ||
(is (= ["Methionine", "Phenylalanine"] | ||
(protein-translation/translate-rna "AUGUUUUAA"))))) | ||
|
||
(deftest translation-stops-if-STOP-codon-in-middle-of-three-codon-sequence | ||
(testing "Translation stops if STOP codon in middle of three-codon sequence" | ||
(is (= ["Tryptophan"] | ||
(protein-translation/translate-rna "UGGUAGUGG"))))) | ||
|
||
(deftest translation-stops-if-STOP-codon-in-middle-of-six-codon-sequence | ||
(testing "Translation stops if STOP codon in middle of six-codon sequence" | ||
(is (= ["Tryptophan", "Cysteine", "Tyrosine"] | ||
(protein-translation/translate-rna "UGGUGUUAUUAAUGGUUU"))))) | ||
|
||
(deftest sequence-of-two-non-STOP-codons-does-not-translate-to-a-STOP-codon | ||
(testing "Sequence of two non-STOP codons does not translate to a STOP codon" | ||
(is (= ["Methionine", "Methionine"] | ||
(protein-translation/translate-rna "AUGAUG"))))) | ||
|
||
(deftest incomplete-RNA-sequence-can-translate-if-valid-until-a-STOP-codon | ||
(testing "Incomplete RNA sequence can translate if valid until a STOP codon" | ||
(is (= ["Phenylalanine", "Phenylalanine"] | ||
(protein-translation/translate-rna "UUCUUCUAAUGGU"))))) |