Skip to content
Permalink
Browse files

Apply astyle

  • Loading branch information
suricactus authored and nyalldawson committed Mar 15, 2020
1 parent 9e75e3b commit 98965e6aaa793ad8fd039b0527c732d3eed6eda1
Showing with 10 additions and 10 deletions.
  1. +4 −4 src/core/qgsstringutils.cpp
  2. +6 −6 tests/src/python/test_qgsstringutils.py
@@ -489,11 +489,11 @@ double QgsStringUtils::fuzzyScore( const QString &candidate, const QString &sear
}

// if the search string is covered, check if the last match is end of word
if (searchIdx >= searchLength)
if ( searchIdx >= searchLength )
{
bool isEndOfWord = (candidateIdx >= candidateLength)
? true
: candidateNormalized[candidateIdx].isSpace() || candidateNormalized[candidateIdx].isPunct();
bool isEndOfWord = ( candidateIdx >= candidateLength )
? true
: candidateNormalized[candidateIdx].isSpace() || candidateNormalized[candidateIdx].isPunct();

if ( isEndOfWord )
score += FUZZY_SCORE_WORD_MATCH;
@@ -192,29 +192,29 @@ def testfuzzyScore(self):
self.assertEqual(
QgsStringUtils.fuzzyScore('foo bar', 'foobar'),
QgsStringUtils.fuzzyScore('foo_bar', 'foobar')
)
)
self.assertEqual(
QgsStringUtils.fuzzyScore('foo bar', 'foobar'),
QgsStringUtils.fuzzyScore('foo,bar', 'foobar')
)
)
self.assertEqual(
QgsStringUtils.fuzzyScore('foo bar', 'foobar'),
QgsStringUtils.fuzzyScore('foo!bar', 'foobar')
)
)
# note the accent
self.assertEqual(
QgsStringUtils.fuzzyScore('foo!bér', 'foober'),
QgsStringUtils.fuzzyScore('foo!ber', 'foobér')
)
)
self.assertGreater(
QgsStringUtils.fuzzyScore('abcd efg hig', 'abcd hig'),
QgsStringUtils.fuzzyScore('abcd efg hig', 'abcd e h')
)
)
# full words are preferred, even though the same number of characters used
self.assertGreater(
QgsStringUtils.fuzzyScore('abcd efg hig', 'abcd hig'),
QgsStringUtils.fuzzyScore('abcd efg hig', 'abcd e hi')
)
)


if __name__ == '__main__':

0 comments on commit 98965e6

Please sign in to comment.
You can’t perform that action at this time.