Module:anui-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
 
(31 intermediate revisions by the same user not shown)
Line 13: Line 13:
return tests:equals(
return tests:equals(
bold(term),
bold(term),
m_IPA.crux(term),
mw.ustring.toNFC(mw.ustring.toNFD(m_IPA.crux(term))),
expected,
mw.ustring.toNFC(mw.ustring.toNFD(expected)),
{ display = IPA_style }
{ display = IPA_style, show_difference = true}
)
)
end
end
Line 23: Line 23:
{"aa", "aː˧"},
{"aa", "aː˧"},
{"aã", "ãː˥˦"},
{"aã", "ãː˥˦"},
{"a̰a", "a̰ː˦"},
{"a̰a", "a̰̰ː˦"},
{"a̰ã", "ã̰ː˧"},
{"a̰ã", "ã̰̰ː˧"},
{"a̰ʼa", "a̰ʔa˦"},
{"a̰ʼa", "a̰̰ʔa˦"},
{"a̰ʼã", "ã̰ʔã˥˦"},
{"a̰ʼã", "ã̰̰ʔã˥˦"},
{"um", "m̍ː˥˦"},
{"ùu", "ṵː˨"},
{"um", "m̩ː˥˦"},
{"ṵm", "m̰̍ː˧"},
{"ṵm", "m̰̍ː˧"},
{"mʼm", "m̰̍ʔm˧"},
{"mʼm", "m̰̍ʔm̩˧"},
{"oi", "ɔi"},
{"oi", "ɔi˧"},
{"oĩ", "ɔ̃ĩ˥˦"},
{"oĩ", "ɔ̃ĩ˥˦"},
{"uĩ", "m̩ĩ˥˦"},
{"ṵĩ", "m̰̍ĩ˧"},
{"ḛe", "ḛ̰ː˦"},
{"ṭʼṭʼaṇi", "ʈʼʈʼaᶯɖi"},
{"šǃxa̰ʼã", "ʃǃ͡χɑ̰̃ʔã˥˦"},
{"ʘui", "ʘɯi˧"},
{"ṭrui", "ʈ͡ʂɯi˧"},
}
}
self:iterate(list, "check_output")
self:iterate(list, "check_output")

Latest revision as of 20:33, 6 October 2023


All tests passed. (refresh)
Text Expected Actual
test_example:
Passed aa aː˧ aː˧
Passed ãː˥˦ ãː˥˦
Passed a̰a a̰̰ː˦ a̰̰ː˦
Passed a̰ã ã̰̰ː˧ ã̰̰ː˧
Passed a̰ʼa a̰̰ʔa˦ a̰̰ʔa˦
Passed a̰ʼã ã̰̰ʔã˥˦ ã̰̰ʔã˥˦
Passed ùu ṵː˨ ṵː˨
Passed um m̩ː˥˦ m̩ː˥˦
Passed ṵm m̰̍ː˧ m̰̍ː˧
Passed mʼm m̰̍ʔm̩˧ m̰̍ʔm̩˧
Passed oi ɔi˧ ɔi˧
Passed ɔ̃ĩ˥˦ ɔ̃ĩ˥˦
Passed m̩ĩ˥˦ m̩ĩ˥˦
Passed ṵĩ m̰̍ĩ˧ m̰̍ĩ˧
Passed ḛe ḛ̰ː˦ ḛ̰ː˦
Passed ṭʼṭʼaṇi ʈʼʈʼaᶯɖi ʈʼʈʼaᶯɖi
Passed šǃxa̰ʼã ʃǃ͡χɑ̰̃ʔã˥˦ ʃǃ͡χɑ̰̃ʔã˥˦
Passed ʘui ʘɯi˧ ʘɯi˧
Passed ṭrui ʈ͡ʂɯi˧ ʈ͡ʂɯi˧

local tests = require('Module:UnitTests')
local m_IPA = require('Module:anui-pron')

local function IPA_style(IPA)
	return '<span style="font-size:110%;font-family:Gentium,\'DejaVu Sans\',\'Segoe UI\',sans-serif>' .. IPA .. '</span>'
end

local function bold(x)
	return "'''" .. x .. "'''"	
end

function tests:check_output(term, expected)
	return tests:equals(
		bold(term),
		mw.ustring.toNFC(mw.ustring.toNFD(m_IPA.crux(term))),
		mw.ustring.toNFC(mw.ustring.toNFD(expected)),
		{ display = IPA_style, show_difference = true}
	)
end

function tests:test_example()
	local list = {
		{"aa", "aː˧"},
		{"aã", "ãː˥˦"},
		{"a̰a", "a̰̰ː˦"},
		{"a̰ã", "ã̰̰ː˧"},
		{"a̰ʼa", "a̰̰ʔa˦"},
		{"a̰ʼã", "ã̰̰ʔã˥˦"},
		{"ùu", "ṵː˨"},
		{"um", "m̩ː˥˦"},
		{"ṵm", "m̰̍ː˧"},
		{"mʼm", "m̰̍ʔm̩˧"},
		{"oi", "ɔi˧"},
		{"oĩ", "ɔ̃ĩ˥˦"},
		{"uĩ", "m̩ĩ˥˦"},
		{"ṵĩ", "m̰̍ĩ˧"},
		{"ḛe", "ḛ̰ː˦"},
		{"ṭʼṭʼaṇi", "ʈʼʈʼaᶯɖi"},
		{"šǃxa̰ʼã", "ʃǃ͡χɑ̰̃ʔã˥˦"},
		{"ʘui", "ʘɯi˧"},
		{"ṭrui", "ʈ͡ʂɯi˧"},
	}
	self:iterate(list, "check_output")
end

return tests