add test case

This commit is contained in:
wyy 2014-04-19 13:01:31 +08:00
parent 9f100121f8
commit 884aa89009
2 changed files with 7 additions and 1 deletions

View File

@ -8,3 +8,4 @@
请在一米线外等候
人事处女干事
去医院做B超叫号123
B超 T恤

View File

@ -44,13 +44,18 @@ using namespace CppJieba;
TEST(MixSegmentTest, Test1)
{
MixSegment segment("../dict/extra_dict/jieba.dict.small.utf8", "../dict/hmm_model.utf8");;
MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");;
const char* str = "我来自北京邮电大学。。。学号123456";
const char* res[] = {"", "来自", "北京邮电大学", "","","", "学号", "123456"};
const char* str2 = "B超 T恤";
const char* res2[] = {"B超"," ", "T恤"};
vector<string> words;
ASSERT_TRUE(segment);
ASSERT_TRUE(segment.cut(str, words));
ASSERT_EQ(words, vector<string>(res, res + sizeof(res)/sizeof(res[0])));
ASSERT_TRUE(segment.cut(str2, words));
ASSERT_EQ(words, vector<string>(res2, res2 + sizeof(res2)/sizeof(res2[0])));
}
TEST(MPSegmentTest, Test1)