Example #1
0
 DictGroupPtr CreateDictGroupForConversion() const {
   DictPtr phrasesDict = CreateDictForPhrases();
   DictPtr charactersDict = CreateDictForCharacters();
   DictGroupPtr dictGroup(
       new DictGroup(list<DictPtr>{phrasesDict, charactersDict}));
   return dictGroup;
 }
Example #2
0
 static DictGroupPtr CreateDictGroupForConversion() {
   DictGroupPtr dictGroup(new DictGroup);
   DictPtr phrasesDict = CreateDictForPhrases();
   DictPtr charactersDict = CreateDictForCharacters();
   dictGroup->AddDict(phrasesDict);
   dictGroup->AddDict(charactersDict);
   return dictGroup;
 }
TEST_F(DictGroupTest, TaiwanPhraseGroupTest) {
  const DictGroupPtr dictGroup(new DictGroup(
      list<DictPtr>{CreateDictForPhrases(), CreateTaiwanPhraseDict()}));
  {
    const auto& entry = dictGroup->Dict::MatchPrefix(utf8("鼠标"));
    EXPECT_EQ(utf8("鼠標"), entry.Get()->GetDefault());
  }
  {
    const auto& entry = dictGroup->Dict::MatchPrefix(utf8("克罗地亚"));
    EXPECT_EQ(utf8("克羅埃西亞"), entry.Get()->GetDefault());
  }
  {
    const auto& matches = dictGroup->Dict::MatchAllPrefixes(utf8("鼠标"));
    EXPECT_EQ(1, matches.size());
    EXPECT_EQ(utf8("鼠標"), matches[0]->GetDefault());
  }
}