Module:IPA/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

All tests passed. (refresh)

TextExpectedActualDiffers at
test_convert_ipa_to_xsampa:
Passed/ukrɑˈjɪnɑ//ukrA"jInA//ukrA"jInA/
Passed/ˈdɪkʃənɛɹi//"dIkS@nEr\i//"dIkS@nEr\i/
Passed/krɛ(ː)m//krE(:)m//krE(:)m/
Passed[bˠɑːd̪ˠ][b_GA:d_d_G][b_GA:d_d_G]
Passed[ŋ̍˩˨][N=__B__L][N=__B__L]
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=/
TextExpectedActualDiffers at
test_convert_xsampa_to_ipa:
Passed/ukrA"jInA//ukrɑˈjɪnɑ//ukrɑˈjɪnɑ/
Passed/"dIkS@nEr\i//ˈdɪkʃənɛɹi//ˈdɪkʃənɛɹi/
Passed/krE(:)m//krɛ(ː)m//krɛ(ː)m/
Passed[b_GA:d_d_G][bˠɑːd̪ˠ][bˠɑːd̪ˠ]
Passed[N=__B__L][ŋ̍˩˨][ŋ̍˩˨]
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̩/
TextExpectedActualDiffers at
test_roundtrip_ipa:
Passed/ukrɑˈjɪnɑ//ukrɑˈjɪnɑ//ukrɑˈjɪnɑ/
Passed/ˈdɪkʃənɛɹi//ˈdɪkʃənɛɹi//ˈdɪkʃənɛɹi/
Passed/krɛ(ː)m//krɛ(ː)m//krɛ(ː)m/
Passed[bˠɑːd̪ˠ][bˠɑːd̪ˠ][bˠɑːd̪ˠ]
Passed[ŋ̍˩˨][ŋ̍˩˨][ŋ̍˩˨]
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̩/
TextExpectedActualDiffers at
test_roundtrip_xsampa:
Passed/ukrA"jInA//ukrA"jInA//ukrA"jInA/
Passed/"dIkS@nEr\i//"dIkS@nEr\i//"dIkS@nEr\i/
Passed/krE(:)m//krE(:)m//krE(:)m/
Passed[b_GA:d_d_G][b_GA:d_d_G][b_GA:d_d_G]
Passed[N=__B__L][N=__B__L][N=__B__L]
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/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