summaryrefslogtreecommitdiff
path: root/internal/num/roman_test.go
blob: cdb8f6d7d54c6e51a7138c1f736313cd48449805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
			}
		})
	}
}