Module:qhv-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "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,\'De...")
(No difference)

Revision as of 16:35, 7 February 2021


3 tests failed. (refresh)
Text Expected Actual
test_example:
Failed drakarys draˈkarys draˈkaɾys
Passed valonqar vaˈloɴqar vaˈloɴqar
Passed Thoros ˈθoɾos ˈθoɾos
Failed arakh 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 zirȳ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:test_example()
	local list = {
		{"drakarys", "draˈkarys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"arakh", "aˈɾax"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"zirȳla", "ziˈryːla"},
	}
	self:iterate(list, "check_output")
end

return tests