@@ -21,10 +21,10 @@ static EXTENSIVE_ITER_OVERRIDE: LazyLock<Option<u64>> = LazyLock::new(|| {
21
21
/// Specific tests that need to have a reduced amount of iterations to complete in a reasonable
22
22
/// amount of time.
23
23
///
24
- /// Contains the itentifier+generator combo to match on, plus the factor to reduce by.
25
- const EXTEMELY_SLOW_TESTS : & [ ( Identifier , GeneratorKind , u64 ) ] = & [
26
- ( Identifier :: Fmodf128 , GeneratorKind :: QuickSpaced , 40 ) ,
27
- ( Identifier :: Fmodf128 , GeneratorKind :: Extensive , 40 ) ,
24
+ /// Contains the itentifier+generator+exhaustive combo to match on, plus the factor to reduce by.
25
+ const EXTEMELY_SLOW_TESTS : & [ ( Identifier , GeneratorKind , bool , u64 ) ] = & [
26
+ ( Identifier :: Fmodf128 , GeneratorKind :: Spaced , false , 40 ) ,
27
+ ( Identifier :: Fmodf128 , GeneratorKind :: Spaced , true , 40 ) ,
28
28
] ;
29
29
30
30
/// Maximum number of iterations to run for a single routine.
@@ -52,6 +52,7 @@ pub struct CheckCtx {
52
52
/// Source of truth for tests.
53
53
pub basis : CheckBasis ,
54
54
pub gen_kind : GeneratorKind ,
55
+ pub extensive : bool ,
55
56
/// If specified, this value will override the value returned by [`iteration_count`].
56
57
pub override_iterations : Option < u64 > ,
57
58
}
@@ -67,12 +68,19 @@ impl CheckCtx {
67
68
base_name_str : fn_ident. base_name ( ) . as_str ( ) ,
68
69
basis,
69
70
gen_kind,
71
+ extensive : false ,
70
72
override_iterations : None ,
71
73
} ;
72
74
ret. ulp = crate :: default_ulp ( & ret) ;
73
75
ret
74
76
}
75
77
78
+ /// Configure that this is an extensive test.
79
+ pub fn extensive ( mut self , extensive : bool ) -> Self {
80
+ self . extensive = extensive;
81
+ self
82
+ }
83
+
76
84
/// The number of input arguments for this function.
77
85
pub fn input_count ( & self ) -> usize {
78
86
self . fn_ident . math_op ( ) . rust_sig . args . len ( )
@@ -99,8 +107,7 @@ pub enum CheckBasis {
99
107
#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
100
108
pub enum GeneratorKind {
101
109
EdgeCases ,
102
- Extensive ,
103
- QuickSpaced ,
110
+ Spaced ,
104
111
Random ,
105
112
}
106
113
@@ -216,21 +223,22 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
216
223
let random_iter_count = domain_iter_count / 100 ;
217
224
218
225
let mut total_iterations = match ctx. gen_kind {
219
- GeneratorKind :: QuickSpaced => domain_iter_count,
226
+ GeneratorKind :: Spaced if ctx. extensive => extensive_max_iterations ( ) ,
227
+ GeneratorKind :: Spaced => domain_iter_count,
220
228
GeneratorKind :: Random => random_iter_count,
221
- GeneratorKind :: Extensive => extensive_max_iterations ( ) ,
222
229
GeneratorKind :: EdgeCases => {
223
230
unimplemented ! ( "edge case tests shoudn't need `iteration_count`" )
224
231
}
225
232
} ;
226
233
227
234
// Some tests are significantly slower than others and need to be further reduced.
228
- if let Some ( ( _id, _gen, scale) ) = EXTEMELY_SLOW_TESTS
229
- . iter ( )
230
- . find ( |( id, gen, _scale) | * id == ctx. fn_ident && * gen == ctx. gen_kind )
235
+ if let Some ( ( _id, _gen, _extensive, scale) ) =
236
+ EXTEMELY_SLOW_TESTS . iter ( ) . find ( |( id, gen, extensive, _scale) | {
237
+ * id == ctx. fn_ident && * gen == ctx. gen_kind && * extensive == ctx. extensive
238
+ } )
231
239
{
232
240
// However, do not override if the extensive iteration count has been manually set.
233
- if !( ctx. gen_kind == GeneratorKind :: Extensive && EXTENSIVE_ITER_OVERRIDE . is_some ( ) ) {
241
+ if !( ctx. extensive && EXTENSIVE_ITER_OVERRIDE . is_some ( ) ) {
234
242
total_iterations /= scale;
235
243
}
236
244
}
@@ -265,7 +273,7 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
265
273
let total = ntests. pow ( t_env. input_count . try_into ( ) . unwrap ( ) ) ;
266
274
267
275
let seed_msg = match ctx. gen_kind {
268
- GeneratorKind :: QuickSpaced | GeneratorKind :: Extensive => String :: new ( ) ,
276
+ GeneratorKind :: Spaced => String :: new ( ) ,
269
277
GeneratorKind :: Random => {
270
278
format ! ( " using `{SEED_ENV}={}`" , str :: from_utf8( SEED . as_slice( ) ) . unwrap( ) )
271
279
}
@@ -307,8 +315,8 @@ pub fn int_range(ctx: &CheckCtx, argnum: usize) -> RangeInclusive<i32> {
307
315
let extensive_range = ( -0xfff ) ..=0xfffff ;
308
316
309
317
match ctx. gen_kind {
310
- GeneratorKind :: Extensive => extensive_range,
311
- GeneratorKind :: QuickSpaced | GeneratorKind :: Random => non_extensive_range,
318
+ _ if ctx . extensive => extensive_range,
319
+ GeneratorKind :: Spaced | GeneratorKind :: Random => non_extensive_range,
312
320
GeneratorKind :: EdgeCases => extensive_range,
313
321
}
314
322
}
0 commit comments