improves test chewing table
authorPeng Wu <alexepico@gmail.com>
Wed, 7 Dec 2011 03:30:03 +0000 (11:30 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 7 Dec 2011 03:30:03 +0000 (11:30 +0800)
tests/storage/test_chewing_table.cpp

index b600af8c3651ec5e87c2ec255156310046d36ff6..d79a446a1dde965f0cffe1cfb5d7ead19098d86d 100644 (file)
@@ -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);