Skip to content

Commit 81425f0

Browse files
authored
Sync roman-numerals with problem-specifications (#546)
* Rectify tests.toml for roman-numerals This removes an entry for an unimplemented test. See #370 * Normalize test descriptions in roman-numerals This uses the descriptions found in the canonical-data in problem-specifications for the test descriptions in the roman-numerals test suite. * Sync roman-numerals with problem-specifications This brings in updates to the instructions and metadata, as well as adding several new tests.
1 parent a7c03e1 commit 81425f0

File tree

4 files changed

+116
-75
lines changed

4 files changed

+116
-75
lines changed

exercises/practice/roman-numerals/.docs/instructions.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@
22

33
Write a function to convert from normal numbers to Roman Numerals.
44

5-
The Romans were a clever bunch. They conquered most of Europe and ruled
6-
it for hundreds of years. They invented concrete and straight roads and
7-
even bikinis. One thing they never discovered though was the number
8-
zero. This made writing and dating extensive histories of their exploits
9-
slightly more challenging, but the system of numbers they came up with
10-
is still in use today. For example the BBC uses Roman numerals to date
11-
their programmes.
12-
13-
The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
14-
these letters have lots of straight lines and are hence easy to hack
15-
into stone tablets).
5+
The Romans were a clever bunch.
6+
They conquered most of Europe and ruled it for hundreds of years.
7+
They invented concrete and straight roads and even bikinis.
8+
One thing they never discovered though was the number zero.
9+
This made writing and dating extensive histories of their exploits slightly more challenging, but the system of numbers they came up with is still in use today.
10+
For example the BBC uses Roman numerals to date their programs.
11+
12+
The Romans wrote numbers using letters - I, V, X, L, C, D, M.
13+
(notice these letters have lots of straight lines and are hence easy to hack into stone tablets).
1614

1715
```text
1816
1 => I
1917
10 => X
2018
7 => VII
2119
```
2220

23-
There is no need to be able to convert numbers larger than about 3000.
21+
The maximum number supported by this notation is 3,999.
2422
(The Romans themselves didn't tend to go any higher)
2523

26-
Wikipedia says: Modern Roman numerals ... are written by expressing each
27-
digit separately starting with the left most digit and skipping any
28-
digit with a value of zero.
24+
Wikipedia says: Modern Roman numerals ... are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero.
2925

3026
To see this in practice, consider the example of 1990.
3127

@@ -40,4 +36,6 @@ In Roman numerals 1990 is MCMXC:
4036
2000=MM
4137
8=VIII
4238

43-
See also: http://www.novaroma.org/via_romana/numbers.html
39+
Learn more about [Roman numberals on Wikipedia][roman-numerals].
40+
41+
[roman-numerals]: https://wiki.imperivm-romanvm.com/wiki/Roman_Numerals

exercises/practice/roman-numerals/.meta/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"blurb": "Write a function to convert from normal numbers to Roman Numerals.",
32
"authors": [
43
"LegalizeAdulthood"
54
],
@@ -24,6 +23,7 @@
2423
".meta/example.h"
2524
]
2625
},
26+
"blurb": "Write a function to convert from normal numbers to Roman Numerals.",
2727
"source": "The Roman Numeral Kata",
28-
"source_url": "http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals"
28+
"source_url": "https://codingdojo.org/kata/RomanNumerals/"
2929
}
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,88 @@
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"
2532

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

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

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

3542
[d5b283d4-455d-4e68-aacf-add6c4b51915]
36-
description = "50 is a single L"
43+
description = "59 is LIX"
3744

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

4148
[30494be1-9afb-4f84-9d71-db9df18b55e3]
42-
description = "100 is a single C"
49+
description = "141 is CXLI"
4350

4451
[267f0207-3c55-459a-b81d-67cec7a46ed9]
45-
description = "60, being 50 + 10, is LX"
52+
description = "163 is CLXIII"
4653

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

5057
[6b71841d-13b2-46b4-ba97-dec28133ea80]
51-
description = "500 is a single D"
58+
description = "575 is DLXXV"
5259

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

5663
[e6de6d24-f668-41c0-88d7-889c0254d173]
57-
description = "1000 is a single M"
64+
description = "1024 is MXXIV"
5865

5966
[bb550038-d4eb-4be2-a9ce-f21961ac3bc6]
60-
description = "3000 is three M's"
67+
description = "3000 is MMM"
68+
69+
[6d1d82d5-bf3e-48af-9139-87d7165ed509]
70+
description = "16 is XVI"
71+
72+
[4465ffd5-34dc-44f3-ada5-56f5007b6dad]
73+
description = "66 is LXVI"
74+
75+
[902ad132-0b4d-40e3-8597-ba5ed611dd8d]
76+
description = "166 is CLXVI"
77+
78+
[dacb84b9-ea1c-4a61-acbb-ce6b36674906]
79+
description = "666 is DCLXVI"
80+
81+
[efbe1d6a-9f98-4eb5-82bc-72753e3ac328]
82+
description = "1666 is MDCLXVI"
83+
84+
[3bc4b41c-c2e6-49d9-9142-420691504336]
85+
description = "3001 is MMMI"
86+
87+
[4e18e96b-5fbb-43df-a91b-9cb511fe0856]
88+
description = "3999 is MMMCMXCIX"

exercises/practice/roman-numerals/roman_numerals_test.cpp

