Skyline: Improve failure reporting in AssertEx.FileEquals #3021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This greatly improves failure reporting for AssertEx.FileEquals() where the old code used to just report the two lines where the comparison failed, the new code gives a lot more detail on the internal reasons when paths and column tolerances are involved. This code also adds a class ColumnTolerances to formalize the tolerance evaluation and introduces a tolerance that applies to the mantissa of the number in scientific notation to better capture limitations in precision and potential rounding error.
Before (mistakenly interpreted as a path difference):
Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Diff found at line 225 position 0: expected
Orbi3_SA_IP_pHis3_01.mzML 17836 17876 8 3 3495.7076 1166.5775 1.050319E+08 2.961274E+08 110.6513 110.8777 110.7155 0.9989 _ 17848 H254C156N43O46S1[-2.150306] mass3495.7076_RT110.7155
actual
z:\download\Perftests\Label-free\converted\Orbi3_SA_IP_pHis3_01.mzML 17836 17876 8 3 3495.7076 1166.5775 1.050319E+08 2.961275E+08 110.6513 110.8777 110.7155 0.9989 _ 17848 H254C156N43O46S1[-2.150306] mass3495.7076_RT110.7155
After (skipping thousands of lines that match by the specified precision and more clearly showing the problem):
Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException: Assert.Fail failed. Diff found at line 7723 position 5:
expected
Orbi3_SA_IP_pHis3_01.mzML 2350 2371 5 1 863.4852 864.4928 1732674 5650320 15.8053 15.9211 15.8631 0.9988 _ 2361 H86C38N10O11[+4.837413] mass863.4852_RT15.8631
actual
z:\download\Perftests\Label-free\converted\Orbi3_SA_IP_pHis3_01.mzML 8456 8477 6 2 1228.6413 615.3279 1732675 8681932 51.0093 51.1453 51.1453 0.9942 _ 8477 H102C55N15O16[-0.121619] mass1228.6413_RT51.1453
expected with paths removed
path 2350 2371 5 1 863.4852 864.4928 1732674 5650320 15.8053 15.9211 15.8631 0.9988 _ 2361 H86C38N10O11[+4.837413] mass863.4852_RT15.8631
actual with paths removed
path 8456 8477 6 2 1228.6413 615.3279 1732675 8681932 51.0093 51.1453 51.1453 0.9942 _ 8477 H102C55N15O16[-0.121619] mass1228.6413_RT51.1453
matching prefix: 'path '
matching suffix: ''
decimal matching: Expected decimal mantissa: 2.35 does not match actual 8.456 to within 0.00015015