@@ -552,6 +552,23 @@ fn robust_positive_percentile(values: &[f32], percentile: f32) -> f32 {
552552#[ cfg( test) ]
553553mod tests {
554554 use super :: * ;
555+ use std:: path:: PathBuf ;
556+
557+ /// Returns the three Tortoise fixture paths if all three exist on disk,
558+ /// else `None`. The fixtures live outside the repo (in a sibling
559+ /// `test_data/` directory) and aren't checked in, so CI runners and
560+ /// fresh clones won't have them — those test runs skip cleanly via the
561+ /// `else { return; }` pattern in each test below.
562+ fn tortoise_fixtures ( ) -> Option < ( PathBuf , PathBuf , PathBuf ) > {
563+ let coeff = PathBuf :: from ( "../test_data/xx_mapmri.nii" ) ;
564+ let tensor = PathBuf :: from ( "../test_data/xx_L1_DT.nii" ) ;
565+ let uvec = PathBuf :: from ( "../test_data/xx_uvec.nii" ) ;
566+ if coeff. exists ( ) && tensor. exists ( ) && uvec. exists ( ) {
567+ Some ( ( coeff, tensor, uvec) )
568+ } else {
569+ None
570+ }
571+ }
555572
556573 #[ test]
557574 fn infers_tortoise_radial_order_four_from_fixture_coeff_count ( ) {
@@ -560,12 +577,16 @@ mod tests {
560577
561578 #[ test]
562579 fn real_fixture_selected_voxel_projects_to_finite_sh ( ) {
580+ let Some ( ( coeff_path, tensor_path, uvec_path) ) = tortoise_fixtures ( ) else {
581+ eprintln ! ( "Tortoise fixtures not found at ../test_data/; skipping." ) ;
582+ return ;
583+ } ;
563584 let ( coeff_dims, _, coeff_data) =
564- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_mapmri.nii" ) ) . unwrap ( ) ;
585+ mrtrix:: load_nifti_f32_volume ( & coeff_path ) . unwrap ( ) ;
565586 let ( tensor_dims, _, tensor_data) =
566- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_L1_DT.nii" ) ) . unwrap ( ) ;
587+ mrtrix:: load_nifti_f32_volume ( & tensor_path ) . unwrap ( ) ;
567588 let ( uvec_dims, _, uvec_data) =
568- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_uvec.nii" ) ) . unwrap ( ) ;
589+ mrtrix:: load_nifti_f32_volume ( & uvec_path ) . unwrap ( ) ;
569590 let ( dims3, ncoeffs) = normalize_trailing_channels (
570591 & coeff_dims,
571592 Path :: new ( "xx_mapmri.nii" ) ,
@@ -607,10 +628,12 @@ mod tests {
607628
608629 #[ test]
609630 fn real_fixture_has_two_coeff_supported_zero_uvec_voxels ( ) {
610- let ( coeff_dims, _, coeff_data) =
611- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_mapmri.nii" ) ) . unwrap ( ) ;
612- let ( uvec_dims, _, uvec_data) =
613- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_uvec.nii" ) ) . unwrap ( ) ;
631+ let Some ( ( coeff_path, _, uvec_path) ) = tortoise_fixtures ( ) else {
632+ eprintln ! ( "Tortoise fixtures not found at ../test_data/; skipping." ) ;
633+ return ;
634+ } ;
635+ let ( coeff_dims, _, coeff_data) = mrtrix:: load_nifti_f32_volume ( & coeff_path) . unwrap ( ) ;
636+ let ( uvec_dims, _, uvec_data) = mrtrix:: load_nifti_f32_volume ( & uvec_path) . unwrap ( ) ;
614637 let ( dims3, ncoeffs) = normalize_trailing_channels (
615638 & coeff_dims,
616639 Path :: new ( "xx_mapmri.nii" ) ,
@@ -641,12 +664,16 @@ mod tests {
641664
642665 #[ test]
643666 fn fixture_tensor_export_order_produces_positive_eigenvalues ( ) {
667+ let Some ( ( coeff_path, tensor_path, uvec_path) ) = tortoise_fixtures ( ) else {
668+ eprintln ! ( "Tortoise fixtures not found at ../test_data/; skipping." ) ;
669+ return ;
670+ } ;
644671 let ( coeff_dims, _, coeff_data) =
645- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_mapmri.nii" ) ) . unwrap ( ) ;
672+ mrtrix:: load_nifti_f32_volume ( & coeff_path ) . unwrap ( ) ;
646673 let ( tensor_dims, _, tensor_data) =
647- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_L1_DT.nii" ) ) . unwrap ( ) ;
674+ mrtrix:: load_nifti_f32_volume ( & tensor_path ) . unwrap ( ) ;
648675 let ( uvec_dims, _, uvec_data) =
649- mrtrix:: load_nifti_f32_volume ( Path :: new ( "../test_data/xx_uvec.nii" ) ) . unwrap ( ) ;
676+ mrtrix:: load_nifti_f32_volume ( & uvec_path ) . unwrap ( ) ;
650677 let ( dims3, ncoeffs) = normalize_trailing_channels (
651678 & coeff_dims,
652679 Path :: new ( "xx_mapmri.nii" ) ,
0 commit comments