Module:User:Justinrleung/testcases

local p = require('Module:UnitTests') local m = require('Module:User:Justinrleung')

function p:py_tongyong(text, expected) self:equals(text, m.py_tongyong(text), expected) end

function p:test_py_tongyong(text, expected) self:py_tongyong("tōngyòng pīnyīn", "tongyòng pinyin") self:py_tongyong("xiǎo", "siǎo") self:py_tongyong("māma", "mamå") self:py_tongyong("xióngmāo", "syóngmao") self:py_tongyong("zhǎngguǎn", "jhǎngguǎn") self:py_tongyong("qú", "cyú") self:py_tongyong("lǔ", "lǔ") self:py_tongyong("lǚ", "lyǔ") self:py_tongyong("fēnglàng", "fonglàng") self:py_tongyong("Qīnghǎi", "Cinghǎi") self:py_tongyong("Fújiàn", "Fújiàn") self:py_tongyong("Guǎngdōng", "Guǎngdong") self:py_tongyong("Héběi", "Héběi") self:py_tongyong("Húnán", "Húnán") self:py_tongyong("Zhèjiāng", "Jhèjiang") self:py_tongyong("Nèiménggǔ", "Nèiménggǔ") self:py_tongyong("Shǎnxī", "Shǎnsi") self:py_tongyong("Xīnjiāng", "Sinjiang") self:py_tongyong("Xīzàng", "Sizàng") self:py_tongyong("Sìchuān", "Sìhchuan") end

function p:link(text, expected) self:equals(text, m.link(text), expected) end

function p:test_link self:link('text', '') end

function p:pfs_to_hrs(text, expected) self:equals(text, m.pfs_to_hrs(text), expected) end

function p:test_pfs_to_hrs self:pfs_to_hrs('pfs=kîm-ngit', 'gim´ ngid`') self:pfs_to_hrs('pfs=Kîm-ngit', 'gim´ ngid`') self:pfs_to_hrs('pfs=Mâ-lòi-sî-á', 'ma´ loiˇ xi´ a`') self:pfs_to_hrs('pfs=ngòan', 'nguanˇ') self:pfs_to_hrs('pfs=ngài', 'ngaiˇ') self:pfs_to_hrs('pfs=ngì', 'ngiˇ') self:pfs_to_hrs('pfs=phang', 'pang') self:pfs_to_hrs('pfs=pha̍k', 'pag') self:pfs_to_hrs('pfs=sṳ̀n', 'siinˇ') self:pfs_to_hrs('pfs=sṳ̍t', 'siid') self:pfs_to_hrs('pfs=sṳt', 'siid`') self:pfs_to_hrs('pfs=yèn', 'ienˇ') self:pfs_to_hrs('pfs=yit', 'id`') end

function p:poj_check_invalid(text, expected) self:equals(text, m.poj_check_invalid(text), expected) end

function p:test_poj_check_invalid self:poj_check_invalid('khoê', 'khôe') self:poj_check_invalid('khoâ', 'khôa') end

return p