Skip to content

Commit

Permalink
rna-transcription: Add generators and regenerate tests (#798)
Browse files Browse the repository at this point in the history
* update function template

* update example solution

* add generators and regenerate tests

* update contributors

[no important files changed]
  • Loading branch information
tasxatzial authored Jan 22, 2025
1 parent 85d5ebd commit 8675462
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion exercises/practice/rna-transcription/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"sjwarner-bp",
"solaryeti",
"tejasbubane",
"yurrriq"
"yurrriq",
"tasxatzial"
],
"files": {
"solution": [
Expand Down
6 changes: 1 addition & 5 deletions exercises/practice/rna-transcription/.meta/example.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@
\A \U
\T \A})

(defn- translate [c]
{:post [%]}
(dna->rna c))

(defn to-rna [dna]
(apply str (map translate dna)))
(apply str (map dna->rna dna)))
9 changes: 9 additions & 0 deletions exercises/practice/rna-transcription/.meta/generator.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns rna-transcription-test
(:require [clojure.test :refer [deftest testing is]]
rna-transcription))

{{#test_cases.toRna}}
(deftest to-rna_test_{{idx}}
(testing {{description}}
(is (= {{expected}} (rna-transcription/to-rna {{input.dna}})))))
{{/test_cases.toRna}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(ns rna-transcription)

(defn to-rna [dna] ;; <- arglist goes here
;; your code goes here
)
(defn to-rna
"Returns the RNA complement of the given DNA string sequence."
[dna]
;; function body
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
(:require [clojure.test :refer [deftest testing is]]
rna-transcription))

(deftest empty-sequence
(deftest to-rna_test_1
(testing "Empty RNA sequence"
(is (= "" (rna-transcription/to-rna "")))))

(deftest rna-complement-of-cytosine
(deftest to-rna_test_2
(testing "RNA complement of cytosine is guanine"
(is (= "G" (rna-transcription/to-rna "C")))))

(deftest rna-complement-of-guanine
(deftest to-rna_test_3
(testing "RNA complement of guanine is cytosine"
(is (= "C" (rna-transcription/to-rna "G")))))

(deftest rna-complement-of-thymine
(deftest to-rna_test_4
(testing "RNA complement of thymine is adenine"
(is (= "A" (rna-transcription/to-rna "T")))))

(deftest rna-complement-of-adenine
(deftest to-rna_test_5
(testing "RNA complement of adenine is uracil"
(is (= "U" (rna-transcription/to-rna "A")))))

(deftest rna-complement
(deftest to-rna_test_6
(testing "RNA complement"
(is (= "UGCACCAGAAUU" (rna-transcription/to-rna "ACGTGGTCTTAA")))))

0 comments on commit 8675462

Please sign in to comment.