Skip to content

Commit

Permalink
Add test for float::round
Browse files Browse the repository at this point in the history
  • Loading branch information
codeblack08 committed Jan 30, 2013
1 parent 02e907b commit b505504
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/libcore/float.rs
Expand Up @@ -581,6 +581,15 @@ pub fn test_to_str_inf() {
assert to_str(-infinity, 10u) == ~"-inf";
}

#[test]
pub fn test_round() {
assert round(5.8) == 6.0;
assert round(5.2) == 5.0;
assert round(3.0) == 3.0;
assert round(2.5) == 3.0;
assert round(-3.5) == -4.0;
}

#[test]
pub fn test_traits() {
fn test<U:num::Num cmp::Eq>(ten: &U) {
Expand Down Expand Up @@ -609,8 +618,3 @@ pub fn test_traits() {
// buffer-file-coding-system: utf-8-unix
// End:
//





0 comments on commit b505504

Please sign in to comment.