2018-10-30 18:14:12 +08:00
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
2018-06-27 13:46:42 +08:00
|
|
|
|
#include "base/suggest_words.h"
|
|
|
|
|
#include "tests/suggest_test.inc"
|
|
|
|
|
|
|
|
|
|
TEST(SuggestWords, basic) {
|
2018-08-24 07:45:37 +08:00
|
|
|
|
suggest_words_t* sw = suggest_words_create((const asset_info_t*)data_suggest_test);
|
2018-06-27 13:46:42 +08:00
|
|
|
|
|
|
|
|
|
ASSERT_EQ(suggest_words_find(sw, L"故"[0]), RET_OK);
|
2021-09-16 16:06:55 +08:00
|
|
|
|
ASSERT_EQ(sw->words_nr, 8u);
|
2018-10-30 18:14:12 +08:00
|
|
|
|
assert_str_eq(L"事", sw->words);
|
2018-06-27 13:46:42 +08:00
|
|
|
|
|
|
|
|
|
ASSERT_EQ(suggest_words_find(sw, L"飞"[0]), RET_OK);
|
2021-09-16 16:06:55 +08:00
|
|
|
|
ASSERT_EQ(sw->words_nr, 15u);
|
2018-10-30 18:14:12 +08:00
|
|
|
|
assert_str_eq(L"机", sw->words);
|
2018-06-27 13:46:42 +08:00
|
|
|
|
|
|
|
|
|
ASSERT_EQ(suggest_words_find(sw, L"几"[0]), RET_OK);
|
2021-09-16 16:06:55 +08:00
|
|
|
|
ASSERT_EQ(sw->words_nr, 15u);
|
2018-10-30 18:14:12 +08:00
|
|
|
|
assert_str_eq(L"个", sw->words);
|
2018-06-27 13:46:42 +08:00
|
|
|
|
|
|
|
|
|
suggest_words_destroy(sw);
|
|
|
|
|
}
|