Skip to content

Commit 884aa89

Browse files
committed
add test case
1 parent 9f10012 commit 884aa89

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/testdata/testlines.utf8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
请在一米线外等候
99
人事处女干事
1010
去医院做B超,叫号123
11+
B超 T恤

test/unittest/TSegments.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@ using namespace CppJieba;
4444

4545
TEST(MixSegmentTest, Test1)
4646
{
47-
MixSegment segment("../dict/extra_dict/jieba.dict.small.utf8", "../dict/hmm_model.utf8");;
47+
MixSegment segment("../dict/jieba.dict.utf8", "../dict/hmm_model.utf8");;
4848
const char* str = "我来自北京邮电大学。。。学号123456";
4949
const char* res[] = {"", "来自", "北京邮电大学", "","","", "学号", "123456"};
50+
const char* str2 = "B超 T恤";
51+
const char* res2[] = {"B超"," ", "T恤"};
5052
vector<string> words;
5153
ASSERT_TRUE(segment);
54+
5255
ASSERT_TRUE(segment.cut(str, words));
5356
ASSERT_EQ(words, vector<string>(res, res + sizeof(res)/sizeof(res[0])));
57+
ASSERT_TRUE(segment.cut(str2, words));
58+
ASSERT_EQ(words, vector<string>(res2, res2 + sizeof(res2)/sizeof(res2[0])));
5459
}
5560

5661
TEST(MPSegmentTest, Test1)

0 commit comments

Comments
 (0)