Skip to content

Commit 5973b0c

Browse files
committed
add tests for min and max from Float
1 parent 8a55cd9 commit 5973b0c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/libstd/num/f32.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,18 @@ mod tests {
866866
use num::*;
867867
use num;
868868

869+
#[test]
870+
fn test_min_nan() {
871+
assert_eq!(NAN.min(2.0), 2.0);
872+
assert_eq!(2.0f32.min(NAN), 2.0);
873+
}
874+
875+
#[test]
876+
fn test_max_nan() {
877+
assert_eq!(NAN.max(2.0), 2.0);
878+
assert_eq!(2.0f32.max(NAN), 2.0);
879+
}
880+
869881
#[test]
870882
fn test_num() {
871883
num::test_num(10f32, 2f32);

src/libstd/num/f64.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,18 @@ mod tests {
865865
use num::*;
866866
use num;
867867

868+
#[test]
869+
fn test_min_nan() {
870+
assert_eq!(NAN.min(2.0), 2.0);
871+
assert_eq!(2.0f64.min(NAN), 2.0);
872+
}
873+
874+
#[test]
875+
fn test_max_nan() {
876+
assert_eq!(NAN.max(2.0), 2.0);
877+
assert_eq!(2.0f64.max(NAN), 2.0);
878+
}
879+
868880
#[test]
869881
fn test_num() {
870882
num::test_num(10f64, 2f64);

0 commit comments

Comments
 (0)