summaryrefslogtreecommitdiff
path: root/internal/num/roman_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-03-18 20:47:25 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-03-18 20:47:25 +0100
commit7405ae1ca49258e9fd777171062db56cc73647ae (patch)
tree821d56c3914a4b75d146f4dfec35fae7fd475b35 /internal/num/roman_test.go
parentadf0350662e3f875c92a37c7ca054c6a3964d45b (diff)
add numerical representations
Diffstat (limited to 'internal/num/roman_test.go')
-rw-r--r--internal/num/roman_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/num/roman_test.go b/internal/num/roman_test.go
new file mode 100644
index 0000000..cdb8f6d
--- /dev/null
+++ b/internal/num/roman_test.go
@@ -0,0 +1,25 @@
+package num
+
+import "testing"
+
+func TestRoman(t *testing.T) {
+ testCases := []struct {
+ r Roman
+ s string
+ }{
+ {0, ""},
+ {1990, "MCMXC"},
+ {2008, "MMVIII"},
+ {1666, "MDCLXVI"},
+ {1e3 - 1, "CMXCIX"},
+ {2e3 - 1, "MCMXCIX"},
+ {4e3 - 1, "MMMCMXCIX"},
+ }
+ for _, tc := range testCases {
+ t.Run(tc.s, func(t *testing.T) {
+ if tc.r.String() != tc.s {
+ t.Errorf("got %v, want %v", tc.r, tc.s)
+ }
+ })
+ }
+}