local tests = require('Module:UnitTests')
local m_tr = require('Module:Cyrs-translit')
local full_link = require('Module:links').full_link
local lang_cu = require('Module:languages').getByCode('cu')
local lang_ono = require('Module:languages').getByCode('zle-ono')
local lang_orv = require('Module:languages').getByCode('orv')
local function link(word, lang)
return full_link{ term = word, lang = lang, tr = "-" }
end
function tests:do_test_translit_cu(word, tr)
self:equals(link(word, lang_cu), m_tr.tr(word, "cu"), tr)
end
function tests:do_test_translit_ono(word, tr)
self:equals(link(word, lang_ono), m_tr.tr(word, "zle-ono"), tr)
end
function tests:do_test_translit_orv(word, tr)
self:equals(link(word, lang_orv), m_tr.tr(word, "orv"), tr)
end
function tests:test_translit_cu()
local examples = {
{ "оу", "u" },
{ "сꙑнъ", "synŭ" },
{ "ѣхати", "ěxati" },
{ "бѣлъ", "bělŭ" },
{ "-ъѣ-", "-ŭě-" },
{ "аѵ", "av" },
{ "щенѧ", "štenę" },
{ "четꙑре", "četyre" },
{ "заѧць", "zaęcĭ" },
}
self:iterate(examples, "do_test_translit_cu")
end
function tests:test_translit_ono()
local examples = {
{ "оу", "u" },
{ "стръи", "strŷi" },
{ "ѣхати", "jěxati" },
{ "бѣлъ", "bělŭ" },
{ "-ъѣ-", "-ŭjě-" },
{ "аѵ", "av" },
{ "щенѧ", "śćenę" },
{ "четꙑре", "ćetyre" },
{ "ꙁаѧць", "zajęćĭ" },
}
self:iterate(examples, "do_test_translit_ono")
end
function tests:test_translit_orv()
local examples = {
{ "оу", "u" },
{ "стръи", "strŷi" },
{ "ѣхати", "jěxati" },
{ "бѣле", "běle" },
{ "-ъѣ-", "-ŭjě-" },
{ "аѵ", "av" },
{ "щенѧ", "ščenę" },
{ "четꙑре", "četyre" },
{ "заѧць", "zajęcĭ" },
}
self:iterate(examples, "do_test_translit_orv")
end
return tests