[Tests] added float tests

This commit is contained in:
David Rajchenbach-Teller 2011-10-12 10:25:58 +02:00
parent 8c9dd54ded
commit 75bda422df
2 changed files with 20 additions and 0 deletions

19
src/test/stdtest/float.rs Normal file
View 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 );
}

View file

@ -29,6 +29,7 @@ mod sys;
mod task;
mod test;
mod uint;
mod float;
// Local Variables:
// mode: rust