aaronhktan / jyut-dict

A free, open-source, offline Cantonese Dictionary for Windows, Mac, and Linux. Qt, SQLite. C++ and Python.
https://jyutdictionary.com
MIT License
126 stars 8 forks source link

#160: Write unit tests for ScriptDetector #165

Closed aaronhktan closed 8 months ago

aaronhktan commented 8 months ago

Description

This commit adds unit tests for the ScriptDetector class, and also adds code to ChineseUtils to check for invalid tones in Jyutping/Pinyin.

Part of a series of commits for #160.

Type of change

How Has This Been Tested?

Tested on all three platforms.

********* Start testing of TestScriptDetector *********
Config: Using QtTest library 5.15.12, Qt 5.15.12 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 12.3.0), pop 22.04
PASS   : TestScriptDetector::initTestCase()
PASS   : TestScriptDetector::simplifiedChinese()
PASS   : TestScriptDetector::noSimplifiedChinese()
PASS   : TestScriptDetector::traditionalChinese()
PASS   : TestScriptDetector::noTraditionalChinese()
PASS   : TestScriptDetector::chinese()
PASS   : TestScriptDetector::noChinese()
PASS   : TestScriptDetector::validJyutping()
PASS   : TestScriptDetector::noValidJyutping()
PASS   : TestScriptDetector::validPinyin()
PASS   : TestScriptDetector::noValidPinyin()
PASS   : TestScriptDetector::cleanupTestCase()
Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 11ms
********* Finished testing of TestScriptDetector *********

Checklist: