@@ -526,17 +526,17 @@ private static void Test<T>(Random rng, ReadOnlySpan<T> haystackRandom, ReadOnly
526526
527527                if  ( expectedIndex  !=  indexOfAnyIndex ) 
528528                { 
529-                     AssertionFailed ( haystack ,  needle ,  expectedIndex ,  indexOfAnyIndex ,  nameof ( indexOfAny ) ) ; 
529+                     AssertionFailed ( haystack ,  needle ,  searchValuesInstance ,   expectedIndex ,  indexOfAnyIndex ,  nameof ( indexOfAny ) ) ; 
530530                } 
531531
532532                if  ( expectedIndex  !=  searchValuesIndex ) 
533533                { 
534-                     AssertionFailed ( haystack ,  needle ,  expectedIndex ,  searchValuesIndex ,  nameof ( searchValues ) ) ; 
534+                     AssertionFailed ( haystack ,  needle ,  searchValuesInstance ,   expectedIndex ,  searchValuesIndex ,  nameof ( searchValues ) ) ; 
535535                } 
536536
537537                if  ( ( expectedIndex  >=  0 )  !=  searchValuesContainsResult ) 
538538                { 
539-                     AssertionFailed ( haystack ,  needle ,  expectedIndex ,  searchValuesContainsResult  ?  0  :  - 1 ,  nameof ( searchValuesContainsResult ) ) ; 
539+                     AssertionFailed ( haystack ,  needle ,  searchValuesInstance ,   expectedIndex ,  searchValuesContainsResult  ?  0  :  - 1 ,  nameof ( searchValuesContainsResult ) ) ; 
540540                } 
541541            } 
542542
@@ -546,13 +546,16 @@ private static ReadOnlySpan<T> GetRandomSlice<T>(Random rng, ReadOnlySpan<T> spa
546546                return  slice . Slice ( 0 ,  Math . Min ( slice . Length ,  rng . Next ( maxLength  +  1 ) ) ) ; 
547547            } 
548548
549-             private  static void  AssertionFailed < T > ( ReadOnlySpan < T >  haystack ,  ReadOnlySpan < T >  needle ,  int  expected ,  int  actual ,  string  approach ) 
549+             private  static void  AssertionFailed < T > ( ReadOnlySpan < T >  haystack ,  ReadOnlySpan < T >  needle ,  SearchValues < T >   searchValues ,   int  expected ,  int  actual ,  string  approach ) 
550550                where  T  :  INumber < T > 
551551            { 
552+                 Type  implType  =  searchValues . GetType ( ) ; 
553+                 string  impl  =  $ "{ implType . Name }  [{ string . Join ( ", " ,  implType . GenericTypeArguments . Select ( t =>  t . Name ) ) } ]"; 
554+ 
552555                string  readableHaystack  =  string . Join ( ", " ,  haystack . ToArray ( ) . Select ( c =>  int . CreateChecked ( c ) ) ) ; 
553556                string  readableNeedle  =  string . Join ( ", " ,  needle . ToArray ( ) . Select ( c =>  int . CreateChecked ( c ) ) ) ; 
554557
555-                 Assert . Fail ( $ "Expected { expected } , got { approach } ={ actual }  for needle='{ readableNeedle } ', haystack='{ readableHaystack } '") ; 
558+                 Assert . Fail ( $ "Expected { expected } , got { approach } ={ actual }  for impl=' { impl } ',  needle='{ readableNeedle } ', haystack='{ readableHaystack } '") ; 
556559            } 
557560        } 
558561    } 
0 commit comments