@@ -5,7 +5,7 @@ extern crate ordered_float;
55extern crate num_traits;
66
77pub use ordered_float:: * ;
8- pub use num_traits:: { Bounded , Float } ;
8+ pub use num_traits:: { Bounded , Float , One , Zero } ;
99pub use std:: cmp:: Ordering :: * ;
1010pub use std:: { f32, f64, panic} ;
1111
@@ -105,6 +105,15 @@ describe! not_nan32 {
105105 assert!( panic:: catch_unwind( || { let mut tmp = NotNan :: from( 0.0f32 ) ; tmp %= f32 :: NAN ; } ) . is_err( ) ) ;
106106 }
107107
108+ it "should implement Zero" {
109+ assert_eq!( NotNaN :: <f32 >:: zero( ) , NotNaN :: from( 0.0f32 ) ) ;
110+ assert!( NotNaN :: <f32 >:: zero( ) . is_zero( ) ) ;
111+ }
112+
113+ it "should implement One" {
114+ assert_eq!( NotNaN :: <f32 >:: one( ) , NotNaN :: from( 1.0f32 ) )
115+ }
116+
108117 it "should implement Bounded" {
109118 assert_eq!( NotNaN :: <f32 >:: min_value( ) , NotNaN :: from( <f32 as Bounded >:: min_value( ) ) ) ;
110119 assert_eq!( NotNaN :: <f32 >:: max_value( ) , NotNaN :: from( <f32 as Bounded >:: max_value( ) ) ) ;
@@ -173,6 +182,15 @@ describe! not_nan64 {
173182 assert!( panic:: catch_unwind( || { let mut tmp = NotNan :: from( 0.0f64 ) ; tmp %= f64 :: NAN ; } ) . is_err( ) ) ;
174183 }
175184
185+ it "should implement Zero" {
186+ assert_eq!( NotNaN :: <f64 >:: zero( ) , NotNaN :: from( 0.0f64 ) ) ;
187+ assert!( NotNaN :: <f64 >:: zero( ) . is_zero( ) ) ;
188+ }
189+
190+ it "should implement One" {
191+ assert_eq!( NotNaN :: <f64 >:: one( ) , NotNaN :: from( 1.0f64 ) )
192+ }
193+
176194 it "should implement Bounded" {
177195 assert_eq!( NotNaN :: <f64 >:: min_value( ) , NotNaN :: from( <f64 as Bounded >:: min_value( ) ) ) ;
178196 assert_eq!( NotNaN :: <f64 >:: max_value( ) , NotNaN :: from( <f64 as Bounded >:: max_value( ) ) ) ;
0 commit comments