Skip to content

Commit 3e9c95e

Browse files
committed
Merge pull request #4690 from codeblack08/test-round
Add test for float::round
2 parents d2e1bfb + b505504 commit 3e9c95e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/libcore/float.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,15 @@ pub fn test_to_str_inf() {
581581
assert to_str(-infinity, 10u) == ~"-inf";
582582
}
583583

584+
#[test]
585+
pub fn test_round() {
586+
assert round(5.8) == 6.0;
587+
assert round(5.2) == 5.0;
588+
assert round(3.0) == 3.0;
589+
assert round(2.5) == 3.0;
590+
assert round(-3.5) == -4.0;
591+
}
592+
584593
#[test]
585594
pub fn test_traits() {
586595
fn test<U:num::Num cmp::Eq>(ten: &U) {
@@ -609,8 +618,3 @@ pub fn test_traits() {
609618
// buffer-file-coding-system: utf-8-unix
610619
// End:
611620
//
612-
613-
614-
615-
616-

0 commit comments

Comments
 (0)