@@ -24,9 +24,9 @@ static EXTENSIVE_ITER_OVERRIDE: LazyLock<Option<u64>> = LazyLock::new(|| {
2424/// amount of time.
2525///
2626/// 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 ) ,
3030] ;
3131
3232/// Maximum number of iterations to run for a single routine.
@@ -54,6 +54,7 @@ pub struct CheckCtx {
5454 /// Source of truth for tests.
5555 pub basis : CheckBasis ,
5656 pub gen_kind : GeneratorKind ,
57+ pub extensive : bool ,
5758 /// If specified, this value will override the value returned by [`iteration_count`].
5859 pub override_iterations : Option < u64 > ,
5960}
@@ -69,12 +70,19 @@ impl CheckCtx {
6970 base_name_str : fn_ident. base_name ( ) . as_str ( ) ,
7071 basis,
7172 gen_kind,
73+ extensive : false ,
7274 override_iterations : None ,
7375 } ;
7476 ret. ulp = crate :: default_ulp ( & ret) ;
7577 ret
7678 }
7779
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+
7886 /// The number of input arguments for this function.
7987 pub fn input_count ( & self ) -> usize {
8088 self . fn_ident . math_op ( ) . rust_sig . args . len ( )
@@ -101,8 +109,7 @@ pub enum CheckBasis {
101109#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
102110pub enum GeneratorKind {
103111 EdgeCases ,
104- Extensive ,
105- QuickSpaced ,
112+ Spaced ,
106113 Random ,
107114 List ,
108115}
@@ -216,17 +223,17 @@ 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 | GeneratorKind :: List => {
223230 unimplemented ! ( "shoudn't need `iteration_count` for {:?}" , ctx. gen_kind)
224231 }
225232 } ;
226233
227234 // 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 {
230237 // Extensive already has a pretty high test count.
231238 total_iterations *= 2 ;
232239 } else {
@@ -244,12 +251,15 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
244251 }
245252
246253 // 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+ } )
250260 {
251261 // 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 ( ) ) {
253263 total_iterations /= scale;
254264 }
255265 }
@@ -279,7 +289,7 @@ pub fn iteration_count(ctx: &CheckCtx, argnum: usize) -> u64 {
279289 let total = ntests. pow ( t_env. input_count . try_into ( ) . unwrap ( ) ) ;
280290
281291 let seed_msg = match ctx. gen_kind {
282- GeneratorKind :: QuickSpaced | GeneratorKind :: Extensive => String :: new ( ) ,
292+ GeneratorKind :: Spaced => String :: new ( ) ,
283293 GeneratorKind :: Random => {
284294 format ! (
285295 " using `{SEED_ENV}={}`" ,
@@ -327,8 +337,8 @@ pub fn int_range(ctx: &CheckCtx, argnum: usize) -> RangeInclusive<i32> {
327337 let extensive_range = ( -0xfff ) ..=0xfffff ;
328338
329339 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,
332342 GeneratorKind :: EdgeCases => extensive_range,
333343 GeneratorKind :: List => unimplemented ! ( "shoudn't need range for {:?}" , ctx. gen_kind) ,
334344 }
0 commit comments