From b505504dc4ebcc7a6f121163ae510cfb5fd2834f Mon Sep 17 00:00:00 2001 From: Cody Schroeder Date: Wed, 30 Jan 2013 01:27:08 -0800 Subject: [PATCH] Add test for float::round --- src/libcore/float.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 999e0df007b9b..7ff8599679c80 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -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(ten: &U) { @@ -609,8 +618,3 @@ pub fn test_traits() { // buffer-file-coding-system: utf-8-unix // End: // - - - - -