mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:59:56 +00:00
UnitTests: add another dialogue keyword test
This commit is contained in:
parent
2ac23008f5
commit
66e7e04807
1 changed files with 19 additions and 0 deletions
|
@ -46,3 +46,22 @@ TEST_F(KeywordSearchTest, keyword_test_conflict_resolution2)
|
||||||
ASSERT_TRUE (matches.size() == 1);
|
ASSERT_TRUE (matches.size() == 1);
|
||||||
ASSERT_TRUE (std::string(matches.front().mBeg, matches.front().mEnd) == "dwemer language");
|
ASSERT_TRUE (std::string(matches.front().mBeg, matches.front().mEnd) == "dwemer language");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(KeywordSearchTest, keyword_test_conflict_resolution3)
|
||||||
|
{
|
||||||
|
// testing that the longest keyword is chosen, rather than maximizing the
|
||||||
|
// amount of highlighted characters by highlighting the first and last keyword
|
||||||
|
MWDialogue::KeywordSearch<std::string, int> search;
|
||||||
|
search.seed("foo bar", 0);
|
||||||
|
search.seed("bar lock", 0);
|
||||||
|
search.seed("lock so", 0);
|
||||||
|
|
||||||
|
std::string text = "foo bar lock so";
|
||||||
|
|
||||||
|
std::vector<MWDialogue::KeywordSearch<std::string, int>::Match> matches;
|
||||||
|
search.highlightKeywords(text.begin(), text.end(), matches);
|
||||||
|
|
||||||
|
ASSERT_TRUE (matches.size() == 1);
|
||||||
|
ASSERT_TRUE (std::string(matches.front().mBeg, matches.front().mEnd) == "bar lock");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue