@@ -21,10 +21,10 @@ static EXTENSIVE_ITER_OVERRIDE: LazyLock<Option<u64>> = LazyLock::new(|| {
2121/// Specific tests that need to have a reduced amount of iterations to complete in a reasonable
2222/// amount of time.
2323///
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 ) ,
2828] ;
2929
3030/// Maximum number of iterations to run for a single routine.
@@ -52,6 +52,7 @@ pub struct CheckCtx {
5252 /// Source of truth for tests.
5353 pub basis : CheckBasis ,
5454 pub gen_kind : GeneratorKind ,
55+ pub extensive : bool ,
5556 /// If specified, this value will override the value returned by [`iteration_count`].
5657 pub override_iterations : Option < u64 > ,
5758}
@@ -67,12 +68,19 @@ impl CheckCtx {
6768 base_name_str : fn_ident. base_name ( ) . as_str ( ) ,
6869 basis,
6970 gen_kind,
71+ extensive : false ,
7072 override_iterations : None ,
7173 } ;
7274 ret. ulp = crate :: default_ulp ( & ret) ;
7375 ret
7476 }
7577
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+
7684 /// The number of input arguments for this function.
7785 pub fn input_count ( & self ) -> usize {
7886 self . fn_ident . math_op ( ) . rust_sig . args . len ( )
@@ -99,8 +107,7 @@ pub enum CheckBasis {
99107#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
100108pub enum GeneratorKind {
101109 EdgeCases ,
102- Extensive ,
103- QuickSpaced ,
110+ Spaced ,
104111 Random ,
105112}
106113
@@ -216,21 +223,22 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
216223 let random_iter_count = domain_iter_count / 100 ;
217224
218225 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,
220228 GeneratorKind :: Random => random_iter_count,
221- GeneratorKind :: Extensive => extensive_max_iterations ( ) ,
222229 GeneratorKind :: EdgeCases => {
223230 unimplemented ! ( "edge case tests shoudn't need `iteration_count`" )
224231 }
225232 } ;
226233
227234 // 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+ } )
231239 {
232240 // 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 ( ) ) {
234242 total_iterations /= scale;
235243 }
236244 }
@@ -265,7 +273,7 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
265273 let total = ntests. pow ( t_env. input_count . try_into ( ) . unwrap ( ) ) ;
266274
267275 let seed_msg = match ctx. gen_kind {
268- GeneratorKind :: QuickSpaced | GeneratorKind :: Extensive => String :: new ( ) ,
276+ GeneratorKind :: Spaced => String :: new ( ) ,
269277 GeneratorKind :: Random => {
270278 format ! ( " using `{SEED_ENV}={}`" , str :: from_utf8( SEED . as_slice( ) ) . unwrap( ) )
271279 }
@@ -307,8 +315,8 @@ pub fn int_range(ctx: &CheckCtx, argnum: usize) -> RangeInclusive<i32> {
307315 let extensive_range = ( -0xfff ) ..=0xfffff ;
308316
309317 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,
312320 GeneratorKind :: EdgeCases => extensive_range,
313321 }
314322}
0 commit comments