-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tom Delmas <[email protected]>
- Loading branch information
Showing
9 changed files
with
346 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use typed_floats::*; | ||
|
||
typed_floats_macros::generate_tests!(); | ||
|
||
#[test] | ||
fn test_others() { | ||
let values = [ | ||
(f64::NAN, false), | ||
(f64::INFINITY, true), | ||
(f64::NEG_INFINITY, true), | ||
(0.0f64, true), | ||
(-0.0f64, true), | ||
(1.0f64, true), | ||
(-1.0f64, true), | ||
]; | ||
|
||
for (value, expected) in &values { | ||
let num = NonNaN::try_from(*value); | ||
let result = num.is_ok(); | ||
assert_eq!(result, *expected); | ||
|
||
match num { | ||
Ok(num) => { | ||
let v: f64 = num.into(); | ||
assert_eq!(v, *value); | ||
} | ||
Err(_) => {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.