local tests = require('Module:UnitTests')
local za_conv = require('Module:za-pron')
function tests:check_syllabification(za, za_split)
self:equals(za, za_conv.convert(za, 'IPA'), za_conv.convert(za_split, 'IPA'))
end
function tests:test_syllabification()
self:check_syllabification('Sawndip', 'Saw ndip')
self:check_syllabification('Cunghgoz Yinzminz Yinzhangz cib maenz', 'Cungh goz Yinz minz Yinz hangz cib maenz')
self:check_syllabification('son mwngz hwnj max gvaq dah', 'son mwngz hwnj max gvaq dah')
self:check_syllabification('bak daep bag daeb', 'bak daep bag daeb')
self:check_syllabification('ga ge gi go gu gw', 'ga ge gi go gu gw')
self:check_syllabification('gaen gen gien goen guen gwen', 'gaen gen gien goen guen gwen')
self:check_syllabification('gan gen gin gon gun gwn', 'gan gen gin gon gun gwn')
self:check_syllabification('Aumwnz aumwnz', 'au mwnz au mwnz')
-- test syllable breaking
self:check_syllabification('ndaundeiq', 'ndau ndeiq') -- _.nd
self:check_syllabification('lwgvuengz', 'lwg vuengz') -- g.vu
self:check_syllabification('goengvunz', 'goeng vunz') -- ng.vu
self:check_syllabification('sae\'gva', 'sae gva') -- 'gv
self:check_syllabification('denyingj', 'den yingj') -- n.y
self:check_syllabification('genyi', 'gen yi') -- n.y
self:check_syllabification('riu\'nyaen', 'riu nyaen') -- 'ny
self:check_syllabification('faengeiz', 'faen geiz') -- n.g
self:check_syllabification('ndi\'ngah', 'ndi ngah') -- 'ng
self:check_syllabification('Yindu', 'yin du')
self:check_syllabification('diegyouq', 'dieg youq')
-- http://www.gxmyw.com.cn/wsxzw/2016/0808/1158.html
self:check_syllabification('coit', 'co it')
self:check_syllabification('bangbouj', 'bang bouj')
self:check_syllabification('gyaeundei', 'gyaeu ndei')
self:check_syllabification('haicin', 'hai cin')
self:check_syllabification('dailix', 'dai lix')
self:check_syllabification('codaeuz', 'co daeuz')
self:check_syllabification('saenamz', 'sae namz')
self:check_syllabification('sim\'in', 'sim in')
self:check_syllabification('fwn\'oemq', 'fwn oemq')
self:check_syllabification('banhaet', 'ban haet')
self:check_syllabification('daegdaengq', 'daeg daengq')
self:check_syllabification('goien', 'go ien')
self:check_syllabification('cingya', 'cin gya')
self:check_syllabification('ngaenzhangz', 'ngaenz hangz')
self:check_syllabification('cungqgyang', 'cungq gyang')
self:check_syllabification('nditndat', 'ndit ndat')
self:check_syllabification('ndiepgyaez', 'ndiep gyaez')
self:check_syllabification('ndikhanh', 'ndik hanh')
end
function tests:check_ipa(za, ipa)
self:equals(za, za_conv.convert(za, 'IPA'), '/' .. ipa .. '/')
end
function tests:test_ipa()
self:check_ipa('son mwngz hwnj max gvaq dah', 'θoːn˨˦ mɯŋ˧˩ hɯn˥ ma˦˨ kʷa˧˥ ta˧')
end
function tests:check_old(za, old)
self:equals(za, za_conv.convert(za, 'old'), old)
end
function tests:test_old()
self:check_old('Bauq Sawcuengh', 'Bauƽ Səɯcueŋƅ')
self:check_old('Yinzminzgunghseq dwg yinzminz dih swnghcanj caeuq swnghhoz dih yiengh cujciz ndeu', 'Yinƨminƨguŋƅseƽ dɯg yinƨminƨ diƅ sɯŋƅcanз cəuƽ sɯŋƅhoƨ diƅ yieŋƅ cuзciƨ ƌeu')
self:check_old('Cunghgoz Yinzminz Yinzhangz cib maenz', 'Cuŋƅgoƨ Yinƨminƨ Yinƨhaŋƨ cib mənƨ')
end
return tests