summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-08-31 15:36:43 +0800
committerPeng Wu <alexepico@gmail.com>2011-08-31 15:36:43 +0800
commitd6288dc6efd141b0307a56f0660771e11a1cc690 (patch)
tree4a80771445c93d67878d360913832ab00232c582
parent35c9c51a81780340924cb0edef4b77e719f15b92 (diff)
downloadlibpinyin-d6288dc6efd141b0307a56f0660771e11a1cc690.zip
libpinyin-d6288dc6efd141b0307a56f0660771e11a1cc690.tar.gz
libpinyin-d6288dc6efd141b0307a56f0660771e11a1cc690.tar.xz
add test case for chewing
-rw-r--r--tests/storage/test_parser.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/storage/test_parser.cpp b/tests/storage/test_parser.cpp
index 08e1d43..d98b608 100644
--- a/tests/storage/test_parser.cpp
+++ b/tests/storage/test_parser.cpp
@@ -29,7 +29,6 @@
#include "pinyin_internal.h"
static const char *help_msg =
- "Too few argument!\n"
"Usage:\n"
" test-parser [options]\n\n"
" -i Use incomplete pinyin.\n"
@@ -50,6 +49,10 @@ static const char *help_msg =
" zy-et\n"
" zy-et26\n";
+void print_help(){
+ printf(help_msg);
+}
+
int main (int argc, char * argv [])
{
NullPinyinValidator validator;
@@ -68,7 +71,7 @@ int main (int argc, char * argv [])
if (++i >= argc) break;
if ( !strcmp("-h", argv [i]) || !strcmp ("--help", argv [i]) ) {
- printf(help_msg);
+ print_help ();
return 0;
}
@@ -96,6 +99,26 @@ int main (int argc, char * argv [])
parser = new PinyinShuangPinParser (SHUANG_PIN_ABC);
else if (!strcmp (argv[i], "sp-liushi"))
parser = new PinyinShuangPinParser (SHUANG_PIN_LIUSHI);
+ if (!strcmp (argv[i], "zy") || !strcmp (argv[i], "zy-standard") || !strcmp (argv[i], "zy-default"))
+ parser = new PinyinZhuYinParser ();
+ else if (!strcmp (argv[i], "zy-hsu"))
+ parser = new PinyinZhuYinParser (ZHUYIN_HSU);
+ else if (!strcmp (argv[i], "zy-ibm"))
+ parser = new PinyinZhuYinParser (ZHUYIN_IBM);
+ else if (!strcmp (argv[i], "zy-gin-yieh"))
+ parser = new PinyinZhuYinParser (ZHUYIN_GIN_YIEH);
+ else if (!strcmp (argv[i], "zy-et"))
+ parser = new PinyinZhuYinParser (ZHUYIN_ET);
+ else if (!strcmp (argv[i], "zy-et26"))
+ parser = new PinyinZhuYinParser (ZHUYIN_ET26);
+ else if (!strcmp (argv[i], "zy-zhuyin"))
+ parser = new PinyinZhuYinParser (ZHUYIN_ZHUYIN);
+ else {
+ fprintf(stderr, "Unknown Parser:%s.\n", argv[i]);
+ print_help();
+ exit(EINVAL);
+ }
+
continue;
}