@@ -24,9 +24,9 @@ static EXTENSIVE_ITER_OVERRIDE: LazyLock<Option<u64>> = LazyLock::new(|| {
24
24
/// amount of time.
25
25
///
26
26
/// Contains the itentifier+generator combo to match on, plus the factor to reduce by.
27
- const EXTEMELY_SLOW_TESTS : & [ ( Identifier , GeneratorKind , u64 ) ] = & [
28
- ( Identifier :: Fmodf128 , GeneratorKind :: QuickSpaced , 50 ) ,
29
- ( Identifier :: Fmodf128 , GeneratorKind :: Extensive , 50 ) ,
27
+ const EXTEMELY_SLOW_TESTS : & [ ( Identifier , GeneratorKind , bool , u64 ) ] = & [
28
+ ( Identifier :: Fmodf128 , GeneratorKind :: QuickSpaced , false , 50 ) ,
29
+ ( Identifier :: Fmodf128 , GeneratorKind :: Extensive , true , 50 ) ,
30
30
] ;
31
31
32
32
/// Maximum number of iterations to run for a single routine.
@@ -54,6 +54,7 @@ pub struct CheckCtx {
54
54
/// Source of truth for tests.
55
55
pub basis : CheckBasis ,
56
56
pub gen_kind : GeneratorKind ,
57
+ pub extensive : bool ,
57
58
/// If specified, this value will override the value returned by [`iteration_count`].
58
59
pub override_iterations : Option < u64 > ,
59
60
}
@@ -69,12 +70,19 @@ impl CheckCtx {
69
70
base_name_str : fn_ident. base_name ( ) . as_str ( ) ,
70
71
basis,
71
72
gen_kind,
73
+ extensive : false ,
72
74
override_iterations : None ,
73
75
} ;
74
76
ret. ulp = crate :: default_ulp ( & ret) ;
75
77
ret
76
78
}
77
79
80
+ /// Configure that this is an extensive test.
81
+ pub fn extensive ( mut self , extensive : bool ) -> Self {
82
+ self . extensive = extensive;
83
+ self
84
+ }
85
+
78
86
/// The number of input arguments for this function.
79
87
pub fn input_count ( & self ) -> usize {
80
88
self . fn_ident . math_op ( ) . rust_sig . args . len ( )
@@ -101,8 +109,7 @@ pub enum CheckBasis {
101
109
#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
102
110
pub enum GeneratorKind {
103
111
EdgeCases ,
104
- Extensive ,
105
- QuickSpaced ,
112
+ Spaced ,
106
113
Random ,
107
114
List ,
108
115
}
@@ -216,17 +223,17 @@ 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 | GeneratorKind :: List => {
223
230
unimplemented ! ( "shoudn't need `iteration_count` for {:?}" , ctx. gen_kind)
224
231
}
225
232
} ;
226
233
227
234
// Larger float types get more iterations.
228
- if t_env. large_float_ty && ctx . gen_kind != GeneratorKind :: Extensive {
229
- if ctx. gen_kind == GeneratorKind :: Extensive {
235
+ if t_env. large_float_ty {
236
+ if ctx. extensive {
230
237
// Extensive already has a pretty high test count.
231
238
total_iterations *= 2 ;
232
239
} else {
@@ -244,12 +251,15 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
244
251
}
245
252
246
253
// Some tests are significantly slower than others and need to be further reduced.
247
- if let Some ( ( _id, _gen, scale) ) = EXTEMELY_SLOW_TESTS
248
- . iter ( )
249
- . find ( |( id, generator, _scale) | * id == ctx. fn_ident && * generator == ctx. gen_kind )
254
+ if let Some ( ( _id, _generator, _extensive, scale) ) =
255
+ EXTEMELY_SLOW_TESTS
256
+ . iter ( )
257
+ . find ( |( id, generator, extensive, _scale) | {
258
+ * id == ctx. fn_ident && * generator == ctx. gen_kind && * extensive == ctx. extensive
259
+ } )
250
260
{
251
261
// However, do not override if the extensive iteration count has been manually set.
252
- if !( ctx. gen_kind == GeneratorKind :: Extensive && EXTENSIVE_ITER_OVERRIDE . is_some ( ) ) {
262
+ if !( ctx. extensive && EXTENSIVE_ITER_OVERRIDE . is_some ( ) ) {
253
263
total_iterations /= scale;
254
264
}
255
265
}
@@ -279,7 +289,7 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
279
289
let total = ntests. pow ( t_env. input_count . try_into ( ) . unwrap ( ) ) ;
280
290
281
291
let seed_msg = match ctx. gen_kind {
282
- GeneratorKind :: QuickSpaced | GeneratorKind :: Extensive => String :: new ( ) ,
292
+ GeneratorKind :: Spaced => String :: new ( ) ,
283
293
GeneratorKind :: Random => {
284
294
format ! (
285
295
" using `{SEED_ENV}={}`" ,
@@ -327,8 +337,8 @@ pub fn int_range(ctx: &CheckCtx, argnum: usize) -> RangeInclusive<i32> {
327
337
let extensive_range = ( -0xfff ) ..=0xfffff ;
328
338
329
339
match ctx. gen_kind {
330
- GeneratorKind :: Extensive => extensive_range,
331
- GeneratorKind :: QuickSpaced | GeneratorKind :: Random => non_extensive_range,
340
+ _ if ctx . extensive => extensive_range,
341
+ GeneratorKind :: Spaced | GeneratorKind :: Random => non_extensive_range,
332
342
GeneratorKind :: EdgeCases => extensive_range,
333
343
GeneratorKind :: List => unimplemented ! ( "shoudn't need range for {:?}" , ctx. gen_kind) ,
334
344
}
0 commit comments