@@ -813,9 +813,11 @@ static string ToStringPadded(Half value)
813813 /// <summary>Verifies that two <see cref="double"/> values are equal, within the <paramref name="allowedVariance"/>.</summary>
814814 /// <param name="expected">The expected value</param>
815815 /// <param name="actual">The value to be compared against</param>
816- /// <param name="allowedVariance">The total variance allowed between the expected and actual results.</param>
816+ /// <param name="variance">The total variance allowed between the expected and actual results.</param>
817+ /// <param name="banner">The banner to show; if <c>null</c>, then the standard
818+ /// banner of "Values differ" will be used</param>
817819 /// <exception cref="EqualException">Thrown when the values are not equal</exception>
818- public static void Equal ( double expected , double actual , double variance )
820+ public static void Equal ( double expected , double actual , double variance , string ? banner = null )
819821 {
820822 if ( double . IsNaN ( expected ) )
821823 {
@@ -824,11 +826,11 @@ public static void Equal(double expected, double actual, double variance)
824826 return ;
825827 }
826828
827- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
829+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
828830 }
829831 else if ( double . IsNaN ( actual ) )
830832 {
831- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
833+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
832834 }
833835
834836 if ( double . IsNegativeInfinity ( expected ) )
@@ -838,11 +840,11 @@ public static void Equal(double expected, double actual, double variance)
838840 return ;
839841 }
840842
841- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
843+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
842844 }
843845 else if ( double . IsNegativeInfinity ( actual ) )
844846 {
845- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
847+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
846848 }
847849
848850 if ( double . IsPositiveInfinity ( expected ) )
@@ -852,11 +854,11 @@ public static void Equal(double expected, double actual, double variance)
852854 return ;
853855 }
854856
855- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
857+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
856858 }
857859 else if ( double . IsPositiveInfinity ( actual ) )
858860 {
859- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
861+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
860862 }
861863
862864 if ( IsNegativeZero ( expected ) )
@@ -868,7 +870,7 @@ public static void Equal(double expected, double actual, double variance)
868870
869871 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
870872 {
871- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
873+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
872874 }
873875
874876 // When the variance is not +-0.0, then we are handling a case where
@@ -879,7 +881,7 @@ public static void Equal(double expected, double actual, double variance)
879881 {
880882 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
881883 {
882- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
884+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
883885 }
884886
885887 // When the variance is not +-0.0, then we are handling a case where
@@ -896,7 +898,7 @@ public static void Equal(double expected, double actual, double variance)
896898
897899 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
898900 {
899- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
901+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
900902 }
901903
902904 // When the variance is not +-0.0, then we are handling a case where
@@ -907,7 +909,7 @@ public static void Equal(double expected, double actual, double variance)
907909 {
908910 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
909911 {
910- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
912+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
911913 }
912914
913915 // When the variance is not +-0.0, then we are handling a case where
@@ -919,16 +921,18 @@ public static void Equal(double expected, double actual, double variance)
919921
920922 if ( delta > variance )
921923 {
922- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
924+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
923925 }
924926 }
925927
926928 /// <summary>Verifies that two <see cref="float"/> values are equal, within the <paramref name="variance"/>.</summary>
927929 /// <param name="expected">The expected value</param>
928930 /// <param name="actual">The value to be compared against</param>
929931 /// <param name="variance">The total variance allowed between the expected and actual results.</param>
932+ /// <param name="banner">The banner to show; if <c>null</c>, then the standard
933+ /// banner of "Values differ" will be used</param>
930934 /// <exception cref="EqualException">Thrown when the values are not equal</exception>
931- public static void Equal ( float expected , float actual , float variance )
935+ public static void Equal ( float expected , float actual , float variance , string ? banner = null )
932936 {
933937 if ( float . IsNaN ( expected ) )
934938 {
@@ -937,11 +941,11 @@ public static void Equal(float expected, float actual, float variance)
937941 return ;
938942 }
939943
940- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
944+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
941945 }
942946 else if ( float . IsNaN ( actual ) )
943947 {
944- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
948+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
945949 }
946950
947951 if ( float . IsNegativeInfinity ( expected ) )
@@ -951,11 +955,11 @@ public static void Equal(float expected, float actual, float variance)
951955 return ;
952956 }
953957
954- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
958+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
955959 }
956960 else if ( float . IsNegativeInfinity ( actual ) )
957961 {
958- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
962+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
959963 }
960964
961965 if ( float . IsPositiveInfinity ( expected ) )
@@ -965,11 +969,11 @@ public static void Equal(float expected, float actual, float variance)
965969 return ;
966970 }
967971
968- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
972+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
969973 }
970974 else if ( float . IsPositiveInfinity ( actual ) )
971975 {
972- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
976+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
973977 }
974978
975979 if ( IsNegativeZero ( expected ) )
@@ -981,7 +985,7 @@ public static void Equal(float expected, float actual, float variance)
981985
982986 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
983987 {
984- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
988+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
985989 }
986990
987991 // When the variance is not +-0.0, then we are handling a case where
@@ -992,7 +996,7 @@ public static void Equal(float expected, float actual, float variance)
992996 {
993997 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
994998 {
995- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
999+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
9961000 }
9971001
9981002 // When the variance is not +-0.0, then we are handling a case where
@@ -1009,7 +1013,7 @@ public static void Equal(float expected, float actual, float variance)
10091013
10101014 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
10111015 {
1012- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1016+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10131017 }
10141018
10151019 // When the variance is not +-0.0, then we are handling a case where
@@ -1020,7 +1024,7 @@ public static void Equal(float expected, float actual, float variance)
10201024 {
10211025 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
10221026 {
1023- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1027+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10241028 }
10251029
10261030 // When the variance is not +-0.0, then we are handling a case where
@@ -1032,7 +1036,7 @@ public static void Equal(float expected, float actual, float variance)
10321036
10331037 if ( delta > variance )
10341038 {
1035- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1039+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10361040 }
10371041 }
10381042
@@ -1041,8 +1045,10 @@ public static void Equal(float expected, float actual, float variance)
10411045 /// <param name="expected">The expected value</param>
10421046 /// <param name="actual">The value to be compared against</param>
10431047 /// <param name="variance">The total variance allowed between the expected and actual results.</param>
1048+ /// <param name="banner">The banner to show; if <c>null</c>, then the standard
1049+ /// banner of "Values differ" will be used</param>
10441050 /// <exception cref="EqualException">Thrown when the values are not equal</exception>
1045- public static void Equal ( Half expected , Half actual , Half variance )
1051+ public static void Equal ( Half expected , Half actual , Half variance , string ? banner = null )
10461052 {
10471053 if ( Half . IsNaN ( expected ) )
10481054 {
@@ -1051,11 +1057,11 @@ public static void Equal(Half expected, Half actual, Half variance)
10511057 return ;
10521058 }
10531059
1054- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1060+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10551061 }
10561062 else if ( Half . IsNaN ( actual ) )
10571063 {
1058- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1064+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10591065 }
10601066
10611067 if ( Half . IsNegativeInfinity ( expected ) )
@@ -1065,11 +1071,11 @@ public static void Equal(Half expected, Half actual, Half variance)
10651071 return ;
10661072 }
10671073
1068- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1074+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10691075 }
10701076 else if ( Half . IsNegativeInfinity ( actual ) )
10711077 {
1072- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1078+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10731079 }
10741080
10751081 if ( Half . IsPositiveInfinity ( expected ) )
@@ -1079,11 +1085,11 @@ public static void Equal(Half expected, Half actual, Half variance)
10791085 return ;
10801086 }
10811087
1082- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1088+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10831089 }
10841090 else if ( Half . IsPositiveInfinity ( actual ) )
10851091 {
1086- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1092+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10871093 }
10881094
10891095 if ( IsNegativeZero ( expected ) )
@@ -1095,7 +1101,7 @@ public static void Equal(Half expected, Half actual, Half variance)
10951101
10961102 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
10971103 {
1098- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1104+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
10991105 }
11001106
11011107 // When the variance is not +-0.0, then we are handling a case where
@@ -1106,7 +1112,7 @@ public static void Equal(Half expected, Half actual, Half variance)
11061112 {
11071113 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
11081114 {
1109- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1115+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
11101116 }
11111117
11121118 // When the variance is not +-0.0, then we are handling a case where
@@ -1123,7 +1129,7 @@ public static void Equal(Half expected, Half actual, Half variance)
11231129
11241130 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
11251131 {
1126- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1132+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
11271133 }
11281134
11291135 // When the variance is not +-0.0, then we are handling a case where
@@ -1134,7 +1140,7 @@ public static void Equal(Half expected, Half actual, Half variance)
11341140 {
11351141 if ( IsPositiveZero ( variance ) || IsNegativeZero ( variance ) )
11361142 {
1137- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1143+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
11381144 }
11391145
11401146 // When the variance is not +-0.0, then we are handling a case where
@@ -1146,7 +1152,7 @@ public static void Equal(Half expected, Half actual, Half variance)
11461152
11471153 if ( delta > variance )
11481154 {
1149- throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) ) ;
1155+ throw EqualException . ForMismatchedValues ( ToStringPadded ( expected ) , ToStringPadded ( actual ) , banner ) ;
11501156 }
11511157 }
11521158#endif
0 commit comments