cppjieba/test/unittest/TFullSegment.cpp
2014-03-15 22:48:29 +08:00

19 lines
545 B
C++

#include "src/FullSegment.hpp"
#include "gtest/gtest.h"
using namespace CppJieba;
TEST(FullSegment, Test1)
{
FullSegment segment("../dict/extra_dict/jieba.dict.small.utf8");
const char* str = "我来自北京邮电大学。。。 学号 123456";
vector<string> words;
ASSERT_EQ(segment.cut(str, words), true);
string s;
s << words;
ASSERT_EQ(s, "[\"\", \"来自\", \"北京\", \"北京邮电大学\", \"邮电\", \"电大\", \"大学\", \"\", \"\", \"\", \" \", \"\", \"\", \" 123456\"]");
}