@@ -517,12 +517,12 @@ private bool GetNumbersFromFile(ref string firstString, ref string secondString,
517
517
518
518
if ( firstCollection . Count == secondCollection . Count )
519
519
{
520
- if ( ! MatchNumberWithTolerance ( firstCollection , secondCollection , digitsOfPrecision ) )
520
+ if ( ! MatchNumberWithTolerance ( firstCollection , secondCollection , digitsOfPrecision ) )
521
521
{
522
522
return false ;
523
523
}
524
524
}
525
-
525
+
526
526
firstString = MatchNumbers . Replace ( firstString , "%Number%" ) ;
527
527
secondString = MatchNumbers . Replace ( secondString , "%Number%" ) ;
528
528
return true ;
@@ -551,14 +551,20 @@ private bool MatchNumberWithTolerance(MatchCollection firstCollection, MatchColl
551
551
// would fail the inRange == true check, but would suceed the following, and we doconsider those two numbers
552
552
// (1.82844949 - 1.8284502) = -0.00000071
553
553
554
+ double delta2 = 0 ;
554
555
if ( ! inRange )
555
556
{
556
- delta = Math . Round ( f1 - f2 , digitsOfPrecision ) ;
557
- inRange = delta >= - allowedVariance && delta <= allowedVariance ;
557
+ delta2 = Math . Round ( f1 - f2 , digitsOfPrecision ) ;
558
+ inRange = delta2 >= - allowedVariance && delta2 <= allowedVariance ;
558
559
}
559
560
560
- if ( ! inRange )
561
+ if ( ! inRange )
561
562
{
563
+ Fail ( _allowMismatch , $ "Output and baseline mismatch at line { i } ." + Environment . NewLine +
564
+ $ "Values to compare are { firstCollection [ i ] } and { secondCollection [ i ] } " + Environment . NewLine +
565
+ $ "\t AllowedVariance: { allowedVariance } " + Environment . NewLine +
566
+ $ "\t delta: { delta } " + Environment . NewLine +
567
+ $ "\t delta2: { delta2 } " + Environment . NewLine ) ;
562
568
return false ;
563
569
}
564
570
}
0 commit comments