Module:User:Erutuon/script recognition/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

All tests passed. (refresh)

TextExpectedActual
test_charToScript:
PassedALatnLatn
PassedHaniHani
PassedώGrekGrek
Passedpolytonicpolytonic
PassedЖCyrlCyrl
PassedѸCyrsCyrs
PassedCyrsCyrs
Passed!(nil)(nil)

local tests = require("Module:UnitTests")

local m_sc_recognition = require("Module:User:Erutuon/script_recognition")

function tests:check_charToScript(char, expected)
	self:equals(
		char,
		m_sc_recognition.charToScript(char),
		expected
	)
end

function tests:test_charToScript()
	local examples = {
		{ "A", "Latn" },
		{ "一", "Hani" },
		{ "ώ", "Grek" },
		{ "ὦ", "polytonic" },
		{ "Ж", "Cyrl" },
		{ "Ѹ", "Cyrs" },
		{ "ꙑ", "Cyrs" },
		{ "!", nil },
	}
	
	tests:iterate(examples, "check_charToScript")
end

return tests