[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim f5300086fd 02/41: * tests/pyim-tests.el (pyim-test
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim f5300086fd 02/41: * tests/pyim-tests.el (pyim-tests-pyim-candidates-get-chief): New test. |
Date: |
Sat, 4 Jun 2022 09:57:45 -0400 (EDT) |
branch: externals/pyim
commit f5300086fd531faa8e958f3218753177c71c3c73
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* tests/pyim-tests.el (pyim-tests-pyim-candidates-get-chief): New test.
---
tests/pyim-tests.el | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index d80cd76078..9e30562272 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -450,6 +450,41 @@
'("cangjie/aaaa")))))
;; ** pyim-candidates 相关单元测试
+(ert-deftest pyim-tests-pyim-candidates-get-chief ()
+ (let ((wubi (pyim-scheme-get 'wubi))
+ (personal-words1 '("呵呵" "天" "恭恭敬敬"))
+ (personal-words2 '("呵呵" "恭恭敬敬"))
+ (common-words1 '("工" "恭恭敬敬"))
+ (common-words2 '("恭恭敬敬" "工")))
+
+ ;; 形码输入法选择第一位词条的规则是:
+ ;; 1. 如果从公共词库里面获取到的第一个词条是汉字,就选择它。
+ ;; 2. 如果不是,就从个人词库里面按排列的先后顺序,获取一个汉字。
+ (should (equal (pyim-candidates-get-chief wubi personal-words1
common-words1)
+ "工"))
+ (should (equal (pyim-candidates-get-chief wubi personal-words1
common-words2)
+ "天"))
+ (should-not (pyim-candidates-get-chief wubi personal-words2
common-words2)))
+
+ (let ((quanpin (pyim-scheme-get 'quanpin))
+ (pyim-dhashcache-iword2count-recent-10-words
+ (read "#s(hash-table size 65 test equal rehash-size 1.5
rehash-threshold 0.8125 data (:all-words (\"就\" \"不是\" \"如果\" \"是\" \"规则\"
\"的\" \"词条\" \"第一位\" \"选择\" \"输入法\") \"如果\" 1 \"的\" 1 \"就\" 1 \"输入法\" 2 \"词条\"
1 \"不是\" 1 \"选择\" 1 \"第一位\" 1 \"规则\" 1 \"是\" 1))"))
+ (pyim-dhashcache-iword2count-recent-50-words
+ (read "#s(hash-table size 65 test equal rehash-size 1.5
rehash-threshold 0.8125 data (:all-words (\"就\" \"不是\" \"如果\" \"是\" \"规则\"
\"的\" \"词条\" \"第一位\" \"选择\" \"输入法\" \"形码\" \"天\" \"网\" \"呵呵\" \"工\" \"你\"
\"天空\" \"蓝天\" \"大地\" \"不好\" \"我\" \"你好\") \"你好\" 1 \"你\" 3 \"我\" 1 \"不好\" 1
\"天空\" 2 \"天\" 3 \"大地\" 1 \"蓝天\" 4 \"工\" 2 \"呵呵\" 1 \"网\" 1 \"形码\" 1 \"输入法\" 1
\"选择\" 1 \"第一位\" 1 \"词条\" 1 \"的\" 1 \"规则\" 1 \"是\" 1 \"如果\" 1 \"不是\" 1 \"就\"
1))"))
+ (personal-words1 '("输入罚" "输入法"))
+ (personal-words2 '("蓝田" "蓝天"))
+ (personal-words3 '("美丽" "魅力")))
+
+ ;; 1. 最近输入的10个不同的词中出现一次以上。
+ (should (equal (pyim-candidates-get-chief quanpin personal-words1 nil)
+ "输入法"))
+ ;; 2. 最近输入的50个不同的词中出现过三次以上。
+ (should (equal (pyim-candidates-get-chief quanpin personal-words2 nil)
+ "蓝天"))
+ ;; 3. 个人词条中的第一个词。
+ (should (equal (pyim-candidates-get-chief quanpin personal-words3 nil)
+ "美丽"))))
+
(ert-deftest pyim-tests-pyim-candidates-search-buffer ()
(with-temp-buffer
(insert "你好你好你坏你坏你话牛蛤牛和牛蛤牛蛤牛蛤牛蛤牛蛤")
- [elpa] externals/pyim 665867fc0a 31/41: Set pyim-process-autoselector default value is nil., (continued)
- [elpa] externals/pyim 665867fc0a 31/41: Set pyim-process-autoselector default value is nil., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 424e488118 36/41: Add preview test, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 845e9f6e4f 23/41: * pyim-candidates.el (pyim-candidates-create-async): Simplify shuangpin., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 5611319de0 35/41: Add page test, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim aa07a23fda 39/41: * pyim-probe.el (pyim-probe-org-latex-mode): Update., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 573fefe532 38/41: Use (eql symbol) instead of (eql 'symbol)., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 2f1aaaa9a7 41/41: Merge pull request #442 from tumashu/struct, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim c5a77c3f73 05/41: Add pyim-candidate-create-async, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 0d357b5fd9 08/41: pyim-candidates-create-like-znabc, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 6ce5f49b8f 01/41: Big refactor: use cl-defstruct and cl-defgeneric., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim f5300086fd 02/41: * tests/pyim-tests.el (pyim-tests-pyim-candidates-get-chief): New test.,
ELPA Syncer <=
- [elpa] externals/pyim f536e5ede3 06/41: Fix warns., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 33a0f5a9b7 09/41: Add pyim-candidates-create-like-jianpin, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim b6b46a4e36 22/41: * pyim-candidates.el (pyim-candidates-create): Remove method of shuangpin., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim b3868caa80 29/41: Add pyim-probe tests, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 951013539c 33/41: Add progress to commentary, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim f4cc14ac64 32/41: Fix pyim-test.el, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 1b767c669e 40/41: * pyim-probe.el (pyim-probe-org-speed-commands): Updated., ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 6ef8630475 11/41: pyim-candidates-create-like-znabc -> pyim-candidates-znabc-words, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 2aa48479b4 14/41: pyim-candidates-create-get-pymap-chars -> pyim-candidates-pymap-chars, ELPA Syncer, 2022/06/04
- [elpa] externals/pyim 016064e7fc 16/41: Update docstring., ELPA Syncer, 2022/06/04