Fix issue when two filter "excludes" have the same string length#22
Merged
DefaultRyan merged 1 commit intomasterfrom May 5, 2021
Merged
Fix issue when two filter "excludes" have the same string length#22DefaultRyan merged 1 commit intomasterfrom
DefaultRyan merged 1 commit intomasterfrom
Conversation
Member
|
Thanks Ryan, and for adding test cases |
Scottj1s
approved these changes
May 5, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Found an issue where supplying multiple excludes with the same length caused bad behavior in Release and asserts in Debug.
Added test cases, and the second test case, "filter_excludes_same_length" was hitting an assert in debug due to a malformed sorting predicate in the
filterclass. In the test case, bothcompare({"N.N3", false}, {"N.N4", false})andcompare({"N.N4", false}, {"N.N3", false})would returntrue, violating sorting constraints.For the curious,
std::sort(and the other C++ sortings I can think of) require a Strict Weak Ordering. What this means in C++ terms is, given a comparison objectcompare, the following requirements must be met:compare(a, a) == falsefor allacompare(a, b) == truethencompare(b, a) == falsecompare(a, b) == trueandcompare(b, c) == truethencompare(a, c) == truecompare(a, b) == falseandcompare(b, a) == falseandcompare(b, c) == falseandcompare(c, b) == falsethencompare(a, c) == falseandcompare(c, a) == false(aka transitivity of equivalence)Fixes #21