@@ -839,77 +839,80 @@ mod tests {
839839 #[ test]
840840 fn test_outputs_match_no_epsilon ( ) {
841841 let runner = Runner :: new ( PathBuf :: from ( "dummy_base" ) ) ;
842-
842+
843843 // Exact match should work
844844 assert ! ( runner. outputs_match( b"hello" , b"hello" , None , OutputType :: Raw ) ) ;
845-
845+
846846 // Different content should not match
847847 assert ! ( !runner. outputs_match( b"hello" , b"world" , None , OutputType :: Raw ) ) ;
848848 }
849849
850850 #[ test]
851851 fn test_outputs_match_with_epsilon_f32 ( ) {
852852 let runner = Runner :: new ( PathBuf :: from ( "dummy_base" ) ) ;
853-
853+
854854 // Prepare test data - two floats with small difference
855855 let val1: f32 = 1.0 ;
856856 let val2: f32 = 1.00001 ;
857857 let arr1 = [ val1] ;
858858 let arr2 = [ val2] ;
859859 let bytes1 = bytemuck:: cast_slice ( & arr1) ;
860860 let bytes2 = bytemuck:: cast_slice ( & arr2) ;
861-
861+
862862 // Should not match without epsilon
863863 assert ! ( !runner. outputs_match( bytes1, bytes2, None , OutputType :: F32 ) ) ;
864-
864+
865865 // Should match with sufficient epsilon
866866 assert ! ( runner. outputs_match( bytes1, bytes2, Some ( 0.0001 ) , OutputType :: F32 ) ) ;
867-
867+
868868 // Should not match with too small epsilon
869869 assert ! ( !runner. outputs_match( bytes1, bytes2, Some ( 0.000001 ) , OutputType :: F32 ) ) ;
870870 }
871871
872872 #[ test]
873873 fn test_outputs_match_with_epsilon_f64 ( ) {
874874 let runner = Runner :: new ( PathBuf :: from ( "dummy_base" ) ) ;
875-
875+
876876 // Prepare test data - two doubles with small difference
877877 let val1: f64 = 1.0 ;
878878 let val2: f64 = 1.00001 ;
879879 let arr1 = [ val1] ;
880880 let arr2 = [ val2] ;
881881 let bytes1 = bytemuck:: cast_slice ( & arr1) ;
882882 let bytes2 = bytemuck:: cast_slice ( & arr2) ;
883-
883+
884884 // Should not match without epsilon
885885 assert ! ( !runner. outputs_match( bytes1, bytes2, None , OutputType :: F64 ) ) ;
886-
886+
887887 // Should match with sufficient epsilon
888888 assert ! ( runner. outputs_match( bytes1, bytes2, Some ( 0.0001 ) , OutputType :: F64 ) ) ;
889-
889+
890890 // Should not match with too small epsilon
891891 assert ! ( !runner. outputs_match( bytes1, bytes2, Some ( 0.000001 ) , OutputType :: F64 ) ) ;
892892 }
893893
894894 #[ test]
895895 fn test_group_outputs_with_epsilon ( ) {
896896 let runner = Runner :: new ( PathBuf :: from ( "dummy_base" ) ) ;
897-
897+
898898 // Create float outputs with small differences
899899 let val1: f32 = 1.0 ;
900900 let val2: f32 = 1.00001 ;
901901 let val3: f32 = 2.0 ;
902-
903- let pkg1 = dummy_package_output ( "foo" , "/path/to/foo" , bytemuck:: cast_slice ( & [ val1] ) , "tmp1" ) ;
904- let pkg2 = dummy_package_output ( "bar" , "/path/to/bar" , bytemuck:: cast_slice ( & [ val2] ) , "tmp2" ) ;
905- let pkg3 = dummy_package_output ( "baz" , "/path/to/baz" , bytemuck:: cast_slice ( & [ val3] ) , "tmp3" ) ;
906-
902+
903+ let pkg1 =
904+ dummy_package_output ( "foo" , "/path/to/foo" , bytemuck:: cast_slice ( & [ val1] ) , "tmp1" ) ;
905+ let pkg2 =
906+ dummy_package_output ( "bar" , "/path/to/bar" , bytemuck:: cast_slice ( & [ val2] ) , "tmp2" ) ;
907+ let pkg3 =
908+ dummy_package_output ( "baz" , "/path/to/baz" , bytemuck:: cast_slice ( & [ val3] ) , "tmp3" ) ;
909+
907910 let outputs = vec ! [ pkg1, pkg2, pkg3] ;
908-
911+
909912 // Without epsilon, val1 and val2 should be in different groups
910913 let groups = runner. group_outputs ( & outputs, None , OutputType :: F32 ) ;
911914 assert_eq ! ( groups. len( ) , 3 ) ;
912-
915+
913916 // With epsilon, val1 and val2 should be in the same group
914917 let groups_with_epsilon = runner. group_outputs ( & outputs, Some ( 0.0001 ) , OutputType :: F32 ) ;
915918 assert_eq ! ( groups_with_epsilon. len( ) , 2 ) ;
@@ -919,7 +922,8 @@ mod tests {
919922 fn test_invalid_metadata_json ( ) {
920923 // Test that invalid JSON in metadata file causes proper error
921924 let metadata_content = "{ invalid json }" ;
922- let result: Result < difftest:: config:: TestMetadata , _ > = serde_json:: from_str ( metadata_content) ;
925+ let result: Result < difftest:: config:: TestMetadata , _ > =
926+ serde_json:: from_str ( metadata_content) ;
923927 assert ! ( result. is_err( ) ) ;
924928 // Just check that it's an error, don't check the specific message
925929 }
@@ -929,18 +933,20 @@ mod tests {
929933 // This test verifies that when packages have different output types,
930934 // the runner returns an error. This tests the code at line 340-347
931935 // where we check: if output_type != Some(metadata.output_type)
932-
936+
933937 // We can't easily test the full run_test_case flow without real binaries,
934938 // but we can at least verify the error is constructed properly
935-
939+
936940 // Test that the error message is properly formatted
937941 let error = RunnerError :: Config {
938942 msg : format ! (
939943 "Package '{}' has output type {:?}, but previous packages have {:?}" ,
940- "test_pkg" , OutputType :: F32 , Some ( OutputType :: F64 )
944+ "test_pkg" ,
945+ OutputType :: F32 ,
946+ Some ( OutputType :: F64 )
941947 ) ,
942948 } ;
943-
949+
944950 match error {
945951 RunnerError :: Config { msg } => {
946952 assert ! ( msg. contains( "test_pkg" ) ) ;
@@ -954,14 +960,14 @@ mod tests {
954960 #[ test]
955961 fn test_metadata_parsing_error_message ( ) {
956962 // Test that metadata parsing errors are formatted correctly
957-
963+
958964 let error = RunnerError :: Config {
959965 msg : format ! (
960966 "Failed to parse metadata for package '{}': {}" ,
961967 "test_pkg" , "invalid JSON"
962968 ) ,
963969 } ;
964-
970+
965971 match error {
966972 RunnerError :: Config { msg } => {
967973 assert ! ( msg. contains( "Failed to parse metadata" ) ) ;
@@ -971,5 +977,4 @@ mod tests {
971977 _ => panic ! ( "Wrong error type" ) ,
972978 }
973979 }
974-
975980}
0 commit comments