summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-09-03 16:33:25 +0800
committerPeng Wu <alexepico@gmail.com>2012-09-03 16:33:25 +0800
commit424cc567dd0e84662b28baa17dd4879f95c0d507 (patch)
tree4839b7b378031ab610dba1dece4d2f417b35d6e5
parentc0f98a953be642a17d97caef95b92ee479353c94 (diff)
downloadlibpinyin-424cc567dd0e84662b28baa17dd4879f95c0d507.tar.gz
libpinyin-424cc567dd0e84662b28baa17dd4879f95c0d507.tar.xz
libpinyin-424cc567dd0e84662b28baa17dd4879f95c0d507.zip
fixes test_phrase_table.cpp
-rw-r--r--src/storage/facade_phrase_table2.h2
-rw-r--r--tests/storage/test_phrase_table.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/storage/facade_phrase_table2.h b/src/storage/facade_phrase_table2.h
index a6e8bdc..3f40f57 100644
--- a/src/storage/facade_phrase_table2.h
+++ b/src/storage/facade_phrase_table2.h
@@ -98,7 +98,7 @@ public:
*/
int search(int phrase_length, /* in */ ucs4_t phrase[],
/* out */ PhraseTokens tokens) const {
- /* clear ranges. */
+ /* clear tokens. */
for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
if (tokens[i])
g_array_set_size(tokens[i], 0);
diff --git a/tests/storage/test_phrase_table.cpp b/tests/storage/test_phrase_table.cpp
index 3c4c489..968a9f8 100644
--- a/tests/storage/test_phrase_table.cpp
+++ b/tests/storage/test_phrase_table.cpp
@@ -34,6 +34,12 @@ int main(int argc, char * argv[]){
guint32 start = record_time();
for ( size_t i = 0; i < bench_times; ++i){
largetable.search(phrase_len, new_phrase, tokens);
+
+ /* clear tokens. */
+ for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ if (tokens[i])
+ g_array_set_size(tokens[i], 0);
+ }
}
print_time(start, bench_times);