cppjieba_rb 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +21 -0
- data/.github/workflows/linting.yml +30 -0
- data/.github/workflows/release.yml +42 -0
- data/.github/workflows/tests.yml +47 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +45 -0
- data/.ruby-version +1 -0
- data/.yamllint +35 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +11 -0
- data/README.md +5 -5
- data/Rakefile +16 -7
- data/cppjieba_rb.gemspec +46 -33
- data/ext/cppjieba/.github/workflows/cmake.yml +52 -0
- data/ext/cppjieba/.github/workflows/stale-issues.yml +24 -0
- data/ext/cppjieba/.gitmodules +3 -0
- data/ext/cppjieba/{ChangeLog.md → CHANGELOG.md} +50 -1
- data/ext/cppjieba/CMakeLists.txt +11 -14
- data/ext/cppjieba/LICENSE +20 -0
- data/ext/cppjieba/README.md +9 -18
- data/ext/cppjieba/deps/limonp/.github/workflows/cmake.yml +43 -0
- data/ext/cppjieba/deps/limonp/.gitignore +9 -0
- data/ext/cppjieba/deps/limonp/CHANGELOG.md +160 -0
- data/ext/cppjieba/deps/limonp/CMakeLists.txt +61 -0
- data/ext/cppjieba/deps/limonp/LICENSE +20 -0
- data/ext/cppjieba/deps/limonp/README.md +38 -0
- data/ext/cppjieba/deps/limonp/{LocalVector.hpp → include/limonp/LocalVector.hpp} +3 -3
- data/ext/cppjieba/deps/limonp/{Logging.hpp → include/limonp/Logging.hpp} +17 -3
- data/ext/cppjieba/deps/limonp/{StringUtil.hpp → include/limonp/StringUtil.hpp} +31 -10
- data/ext/cppjieba/deps/limonp/test/CMakeLists.txt +8 -0
- data/ext/cppjieba/deps/limonp/test/demo.cpp +40 -0
- data/ext/cppjieba/deps/limonp/test/testdata/1.conf +5 -0
- data/ext/cppjieba/deps/limonp/test/testdata/StdExtension.data +3 -0
- data/ext/cppjieba/deps/limonp/test/testdata/dict.gbk +50 -0
- data/ext/cppjieba/deps/limonp/test/testdata/dict.utf8 +50 -0
- data/ext/cppjieba/deps/limonp/test/testdata/io_testfile +2 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.1.utf8 +93 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.0.utf8 +93 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.1.utf8 +67 -0
- data/ext/cppjieba/deps/limonp/test/testdata/jieba.dict.2.utf8 +64 -0
- data/ext/cppjieba/deps/limonp/test/unittest/CMakeLists.txt +30 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TArgvContext.cpp +16 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TCastFloat.cpp +19 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TClosure.cpp +85 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TColorPrint.cpp +20 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TConfig.cpp +17 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TLocalVector.cpp +41 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TLogging.cpp +12 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TStdExtension.cpp +95 -0
- data/ext/cppjieba/deps/limonp/test/unittest/TStringUtil.cpp +183 -0
- data/ext/cppjieba/include/cppjieba/DictTrie.hpp +9 -0
- data/ext/cppjieba/include/cppjieba/Jieba.hpp +4 -0
- data/ext/cppjieba/include/cppjieba/Trie.hpp +27 -1
- data/ext/cppjieba/test/CMakeLists.txt +4 -3
- data/ext/cppjieba/test/unittest/CMakeLists.txt +16 -7
- data/ext/cppjieba_rb/extconf.rb +11 -6
- data/ext/cppjieba_rb/internal.cc +1 -1
- data/lib/cppjieba_rb/segment.rb +4 -1
- data/lib/cppjieba_rb/version.rb +3 -1
- data/lib/cppjieba_rb.rb +12 -5
- data/test/test_keyword.rb +8 -8
- data/test/test_segment.rb +14 -10
- data/test/test_stop_word_filter.rb +5 -3
- data/test/test_tagging.rb +5 -2
- metadata +63 -140
- data/.travis.yml +0 -30
- data/ext/cppjieba/.travis.yml +0 -21
- data/ext/cppjieba/README_EN.md +0 -115
- data/ext/cppjieba/appveyor.yml +0 -32
- data/ext/cppjieba/deps/CMakeLists.txt +0 -1
- data/ext/cppjieba/deps/gtest/CMakeLists.txt +0 -5
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-death-test.h +0 -283
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-message.h +0 -230
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h +0 -1421
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-param-test.h.pump +0 -487
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-printers.h +0 -796
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-spi.h +0 -232
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-test-part.h +0 -176
- data/ext/cppjieba/deps/gtest/include/gtest/gtest-typed-test.h +0 -259
- data/ext/cppjieba/deps/gtest/include/gtest/gtest.h +0 -2155
- data/ext/cppjieba/deps/gtest/include/gtest/gtest_pred_impl.h +0 -358
- data/ext/cppjieba/deps/gtest/include/gtest/gtest_prod.h +0 -58
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-death-test-internal.h +0 -308
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-filepath.h +0 -210
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-internal.h +0 -1226
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-linked_ptr.h +0 -233
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h +0 -4822
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -301
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-param-util.h +0 -619
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-port.h +0 -1788
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-string.h +0 -350
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h +0 -968
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-tuple.h.pump +0 -336
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h +0 -3330
- data/ext/cppjieba/deps/gtest/include/gtest/internal/gtest-type-util.h.pump +0 -296
- data/ext/cppjieba/deps/gtest/src/.deps/gtest-all.Plo +0 -681
- data/ext/cppjieba/deps/gtest/src/.deps/gtest_main.Plo +0 -509
- data/ext/cppjieba/deps/gtest/src/.dirstamp +0 -0
- data/ext/cppjieba/deps/gtest/src/gtest-all.cc +0 -48
- data/ext/cppjieba/deps/gtest/src/gtest-death-test.cc +0 -1234
- data/ext/cppjieba/deps/gtest/src/gtest-filepath.cc +0 -380
- data/ext/cppjieba/deps/gtest/src/gtest-internal-inl.h +0 -1038
- data/ext/cppjieba/deps/gtest/src/gtest-port.cc +0 -746
- data/ext/cppjieba/deps/gtest/src/gtest-printers.cc +0 -356
- data/ext/cppjieba/deps/gtest/src/gtest-test-part.cc +0 -110
- data/ext/cppjieba/deps/gtest/src/gtest-typed-test.cc +0 -110
- data/ext/cppjieba/deps/gtest/src/gtest.cc +0 -4898
- data/ext/cppjieba/deps/limonp/BlockingQueue.hpp +0 -49
- data/ext/cppjieba/deps/limonp/BoundedBlockingQueue.hpp +0 -67
- data/ext/cppjieba/deps/limonp/BoundedQueue.hpp +0 -65
- data/ext/cppjieba/deps/limonp/FileLock.hpp +0 -74
- data/ext/cppjieba/deps/limonp/Md5.hpp +0 -411
- data/ext/cppjieba/deps/limonp/MutexLock.hpp +0 -51
- data/ext/cppjieba/deps/limonp/Thread.hpp +0 -44
- data/ext/cppjieba/deps/limonp/ThreadPool.hpp +0 -86
- data/ext/cppjieba/test/demo.cpp +0 -80
- /data/ext/cppjieba/deps/{gtest/src/.deps/.dirstamp → limonp/.gitmodules} +0 -0
- /data/ext/cppjieba/deps/limonp/{ArgvContext.hpp → include/limonp/ArgvContext.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Closure.hpp → include/limonp/Closure.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Colors.hpp → include/limonp/Colors.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Condition.hpp → include/limonp/Condition.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{Config.hpp → include/limonp/Config.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{ForcePublic.hpp → include/limonp/ForcePublic.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{NonCopyable.hpp → include/limonp/NonCopyable.hpp} +0 -0
- /data/ext/cppjieba/deps/limonp/{StdExtension.hpp → include/limonp/StdExtension.hpp} +0 -0
- /data/ext/cppjieba/deps/{gtest/src/gtest_main.cc → limonp/test/unittest/gtest_main.cpp} +0 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
AT&T 3 nz
|
2
|
+
B超 3 n
|
3
|
+
c# 3 nz
|
4
|
+
C# 3 nz
|
5
|
+
c++ 3 nz
|
6
|
+
C++ 3 nz
|
7
|
+
T恤 4 n
|
8
|
+
一 217830 m
|
9
|
+
一一 1670 m
|
10
|
+
一一二 11 m
|
11
|
+
一一例 3 m
|
12
|
+
一一分 8 m
|
13
|
+
一一列举 34 i
|
14
|
+
一一对 9 m
|
15
|
+
一一对应 43 l
|
16
|
+
一一记 2 m
|
17
|
+
一一道来 4 l
|
18
|
+
一丁 18 d
|
19
|
+
一丁不识 3 i
|
20
|
+
一丁点 3 m
|
21
|
+
一丁点儿 24 m
|
22
|
+
一七 22 m
|
23
|
+
一七八不 3 l
|
24
|
+
一万 442 m
|
25
|
+
一万一千 4 m
|
26
|
+
一万一千五百二十颗 2 m
|
27
|
+
一万一千八百八十斤 2 m
|
28
|
+
一万一千多间 2 m
|
29
|
+
一万一千零九十五册 4 m
|
30
|
+
一万七千 5 m
|
31
|
+
一万七千余 2 m
|
32
|
+
一万七千多 2 m
|
33
|
+
一万七千多户 2 m
|
34
|
+
一万万 4 m
|
35
|
+
一万万两 4 m
|
36
|
+
一万三千 8 m
|
37
|
+
一万三千五百一十七 2 m
|
38
|
+
一万三千五百斤 4 m
|
39
|
+
一万三千余种 2 m
|
40
|
+
一万三千块 2 m
|
41
|
+
一万两 124 m
|
42
|
+
一万两万 4 m
|
43
|
+
一万两千 3 m
|
44
|
+
一万个 62 m
|
45
|
+
一万九千 2 m
|
46
|
+
一万九千余 2 m
|
47
|
+
一万二 10 m
|
48
|
+
一万二千 7 m
|
49
|
+
一万二千两 2 m
|
50
|
+
一万二千五百 4 m
|
@@ -0,0 +1,93 @@
|
|
1
|
+
龙鸣狮吼 3 nr
|
2
|
+
龙齐诺 2 nr
|
3
|
+
龙齿 3 n
|
4
|
+
龚 176 nr
|
5
|
+
龚世萍 2 nr
|
6
|
+
龚书铎 2 nr
|
7
|
+
龚二人 2 nr
|
8
|
+
龚云甫 3 nr
|
9
|
+
龚伟强 5 nr
|
10
|
+
龚先生 4 nr
|
11
|
+
龚光杰 44 nr
|
12
|
+
龚古尔 24 nr
|
13
|
+
龚子敬 2 nr
|
14
|
+
龚孝升 12 nr
|
15
|
+
龚学平 2 nr
|
16
|
+
龚完敬 5 nr
|
17
|
+
龚定庵 3 nr
|
18
|
+
龚定敬 2 nr
|
19
|
+
龚宝铨 5 nr
|
20
|
+
龚家村 3 nr
|
21
|
+
龚建国 29 nr
|
22
|
+
龚德俊 6 nr
|
23
|
+
龚心瀚 3 nr
|
24
|
+
龚志国 2 nr
|
25
|
+
龚意田 3 nr
|
26
|
+
龚慈恩 3 nr
|
27
|
+
龚施茜 3 nr
|
28
|
+
龚晓犁 2 nr
|
29
|
+
龚普洛 3 nr
|
30
|
+
龚智超 7 nr
|
31
|
+
龚松林 10 nr
|
32
|
+
龚永明 3 nr
|
33
|
+
龚永泉 5 nr
|
34
|
+
龚泽艺 256 nr
|
35
|
+
龚睿 8 nrfg
|
36
|
+
龚祖同 2 nr
|
37
|
+
龚秋婷 3 nr
|
38
|
+
龚老爷 2 nr
|
39
|
+
龚育之 19 nr
|
40
|
+
龚自珍 28 nr
|
41
|
+
龚蓓苾 3 nr
|
42
|
+
龚虹嘉 3 nr
|
43
|
+
龚诗嘉 3 nr
|
44
|
+
龛 223 ng
|
45
|
+
龜 2 zg
|
46
|
+
龟 903 ns
|
47
|
+
龟儿子 123 n
|
48
|
+
龟兆 3 nz
|
49
|
+
龟兹 215 ns
|
50
|
+
龟兹王 3 nrt
|
51
|
+
龟冷搘床 3 v
|
52
|
+
龟冷支床 3 n
|
53
|
+
龟卜 3 n
|
54
|
+
龟厌不告 3 l
|
55
|
+
龟壳 33 n
|
56
|
+
龟壳花 3 n
|
57
|
+
龟头 34 n
|
58
|
+
龟头炎 3 n
|
59
|
+
龟山 23 ns
|
60
|
+
龟山乡 3 ns
|
61
|
+
龟山岛 3 ns
|
62
|
+
龟年鹤寿 3 ns
|
63
|
+
龟年鹤算 3 l
|
64
|
+
龟文 3 nz
|
65
|
+
龟文写迹 3 n
|
66
|
+
龟文鸟迹 3 n
|
67
|
+
龟板 10 n
|
68
|
+
龟毛免角 3 n
|
69
|
+
龟毛兔角 3 n
|
70
|
+
龟溪 3 ns
|
71
|
+
龟玉 3 nz
|
72
|
+
龟王 3 nz
|
73
|
+
龟甲 92 ns
|
74
|
+
龟甲胶 3 nz
|
75
|
+
龟筮 3 n
|
76
|
+
龟纹 3 n
|
77
|
+
龟缩 29 v
|
78
|
+
龟肉 3 n
|
79
|
+
龟背 21 n
|
80
|
+
龟背竹 3 n
|
81
|
+
龟苓膏 3 n
|
82
|
+
龟苗 3 n
|
83
|
+
龟裂 34 v
|
84
|
+
龟足 5 v
|
85
|
+
龟鉴 2 n
|
86
|
+
龟镜 3 nz
|
87
|
+
龟鳖 3 n
|
88
|
+
龟鹤遐寿 3 l
|
89
|
+
龟龄鹤算 3 n
|
90
|
+
龟龙片甲 3 nz
|
91
|
+
龟龙麟凤 3 ns
|
92
|
+
龠 5 g
|
93
|
+
龢 732 zg
|
@@ -0,0 +1,93 @@
|
|
1
|
+
龙鸣狮吼 3 nr
|
2
|
+
龙齐诺 2 nr
|
3
|
+
龙齿 3 n
|
4
|
+
龚 176 nr
|
5
|
+
龚世萍 2 nr
|
6
|
+
龚书铎 2 nr
|
7
|
+
龚二人 2 nr
|
8
|
+
龚云甫 3 nr
|
9
|
+
龚伟强 5 nr
|
10
|
+
龚先生 4 nr
|
11
|
+
龚光杰 44 nr
|
12
|
+
龚古尔 24 nr
|
13
|
+
龚子敬 2 nr
|
14
|
+
龚孝升 12 nr
|
15
|
+
龚学平 2 nr
|
16
|
+
龚完敬 5 nr
|
17
|
+
龚定庵 3 nr
|
18
|
+
龚定敬 2 nr
|
19
|
+
龚宝铨 5 nr
|
20
|
+
龚家村 3 nr
|
21
|
+
龚建国 29 nr
|
22
|
+
龚德俊 6 nr
|
23
|
+
龚心瀚 3 nr
|
24
|
+
龚志国 2 nr
|
25
|
+
龚意田 3 nr
|
26
|
+
龚慈恩 3 nr
|
27
|
+
龚施茜 3 nr
|
28
|
+
龚晓犁 2 nr
|
29
|
+
龚普洛 3 nr
|
30
|
+
龚智超 7 nr
|
31
|
+
龚松林 10 nr
|
32
|
+
龚永明 3 nr
|
33
|
+
龚永泉 5 nr
|
34
|
+
龚泽艺 256 nr
|
35
|
+
龚睿 8 nrfg
|
36
|
+
龚祖同 2 nr
|
37
|
+
龚秋婷 3 nr
|
38
|
+
龚老爷 2 nr
|
39
|
+
龚育之 19 nr
|
40
|
+
龚自珍 28 nr
|
41
|
+
龚蓓苾 3 nr
|
42
|
+
龚虹嘉 3 nr
|
43
|
+
龚诗嘉 3 nr
|
44
|
+
龛 223 ng
|
45
|
+
龜 2 zg
|
46
|
+
龟 903 ns
|
47
|
+
龟儿子 123 n
|
48
|
+
龟兆 3 nz
|
49
|
+
龟兹 215 ns
|
50
|
+
龟兹王 3 nrt
|
51
|
+
龟冷搘床 3 v
|
52
|
+
龟冷支床 3 n
|
53
|
+
龟卜 3 n
|
54
|
+
龟厌不告 3 l
|
55
|
+
龟壳 33 n
|
56
|
+
龟壳花 3 n
|
57
|
+
龟头 34 n
|
58
|
+
龟头炎 3 n
|
59
|
+
龟山 23 ns
|
60
|
+
龟山乡 3 ns
|
61
|
+
龟山岛 3 ns
|
62
|
+
龟年鹤寿 3 ns
|
63
|
+
龟年鹤算 3 l
|
64
|
+
龟文 3 nz
|
65
|
+
龟文写迹 3 n
|
66
|
+
龟文鸟迹 3 n
|
67
|
+
龟板 10 n
|
68
|
+
龟毛免角 3 n
|
69
|
+
龟毛兔角 3 n
|
70
|
+
龟溪 3 ns
|
71
|
+
龟玉 3 nz
|
72
|
+
龟王 3 nz
|
73
|
+
龟甲 92 ns
|
74
|
+
龟甲胶 3 nz
|
75
|
+
龟筮 3 n
|
76
|
+
龟纹 3 n
|
77
|
+
龟缩 29 v
|
78
|
+
龟肉 3 n
|
79
|
+
龟背 21 n
|
80
|
+
龟背竹 3 n
|
81
|
+
龟苓膏 3 n
|
82
|
+
龟苗 3 n
|
83
|
+
龟裂 34 v
|
84
|
+
龟足 5 v
|
85
|
+
龟鉴 2 n
|
86
|
+
龟镜 3 nz
|
87
|
+
龟鳖 3 n
|
88
|
+
龟鹤遐寿 3 l
|
89
|
+
龟龄鹤算 3 n
|
90
|
+
龟龙片甲 3 nz
|
91
|
+
龟龙麟凤 3 ns
|
92
|
+
龠 5 g
|
93
|
+
龢 732 zg
|
@@ -0,0 +1,67 @@
|
|
1
|
+
AT&T 3 nz
|
2
|
+
B超 3 n
|
3
|
+
c# 3 nz
|
4
|
+
C# 3 nz
|
5
|
+
c++ 3 nz
|
6
|
+
C++ 3 nz
|
7
|
+
T恤 4 n
|
8
|
+
一 217830 m
|
9
|
+
一一 1670 m
|
10
|
+
一一二 11 m
|
11
|
+
一一例 3 m
|
12
|
+
一一分 8 m
|
13
|
+
一一列举 34 i
|
14
|
+
一一对 9 m
|
15
|
+
一一对应 43 l
|
16
|
+
一一记 2 m
|
17
|
+
一一道来 4 l
|
18
|
+
一丁 18 d
|
19
|
+
一丁不识 3 i
|
20
|
+
一丁点 3 m
|
21
|
+
一丁点儿 24 m
|
22
|
+
一七 22 m
|
23
|
+
一七八不 3 l
|
24
|
+
一万 442 m
|
25
|
+
一万一千 4 m
|
26
|
+
一万一千五百二十颗 2 m
|
27
|
+
一万一千八百八十斤 2 m
|
28
|
+
一万一千多间 2 m
|
29
|
+
一万一千零九十五册 4 m
|
30
|
+
一万七千 5 m
|
31
|
+
一万七千余 2 m
|
32
|
+
一万七千多 2 m
|
33
|
+
一万七千多户 2 m
|
34
|
+
一万万 4 m
|
35
|
+
一万万两 4 m
|
36
|
+
一万三千 8 m
|
37
|
+
一万三千五百一十七 2 m
|
38
|
+
一万三千五百斤 4 m
|
39
|
+
一万三千余种 2 m
|
40
|
+
一万三千块 2 m
|
41
|
+
一万两 124 m
|
42
|
+
一万两万 4 m
|
43
|
+
一万两千 3 m
|
44
|
+
一万个 62 m
|
45
|
+
一万九千 2 m
|
46
|
+
一万九千余 2 m
|
47
|
+
一万二 10 m
|
48
|
+
一万二千 7 m
|
49
|
+
一万二千两 2 m
|
50
|
+
一万二千五百 4 m
|
51
|
+
一万二千五百一十二 2 m
|
52
|
+
一万二千五百余 2 m
|
53
|
+
一万二千五百余吨 2 m
|
54
|
+
一万二千亩 2 m
|
55
|
+
一万二千余 2 m
|
56
|
+
一万二千六百八十二箱 2 m
|
57
|
+
一万二千名 3 m
|
58
|
+
一万二千里 3 m
|
59
|
+
一万五 6 m
|
60
|
+
一万五千 45 m
|
61
|
+
一万五千一百四十四卷 2 m
|
62
|
+
一万五千两 4 m
|
63
|
+
一万五千个 2 m
|
64
|
+
一万五千二百余 2 m
|
65
|
+
一万五千余 9 m
|
66
|
+
一万五千元 3 m
|
67
|
+
一万五千名 4 m
|
@@ -0,0 +1,64 @@
|
|
1
|
+
一万七千 5 m
|
2
|
+
一万七千余 2 m
|
3
|
+
一万七千多 2 m
|
4
|
+
一万七千多户 2 m
|
5
|
+
一万万 4 m
|
6
|
+
一万万两 4 m
|
7
|
+
一万三千 8 m
|
8
|
+
一万三千五百一十七 2 m
|
9
|
+
一万三千五百斤 4 m
|
10
|
+
一万三千余种 2 m
|
11
|
+
一万三千块 2 m
|
12
|
+
一万两 124 m
|
13
|
+
一万两万 4 m
|
14
|
+
一万两千 3 m
|
15
|
+
一万个 62 m
|
16
|
+
一万九千 2 m
|
17
|
+
一万九千余 2 m
|
18
|
+
一万二 10 m
|
19
|
+
一万二千 7 m
|
20
|
+
一万二千两 2 m
|
21
|
+
一万二千五百 4 m
|
22
|
+
一万二千五百一十二 2 m
|
23
|
+
一万二千五百余 2 m
|
24
|
+
一万二千五百余吨 2 m
|
25
|
+
一万二千亩 2 m
|
26
|
+
一万二千余 2 m
|
27
|
+
一万二千六百八十二箱 2 m
|
28
|
+
一万二千名 3 m
|
29
|
+
一万二千里 3 m
|
30
|
+
一万五 6 m
|
31
|
+
一万五千 45 m
|
32
|
+
一万五千一百四十四卷 2 m
|
33
|
+
一万五千两 4 m
|
34
|
+
一万五千个 2 m
|
35
|
+
一万五千二百余 2 m
|
36
|
+
一万五千余 9 m
|
37
|
+
一万五千元 3 m
|
38
|
+
一万五千名 4 m
|
39
|
+
一万五千多 2 m
|
40
|
+
一万五千家 2 m
|
41
|
+
一万亿 3 m
|
42
|
+
一万亿美元 5 m
|
43
|
+
一万余 41 m
|
44
|
+
一万余吨 2 m
|
45
|
+
一万余顷 2 m
|
46
|
+
一万倍 14 m
|
47
|
+
一万元 61 m
|
48
|
+
一万八 5 m
|
49
|
+
一万八千 7 m
|
50
|
+
一万八千余 8 m
|
51
|
+
一万八千多元 2 m
|
52
|
+
一万公里 2 m
|
53
|
+
一万六千 5 m
|
54
|
+
一万六千三百户 2 m
|
55
|
+
一万六千余户 2 m
|
56
|
+
一万六千多 3 m
|
57
|
+
一万册 2 m
|
58
|
+
一万刀 7 m
|
59
|
+
一万匹 4 m
|
60
|
+
一万卷 2 m
|
61
|
+
一万双 6 m
|
62
|
+
一万发 2 m
|
63
|
+
一万句 11 m
|
64
|
+
一万只 9 m
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
if (MSVC)
|
3
|
+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
|
4
|
+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
5
|
+
endif()
|
6
|
+
|
7
|
+
include(FetchContent)
|
8
|
+
|
9
|
+
FetchContent_Declare(
|
10
|
+
googletest
|
11
|
+
GIT_REPOSITORY https://github.com/google/googletest.git
|
12
|
+
GIT_TAG release-1.11.0
|
13
|
+
)
|
14
|
+
FetchContent_MakeAvailable(googletest)
|
15
|
+
|
16
|
+
ADD_EXECUTABLE(test.run
|
17
|
+
gtest_main.cpp
|
18
|
+
TLogging.cpp
|
19
|
+
TArgvContext.cpp
|
20
|
+
TConfig.cpp
|
21
|
+
TStringUtil.cpp
|
22
|
+
TStdExtension.cpp
|
23
|
+
TLocalVector.cpp
|
24
|
+
TClosure.cpp
|
25
|
+
TColorPrint.cpp
|
26
|
+
)
|
27
|
+
TARGET_LINK_LIBRARIES(test.run gtest)
|
28
|
+
|
29
|
+
#include(GoogleTest)
|
30
|
+
#gtest_discover_tests(test.run)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#include "limonp/ArgvContext.hpp"
|
2
|
+
#include "gtest/gtest.h"
|
3
|
+
|
4
|
+
using namespace limonp;
|
5
|
+
|
6
|
+
TEST(ArgvContextTest, Test1) {
|
7
|
+
const char * argv[] = {"./exe1", "--hehe", "11", "key2", "-k", "val"};
|
8
|
+
string s;
|
9
|
+
ArgvContext arg(sizeof(argv)/sizeof(argv[0]), argv);
|
10
|
+
s<<arg;
|
11
|
+
ASSERT_EQ(s, "[\"./exe1\", \"key2\"]{--hehe:11, -k:val}{}");
|
12
|
+
ASSERT_EQ("key2", arg[1]);
|
13
|
+
ASSERT_EQ("11", arg["--hehe"]);
|
14
|
+
ASSERT_FALSE(arg.HasKey("-help"));
|
15
|
+
}
|
16
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#include "limonp/CastFloat.hpp"
|
2
|
+
#include "gtest/gtest.h"
|
3
|
+
#include <cmath>
|
4
|
+
|
5
|
+
using namespace std;
|
6
|
+
using namespace limonp;
|
7
|
+
using namespace CastFloat;
|
8
|
+
|
9
|
+
TEST(CastFunctTest, Test1) {
|
10
|
+
ASSERT_LT(abs(shortBitsToFloat(127) - 3.43025e-05), 0.0001);
|
11
|
+
ASSERT_LT(abs(-122880 - shortBitsToFloat(-128)), 0.0001);
|
12
|
+
ASSERT_EQ(shortBitsToFloat(0), 0);
|
13
|
+
//for(short i = -128 ; i <= 127; i++)
|
14
|
+
//{
|
15
|
+
// float f = shortBitsToFloat(i);
|
16
|
+
// cout<<i<<" "<<f<<endl;
|
17
|
+
//}
|
18
|
+
}
|
19
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#include "gtest/gtest.h"
|
2
|
+
#include "limonp/Closure.hpp"
|
3
|
+
|
4
|
+
using namespace limonp;
|
5
|
+
|
6
|
+
void Foo0() {
|
7
|
+
}
|
8
|
+
|
9
|
+
void Foo1(int x) {
|
10
|
+
}
|
11
|
+
|
12
|
+
void Foo2(int x, float y) {
|
13
|
+
}
|
14
|
+
|
15
|
+
void Foo3(int x, float y, double z) {
|
16
|
+
}
|
17
|
+
|
18
|
+
class Obj {
|
19
|
+
public:
|
20
|
+
void Foo0() {
|
21
|
+
}
|
22
|
+
void Foo1(int x) {
|
23
|
+
}
|
24
|
+
void Foo2(int x, float y) {
|
25
|
+
}
|
26
|
+
void Foo3(int x, float y, double z) {
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
TEST(Closure, Test0) {
|
31
|
+
ClosureInterface* c;
|
32
|
+
|
33
|
+
c = NewClosure(&Foo0);
|
34
|
+
ASSERT_TRUE(c != NULL);
|
35
|
+
c->Run();
|
36
|
+
delete c;
|
37
|
+
c = NULL;
|
38
|
+
|
39
|
+
c = NewClosure(&Foo1, 1);
|
40
|
+
ASSERT_TRUE(c != NULL);
|
41
|
+
c->Run();
|
42
|
+
delete c;
|
43
|
+
c = NULL;
|
44
|
+
|
45
|
+
c = NewClosure(&Foo2, 1, float(2));
|
46
|
+
ASSERT_TRUE(c != NULL);
|
47
|
+
c->Run();
|
48
|
+
delete c;
|
49
|
+
c = NULL;
|
50
|
+
|
51
|
+
c = NewClosure(&Foo3, 1, float(2), double(3));
|
52
|
+
ASSERT_TRUE(c != NULL);
|
53
|
+
c->Run();
|
54
|
+
delete c;
|
55
|
+
c = NULL;
|
56
|
+
}
|
57
|
+
|
58
|
+
TEST(Closure, Test1) {
|
59
|
+
ClosureInterface* c;
|
60
|
+
|
61
|
+
Obj obj;
|
62
|
+
c = NewClosure(&obj, &Obj::Foo0);
|
63
|
+
ASSERT_TRUE(c != NULL);
|
64
|
+
c->Run();
|
65
|
+
delete c;
|
66
|
+
c = NULL;
|
67
|
+
|
68
|
+
c = NewClosure(&obj, &Obj::Foo1, 1);
|
69
|
+
ASSERT_TRUE(c != NULL);
|
70
|
+
c->Run();
|
71
|
+
delete c;
|
72
|
+
c = NULL;
|
73
|
+
|
74
|
+
c = NewClosure(&obj, &Obj::Foo2, 1, float(2));
|
75
|
+
ASSERT_TRUE(c != NULL);
|
76
|
+
c->Run();
|
77
|
+
delete c;
|
78
|
+
c = NULL;
|
79
|
+
|
80
|
+
c = NewClosure(&obj, &Obj::Foo3, 1, float(2), double(3));
|
81
|
+
ASSERT_TRUE(c != NULL);
|
82
|
+
c->Run();
|
83
|
+
delete c;
|
84
|
+
c = NULL;
|
85
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#include "gtest/gtest.h"
|
2
|
+
#include "limonp/Colors.hpp"
|
3
|
+
#include "limonp/Logging.hpp"
|
4
|
+
|
5
|
+
using namespace limonp;
|
6
|
+
|
7
|
+
TEST(ColorPrint, Test1) {
|
8
|
+
ColorPrintln(RED, "hello %s", "world");
|
9
|
+
ColorPrintln(RED, "hello %s", "world");
|
10
|
+
XLOG(INFO) << "hello world";
|
11
|
+
ColorPrintln(RED, "hello %s", "world");
|
12
|
+
ColorPrintln(GREEN, "hello %s", "world");
|
13
|
+
XLOG(INFO) << "hello world";
|
14
|
+
ColorPrintln(BLACK, "hello %s", "world");
|
15
|
+
ColorPrintln(YELLOW, "hello %s", "world");
|
16
|
+
ColorPrintln(BLUE, "hello %s", "world");
|
17
|
+
ColorPrintln(PURPLE, "hello %s", "world");
|
18
|
+
ColorPrintln(PURPLE, "hello %s", "world", " and colors");
|
19
|
+
}
|
20
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#include "limonp/Config.hpp"
|
2
|
+
#include "gtest/gtest.h"
|
3
|
+
|
4
|
+
using namespace limonp;
|
5
|
+
TEST(COnfigTest, Test1) {
|
6
|
+
Config conf("../test/testdata/1.conf");
|
7
|
+
string res;
|
8
|
+
ASSERT_EQ("{key1:val1, key2:val2}", res << conf);
|
9
|
+
res = conf.Get("key1", "");
|
10
|
+
ASSERT_EQ("val1", res);
|
11
|
+
res = conf.Get("key2", "");
|
12
|
+
ASSERT_EQ("val2", res);
|
13
|
+
const char * str = conf["key3"];
|
14
|
+
ASSERT_FALSE(str);
|
15
|
+
ASSERT_TRUE(0 == strcmp(conf["key2"], "val2"));
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#include "limonp/LocalVector.hpp"
|
2
|
+
#include "limonp/StdExtension.hpp"
|
3
|
+
#include <fstream>
|
4
|
+
#include "gtest/gtest.h"
|
5
|
+
|
6
|
+
using namespace limonp;
|
7
|
+
|
8
|
+
TEST(LocalVector, test1) {
|
9
|
+
LocalVector<size_t> vec;
|
10
|
+
ASSERT_EQ(vec.size(), 0u);
|
11
|
+
ASSERT_EQ(vec.capacity(), LOCAL_VECTOR_BUFFER_SIZE);
|
12
|
+
ASSERT_TRUE(vec.empty());
|
13
|
+
size_t size = 129;
|
14
|
+
for(size_t i = 0; i < size; i++) {
|
15
|
+
vec.push_back(i);
|
16
|
+
}
|
17
|
+
ASSERT_EQ(vec.size(), size);
|
18
|
+
ASSERT_EQ(vec.capacity(), 256u);
|
19
|
+
ASSERT_FALSE(vec.empty());
|
20
|
+
LocalVector<size_t> vec2(vec);
|
21
|
+
ASSERT_EQ(vec2.capacity(), vec.capacity());
|
22
|
+
ASSERT_EQ(vec2.size(), vec.size());
|
23
|
+
}
|
24
|
+
|
25
|
+
TEST(LocalVector, test2) {
|
26
|
+
LocalVector<size_t> vec;
|
27
|
+
ASSERT_EQ(vec.size(), 0u);
|
28
|
+
ASSERT_EQ(vec.capacity(), LOCAL_VECTOR_BUFFER_SIZE);
|
29
|
+
ASSERT_TRUE(vec.empty());
|
30
|
+
size_t size = 1;
|
31
|
+
for(size_t i = 0; i < size; i++) {
|
32
|
+
vec.push_back(i);
|
33
|
+
}
|
34
|
+
ASSERT_EQ(vec.size(), size);
|
35
|
+
ASSERT_EQ(vec.capacity(), LOCAL_VECTOR_BUFFER_SIZE);
|
36
|
+
ASSERT_FALSE(vec.empty());
|
37
|
+
LocalVector<size_t> vec2;
|
38
|
+
vec2 = vec;
|
39
|
+
ASSERT_EQ(vec2.capacity(), vec.capacity());
|
40
|
+
ASSERT_EQ(vec2.size(), vec.size());
|
41
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#define LOGGING_LEVEL LL_WARNING
|
2
|
+
#include "limonp/Logging.hpp"
|
3
|
+
#include "gtest/gtest.h"
|
4
|
+
|
5
|
+
TEST(Logging, Test1) {
|
6
|
+
XLOG(DEBUG) << "xxx" << " yyy";
|
7
|
+
XLOG(INFO) << "hello";
|
8
|
+
XLOG(WARNING) << "hello";
|
9
|
+
XLOG(ERROR) << "hello";
|
10
|
+
//XCHECK(false) << "hello, " << "world";
|
11
|
+
//XLOG(FATAL) << "hello";
|
12
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#include "limonp/StdExtension.hpp"
|
2
|
+
#include "limonp/StringUtil.hpp"
|
3
|
+
#include "gtest/gtest.h"
|
4
|
+
#include <iostream>
|
5
|
+
#include <deque>
|
6
|
+
|
7
|
+
using namespace limonp;
|
8
|
+
TEST(StdOutbound, Test1) {
|
9
|
+
ifstream ifs("../test/testdata/StdExtension.data");
|
10
|
+
string s;
|
11
|
+
s << ifs;
|
12
|
+
ASSERT_EQ("key1 = val1\n##this is comment\nkey2=val2\n", s);
|
13
|
+
|
14
|
+
const char * outFileName = "stdoutbuond.test.tmp";
|
15
|
+
ofstream ofs(outFileName);
|
16
|
+
s = outFileName;
|
17
|
+
ofs << s;
|
18
|
+
ASSERT_TRUE(!!ofs);
|
19
|
+
ofs.close();
|
20
|
+
|
21
|
+
ifstream ifs2(outFileName);
|
22
|
+
s << ifs2;
|
23
|
+
ASSERT_EQ(outFileName, s);
|
24
|
+
}
|
25
|
+
|
26
|
+
TEST(StdOutbound, Funct_IsIn) {
|
27
|
+
map<int, int> mp;
|
28
|
+
for(size_t i = 1; i < 5; i ++) {
|
29
|
+
mp[i] = i+1;
|
30
|
+
}
|
31
|
+
|
32
|
+
ASSERT_TRUE(IsIn(mp, 1));
|
33
|
+
ASSERT_FALSE(IsIn(mp, 0));
|
34
|
+
}
|
35
|
+
|
36
|
+
TEST(StdOutbound, Test2) {
|
37
|
+
map<int, int> mp1;
|
38
|
+
mp1[1] = 2;
|
39
|
+
mp1[2] = 3;
|
40
|
+
string s;
|
41
|
+
ASSERT_EQ(s << mp1, "{1:2, 2:3}");
|
42
|
+
unordered_map<int,int> mp2;
|
43
|
+
mp2[1] = 2;
|
44
|
+
mp2[2] = 3;
|
45
|
+
s << mp2;
|
46
|
+
ASSERT_TRUE( s == "{1:2, 2:3}" || s == "{2:3, 1:2}");
|
47
|
+
}
|
48
|
+
|
49
|
+
TEST(StdOutbound, Test3) {
|
50
|
+
{
|
51
|
+
vector<string> v;
|
52
|
+
v.push_back("1");
|
53
|
+
v.push_back("2");
|
54
|
+
string s;
|
55
|
+
ASSERT_EQ(s << v, "[\"1\", \"2\"]");
|
56
|
+
}
|
57
|
+
{
|
58
|
+
deque<string> v;
|
59
|
+
v.push_back("1");
|
60
|
+
v.push_back("2");
|
61
|
+
string s;
|
62
|
+
ASSERT_EQ(s << v, "[\"1\", \"2\"]");
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
struct TestWord {
|
67
|
+
string word;
|
68
|
+
size_t offset;
|
69
|
+
}; // struct TestWord
|
70
|
+
|
71
|
+
ostream& operator << (ostream& os, const TestWord& w) {
|
72
|
+
return os << "{\"word\": \"" << w.word << "\", \"offset\": " << w.offset << "}";
|
73
|
+
}
|
74
|
+
|
75
|
+
TEST(StdOutbound, TestWord) {
|
76
|
+
{
|
77
|
+
vector<string> v;
|
78
|
+
v.push_back("1");
|
79
|
+
v.push_back("2");
|
80
|
+
string s;
|
81
|
+
ASSERT_EQ(s << v, "[\"1\", \"2\"]");
|
82
|
+
}
|
83
|
+
{
|
84
|
+
vector<TestWord> v;
|
85
|
+
TestWord w;
|
86
|
+
w.word = "hello";
|
87
|
+
w.offset = 0;
|
88
|
+
v.push_back(w);
|
89
|
+
w.word = "world";
|
90
|
+
w.offset = 5;
|
91
|
+
v.push_back(w);
|
92
|
+
string s;
|
93
|
+
ASSERT_EQ(s << v, "[{\"word\": \"hello\", \"offset\": 0}, {\"word\": \"world\", \"offset\": 5}]");
|
94
|
+
}
|
95
|
+
}
|