Module:anui-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 35: Line 35:
{"uĩ", "m̩ĩ˥˦"},
{"uĩ", "m̩ĩ˥˦"},
{"ṵĩ", "m̰̍ĩ˧"},
{"ṵĩ", "m̰̍ĩ˧"},
{"ḛe", "ee"},
{"ḛe", "ḛ̰ː˦"},
}
}
self:iterate(list, "check_output")
self:iterate(list, "check_output")

Revision as of 18:37, 2 July 2021


7 tests failed. (refresh)
Text Expected Actual
test_example:
Passed aa aː˧ aː˧
Passed ãː˥˦ ãː˥˦
Failed a̰a a̰ː˦ a̰̰ː˦
Failed a̰ã ã̰ː˧ ã̰̰ː˧
Failed a̰ʼa a̰ʔa˦ a̰̰ʔa˦
Failed a̰ʼã ã̰ʔã˥˦ ã̰̰ʔã˥˦
Failed ùu ṵː˨ ː˨
Passed um m̩ː˥˦ m̩ː˥˦
Passed ṵm m̰̍ː˧ m̰̍ː˧
Failed mʼm m̰̍ʔm̩˧ m̰̍ʔm̩˧
Passed oi ɔi˧ ɔi˧
Passed ɔ̃ĩ˥˦ ɔ̃ĩ˥˦
Passed m̩ĩ˥˦ m̩ĩ˥˦
Passed ṵĩ m̰̍ĩ˧ m̰̍ĩ˧
Failed ḛe ḛ̰ː˦ ḛ̰ː˦

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),
		m_IPA.crux(term),
		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̰ʼã", "ã̰ʔã˥˦"}, -- false negative
		{"ùu", "ṵː˨"}, -- false negative
		{"um", "m̩ː˥˦"},
		{"ṵm", "m̰̍ː˧"},
		{"mʼm", "m̰̍ʔm̩˧"}, -- false negative
		{"oi", "ɔi˧"},
		{"oĩ", "ɔ̃ĩ˥˦"},
		{"uĩ", "m̩ĩ˥˦"},
		{"ṵĩ", "m̰̍ĩ˧"},
		{"ḛe", "ḛ̰ː˦"},
	}
	self:iterate(list, "check_output")
end

return tests