diff options
Diffstat (limited to 'tests/arguments.rs')
-rw-r--r-- | tests/arguments.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/arguments.rs b/tests/arguments.rs index 4b5a2a0..55b4a4b 100644 --- a/tests/arguments.rs +++ b/tests/arguments.rs @@ -7,12 +7,13 @@ #![allow(non_snake_case)] use ::std::io::Cursor; -use ::std::marker::PhantomData; use ::iosonism::args::ArgumentType; use ::iosonism::args::BoolArgumentType; -use ::iosonism::args::FloatArgumentType; -use ::iosonism::args::IntegerArgumentType; +use ::iosonism::args::bounded_float; +use ::iosonism::args::bounded_integer; +use ::iosonism::args::float; +use ::iosonism::args::integer; use ::iosonism::strcursor::StringReader; mod common; @@ -45,7 +46,7 @@ fn test_i32__parse() { let mut reader = Cursor::new("15"); assert_eq!( ArgumentType::<(), ErrorPanic>::parse( - &IntegerArgumentType { range: .., _ty: PhantomData::<i32> }, + &integer::<i32>(), &mut reader, ), Ok(15), @@ -57,7 +58,7 @@ fn test_i32__parse() { fn test_i32__parse__range() { let mut reader = Cursor::new("-5"); assert!(ArgumentType::<(), ErrorCall<ErrFn>>::parse( - &IntegerArgumentType { range: 0..=100, _ty: PhantomData::<i32> }, + &bounded_integer(0..100i32), &mut reader, ).is_err()); struct ErrFn; @@ -74,7 +75,7 @@ fn test_i64__parse() { let mut reader = Cursor::new("15"); assert_eq!( ArgumentType::<(), ErrorPanic>::parse( - &IntegerArgumentType { range: .., _ty: PhantomData::<i64> }, + &integer::<i64>(), &mut reader, ), Ok(15), @@ -86,7 +87,7 @@ fn test_i64__parse() { fn test_i64__parse__range() { let mut reader = Cursor::new("-5"); assert!(ArgumentType::<(), ErrorCall<ErrFn>>::parse( - &IntegerArgumentType { range: 0..=100, _ty: PhantomData::<i64> }, + &bounded_integer(0..100i64), &mut reader, ).is_err()); struct ErrFn; @@ -103,7 +104,7 @@ fn test_f32__parse() { let mut reader = Cursor::new("15"); assert_eq!( ArgumentType::<(), ErrorPanic>::parse( - &FloatArgumentType { range: .., _ty: PhantomData::<f32> }, + &float::<f32>(), &mut reader, ), Ok(15.0), @@ -115,7 +116,7 @@ fn test_f32__parse() { fn test_f32__parse__range() { let mut reader = Cursor::new("-5"); assert!(ArgumentType::<(), ErrorCall<ErrFn>>::parse( - &FloatArgumentType { range: 0.0..=100.0, _ty: PhantomData::<f32> }, + &bounded_float(0.0..100f32), &mut reader, ).is_err()); struct ErrFn; @@ -132,7 +133,7 @@ fn test_f64__parse() { let mut reader = Cursor::new("15"); assert_eq!( ArgumentType::<(), ErrorPanic>::parse( - &FloatArgumentType { range: .., _ty: PhantomData::<f64> }, + &float::<f64>(), &mut reader, ), Ok(15.0), @@ -144,7 +145,7 @@ fn test_f64__parse() { fn test_f64__parse__range() { let mut reader = Cursor::new("-5"); assert!(ArgumentType::<(), ErrorCall<ErrFn>>::parse( - &FloatArgumentType { range: 0.0..=100.0, _ty: PhantomData::<f64> }, + &bounded_float(0.0..100f64), &mut reader, ).is_err()); struct ErrFn; |