Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skyline: Improve failure reporting in AssertEx.FileEquals #3021

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

brendanx67
Copy link
Contributor

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

@brendanx67 brendanx67 requested a review from bspratt June 19, 2024 20:30
@bspratt
Copy link
Member

bspratt commented Jun 19, 2024

Looks good, other than I really do not think we should be using the scientific notation logic on integers. It took me a little while to understand that it was complaining about "2350" vs "8456". When I think about it, I'd argue for using the E logic only if one or the other text representations does in fact use scientific notation.

And it seems like we could be reporting the column index when comparing TSVs, but that's a nice-to-have.

@brendanx67
Copy link
Contributor Author

brendanx67 commented Jun 19, 2024 via email

brendanx67 and others added 5 commits June 30, 2024 17:50
…k/20240619_assertex_files_improved

Note there were a couple of conflicts with AssertEx.RemovePathDifferences which had been independently modified to better deal with quoted file paths, and to handle file paths embedded in single lines e.g. 'value="c:foo\bar.baz"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants