-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathintToRoman_test.go
More file actions
38 lines (33 loc) · 793 Bytes
/
intToRoman_test.go
File metadata and controls
38 lines (33 loc) · 793 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
package integertoroman
import (
"testing"
"github.com/WindomZ/testify/assert"
)
func Test_intToRoman(t *testing.T) {
assert.Equal(t, "", intToRoman(0))
assert.Equal(t, "", intToRoman(4000))
assert.Equal(t, "I", intToRoman(1))
assert.Equal(t, "X", intToRoman(10))
assert.Equal(t, "C", intToRoman(100))
assert.Equal(t, "M", intToRoman(1000))
assert.Equal(t, "MCXI", intToRoman(1111))
assert.Equal(t, "MCX", intToRoman(1110))
assert.Equal(t, "MMMCMXCIX", intToRoman(3999))
}
func Benchmark_intToRoman(b *testing.B) {
b.StopTimer()
b.ReportAllocs()
b.StartTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
intToRoman(0)
intToRoman(9)
intToRoman(10)
intToRoman(99)
intToRoman(100)
intToRoman(999)
intToRoman(1000)
intToRoman(3999)
}
})
}