Fixing a bug with word-boundary ratio calculation
This commit is contained in:
parent
a8f095ec0a
commit
adb31abef2
@ -36,11 +36,11 @@ int NumWordBoundaryCharMatches( const std::string &query,
|
||||
while ( j < query.size() && i < word_boundary_chars.size() )
|
||||
{
|
||||
if ( toupper( query[ j ] ) == toupper( word_boundary_chars[ i ] ) )
|
||||
++i;
|
||||
++j;
|
||||
++i;
|
||||
}
|
||||
|
||||
return i;
|
||||
return j;
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
@ -116,6 +116,18 @@ TEST( CompleterTest, CompleteMatchForWordBoundaryCharsWins )
|
||||
|
||||
TEST( CompleterTest, RatioUtilizationTieBreak )
|
||||
{
|
||||
EXPECT_THAT( Completer( Candidates(
|
||||
"aGaaFooBarQux",
|
||||
"aBaafbq" ) ).CandidatesForQuery( "fbq" ),
|
||||
ElementsAre( "aGaaFooBarQux",
|
||||
"aBaafbq" ) );
|
||||
|
||||
EXPECT_THAT( Completer( Candidates(
|
||||
"aFooBarQux",
|
||||
"afbq" ) ).CandidatesForQuery( "fbq" ),
|
||||
ElementsAre( "aFooBarQux",
|
||||
"afbq" ) );
|
||||
|
||||
EXPECT_THAT( Completer( Candidates(
|
||||
"FooBarQux",
|
||||
"FooBarQuxZaa" ) ).CandidatesForQuery( "fbq" ),
|
||||
|
Loading…
Reference in New Issue
Block a user