[Tests] added float tests
This commit is contained in:
parent
8c9dd54ded
commit
75bda422df
2 changed files with 20 additions and 0 deletions
19
src/test/stdtest/float.rs
Normal file
19
src/test/stdtest/float.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use std;
|
||||
import std::float;
|
||||
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert ( float::from_str("3.14") == 3.14 );
|
||||
assert ( float::from_str("+3.14") == 3.14 );
|
||||
assert ( float::from_str("-3.14") == -3.14 );
|
||||
assert ( float::from_str("2.5E10") == 25000000000. );
|
||||
assert ( float::from_str("2.5e10") == 25000000000. );
|
||||
assert ( float::from_str("25000000000.E-10") == 2.5 );
|
||||
assert ( float::from_str("") == 0. );
|
||||
assert ( float::from_str(" ") == 0. );
|
||||
assert ( float::from_str(".") == 0. );
|
||||
assert ( float::from_str("5.") == 5. );
|
||||
assert ( float::from_str(".5") == 0.5 );
|
||||
assert ( float::from_str("0.5") == 0.5 );
|
||||
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ mod sys;
|
|||
mod task;
|
||||
mod test;
|
||||
mod uint;
|
||||
mod float;
|
||||
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue