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: Add unit tests for ChineseUtils #163

Closed aaronhktan closed 8 months ago

aaronhktan commented 8 months ago

Description

This commit adds several unit tests for the ChineseUtils namespace, including:

One diff among many for #160.

Type of change

How Has This Been Tested?

Tested on all three platforms. On Mac and Linux, output should look something like the following:

********* Start testing of TestChineseUtils *********
Config: Using QtTest library 5.15.12, Qt 5.15.12 (arm64-little_endian-lp64 shared (dynamic) release build; by Clang 15.0.0 (clang-1500.0.40.1) (Apple)), osx 14.3
PASS   : TestChineseUtils::initTestCase()
PASS   : TestChineseUtils::applyColoursJyutping()
PASS   : TestChineseUtils::applyColoursPinyin()
PASS   : TestChineseUtils::compareStringsSimple()
PASS   : TestChineseUtils::compareStringsSingleMultibyteGrapheme()
PASS   : TestChineseUtils::compareStringsMultipleMultibyteGraphemes()
PASS   : TestChineseUtils::compareStringsMultibyteGraphemesWithAlpha()
PASS   : TestChineseUtils::compareStringsCompatibilityVariantNormalization()
PASS   : TestChineseUtils::jyutpingToYaleSimple()
PASS   : TestChineseUtils::jyutpingToYaleRejectNoTone()
PASS   : TestChineseUtils::jyutpingToYaleRejectSingleLetter()
PASS   : TestChineseUtils::jyutpingToYaleRejectSpecialCharacter()
PASS   : TestChineseUtils::jyutpingToYaleNoSpaces()
PASS   : TestChineseUtils::jyutpingToYaleSpacesToSegment()
PASS   : TestChineseUtils::jyutpingToYaleSpecialFinal()
PASS   : TestChineseUtils::jyutpingToYaleLightTone()
PASS   : TestChineseUtils::jyutpingToYaleSpecialSyllable()
PASS   : TestChineseUtils::jyutpingToYaleTones()
PASS   : TestChineseUtils::jyutpingToYaleNoTone()
PASS   : TestChineseUtils::jyutpingToIPASimple()
PASS   : TestChineseUtils::jyutpingToIPARejectNoTone()
PASS   : TestChineseUtils::jyutpingToIPARejectSingleLetter()
PASS   : TestChineseUtils::jyutpingToIPARejectSpecialCharacter()
PASS   : TestChineseUtils::jyutpingToIPANoSpaces()
PASS   : TestChineseUtils::jyutpingToIPASpacesToSegment()
PASS   : TestChineseUtils::jyutpingToIPAPreprocessInitial()
PASS   : TestChineseUtils::jyutpingToIPASpecialSyllable()
PASS   : TestChineseUtils::jyutpingToIPACheckedTone()
PASS   : TestChineseUtils::jyutpingToIPASpecialFinal()
PASS   : TestChineseUtils::jyutpingToIPATones()
PASS   : TestChineseUtils::jyutpingToIPANoTone()
PASS   : TestChineseUtils::prettyPinyinSimple()
PASS   : TestChineseUtils::prettyPinyinRejectNoTone()
PASS   : TestChineseUtils::prettyPinyinRejectSingleLetter()
PASS   : TestChineseUtils::prettyPinyinRejectSpecialCharacter()
PASS   : TestChineseUtils::prettyPinyinSecondaryVowel()
PASS   : TestChineseUtils::prettyPinyinUmlaut()
PASS   : TestChineseUtils::prettyPinyinTones()
PASS   : TestChineseUtils::prettyPinyinNoTone()
PASS   : TestChineseUtils::numberedPinyinSimple()
PASS   : TestChineseUtils::pinyinWithVSimple()
PASS   : TestChineseUtils::pinuyinToZhuyinSimple()
PASS   : TestChineseUtils::pinuyinToZhuyinRejectNoTone()
PASS   : TestChineseUtils::pinuyinToZhuyinRejectSingleLetter()
PASS   : TestChineseUtils::pinuyinToZhuyinRejectSpecialCharacter()
PASS   : TestChineseUtils::pinuyinToZhuyinNoSpaces()
PASS   : TestChineseUtils::pinuyinToZhuyinSpacesToSegment()
PASS   : TestChineseUtils::pinuyinToZhuyinSpecialInitial()
PASS   : TestChineseUtils::pinuyinToZhuyinSpecialFinals()
PASS   : TestChineseUtils::pinuyinToZhuyinErhua()
PASS   : TestChineseUtils::pinuyinToZhuyinMalformed()
PASS   : TestChineseUtils::pinyinToIPASimple()
PASS   : TestChineseUtils::pinyinToIPARejectNoTone()
PASS   : TestChineseUtils::pinyinToIPARejectSingleLetter()
PASS   : TestChineseUtils::pinyinToIPARejectSpecialCharacter()
PASS   : TestChineseUtils::pinyinToIPANoSpaces()
PASS   : TestChineseUtils::pinyinToIPASpacesToSegment()
PASS   : TestChineseUtils::pinyinToIPASpecialCaseNg()
PASS   : TestChineseUtils::pinyinToIPASpecialCaseRi()
PASS   : TestChineseUtils::pinyinToIPASyllableWithV()
PASS   : TestChineseUtils::pinyinToIPAVoicelessInitial()
PASS   : TestChineseUtils::pinyinToIPAToneThree()
PASS   : TestChineseUtils::pinyinToIPAToneFour()
PASS   : TestChineseUtils::pinyinToIPAOtherTone()
PASS   : TestChineseUtils::pinyinToIPAErhua()
PASS   : TestChineseUtils::segmentJyutpingSimple()
PASS   : TestChineseUtils::segmentJyutpingNoDigits()
PASS   : TestChineseUtils::segmentJyutpingNoSpaces()
PASS   : TestChineseUtils::segmentJyutpingNoDigitsNoSpaces()
PASS   : TestChineseUtils::segmentJyutpingNoDigitsApostrophe()
PASS   : TestChineseUtils::segmentJyutpingDigitsApostrophe()
PASS   : TestChineseUtils::segmentJyutpingRemoveSpecialCharacters()
PASS   : TestChineseUtils::segmentJyutpingKeepGlobCharacters()
PASS   : TestChineseUtils::segmentJyutpingKeepGlobCharactersNoWhitespace()
PASS   : TestChineseUtils::segmentJyutpingKeepMultipleGlobCharacters()
PASS   : TestChineseUtils::segmentJyutpingKeepMultipleGlobCharactersWhitespace()
PASS   : TestChineseUtils::segmentJyutpingKeepMultipleGlobCharactersWhitespaceSurround()
PASS   : TestChineseUtils::segmentJyutpingGlobCharactersTrimWhitespace()
PASS   : TestChineseUtils::segmentJyutpingKeepSpecialCharacters()
PASS   : TestChineseUtils::segmentJyutpingRemoveWhitespace()
PASS   : TestChineseUtils::segmentJyutpingLower()
PASS   : TestChineseUtils::segmentJyutpingLowerWithDigits()
PASS   : TestChineseUtils::segmentJyutpingMultipleFinalsVowelsOnly()
PASS   : TestChineseUtils::segmentJyutpingMultipleFinalsConsonantsOnly()
PASS   : TestChineseUtils::segmentJyutpingMultipleFinals()
PASS   : TestChineseUtils::segmentJyutpingGarbage()
PASS   : TestChineseUtils::segmentPinyinSimple()
PASS   : TestChineseUtils::segmentPinyinNoDigits()
PASS   : TestChineseUtils::segmentPinyinNoSpaces()
PASS   : TestChineseUtils::segmentPinyinNoDigitsNoSpaces()
PASS   : TestChineseUtils::segmentPinyinNoDigitsApostrophe()
PASS   : TestChineseUtils::segmentPinyinDigitsApostrophe()
PASS   : TestChineseUtils::segmentPinyinRemoveSpecialCharacters()
PASS   : TestChineseUtils::segmentPinyinKeepGlobCharacters()
PASS   : TestChineseUtils::segmentPinyinKeepGlobCharactersNoWhitespace()
PASS   : TestChineseUtils::segmentPinyinKeepMultipleGlobCharacters()
PASS   : TestChineseUtils::segmentPinyinKeepMultipleGlobCharactersWhitespace()
PASS   : TestChineseUtils::segmentPinyinKeepMultipleGlobCharactersWhitespaceSurround()
PASS   : TestChineseUtils::segmentPinyinGlobCharactersTrimWhitespace()
PASS   : TestChineseUtils::segmentPinyinKeepSpecialCharacters()
PASS   : TestChineseUtils::segmentPinyinRemoveWhitespace()
PASS   : TestChineseUtils::segmentPinyinLower()
PASS   : TestChineseUtils::segmentPinyinLowerWithDigits()
PASS   : TestChineseUtils::segmentPinyinMultipleFinalsVowelsOnly()
PASS   : TestChineseUtils::segmentPinyinMultipleFinals()
PASS   : TestChineseUtils::segmentPinyinGarbage()
PASS   : TestChineseUtils::cleanupTestCase()
Totals: 107 passed, 0 failed, 0 skipped, 0 blacklisted, 13ms
********* Finished testing of TestChineseUtils *********

Checklist: