Module:IPA/testcases
- The following documentation is located at Module:IPA/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
![]() | /ukrɑˈjɪnɑ/ | /ukrA"jInA/ | /ukrA"jInA/ | |
![]() | /ˈdɪkʃənɛɹi/ | /"dIkS@nEr\i/ | /"dIkS@nEr\i/ | |
![]() | /krɛ(ː)m/ | /krE(:)m/ | /krE(:)m/ | |
![]() | [bˠɑːd̪ˠ] | [b_GA:d_d_G] | [b_GA:d_d_G] | |
![]() | [ŋ̍˩˨] | [N=__B__L] | [N=__B__L] | |
![]() | [bˠɑːdʲ] | [b_GA:d_j] | [b_GA:d_j] | |
![]() | [næu̯ˈɾɵːz] | [n{u_^"48:z] | [n{u_^"48:z] | |
![]() | [ɕɪn˥˥niɛn˧˥] | [s\In__T__TniEn__M__T] | [s\In__T__TniEn__M__T] | |
![]() | /ˈdɪkʃən(ə)ɹi/ | /"dIkS@n(@)r\i/ | /"dIkS@n(@)r\i/ | |
![]() | [ˈmɝdɚ] | ["m3`d@`] | ["m3`d@`] | |
![]() | [næu̯ˈɾoːz] | [n{u_^"4o:z] | [n{u_^"4o:z] | |
![]() | [ˈbætl̩ʃɪp] | ["b{tl=SIp] | ["b{tl=SIp] | |
![]() | [noːˈɾuːz] | [no:"4u:z] | [no:"4u:z] | |
![]() | [nou̯ˈɾuːz] | [nou_^"4u:z] | [nou_^"4u:z] | |
![]() | /t͡ʃeɪnd͡ʒ/ | /t__SeInd__Z/ | /t__SeInd__Z/ | |
![]() | /ˈdæzl̩/ | /"d{zl=/ | /"d{zl=/ |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
![]() | /ukrA"jInA/ | /ukrɑˈjɪnɑ/ | /ukrɑˈjɪnɑ/ | |
![]() | /"dIkS@nEr\i/ | /ˈdɪkʃənɛɹi/ | /ˈdɪkʃənɛɹi/ | |
![]() | /krE(:)m/ | /krɛ(ː)m/ | /krɛ(ː)m/ | |
![]() | [b_GA:d_d_G] | [bˠɑːd̪ˠ] | [bˠɑːd̪ˠ] | |
![]() | [N=__B__L] | [ŋ̍˩˨] | [ŋ̍˩˨] | |
![]() | [b_GA:d_j] | [bˠɑːdʲ] | [bˠɑːdʲ] | |
![]() | [n{u_^"48:z] | [næu̯ˈɾɵːz] | [næu̯ˈɾɵːz] | |
![]() | [s\In__T__TniEn__M__T] | [ɕɪn˥˥niɛn˧˥] | [ɕɪn˥˥niɛn˧˥] | |
![]() | /"dIkS@n(@)r\i/ | /ˈdɪkʃən(ə)ɹi/ | /ˈdɪkʃən(ə)ɹi/ | |
![]() | ["m3`d@`] | [ˈmɝdɚ] | [ˈmɝdɚ] | |
![]() | [n{u_^"4o:z] | [næu̯ˈɾoːz] | [næu̯ˈɾoːz] | |
![]() | ["b{tl=SIp] | [ˈbætl̩ʃɪp] | [ˈbætl̩ʃɪp] | |
![]() | [no:"4u:z] | [noːˈɾuːz] | [noːˈɾuːz] | |
![]() | [nou_^"4u:z] | [nou̯ˈɾuːz] | [nou̯ˈɾuːz] | |
![]() | /t__SeInd__Z/ | /t͡ʃeɪnd͡ʒ/ | /t͡ʃeɪnd͡ʒ/ | |
![]() | /"d{zl=/ | /ˈdæzl̩/ | /ˈdæzl̩/ |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
![]() | /ukrɑˈjɪnɑ/ | /ukrɑˈjɪnɑ/ | /ukrɑˈjɪnɑ/ | |
![]() | /ˈdɪkʃənɛɹi/ | /ˈdɪkʃənɛɹi/ | /ˈdɪkʃənɛɹi/ | |
![]() | /krɛ(ː)m/ | /krɛ(ː)m/ | /krɛ(ː)m/ | |
![]() | [bˠɑːd̪ˠ] | [bˠɑːd̪ˠ] | [bˠɑːd̪ˠ] | |
![]() | [ŋ̍˩˨] | [ŋ̍˩˨] | [ŋ̍˩˨] | |
![]() | [bˠɑːdʲ] | [bˠɑːdʲ] | [bˠɑːdʲ] | |
![]() | [næu̯ˈɾɵːz] | [næu̯ˈɾɵːz] | [næu̯ˈɾɵːz] | |
![]() | [ɕɪn˥˥niɛn˧˥] | [ɕɪn˥˥niɛn˧˥] | [ɕɪn˥˥niɛn˧˥] | |
![]() | /ˈdɪkʃən(ə)ɹi/ | /ˈdɪkʃən(ə)ɹi/ | /ˈdɪkʃən(ə)ɹi/ | |
![]() | [ˈmɝdɚ] | [ˈmɝdɚ] | [ˈmɝdɚ] | |
![]() | [næu̯ˈɾoːz] | [næu̯ˈɾoːz] | [næu̯ˈɾoːz] | |
![]() | [ˈbætl̩ʃɪp] | [ˈbætl̩ʃɪp] | [ˈbætl̩ʃɪp] | |
![]() | [noːˈɾuːz] | [noːˈɾuːz] | [noːˈɾuːz] | |
![]() | [nou̯ˈɾuːz] | [nou̯ˈɾuːz] | [nou̯ˈɾuːz] | |
![]() | /t͡ʃeɪnd͡ʒ/ | /t͡ʃeɪnd͡ʒ/ | /t͡ʃeɪnd͡ʒ/ | |
![]() | /ˈdæzl̩/ | /ˈdæzl̩/ | /ˈdæzl̩/ |
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
![]() | /ukrA"jInA/ | /ukrA"jInA/ | /ukrA"jInA/ | |
![]() | /"dIkS@nEr\i/ | /"dIkS@nEr\i/ | /"dIkS@nEr\i/ | |
![]() | /krE(:)m/ | /krE(:)m/ | /krE(:)m/ | |
![]() | [b_GA:d_d_G] | [b_GA:d_d_G] | [b_GA:d_d_G] | |
![]() | [N=__B__L] | [N=__B__L] | [N=__B__L] | |
![]() | [b_GA:d_j] | [b_GA:d_j] | [b_GA:d_j] | |
![]() | [n{u_^"48:z] | [n{u_^"48:z] | [n{u_^"48:z] | |
![]() | [s\In__T__TniEn__M__T] | [s\In__T__TniEn__M__T] | [s\In__T__TniEn__M__T] | |
![]() | /"dIkS@n(@)r\i/ | /"dIkS@n(@)r\i/ | /"dIkS@n(@)r\i/ | |
![]() | ["m3`d@`] | ["m3`d@`] | ["m3`d@`] | |
![]() | [n{u_^"4o:z] | [n{u_^"4o:z] | [n{u_^"4o:z] | |
![]() | ["b{tl=SIp] | ["b{tl=SIp] | ["b{tl=SIp] | |
![]() | [no:"4u:z] | [no:"4u:z] | [no:"4u:z] | |
![]() | [nou_^"4u:z] | [nou_^"4u:z] | [nou_^"4u:z] | |
![]() | /t__SeInd__Z/ | /t__SeInd__Z/ | /t__SeInd__Z/ | |
![]() | /"d{zl=/ | /"d{zl=/ | /"d{zl=/ |
local tests = require('Module:UnitTests')
local m_IPA = require('Module:IPA/X-SAMPA')
local testcases = {
-- [ XSAMPA ] = IPA ;
-- en: [[dictionary]]
['/"dIkS@n(@)r\\i/' ] = '/ˈdɪkʃən(ə)ɹi/' ;
['/"dIkS@nEr\\i/' ] = '/ˈdɪkʃənɛɹi/' ;
-- en: [[battleship]]
['["b{tl=SIp]' ] = '[ˈbætl̩ʃɪp]' ;
-- en: [[murder]]
['["m3`d@`]' ] = '[ˈmɝdɚ]' ;
-- en: [[dazzle]]
['/"d{zl=/' ] = '/ˈdæzl̩/' ;
--[=[ en: [[change]]
['/ʧeɪnʤ/' ] = '/t͡ʃeInd͡ʒ/' ; ]=]
-- en: [[change]]
['/t__SeInd__Z/' ] = '/t͡ʃeɪnd͡ʒ/' ;
-- uk: [[Україна]]
['/ukrA"jInA/' ] = '/ukrɑˈjɪnɑ/' ;
-- fa: [[نوروز]]
['[n{u_^"4o:z]' ] = '[næu̯ˈɾoːz]' ;
['[nou_^"4u:z]' ] = '[nou̯ˈɾuːz]' ;
['[no:"4u:z]' ] = '[noːˈɾuːz]' ;
['[n{u_^"48:z]' ] = '[næu̯ˈɾɵːz]' ;
-- cmn: [[新年]]
['[s\\In__T__TniEn__M__T]' ] = '[ɕɪn˥˥niɛn˧˥]' ;
-- yue: [[唔]]
['[N=__B__L]' ] = '[ŋ̍˩˨]' ;
-- ga: [[báid]], [[bád]]
['[b_GA:d_j]' ] = '[bˠɑːdʲ]' ;
['[b_GA:d_d_G]' ] = '[bˠɑːd̪ˠ]' ;
-- nl: [[crème]]
['/krE(:)m/' ] = '/krɛ(ː)m/' ;
}
local function format_ipa(ipa)
return '<span class="IPA" lang="">' .. ipa .. '</span>'
end
local function format_xsampa(xsampa)
return '<code>' .. xsampa .. '</code>'
end
function tests:test_convert_xsampa_to_ipa()
for xsampa, ipa in pairs(testcases) do
self:equals(
format_xsampa(xsampa),
m_IPA.XSAMPA_to_IPA(xsampa),
ipa,
{ display = format_ipa }
)
end
end
function tests:test_convert_ipa_to_xsampa()
for xsampa, ipa in pairs(testcases) do
self:equals(
format_ipa(ipa),
format_xsampa(m_IPA.IPA_to_XSAMPA(ipa)),
format_xsampa(xsampa),
{ display = format_ipa }
)
end
end
function tests:test_roundtrip_ipa()
for xsampa, ipa in pairs(testcases) do
self:equals(
format_ipa(ipa),
m_IPA.XSAMPA_to_IPA(m_IPA.IPA_to_XSAMPA(ipa)),
ipa,
{ display = format_ipa }
)
end
end
function tests:test_roundtrip_xsampa()
for xsampa, ipa in pairs(testcases) do
self:equals(
format_xsampa(xsampa),
m_IPA.IPA_to_XSAMPA(m_IPA.XSAMPA_to_IPA(xsampa)),
xsampa,
{ display = format_xsampa }
)
end
end
return tests