Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions exercises/practice/run-length-encoding/.meta/generator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
run-length-encoding))

{{#test_cases.encode}}
(deftest run-length-encode_test_{{idx}}
(deftest ^:run-length-encode run-length-encode_test_{{idx}}
(testing {{context}}
(is (= {{expected}}
(run-length-encoding/run-length-encode {{input.string}})))))
{{/test_cases.encode}}

{{#test_cases.decode}}
(deftest run-length-decode_test_{{idx}}
(deftest ^:run-length-decode run-length-decode_test_{{idx}}
(testing {{context}}
(is (= {{expected}}
(run-length-encoding/run-length-decode {{input.string}})))))
Expand Down
4 changes: 3 additions & 1 deletion exercises/practice/run-length-encoding/project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
(defproject run-length-encoding "0.1.0-SNAPSHOT"
:description "run-length-encoding exercise."
:url "https://github.com/exercism/clojure/tree/main/exercises/practice/run-length-encoding"
:dependencies [[org.clojure/clojure "1.12.0"]])
:dependencies [[org.clojure/clojure "1.12.0"]]
:test-selectors {:run-length-encode :run-length-encode
:run-length-decode :run-length-decode})
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,62 @@
(:require [clojure.test :refer [deftest testing is]]
run-length-encoding))

(deftest run-length-encode_test_1
(deftest ^:run-length-encode run-length-encode_test_1
(testing "run-length encode a string ▶ empty string"
(is (= ""
(run-length-encoding/run-length-encode "")))))

(deftest run-length-encode_test_2
(deftest ^:run-length-encode run-length-encode_test_2
(testing "run-length encode a string ▶ single characters only are encoded without count"
(is (= "XYZ"
(run-length-encoding/run-length-encode "XYZ")))))

(deftest run-length-encode_test_3
(deftest ^:run-length-encode run-length-encode_test_3
(testing "run-length encode a string ▶ string with no single characters"
(is (= "2A3B4C"
(run-length-encoding/run-length-encode "AABBBCCCC")))))

(deftest run-length-encode_test_4
(deftest ^:run-length-encode run-length-encode_test_4
(testing "run-length encode a string ▶ single characters mixed with repeated characters"
(is (= "12WB12W3B24WB"
(run-length-encoding/run-length-encode "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB")))))

(deftest run-length-encode_test_5
(deftest ^:run-length-encode run-length-encode_test_5
(testing "run-length encode a string ▶ multiple whitespace mixed in string"
(is (= "2 hs2q q2w2 "
(run-length-encoding/run-length-encode " hsqq qww ")))))

(deftest run-length-encode_test_6
(deftest ^:run-length-encode run-length-encode_test_6
(testing "run-length encode a string ▶ lowercase characters"
(is (= "2a3b4c"
(run-length-encoding/run-length-encode "aabbbcccc")))))

(deftest run-length-decode_test_1
(deftest ^:run-length-decode run-length-decode_test_1
(testing "run-length decode a string ▶ empty string"
(is (= ""
(run-length-encoding/run-length-decode "")))))

(deftest run-length-decode_test_2
(deftest ^:run-length-decode run-length-decode_test_2
(testing "run-length decode a string ▶ single characters only"
(is (= "XYZ"
(run-length-encoding/run-length-decode "XYZ")))))

(deftest run-length-decode_test_3
(deftest ^:run-length-decode run-length-decode_test_3
(testing "run-length decode a string ▶ string with no single characters"
(is (= "AABBBCCCC"
(run-length-encoding/run-length-decode "2A3B4C")))))

(deftest run-length-decode_test_4
(deftest ^:run-length-decode run-length-decode_test_4
(testing "run-length decode a string ▶ single characters with repeated characters"
(is (= "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
(run-length-encoding/run-length-decode "12WB12W3B24WB")))))

(deftest run-length-decode_test_5
(deftest ^:run-length-decode run-length-decode_test_5
(testing "run-length decode a string ▶ multiple whitespace mixed in string"
(is (= " hsqq qww "
(run-length-encoding/run-length-decode "2 hs2q q2w2 ")))))

(deftest run-length-decode_test_6
(deftest ^:run-length-decode run-length-decode_test_6
(testing "run-length decode a string ▶ lowercase string"
(is (= "aabbbcccc"
(run-length-encoding/run-length-decode "2a3b4c")))))
Loading