44// via `.contains(...)` and make sure the dynamic semantics match.
55
66#![ allow( unreachable_patterns) ]
7+ #![ feature( f128) ]
8+ #![ feature( f16) ]
79
810macro_rules! yes {
911 ( $scrutinee: expr, $( $t: tt) +) => {
@@ -39,6 +41,17 @@ fn range_to_inclusive() {
3941 assert ! ( yes!( 'a' , ..='a' ) ) ;
4042 assert ! ( !yes!( 'b' , ..='a' ) ) ;
4143
44+ // f16; `..=X`
45+ // FIXME(f16_f128): remove gate when ABI issues are resolved
46+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
47+ {
48+ // FIXME(f16_f128): enable infinity tests when constants are available
49+ // assert!(yes!(f16::NEG_INFINITY, ..=f16::NEG_INFINITY));
50+ // assert!(yes!(f16::NEG_INFINITY, ..=1.0f16));
51+ assert ! ( yes!( 1.5f16 , ..=1.5f16 ) ) ;
52+ assert ! ( !yes!( 1.6f16 , ..=-1.5f16 ) ) ;
53+ }
54+
4255 // f32; `..=X`
4356 assert ! ( yes!( f32 :: NEG_INFINITY , ..=f32 :: NEG_INFINITY ) ) ;
4457 assert ! ( yes!( f32 :: NEG_INFINITY , ..=1.0f32 ) ) ;
@@ -50,6 +63,17 @@ fn range_to_inclusive() {
5063 assert ! ( yes!( f64 :: NEG_INFINITY , ..=1.0f64 ) ) ;
5164 assert ! ( yes!( 1.5f64 , ..=1.5f64 ) ) ;
5265 assert ! ( !yes!( 1.6f64 , ..=-1.5f64 ) ) ;
66+
67+ // f128; `..=X`
68+ // FIXME(f16_f128): remove gate when ABI issues are resolved
69+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
70+ {
71+ // FIXME(f16_f128): enable infinity tests when constants are available
72+ // assert!(yes!(f128::NEG_INFINITY, ..=f128::NEG_INFINITY));
73+ // assert!(yes!(f128::NEG_INFINITY, ..=1.0f128));
74+ assert ! ( yes!( 1.5f128 , ..=1.5f128 ) ) ;
75+ assert ! ( !yes!( 1.6f128 , ..=-1.5f128 ) ) ;
76+ }
5377}
5478
5579fn range_to ( ) {
@@ -83,6 +107,18 @@ fn range_to() {
83107 assert ! ( !yes!( 'a' , ..'a' ) ) ;
84108 assert ! ( !yes!( 'b' , ..'a' ) ) ;
85109
110+ // f16; `..X`
111+ // FIXME(f16_f128): remove gate when ABI issues are resolved
112+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
113+ {
114+ // FIXME(f16_f128): enable infinity tests when constants are available
115+ // assert!(yes!(f16::NEG_INFINITY, ..1.0f16));
116+ assert ! ( !yes!( 1.5f16 , ..1.5f16 ) ) ;
117+ const E16 : f16 = 1.5f16 + f16:: EPSILON ;
118+ assert ! ( yes!( 1.5f16 , ..E16 ) ) ;
119+ assert ! ( !yes!( 1.6f16 , ..1.5f16 ) ) ;
120+ }
121+
86122 // f32; `..X`
87123 assert ! ( yes!( f32 :: NEG_INFINITY , ..1.0f32 ) ) ;
88124 assert ! ( !yes!( 1.5f32 , ..1.5f32 ) ) ;
@@ -96,6 +132,18 @@ fn range_to() {
96132 const E64 : f64 = 1.5f64 + f64:: EPSILON ;
97133 assert ! ( yes!( 1.5f64 , ..E64 ) ) ;
98134 assert ! ( !yes!( 1.6f64 , ..1.5f64 ) ) ;
135+
136+ // f128; `..X`
137+ // FIXME(f16_f128): remove gate when ABI issues are resolved
138+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
139+ {
140+ // FIXME(f16_f128): enable infinity tests when constants are available
141+ // assert!(yes!(f128::NEG_INFINITY, ..1.0f128));
142+ assert ! ( !yes!( 1.5f128 , ..1.5f128 ) ) ;
143+ const E128 : f128 = 1.5f128 + f128:: EPSILON ;
144+ assert ! ( yes!( 1.5f128 , ..E128 ) ) ;
145+ assert ! ( !yes!( 1.6f128 , ..1.5f128 ) ) ;
146+ }
99147}
100148
101149fn range_from ( ) {
@@ -129,6 +177,21 @@ fn range_from() {
129177 assert ! ( !yes!( 'a' , 'b' ..) ) ;
130178 assert ! ( yes!( core:: char :: MAX , core:: char :: MAX ..) ) ;
131179
180+ // f16; `X..`
181+ // FIXME(f16_f128): remove gate when ABI issues are resolved
182+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
183+ {
184+ // FIXME(f16_f128): enable infinity tests when constants are available
185+ // assert!(yes!(f16::NEG_INFINITY, f16::NEG_INFINITY..));
186+ // assert!(yes!(f16::INFINITY, f16::NEG_INFINITY..));
187+ // assert!(!yes!(f16::NEG_INFINITY, 1.0f16..));
188+ // assert!(yes!(f16::INFINITY, 1.0f16..));
189+ assert ! ( !yes!( 1.0f16 - f16:: EPSILON , 1.0f16 ..) ) ;
190+ assert ! ( yes!( 1.0f16 , 1.0f16 ..) ) ;
191+ // assert!(yes!(f16::INFINITY, 1.0f16..));
192+ // assert!(yes!(f16::INFINITY, f16::INFINITY..));
193+ }
194+
132195 // f32; `X..`
133196 assert ! ( yes!( f32 :: NEG_INFINITY , f32 :: NEG_INFINITY ..) ) ;
134197 assert ! ( yes!( f32 :: INFINITY , f32 :: NEG_INFINITY ..) ) ;
@@ -148,6 +211,21 @@ fn range_from() {
148211 assert ! ( yes!( 1.0f64 , 1.0f64 ..) ) ;
149212 assert ! ( yes!( f64 :: INFINITY , 1.0f64 ..) ) ;
150213 assert ! ( yes!( f64 :: INFINITY , f64 :: INFINITY ..) ) ;
214+
215+ // f128; `X..`
216+ // FIXME(f16_f128): remove gate when ABI issues are resolved
217+ #[ cfg( all( target_arch = "aarch64" , target_os = "linux" ) ) ]
218+ {
219+ // FIXME(f16_f128): enable infinity tests when constants are available
220+ // assert!(yes!(f128::NEG_INFINITY, f128::NEG_INFINITY..));
221+ // assert!(yes!(f128::INFINITY, f128::NEG_INFINITY..));
222+ // assert!(!yes!(f128::NEG_INFINITY, 1.0f128..));
223+ // assert!(yes!(f128::INFINITY, 1.0f128..));
224+ assert ! ( !yes!( 1.0f128 - f128:: EPSILON , 1.0f128 ..) ) ;
225+ assert ! ( yes!( 1.0f128 , 1.0f128 ..) ) ;
226+ // assert!(yes!(f128::INFINITY, 1.0f128..));
227+ // assert!(yes!(f128::INFINITY, f128::INFINITY..));
228+ }
151229}
152230
153231fn main ( ) {
0 commit comments