Jump to content

Module:ne-IPA-Deva/testcases

From Wiktionary, the free dictionary

All tests passed. (refresh)

TextExpectedActualDiffers atComments
test_Chakma:
TextExpectedActualDiffers atComments
test_Devanagari:
Passedçʰetɾiछेत्रिछेत्रि
Passedʐäːʐजाःज्जाःज्

local tests = require('Module:UnitTests')
tr = require('Module:ne-IPA-Deva').tr

local cases = {
	{"çʰetɾi",  l = "छेत्रि"},
    {"ʐäːʐ",  l = "जाःज्"},

}

--[[ here be the tests ]]
function tests:test_Devanagari()
	local res;
	for ia, va in pairs({false, true}) do
		va = not not va
		for ic, vc in ipairs(cases) do
			if va == not not vc.aborts then
				if vc.l then
					res = tr(vc[1], "Deva")
-- equals(name, actual, expected, options)
					if res == vc.l then
						tests:equals(vc[1], res, vc.l)
					elseif vc.l_just then
						tests:equals(vc[1], res, vc.l.."<br>("..vc.l_just..")")
					else
						tests:equals(vc[1], res, vc.l)
					end
				end
			end
		end
	end
end

function tests:test_Chakma()
	local res;
	for ia, va in pairs({false, true}) do
		va = not not va
		for ic, vc in ipairs(cases) do
			if va == not not vc.aborts then
				if vc.c then
					res = tr(vc[1], "Cakm")
-- equals(name, actual, expected, options)
					if res == vc.c then
						tests:equals(vc[1], res, vc.c)
					elseif vc.c_just then
						tests:equals(vc[1], res, vc.c.."<br>("..vc.c_just..")")
					else
						tests:equals(vc[1], res, vc.c)
					end
				end
			end
		end
	end
end

return tests