Module:IPA/testcases

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:IPA/testcases/documentation. [edit]
Useful links: root pageroot page's subpagestransclusionstested module

All tests passed. (refresh)

test_convert_ipa_to_xsampa:
Text Expected Actual Differs at
Passed /ukrɑˈjɪnɑ/ /ukrA"jInA/ /ukrA"jInA/
Passed /ˈdɪkʃənɛɹi/ /"dIkS@nEr\i/ /"dIkS@nEr\i/
Passed [bˠɑːd̪ˠ] [b_GA:d_d_G] [b_GA:d_d_G]
Passed [bˠɑːdʲ] [b_GA:d_j] [b_GA:d_j]
Passed [næu̯ˈɾɵːz] [n{u_^"48:z] [n{u_^"48:z]
Passed [ɕɪn˥˥niɛn˧˥] [s\In_T_TniEn_M_T] [s\In_T_TniEn_M_T]
Passed /ˈdɪkʃən(ə)ɹi/ /"dIkS@n(@)r\i/ /"dIkS@n(@)r\i/
Passed [ˈmɝdɚ] ["m3`d@`] ["m3`d@`]
Passed [næu̯ˈɾoːz] [n{u_^"4o:z] [n{u_^"4o:z]
Passed [ˈbætl̩ʃɪp] ["b{tl=SIp] ["b{tl=SIp]
Passed [noːˈɾuːz] [no:"4u:z] [no:"4u:z]
Passed [nou̯ˈɾuːz] [nou_^"4u:z] [nou_^"4u:z]
Passed /t͡ʃeɪnd͡ʒ/ /t__SeInd__Z/ /t__SeInd__Z/
Passed /ˈdæzl̩/ /"d{zl=/ /"d{zl=/
test_convert_xsampa_to_ipa:
Text Expected Actual Differs at
Passed /ukrA"jInA/ /ukrɑˈjɪnɑ/ /ukrɑˈjɪnɑ/
Passed /"dIkS@nEr\i/ /ˈdɪkʃənɛɹi/ /ˈdɪkʃənɛɹi/
Passed [b_GA:d_d_G] [bˠɑːd̪ˠ] [bˠɑːd̪ˠ]
Passed [b_GA:d_j] [bˠɑːdʲ] [bˠɑːdʲ]
Passed [n{u_^"48:z] [næu̯ˈɾɵːz] [næu̯ˈɾɵːz]
Passed [s\In_T_TniEn_M_T] [ɕɪn˥˥niɛn˧˥] [ɕɪn˥˥niɛn˧˥]
Passed /"dIkS@n(@)r\i/ /ˈdɪkʃən(ə)ɹi/ /ˈdɪkʃən(ə)ɹi/
Passed ["m3`d@`] [ˈmɝdɚ] [ˈmɝdɚ]
Passed [n{u_^"4o:z] [næu̯ˈɾoːz] [næu̯ˈɾoːz]
Passed ["b{tl=SIp] [ˈbætl̩ʃɪp] [ˈbætl̩ʃɪp]
Passed [no:"4u:z] [noːˈɾuːz] [noːˈɾuːz]
Passed [nou_^"4u:z] [nou̯ˈɾuːz] [nou̯ˈɾuːz]
Passed /t__SeInd__Z/ /t͡ʃeɪnd͡ʒ/ /t͡ʃeɪnd͡ʒ/
Passed /"d{zl=/ /ˈdæzl̩/ /ˈdæzl̩/
test_roundtrip_ipa:
Text Expected Actual Differs at
Passed /ukrɑˈjɪnɑ/ /ukrɑˈjɪnɑ/ /ukrɑˈjɪnɑ/
Passed /ˈdɪkʃənɛɹi/ /ˈdɪkʃənɛɹi/ /ˈdɪkʃənɛɹi/
Passed [bˠɑːd̪ˠ] [bˠɑːd̪ˠ] [bˠɑːd̪ˠ]
Passed [bˠɑːdʲ] [bˠɑːdʲ] [bˠɑːdʲ]
Passed [næu̯ˈɾɵːz] [næu̯ˈɾɵːz] [næu̯ˈɾɵːz]
Passed [ɕɪn˥˥niɛn˧˥] [ɕɪn˥˥niɛn˧˥] [ɕɪn˥˥niɛn˧˥]
Passed /ˈdɪkʃən(ə)ɹi/ /ˈdɪkʃən(ə)ɹi/ /ˈdɪkʃən(ə)ɹi/
Passed [ˈmɝdɚ] [ˈmɝdɚ] [ˈmɝdɚ]
Passed [næu̯ˈɾoːz] [næu̯ˈɾoːz] [næu̯ˈɾoːz]
Passed [ˈbætl̩ʃɪp] [ˈbætl̩ʃɪp] [ˈbætl̩ʃɪp]
Passed [noːˈɾuːz] [noːˈɾuːz] [noːˈɾuːz]
Passed [nou̯ˈɾuːz] [nou̯ˈɾuːz] [nou̯ˈɾuːz]
Passed /t͡ʃeɪnd͡ʒ/ /t͡ʃeɪnd͡ʒ/ /t͡ʃeɪnd͡ʒ/
Passed /ˈdæzl̩/ /ˈdæzl̩/ /ˈdæzl̩/
test_roundtrip_xsampa:
Text Expected Actual Differs at
Passed /ukrA"jInA/ /ukrA"jInA/ /ukrA"jInA/
Passed /"dIkS@nEr\i/ /"dIkS@nEr\i/ /"dIkS@nEr\i/
Passed [b_GA:d_d_G] [b_GA:d_d_G] [b_GA:d_d_G]
Passed [b_GA:d_j] [b_GA:d_j] [b_GA:d_j]
Passed [n{u_^"48:z] [n{u_^"48:z] [n{u_^"48:z]
Passed [s\In_T_TniEn_M_T] [s\In_T_TniEn_M_T] [s\In_T_TniEn_M_T]
Passed /"dIkS@n(@)r\i/ /"dIkS@n(@)r\i/ /"dIkS@n(@)r\i/
Passed ["m3`d@`] ["m3`d@`] ["m3`d@`]
Passed [n{u_^"4o:z] [n{u_^"4o:z] [n{u_^"4o:z]
Passed ["b{tl=SIp] ["b{tl=SIp] ["b{tl=SIp]
Passed [no:"4u:z] [no:"4u:z] [no:"4u:z]
Passed [nou_^"4u:z] [nou_^"4u:z] [nou_^"4u:z]
Passed /t__SeInd__Z/ /t__SeInd__Z/ /t__SeInd__Z/
Passed /"d{zl=/ /"d{zl=/ /"d{zl=/

local tests = require('Module:UnitTests')
local m_IPA = require('Module:IPA')
 
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˧˥]' ;
 
	-- ga: [[báid]]
	['[b_GA:d_j]'         ] = '[bˠɑːdʲ]'      ;
 
	-- ga: [[bád]]
	['[b_GA:d_d_G]'       ] = '[bˠɑːd̪ˠ]'      ;
}
 
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), format_ipa(m_IPA.XSAMPA_to_IPA(xsampa)), format_ipa(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))
	end
end
 
function tests:test_roundtrip_ipa()
	for xsampa, ipa in pairs(testcases) do
		self:equals(format_ipa(ipa), format_ipa(m_IPA.XSAMPA_to_IPA(m_IPA.IPA_to_XSAMPA(ipa))), format_ipa(ipa))
	end
end
 
function tests:test_roundtrip_xsampa()
	for xsampa, ipa in pairs(testcases) do
		self:equals(format_xsampa(xsampa), format_xsampa(m_IPA.IPA_to_XSAMPA(m_IPA.XSAMPA_to_IPA(xsampa))), format_xsampa(xsampa))
	end
end
 
return tests