Skip to content

Commit

Permalink
READY(strs_tools): fixed tests (#1426)
Browse files Browse the repository at this point in the history
* fixed tests

* fixed global import
  • Loading branch information
Sakapoi authored Aug 30, 2024
1 parent 58fec05 commit 47408cc
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions module/core/strs_tools/tests/inc/number_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;

//

tests_impls!
Expand All @@ -10,43 +9,43 @@ tests_impls!

/* test.case( "parse" ); */
{
a_id!( the_module::number::parse::< f32, _ >( "1.0" ), Ok( 1.0 ) );
a_id!( crate::the_module::string::number::parse::< f32, _ >( "1.0" ), Ok( 1.0 ) );
}

/* test.case( "parse_partial" ); */
{
a_id!( the_module::number::parse_partial::< i32, _ >( "1a" ), Ok( ( 1, 1 ) ) );
a_id!( crate::the_module::string::number::parse_partial::< i32, _ >( "1a" ), Ok( ( 1, 1 ) ) );
}

/* test.case( "parse_partial_with_options" ); */
{
const FORMAT : u128 = the_module::number::format::STANDARD;
let options = the_module::number::ParseFloatOptions::builder()
const FORMAT : u128 = crate::the_module::string::number::format::STANDARD;
let options = crate::the_module::string::number::ParseFloatOptions::builder()
.exponent( b'^' )
.decimal_point( b',' )
.build()
.unwrap();
let got = the_module::number::parse_partial_with_options::< f32, _, FORMAT >( "0", &options );
let got = crate::the_module::string::number::parse_partial_with_options::< f32, _, FORMAT >( "0", &options );
let exp = Ok( ( 0.0, 1 ) );
a_id!( got, exp );
}

/* test.case( "parse_with_options" ); */
{
const FORMAT: u128 = the_module::number::format::STANDARD;
let options = the_module::number::ParseFloatOptions::builder()
const FORMAT: u128 = crate::the_module::string::number::format::STANDARD;
let options = crate::the_module::string::number::ParseFloatOptions::builder()
.exponent( b'^' )
.decimal_point( b',' )
.build()
.unwrap();
let got = the_module::number::parse_with_options::< f32, _, FORMAT >( "1,2345", &options );
let got = crate::the_module::string::number::parse_with_options::< f32, _, FORMAT >( "1,2345", &options );
let exp = Ok( 1.2345 );
a_id!( got, exp );
}

/* test.case( "to_string" ); */
{
a_id!( the_module::number::to_string( 5 ), "5" );
a_id!( crate::the_module::string::number::to_string( 5 ), "5" );
}

}
Expand Down

0 comments on commit 47408cc

Please sign in to comment.