mirror of
https://github.com/rwinkhart/convertroman.git
synced 2026-09-05 08:27:21 -04:00
Improve README example
This commit is contained in:
@@ -32,10 +32,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
roman := FromInt(4)
|
var roman string
|
||||||
|
|
||||||
|
// lowercase
|
||||||
|
roman = rom.FromInt(4)
|
||||||
if roman == "OOB" {
|
if roman == "OOB" {
|
||||||
panic("Input integer is out of bounds (greater than 3,999,999)")
|
panic("Input integer is out of bounds (greater than 3,999,999)")
|
||||||
}
|
}
|
||||||
fmt.Println(roman == "iv") // True
|
fmt.Println(roman == "iv") // True
|
||||||
|
|
||||||
|
// capital (slightly slower)
|
||||||
|
roman = rom.FromIntCapital(4)
|
||||||
|
if roman == "OOB" {
|
||||||
|
panic("Input integer is out of bounds (greater than 3,999,999)")
|
||||||
|
}
|
||||||
|
fmt.Println(roman == "IV") // True
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package convertroman
|
package convertroman
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,11 +48,3 @@ func BenchmarkFromInt(b *testing.B) {
|
|||||||
_ = FromInt(3999)
|
_ = FromInt(3999)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleFromInt() {
|
|
||||||
roman := FromInt(4)
|
|
||||||
if roman == "OOB" {
|
|
||||||
panic("Input integer is out of bounds (greater than 3,999,999)")
|
|
||||||
}
|
|
||||||
fmt.Println(roman == "iv") // True
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user