Skip to content

Commit 05ee37a

Browse files
Sync roman-numerals tests (#495)
To allow for new test cases, we update an assertion. resolves #473
1 parent 4cb4355 commit 05ee37a

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

exercises/practice/roman-numerals/.meta/example.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
let to_roman n =
3-
assert (n <= 3000);
3+
assert (n < 4000);
44

55
let build ones halves tens = function
66
| 0 -> ""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
(lang dune 1.1)
2-
(version 1.2.0)
2+
(version 1.0)

exercises/practice/roman-numerals/test.ml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
1-
(* roman-numerals - 1.2.0 *)
1+
(* roman-numerals - 1.0 *)
22
open OUnit2
33
open Roman_numerals
44

55
let ae expected actual _ctx = assert_equal ~printer:(fun x -> x) expected actual
66

77
let tests = [
8-
"1 is a single I" >::
8+
"1 is I" >::
99
ae "I" (to_roman 1);
10-
"2 is two I's" >::
10+
"2 is II" >::
1111
ae "II" (to_roman 2);
12-
"3 is three I's" >::
12+
"3 is III" >::
1313
ae "III" (to_roman 3);
14-
"4, being 5 - 1, is IV" >::
14+
"4 is IV" >::
1515
ae "IV" (to_roman 4);
16-
"5 is a single V" >::
16+
"5 is V" >::
1717
ae "V" (to_roman 5);
18-
"6, being 5 + 1, is VI" >::
18+
"6 is VI" >::
1919
ae "VI" (to_roman 6);
20-
"9, being 10 - 1, is IX" >::
20+
"9 is IX" >::
2121
ae "IX" (to_roman 9);
22-
"20 is two X's" >::
22+
"16 is XVI" >::
23+
ae "XVI" (to_roman 16);
24+
"27 is XXVII" >::
2325
ae "XXVII" (to_roman 27);
24-
"48 is not 50 - 2 but rather 40 + 8" >::
26+
"48 is XLVIII" >::
2527
ae "XLVIII" (to_roman 48);
26-
"49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1" >::
28+
"49 is XLIX" >::
2729
ae "XLIX" (to_roman 49);
28-
"50 is a single L" >::
30+
"59 is LIX" >::
2931
ae "LIX" (to_roman 59);
30-
"90, being 100 - 10, is XC" >::
32+
"66 is LXVI" >::
33+
ae "LXVI" (to_roman 66);
34+
"93 is XCIII" >::
3135
ae "XCIII" (to_roman 93);
32-
"100 is a single C" >::
36+
"141 is CXLI" >::
3337
ae "CXLI" (to_roman 141);
34-
"60, being 50 + 10, is LX" >::
38+
"163 is CLXIII" >::
3539
ae "CLXIII" (to_roman 163);
36-
"400, being 500 - 100, is CD" >::
40+
"166 is CLXVI" >::
41+
ae "CLXVI" (to_roman 166);
42+
"402 is CDII" >::
3743
ae "CDII" (to_roman 402);
38-
"500 is a single D" >::
44+
"575 is DLXXV" >::
3945
ae "DLXXV" (to_roman 575);
40-
"900, being 1000 - 100, is CM" >::
46+
"666 is DCLXVI" >::
47+
ae "DCLXVI" (to_roman 666);
48+
"911 is CMXI" >::
4149
ae "CMXI" (to_roman 911);
42-
"1000 is a single M" >::
50+
"1024 is MXXIV" >::
4351
ae "MXXIV" (to_roman 1024);
44-
"3000 is three M's" >::
52+
"1666 is MDCLXVI" >::
53+
ae "MDCLXVI" (to_roman 1666);
54+
"3000 is MMM" >::
4555
ae "MMM" (to_roman 3000);
56+
"3001 is MMMI" >::
57+
ae "MMMI" (to_roman 3001);
58+
"3999 is MMMCMXCIX" >::
59+
ae "MMMCMXCIX" (to_roman 3999);
4660
]
4761

4862
let () =

templates/roman-numerals/.broken

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)