Module:anui-pron/testcases

From Linguifex
Jump to navigation Jump to search

6 tests failed. (refresh)
Text Expected Actual
test_example:
Passed aa aː˧ aː˧
Passed ãː˥˦ ãː˥˦
Failed a̰a a̰ː˦ a̰̰ː˦
Failed àã ã̰ː˧ ã̰̰ː˧
Failed àʼa a̰ʔa˦ a̰̰ʔa˦
Failed àʼã ã̰ʔã˥˦ ã̰̰ʔã˥˦
Failed um m̍ː˥˦ m̩ː˥˦
Passed ùm m̰̍ː˧ m̰̍ː˧
Failed mʼm m̰̍ʔm˧ m̰̍ʔm̩˧

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 }
	)
end

function tests:test_example()
	local list = {
		{"aa", "aː˧"},
		{"aã", "ãː˥˦"},
		{"a̰a", "a̰ː˦"},
		{"àã", "ã̰ː˧"},
		{"àʼa", "a̰ʔa˦"},
		{"àʼã", "ã̰ʔã˥˦"},
		{"um", "m̍ː˥˦"},
		{"ùm", "m̰̍ː˧"},
		{"mʼm", "m̰̍ʔm˧"},
	}
	self:iterate(list, "check_output")
end

return tests