@@ -12,7 +12,9 @@ use anyhow::{Context, anyhow, bail, ensure};
12
12
use libm:: support:: Hexf ;
13
13
14
14
use crate :: precision:: CheckAction ;
15
- use crate :: { CheckCtx , Float , Int , MaybeOverride , SpecialCase , TestResult } ;
15
+ use crate :: {
16
+ CheckBasis , CheckCtx , Float , GeneratorKind , Int , MaybeOverride , SpecialCase , TestResult ,
17
+ } ;
16
18
17
19
/// Trait for calling a function with a tuple as arguments.
18
20
///
@@ -207,6 +209,8 @@ where
207
209
SpecialCase : MaybeOverride < Input > ,
208
210
{
209
211
let ( result, xfail_msg) = match SpecialCase :: check_int ( input, actual, expected, ctx) {
212
+ // `require_biteq` forbids overrides.
213
+ _ if ctx. gen_kind == GeneratorKind :: List => ( actual == expected, None ) ,
210
214
CheckAction :: AssertSuccess => ( actual == expected, None ) ,
211
215
CheckAction :: AssertFailure ( msg) => ( actual != expected, Some ( msg) ) ,
212
216
CheckAction :: Custom ( res) => return res,
@@ -291,7 +295,12 @@ where
291
295
let mut inner = || -> TestResult {
292
296
let mut allowed_ulp = ctx. ulp ;
293
297
298
+ // Forbid overrides if the items came from an explicit list, as long as we are checking
299
+ // against either MPFR or the result itself.
300
+ let require_biteq = ctx. gen_kind == GeneratorKind :: List && ctx. basis != CheckBasis :: Musl ;
301
+
294
302
match SpecialCase :: check_float ( input, actual, expected, ctx) {
303
+ _ if require_biteq => ( ) ,
295
304
CheckAction :: AssertSuccess => ( ) ,
296
305
CheckAction :: AssertFailure ( msg) => assert_failure_msg = Some ( msg) ,
297
306
CheckAction :: Custom ( res) => return res,
@@ -301,6 +310,9 @@ where
301
310
302
311
// Check when both are NaNs
303
312
if actual. is_nan ( ) && expected. is_nan ( ) {
313
+ if require_biteq && ctx. basis == CheckBasis :: None {
314
+ ensure ! ( actual. to_bits( ) == expected. to_bits( ) , "mismatched NaN bitpatterns" ) ;
315
+ }
304
316
// By default, NaNs have nothing special to check.
305
317
return Ok ( ( ) ) ;
306
318
} else if actual. is_nan ( ) || expected. is_nan ( ) {
0 commit comments