Module:qhv-pron/testcases

From Linguifex
< Module:qhv-pron
Revision as of 16:51, 7 February 2021 by Sware (talk | contribs)
Jump to navigation Jump to search

7 tests failed. (refresh)
Text Expected Actual
test_antique:
Failed drakaɾys draˈkarys draˈkaɾys
Failed valonqar vaˈloɴqar ɥaˈloɴqar
Passed Thoros ˈθoɾos ˈθoɾos
Failed aɾakh aˈɾax ˈaɾax
Passed ēngos ˈeːŋɡos ˈeːŋɡos
Passed amīvindigon amiːˈvindiɡon amiːˈvindiɡon
Passed ojehiknon ojeˈhiknon ojeˈhiknon
Passed pōja ˈpoːja ˈpoːja
Passed riña ˈriɲa ˈriɲa
Failed ziɾȳla ziˈryːla ziˈɾyːla
Text Expected Actual
test_modern:
Failed drakaɾys draˈkarys draˈkaɾys
Passed valonqar vaˈloɴqar vaˈloɴqar
Passed Thoros ˈθoɾos ˈθoɾos
Failed aɾakh aˈɾax ˈaɾax
Passed ēngos ˈeːŋɡos ˈeːŋɡos
Passed amīvindigon amiːˈvindiɡon amiːˈvindiɡon
Passed ojehiknon ojeˈhiknon ojeˈhiknon
Passed pōja ˈpoːja ˈpoːja
Passed riña ˈriɲa ˈriɲa
Failed ziɾȳla ziˈryːla ziˈɾyːla

local tests = require('Module:UnitTests')
local m_IPA = require('Module:qhv-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 linkup(text)
	return "[[Contionary:" .. text .. "#High Valyrian|" .. text .. "]]"
end

function tests:check_output(term, expected)
	return tests:equals(
		linkup(term),
		m_IPA.crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:check_output2(term, expected)
	return tests:equals(
		linkup(term),
		m_IPA.antique_crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:test_modern()
	local list = {
		{"drakaɾys", "draˈkarys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"aɾakh", "aˈɾax"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"ziɾȳla", "ziˈryːla"},
	}
	self:iterate(list, "check_output")
end

function tests:test_antique()
	local list = {
		{"drakaɾys", "draˈkarys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"aɾakh", "aˈɾax"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"ziɾȳla", "ziˈryːla"},
	}
	self:iterate(list, "check_output2")
end

return tests