Skip to content

Commit

Permalink
Add roman-numerals template
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Jan 10, 2025
1 parent 66cb526 commit c67c69c
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 38 deletions.
10 changes: 10 additions & 0 deletions exercises/practice/roman-numerals/.meta/generator.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns roman-numerals-test
(:require [clojure.test :refer [deftest testing is]]
roman-numerals))

{{#test_cases}}
(deftest roman-numerals_test_{{idx}}
(testing "{{description}}"
(is (= "{{expected}}" (roman-numerals/numerals {{input.number}})))))

{{/test_cases}}
131 changes: 93 additions & 38 deletions exercises/practice/roman-numerals/test/roman_numerals_test.clj
Original file line number Diff line number Diff line change
@@ -1,57 +1,112 @@
(ns roman-numerals-test
(:require [clojure.test :refer [deftest is]]
roman-numerals))
(:require [clojure.test :refer [deftest testing is]]
roman-numerals))

(deftest one
(is (= "I" (roman-numerals/numerals 1))))
(deftest roman-numerals_test_1
(testing "1 is I"
(is (= "I" (roman-numerals/numerals 1)))))

(deftest two
(is (= "II" (roman-numerals/numerals 2))))
(deftest roman-numerals_test_2
(testing "2 is II"
(is (= "II" (roman-numerals/numerals 2)))))

(deftest three
(is (= "III" (roman-numerals/numerals 3))))
(deftest roman-numerals_test_3
(testing "3 is III"
(is (= "III" (roman-numerals/numerals 3)))))

(deftest four
(is (= "IV" (roman-numerals/numerals 4))))
(deftest roman-numerals_test_4
(testing "4 is IV"
(is (= "IV" (roman-numerals/numerals 4)))))

(deftest five
(is (= "V" (roman-numerals/numerals 5))))
(deftest roman-numerals_test_5
(testing "5 is V"
(is (= "V" (roman-numerals/numerals 5)))))

(deftest six
(is (= "VI" (roman-numerals/numerals 6))))
(deftest roman-numerals_test_6
(testing "6 is VI"
(is (= "VI" (roman-numerals/numerals 6)))))

(deftest nine
(is (= "IX" (roman-numerals/numerals 9))))
(deftest roman-numerals_test_7
(testing "9 is IX"
(is (= "IX" (roman-numerals/numerals 9)))))

(deftest twenty-seven
(is (= "XXVII" (roman-numerals/numerals 27))))
(deftest roman-numerals_test_8
(testing "16 is XVI"
(is (= "XVI" (roman-numerals/numerals 16)))))

(deftest forty-eight
(is (= "XLVIII" (roman-numerals/numerals 48))))
(deftest roman-numerals_test_9
(testing "27 is XXVII"
(is (= "XXVII" (roman-numerals/numerals 27)))))

(deftest fifty-nine
(is (= "LIX" (roman-numerals/numerals 59))))
(deftest roman-numerals_test_10
(testing "48 is XLVIII"
(is (= "XLVIII" (roman-numerals/numerals 48)))))

(deftest ninety-three
(is (= "XCIII" (roman-numerals/numerals 93))))
(deftest roman-numerals_test_11
(testing "49 is XLIX"
(is (= "XLIX" (roman-numerals/numerals 49)))))

(deftest one-hundred-forty-one
(is (= "CXLI" (roman-numerals/numerals 141))))
(deftest roman-numerals_test_12
(testing "59 is LIX"
(is (= "LIX" (roman-numerals/numerals 59)))))

(deftest one-hundred-sixty-three
(is (= "CLXIII" (roman-numerals/numerals 163))))
(deftest roman-numerals_test_13
(testing "66 is LXVI"
(is (= "LXVI" (roman-numerals/numerals 66)))))

(deftest four-hundred-two
(is (= "CDII" (roman-numerals/numerals 402))))
(deftest roman-numerals_test_14
(testing "93 is XCIII"
(is (= "XCIII" (roman-numerals/numerals 93)))))

(deftest five-hundred-seventy-five
(is (= "DLXXV" (roman-numerals/numerals 575))))
(deftest roman-numerals_test_15
(testing "141 is CXLI"
(is (= "CXLI" (roman-numerals/numerals 141)))))

(deftest nine-hundred-eleven
(is (= "CMXI" (roman-numerals/numerals 911))))
(deftest roman-numerals_test_16
(testing "163 is CLXIII"
(is (= "CLXIII" (roman-numerals/numerals 163)))))

(deftest one-thousand-twenty-four
(is (= "MXXIV" (roman-numerals/numerals 1024))))
(deftest roman-numerals_test_17
(testing "166 is CLXVI"
(is (= "CLXVI" (roman-numerals/numerals 166)))))

(deftest roman-numerals_test_18
(testing "402 is CDII"
(is (= "CDII" (roman-numerals/numerals 402)))))

(deftest roman-numerals_test_19
(testing "575 is DLXXV"
(is (= "DLXXV" (roman-numerals/numerals 575)))))

(deftest roman-numerals_test_20
(testing "666 is DCLXVI"
(is (= "DCLXVI" (roman-numerals/numerals 666)))))

(deftest roman-numerals_test_21
(testing "911 is CMXI"
(is (= "CMXI" (roman-numerals/numerals 911)))))

(deftest roman-numerals_test_22
(testing "1024 is MXXIV"
(is (= "MXXIV" (roman-numerals/numerals 1024)))))

(deftest roman-numerals_test_23
(testing "1666 is MDCLXVI"
(is (= "MDCLXVI" (roman-numerals/numerals 1666)))))

(deftest roman-numerals_test_24
(testing "3000 is MMM"
(is (= "MMM" (roman-numerals/numerals 3000)))))

(deftest roman-numerals_test_25
(testing "3001 is MMMI"
(is (= "MMMI" (roman-numerals/numerals 3001)))))

(deftest roman-numerals_test_26
(testing "3888 is MMMDCCCLXXXVIII"
(is (= "MMMDCCCLXXXVIII" (roman-numerals/numerals 3888)))))

(deftest roman-numerals_test_27
(testing "3999 is MMMCMXCIX"
(is (= "MMMCMXCIX" (roman-numerals/numerals 3999)))))

(deftest three-thousand
(is (= "MMM" (roman-numerals/numerals 3000))))

0 comments on commit c67c69c

Please sign in to comment.