Jump to content

Module:Cher-common/testcases

From Wiktionary, the free dictionary

All tests passed. (refresh)

TextExpectedActual
test_to_syll:
Passedakáʔnaka*thiᎠᎦᎾᎦᏘ (aganagati)ᎠᎦᎾᎦᏘ (aganagati)
Passedakha*thaᎠᎦᏔ (agata)ᎠᎦᏔ (agata)
PassedjuunateehlohkwaàstiʔiᏧᎾᏕᏠᏆᏍᏗᎢ (tsunadetloquasdii)ᏧᎾᏕᏠᏆᏍᏗᎢ (tsunadetloquasdii)
PassedkhanéekaᎧᏁᎦ (kanega)ᎧᏁᎦ (kanega)
Passednuuna*tv́vneélvvʔiᏄᎾᏛᏁᎸᎢ (nunadvnelvi)ᏄᎾᏛᏁᎸᎢ (nunadvnelvi)
PassedthlestiᏞᏍᏗ (tlesdi)ᏞᏍᏗ (tlesdi)
Passedtsa*tlv́vkaᏣᏢᎦ (tsatlvga)ᏣᏢᎦ (tsatlvga)
Passedtha the thi tho thu thvᏔ Ꮦ Ꮨ Ꮩ Ꮪ Ꮫ (ta te ti do du dv)Ꮤ Ꮦ Ꮨ Ꮩ Ꮪ Ꮫ (ta te ti do du dv)
Passedta te ti to tu tvᏓ Ꮥ Ꮧ Ꮩ Ꮪ Ꮫ (da de di do du dv)Ꮣ Ꮥ Ꮧ Ꮩ Ꮪ Ꮫ (da de di do du dv)

local tests = require("Module:UnitTests")
local cher = require("Module:Cher-common")
local link = require("Module:links")

local lang = require("Module:languages").getByCode("chr")
local sc = require("Module:scripts").getByCode("Cher")

function tests:check_output(term, expected)
	local actual = cher.to_syll(term)

	self:equals(
		"<code>" .. term .. "</code>",
		link.full_link({ term = actual, lang = lang, sc = sc } ),
		link.full_link({ term = expected, lang = lang, sc = sc } )
	)
end

function tests:test_to_syll()
	examples = {
		{"akáʔnaka*thi", "ᎠᎦᎾᎦᏘ"},
		{"akha*tha", "ᎠᎦᏔ"},
		{"juunateehlohkwaàstiʔi", "ᏧᎾᏕᏠᏆᏍᏗᎢ"},
		{"khanéeka", "ᎧᏁᎦ"},
		{"nuuna*tv́vneélvvʔi", "ᏄᎾᏛᏁᎸᎢ"},
		{"thlesti", "ᏞᏍᏗ"},
		{"tsa*tlv́vka", "ᏣᏢᎦ"},
		{"tha the thi tho thu thv", "Ꮤ Ꮦ Ꮨ Ꮩ Ꮪ Ꮫ"},
		{"ta te ti to tu tv", "Ꮣ Ꮥ Ꮧ Ꮩ Ꮪ Ꮫ"},
	}

	self:iterate(examples, "check_output")
end

return tests