summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-12-07 11:30:03 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-07 11:30:03 +0800
commit2ed063e8baa49779c810241119ba920917645890 (patch)
treed67bf5d2ba934ee128fd169a01421b0732378ee8
parent417081e2ebe587bdb207241eb1e365c0d72d772f (diff)
downloadlibpinyin-2ed063e8baa49779c810241119ba920917645890.tar.gz
libpinyin-2ed063e8baa49779c810241119ba920917645890.tar.xz
libpinyin-2ed063e8baa49779c810241119ba920917645890.zip
improves test chewing table
-rw-r--r--tests/storage/test_chewing_table.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/storage/test_chewing_table.cpp b/tests/storage/test_chewing_table.cpp
index b600af8..d79a446 100644
--- a/tests/storage/test_chewing_table.cpp
+++ b/tests/storage/test_chewing_table.cpp
@@ -76,7 +76,12 @@ int main(int argc, char * argv[]) {
guint32 start = record_time();
PhraseIndexRanges ranges;
- for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ memset(ranges, 0, sizeof(PhraseIndexRanges));
+
+ guint8 min_index, max_index;
+ phrase_index.get_sub_phrase_range(min_index, max_index);
+
+ for (size_t i = min_index; i < max_index; ++i) {
ranges[i] = g_array_new(FALSE, FALSE, sizeof(PhraseIndexRange));
}
@@ -84,7 +89,7 @@ int main(int argc, char * argv[]) {
largetable.search(keys->len, (ChewingKey *)keys->data, ranges);
}
- for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ for (size_t i = min_index; i < max_index; ++i) {
g_array_set_size(ranges[i], 0);
}
print_time(start, bench_times);