From fa35330b42ed3be06f2eda35f08b21233163b047 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 20 May 2016 18:42:01 +0100 Subject: [PATCH] Fix RankedMatch ordering where 'a < a' was true Fixes #679 --- src/ranked_match.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ranked_match.cc b/src/ranked_match.cc index a6145d62..67be7038 100644 --- a/src/ranked_match.cc +++ b/src/ranked_match.cc @@ -158,7 +158,7 @@ bool RankedMatch::operator<(const RankedMatch& other) const } } - return it1 == m_candidate.end(); + return it1 == m_candidate.end() and it2 != other.m_candidate.end(); } UnitTest test_ranked_match{[] { @@ -169,6 +169,7 @@ UnitTest test_ranked_match{[] { kak_assert(count_word_boundaries_match("countWordBoundariesMatch", "cWBM") == 4); kak_assert(RankedMatch{"source", "so"} < RankedMatch{"source_data", "so"}); kak_assert(not (RankedMatch{"source_data", "so"} < RankedMatch{"source", "so"})); + kak_assert(not (RankedMatch{"source", "so"} < RankedMatch{"source", "so"})); }}; UnitTest test_used_letters{[]()