File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11[package ]
2- name = " roman-numerals "
2+ name = " roman_numerals "
33version = " 0.1.0"
44authors = [
" Mark Robson <[email protected] >" ]
55edition = " 2018"
Original file line number Diff line number Diff line change @@ -193,7 +193,10 @@ mod tests {
193193 }
194194}
195195
196- fn numeralise ( number : u32 ) -> String {
196+ pub fn numeralise ( number : i32 ) -> String {
197+ if number > 3999 {
198+ panic ! ( "number must be below 4000" ) ;
199+ }
197200 let mut numeral = String :: from ( "" ) ;
198201 let mut counter = number;
199202 while counter > 0 {
Original file line number Diff line number Diff line change 1+ use std:: env:: args;
2+ use roman_numerals:: numeralise;
3+
14fn main ( ) {
2- println ! ( "Hello, world!" ) ;
5+ let args: Vec < String > = args ( ) . skip ( 1 ) . collect ( ) ;
6+ println ! ( "{:?}" , numeralise( args[ 0 ] . parse:: <i32 >( ) . unwrap( ) ) ) ;
37}
You can’t perform that action at this time.
0 commit comments