Setting default comparator for namespace_map to be the expected behaviour. #8
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.
Very interesting stuff this comparator, learning new stuff all the time. The test looks like a lot has changed, but hilariously, it was working exactly as intended. The changes to the test are just general cleanup, they do NOT change it's behaviour at all.
The big change here is that the default comparator for
quicr::namespace_map
is nowstd::greater
instead ofstd::less
. The reason for this is simple: My original assumption about what was being found was wrong. The real behaviour:std::less
, when using aquicr::Name
to index it, the shortest match will be returned.std::greater
, when using aquicr::Name
to index it, the longest match will be returned.For whatever reason, I seemed to have this reversed in my head, and yet still wrote the correct test that showed that exact result. I suppose the way the test was written before was vague and unhelpful. So, the cleanup of the test and some added comments to the type itself should clear up the issue.
Also changed, but not really important:
quicr::namespace_map
is now a concrete type inheriting fromstd::map
, instead of just being an alias.