summaryrefslogtreecommitdiffstats
path: root/tests/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-12-01 15:40:26 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-01 15:40:26 +0800
commitc34f5d50a1fdf4015d97dd1dba15657b5755ff44 (patch)
tree415f37332b89c40b9bea17afecb79967617b8d09 /tests/storage
parent3d95277dff2e91ce436874bee5e51315f7fc4462 (diff)
downloadlibpinyin-c34f5d50a1fdf4015d97dd1dba15657b5755ff44.tar.gz
libpinyin-c34f5d50a1fdf4015d97dd1dba15657b5755ff44.tar.xz
libpinyin-c34f5d50a1fdf4015d97dd1dba15657b5755ff44.zip
update test cases
Diffstat (limited to 'tests/storage')
-rw-r--r--tests/storage/test_parser2.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/storage/test_parser2.cpp b/tests/storage/test_parser2.cpp
index 2ba2511..3748338 100644
--- a/tests/storage/test_parser2.cpp
+++ b/tests/storage/test_parser2.cpp
@@ -20,6 +20,7 @@
*/
+#include "timer.h"
#include <errno.h>
#include <stdio.h>
#include <assert.h>
@@ -28,6 +29,8 @@
#include "pinyin_parser2.h"
+size_t bench_times = 1000;
+
using namespace pinyin;
static const char * help_msg =
@@ -107,8 +110,14 @@ int main(int argc, char * argv[]) {
#endif
#if 1
- int len = parser->parse(options, keys, key_rests,
+ int len = 0;
+ guint32 start_time = record_time();
+ for ( size_t i = 0; i < bench_times; ++i)
+ len = parser->parse(options, keys, key_rests,
linebuf, strlen(linebuf));
+
+ print_time(start_time, bench_times);
+
printf("parsed %d chars, %d keys.\n", len, keys->len);
assert(keys->len == key_rests->len);