Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#160: Add unit tests for ChineseUtils #163

Merged
merged 9 commits into from
Mar 8, 2024

Conversation

aaronhktan
Copy link
Owner

Description

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

  • Jyutping to Yale conversion
  • Jyutping to IPA conversion
  • Pinyin to Zhuyin conversion
  • Pinyin to IPA conversion
  • Pinyin to Pretty Pinyin and Pinyin with V conversion
  • Jyutping segmentation
  • Pinyin segmentation
  • Tone colour application logic
  • Character comparison logic

One diff among many for #160.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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:

  • My code follows the style guidelines of this project (black for Python
    code, .clang-format in the src/jyut-dict directory for C++)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have translated my user-facing strings to all currently-supported languages
  • I have made corresponding changes to the documentation

@aaronhktan aaronhktan added the maintenance Code quality, maintainability, tech debt label Mar 7, 2024
@aaronhktan aaronhktan added this to the 2024 Milestone 1 milestone Mar 7, 2024
@aaronhktan aaronhktan self-assigned this Mar 7, 2024
@aaronhktan aaronhktan merged commit 70bd168 into main Mar 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Code quality, maintainability, tech debt
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant