Skip to content

[feat] add Hill and Playfair cipher unit tests - #18

Merged
h1s97x merged 2 commits into
mainfrom
feature/add-more-tests-v2
May 17, 2026
Merged

[feat] add Hill and Playfair cipher unit tests#18
h1s97x merged 2 commits into
mainfrom
feature/add-more-tests-v2

Conversation

@h1s97x

Copy link
Copy Markdown
Owner

变更内容

新增测试文件

tests/unit/test_hill.py (14 测试用例)

测试类内容
TestHillEncrypt加密功能测试
TestHillDecrypt解密功能测试
TestHillMatrixOperations矩阵运算(行列式、模、逆)
TestHillValidation密钥验证和错误处理

tests/unit/test_playfair.py (14 测试用例)

测试类内容
TestPlayfairMatrixGeneration密钥矩阵生成
TestPlayfairLetterPositioning字母定位和 J/I 处理
TestPlayfairDifferentRowColumn不同行加密规则

说明

  • ElGamal 和 Enigma 测试因素数生成速度问题暂时跳过

验证结果

  • pytest: 291 passed (新增 28 个测试)

Add tests/unit/test_hill.py (14 test cases):
- Hill cipher encryption/decryption
- Matrix operations (determinant, matrix_mod, inverse)
- Key validation and error handling
Add tests/unit/test_playfair.py (14 test cases):
- Matrix generation from key
- Letter positioning and J/I handling
- Different row/column encryption rules
Note: ElGamal and Enigma tests skipped due to slow prime generation
@h1s97xh1s97x self-assigned this May 16, 2026
@h1s97x
h1s97x merged commit f23ad34 into mainMay 17, 2026
3 checks passed
@h1s97x
h1s97x deleted the feature/add-more-tests-v2 branch May 17, 2026 02:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@h1s97x