From 2fb8a6e8a9802d22c86a84bbc33d7dc07351ef9b Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Sat, 31 Aug 2019 15:14:49 +0900 Subject: [PATCH] Add NaN preserving test for clamp --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 075a729..8e2ce60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -418,6 +418,7 @@ fn clamp_test() { assert_eq!(-1.0, clamp_lower(-2.0, -1.0)); assert_eq!(-1.0, clamp_upper(1.0, -1.0)); assert_eq!(-2.0, clamp_upper(-2.0, -1.0)); + assert!(clamp(::core::f32::NAN, -1.0, 1.0).is_nan()); assert!(clamp_lower(::core::f32::NAN, 1.0).is_nan()); assert!(clamp_upper(::core::f32::NAN, 1.0).is_nan()); }