+50-35
Original file line numberDiff line numberDiff line change
@@ -5,94 +5,109 @@
55
#include "test/catch.hpp"
66
#endif
77

8-
TEST_CASE("one_yields_I")
8+
TEST_CASE("1_is_i")
99
{
1010
REQUIRE("I" == roman_numerals::convert(1));
1111
}
12-
1312
#if defined(EXERCISM_RUN_ALL_TESTS)
14-
TEST_CASE("two_yields_II")
13+
TEST_CASE("2_is_ii")
1514
{
1615
REQUIRE("II" == roman_numerals::convert(2));
1716
}
18-
19-
TEST_CASE("three_yields_III")
17+
TEST_CASE("3_is_iii")
2018
{
2119
REQUIRE("III" == roman_numerals::convert(3));
2220
}
23-
24-
TEST_CASE("four_yields_IV")
21+
TEST_CASE("4_is_iv")
2522
{
2623
REQUIRE("IV" == roman_numerals::convert(4));
2724
}
28-
29-
TEST_CASE("five_yields_V")
25+
TEST_CASE("5_is_v")
3026
{
3127
REQUIRE("V" == roman_numerals::convert(5));
3228
}
33-
34-
TEST_CASE("six_yields_VI")
29+
TEST_CASE("6_is_vi")
3530
{
3631
REQUIRE("VI" == roman_numerals::convert(6));
3732
}
38-
39-
TEST_CASE("nine_yields_IX")
33+
TEST_CASE("9_is_ix")
4034
{
4135
REQUIRE("IX" == roman_numerals::convert(9));
4236
}
43-
44-
TEST_CASE("twenty_seven_yields_XXVII")
37+
TEST_CASE("27_is_xxvii")
4538
{
4639
REQUIRE("XXVII" == roman_numerals::convert(27));
4740
}
48-
49-
TEST_CASE("forty_eight_yields_XLVIII")
41+
TEST_CASE("48_is_xlviii")
5042
{
5143
REQUIRE("XLVIII" == roman_numerals::convert(48));
5244
}
53-
54-
TEST_CASE("fifty_nine_yields_LIX")
45+
TEST_CASE("49_is_xlix")
46+
{
47+
REQUIRE("XLIX" == roman_numerals::convert(49));
48+
}
49+
TEST_CASE("59_is_lix")
5550
{
5651
REQUIRE("LIX" == roman_numerals::convert(59));
5752
}
58-
59-
TEST_CASE("ninety_three_yields_XCIII")
53+
TEST_CASE("93_is_xciii")
6054
{
6155
REQUIRE("XCIII" == roman_numerals::convert(93));
6256
}
63-
64-
TEST_CASE("one_hundred_forty_one_yields_CXLI")
57+
TEST_CASE("141_is_cxli")
6558
{
6659
REQUIRE("CXLI" == roman_numerals::convert(141));
6760
}
68-
69-
TEST_CASE("one_hundred_sixty_three_yields_CLXIII")
61+
TEST_CASE("163_is_clxiii")
7062
{
7163
REQUIRE("CLXIII" == roman_numerals::convert(163));
7264
}
73-
74-
TEST_CASE("four_hundred_two_yields_CDII")
65+
TEST_CASE("402_is_cdii")
7566
{
7667
REQUIRE("CDII" == roman_numerals::convert(402));
7768
}
78-
79-
TEST_CASE("five_hundred_seventy_five_yields_DLXXV")
69+
TEST_CASE("575_is_dlxxv")
8070
{
8171
REQUIRE("DLXXV" == roman_numerals::convert(575));
8272
}
83-
84-
TEST_CASE("nine_hundred_eleven_yields_CMXI")
73+
TEST_CASE("911_is_cmxi")
8574
{
8675
REQUIRE("CMXI" == roman_numerals::convert(911));
8776
}
88-
89-
TEST_CASE("one_thousand_twenty_four_yields_MXXIV")
77+
TEST_CASE("1024_is_mxxiv")
9078
{
9179
REQUIRE("MXXIV" == roman_numerals::convert(1024));
9280
}
93-
94-
TEST_CASE("three_thousand_yields_MMM")
81+
TEST_CASE("3000_is_mmm")
9582
{
9683
REQUIRE("MMM" == roman_numerals::convert(3000));
9784
}
85+
TEST_CASE("16_is_xvi")
86+
{
87+
REQUIRE("XVI" == roman_numerals::convert(16));
88+
}
89+
TEST_CASE("66_is_lxvi")
90+
{
91+
REQUIRE("LXVI" == roman_numerals::convert(66));
92+
}
93+
TEST_CASE("166_is_clxvi")
94+
{
95+
REQUIRE("CLXVI" == roman_numerals::convert(166));
96+
}
97+
TEST_CASE("666_is_dclxvi")
98+
{
99+
REQUIRE("DCLXVI" == roman_numerals::convert(666));
100+
}
101+
TEST_CASE("1666_is_mdclxvi")
102+
{
103+
REQUIRE("MDCLXVI" == roman_numerals::convert(1666));
104+
}
105+
TEST_CASE("3001_is_mmmi")
106+
{
107+
REQUIRE("MMMI" == roman_numerals::convert(3001));
108+
}
109+
TEST_CASE("3999_is_mmmcmxcix")
110+
{
111+
REQUIRE("MMMCMXCIX" == roman_numerals::convert(3999));
112+
}
98113
#endif

0 commit comments

Comments
 (0)