Skip to content

Commit 6125bec

Browse files
roman-numerals: add generator and regenerate tests
[no important files changed]
1 parent 89aec85 commit 6125bec

File tree

4 files changed

+157
-62
lines changed

4 files changed

+157
-62
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(ns roman-numerals-test
2+
(:require [clojure.test :refer [deftest testing is]]
3+
roman-numerals))
4+
{{#test_cases.roman}}
5+
(deftest numerals_test_{{idx}}
6+
(testing "{{description}}"
7+
(is (= "{{expected}}" (roman-numerals/numerals {{input.number}})))))
8+
{{/test_cases.roman~}}
Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,91 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[19828a3a-fbf7-4661-8ddd-cbaeee0e2178]
6-
description = "1 is a single I"
13+
description = "1 is I"
714

815
[f088f064-2d35-4476-9a41-f576da3f7b03]
9-
description = "2 is two I's"
16+
description = "2 is II"
1017

1118
[b374a79c-3bea-43e6-8db8-1286f79c7106]
12-
description = "3 is three I's"
19+
description = "3 is III"
1320

1421
[05a0a1d4-a140-4db1-82e8-fcc21fdb49bb]
15-
description = "4, being 5 - 1, is IV"
22+
description = "4 is IV"
1623

1724
[57c0f9ad-5024-46ab-975d-de18c430b290]
18-
description = "5 is a single V"
25+
description = "5 is V"
1926

2027
[20a2b47f-e57f-4797-a541-0b3825d7f249]
21-
description = "6, being 5 + 1, is VI"
28+
description = "6 is VI"
2229

2330
[ff3fb08c-4917-4aab-9f4e-d663491d083d]
24-
description = "9, being 10 - 1, is IX"
31+
description = "9 is IX"
32+
33+
[6d1d82d5-bf3e-48af-9139-87d7165ed509]
34+
description = "16 is XVI"
2535

2636
[2bda64ca-7d28-4c56-b08d-16ce65716cf6]
27-
description = "20 is two X's"
37+
description = "27 is XXVII"
2838

2939
[a1f812ef-84da-4e02-b4f0-89c907d0962c]
30-
description = "48 is not 50 - 2 but rather 40 + 8"
40+
description = "48 is XLVIII"
3141

3242
[607ead62-23d6-4c11-a396-ef821e2e5f75]
33-
description = "49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1"
43+
description = "49 is XLIX"
3444

3545
[d5b283d4-455d-4e68-aacf-add6c4b51915]
36-
description = "50 is a single L"
46+
description = "59 is LIX"
47+
48+
[4465ffd5-34dc-44f3-ada5-56f5007b6dad]
49+
description = "66 is LXVI"
3750

3851
[46b46e5b-24da-4180-bfe2-2ef30b39d0d0]
39-
description = "90, being 100 - 10, is XC"
52+
description = "93 is XCIII"
4053

4154
[30494be1-9afb-4f84-9d71-db9df18b55e3]
42-
description = "100 is a single C"
55+
description = "141 is CXLI"
4356

4457
[267f0207-3c55-459a-b81d-67cec7a46ed9]
45-
description = "60, being 50 + 10, is LX"
58+
description = "163 is CLXIII"
59+
60+
[902ad132-0b4d-40e3-8597-ba5ed611dd8d]
61+
description = "166 is CLXVI"
4662

4763
[cdb06885-4485-4d71-8bfb-c9d0f496b404]
48-
description = "400, being 500 - 100, is CD"
64+
description = "402 is CDII"
4965

5066
[6b71841d-13b2-46b4-ba97-dec28133ea80]
51-
description = "500 is a single D"
67+
description = "575 is DLXXV"
68+
69+
[dacb84b9-ea1c-4a61-acbb-ce6b36674906]
70+
description = "666 is DCLXVI"
5271

5372
[432de891-7fd6-4748-a7f6-156082eeca2f]
54-
description = "900, being 1000 - 100, is CM"
73+
description = "911 is CMXI"
5574

5675
[e6de6d24-f668-41c0-88d7-889c0254d173]
57-
description = "1000 is a single M"
76+
description = "1024 is MXXIV"
77+
78+
[efbe1d6a-9f98-4eb5-82bc-72753e3ac328]
79+
description = "1666 is MDCLXVI"
5880

5981
[bb550038-d4eb-4be2-a9ce-f21961ac3bc6]
60-
description = "3000 is three M's"
82+
description = "3000 is MMM"
83+
84+
[3bc4b41c-c2e6-49d9-9142-420691504336]
85+
description = "3001 is MMMI"
86+
87+
[2f89cad7-73f6-4d1b-857b-0ef531f68b7e]
88+
description = "3888 is MMMDCCCLXXXVIII"
89+
90+
[4e18e96b-5fbb-43df-a91b-9cb511fe0856]
91+
description = "3999 is MMMCMXCIX"
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(ns roman-numerals)
22

3-
(defn numerals [] ;; <- arglist goes here
4-
;; your code goes here
5-
)
3+
(defn numerals
4+
"Convert a number to its roman numeral(s)"
5+
[n]
6+
;; function body
7+
)
Lines changed: 91 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,111 @@
11
(ns roman-numerals-test
2-
(:require [clojure.test :refer [deftest is]]
2+
(:require [clojure.test :refer [deftest testing is]]
33
roman-numerals))
44

5-
(deftest one
6-
(is (= "I" (roman-numerals/numerals 1))))
5+
(deftest numerals_test_1
6+
(testing "1 is I"
7+
(is (= "I" (roman-numerals/numerals 1)))))
78

8-
(deftest two
9-
(is (= "II" (roman-numerals/numerals 2))))
9+
(deftest numerals_test_2
10+
(testing "2 is II"
11+
(is (= "II" (roman-numerals/numerals 2)))))
1012

11-
(deftest three
12-
(is (= "III" (roman-numerals/numerals 3))))
13+
(deftest numerals_test_3
14+
(testing "3 is III"
15+
(is (= "III" (roman-numerals/numerals 3)))))
1316

14-
(deftest four
15-
(is (= "IV" (roman-numerals/numerals 4))))
17+
(deftest numerals_test_4
18+
(testing "4 is IV"
19+
(is (= "IV" (roman-numerals/numerals 4)))))
1620

17-
(deftest five
18-
(is (= "V" (roman-numerals/numerals 5))))
21+
(deftest numerals_test_5
22+
(testing "5 is V"
23+
(is (= "V" (roman-numerals/numerals 5)))))
1924

20-
(deftest six
21-
(is (= "VI" (roman-numerals/numerals 6))))
25+
(deftest numerals_test_6
26+
(testing "6 is VI"
27+
(is (= "VI" (roman-numerals/numerals 6)))))
2228

23-
(deftest nine
24-
(is (= "IX" (roman-numerals/numerals 9))))
29+
(deftest numerals_test_7
30+
(testing "9 is IX"
31+
(is (= "IX" (roman-numerals/numerals 9)))))
2532

26-
(deftest twenty-seven
27-
(is (= "XXVII" (roman-numerals/numerals 27))))
33+
(deftest numerals_test_8
34+
(testing "16 is XVI"
35+
(is (= "XVI" (roman-numerals/numerals 16)))))
2836

29-
(deftest forty-eight
30-
(is (= "XLVIII" (roman-numerals/numerals 48))))
37+
(deftest numerals_test_9
38+
(testing "27 is XXVII"
39+
(is (= "XXVII" (roman-numerals/numerals 27)))))
3140

32-
(deftest fifty-nine
33-
(is (= "LIX" (roman-numerals/numerals 59))))
41+
(deftest numerals_test_10
42+
(testing "48 is XLVIII"
43+
(is (= "XLVIII" (roman-numerals/numerals 48)))))
3444

35-
(deftest ninety-three
36-
(is (= "XCIII" (roman-numerals/numerals 93))))
45+
(deftest numerals_test_11
46+
(testing "49 is XLIX"
47+
(is (= "XLIX" (roman-numerals/numerals 49)))))
3748

38-
(deftest one-hundred-forty-one
39-
(is (= "CXLI" (roman-numerals/numerals 141))))
49+
(deftest numerals_test_12
50+
(testing "59 is LIX"
51+
(is (= "LIX" (roman-numerals/numerals 59)))))
4052

41-
(deftest one-hundred-sixty-three
42-
(is (= "CLXIII" (roman-numerals/numerals 163))))
53+
(deftest numerals_test_13
54+
(testing "66 is LXVI"
55+
(is (= "LXVI" (roman-numerals/numerals 66)))))
4356

44-
(deftest four-hundred-two
45-
(is (= "CDII" (roman-numerals/numerals 402))))
57+
(deftest numerals_test_14
58+
(testing "93 is XCIII"
59+
(is (= "XCIII" (roman-numerals/numerals 93)))))
4660

47-
(deftest five-hundred-seventy-five
48-
(is (= "DLXXV" (roman-numerals/numerals 575))))
61+
(deftest numerals_test_15
62+
(testing "141 is CXLI"
63+
(is (= "CXLI" (roman-numerals/numerals 141)))))
4964

50-
(deftest nine-hundred-eleven
51-
(is (= "CMXI" (roman-numerals/numerals 911))))
65+
(deftest numerals_test_16
66+
(testing "163 is CLXIII"
67+
(is (= "CLXIII" (roman-numerals/numerals 163)))))
5268

53-
(deftest one-thousand-twenty-four
54-
(is (= "MXXIV" (roman-numerals/numerals 1024))))
69+
(deftest numerals_test_17
70+
(testing "166 is CLXVI"
71+
(is (= "CLXVI" (roman-numerals/numerals 166)))))
5572

56-
(deftest three-thousand
57-
(is (= "MMM" (roman-numerals/numerals 3000))))
73+
(deftest numerals_test_18
74+
(testing "402 is CDII"
75+
(is (= "CDII" (roman-numerals/numerals 402)))))
76+
77+
(deftest numerals_test_19
78+
(testing "575 is DLXXV"
79+
(is (= "DLXXV" (roman-numerals/numerals 575)))))
80+
81+
(deftest numerals_test_20
82+
(testing "666 is DCLXVI"
83+
(is (= "DCLXVI" (roman-numerals/numerals 666)))))
84+
85+
(deftest numerals_test_21
86+
(testing "911 is CMXI"
87+
(is (= "CMXI" (roman-numerals/numerals 911)))))
88+
89+
(deftest numerals_test_22
90+
(testing "1024 is MXXIV"
91+
(is (= "MXXIV" (roman-numerals/numerals 1024)))))
92+
93+
(deftest numerals_test_23
94+
(testing "1666 is MDCLXVI"
95+
(is (= "MDCLXVI" (roman-numerals/numerals 1666)))))
96+
97+
(deftest numerals_test_24
98+
(testing "3000 is MMM"
99+
(is (= "MMM" (roman-numerals/numerals 3000)))))
100+
101+
(deftest numerals_test_25
102+
(testing "3001 is MMMI"
103+
(is (= "MMMI" (roman-numerals/numerals 3001)))))
104+
105+
(deftest numerals_test_26
106+
(testing "3888 is MMMDCCCLXXXVIII"
107+
(is (= "MMMDCCCLXXXVIII" (roman-numerals/numerals 3888)))))
108+
109+
(deftest numerals_test_27
110+
(testing "3999 is MMMCMXCIX"
111+
(is (= "MMMCMXCIX" (roman-numerals/numerals 3999)))))

0 commit comments

Comments
 (0)