Skip to content

Commit

Permalink
Merge pull request #4690 from codeblack08/test-round
Browse files Browse the repository at this point in the history
Add test for float::round
  • Loading branch information
catamorphism committed Jan 30, 2013
2 parents d2e1bfb + b505504 commit 3e9c95e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/libcore/float.rs
Original file line number Diff line number Diff line change
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 3e9c95e

Please sign in to comment.