Module:hit-translit/testcases
Jump to navigation
Jump to search
Documentation for this module may be created at Module:hit-translit/testcases/doc
local hit_translit = require('Module:hit-translit')
local hit_tag = require('Module:hit-translit/tag')
local tests = require('Module:UnitTests')
function tests:test_1_tr()
local test_tr = {
{ "๐ญ๐๐
๐ช๐๐ซ", "ลกa-pรญ-ik-ku-uลก-ta" },
{ "๐ฟ๐
๐๐ซ", "i-ya-at-ta" },
{ "๐ ๐บ๐ธ", "al-pa-aลก" },
{ "๐ ๐
", "ke-er" },
{ "๐ผ๐๐พ๐
๐ธ", "kar-ti-ya-aลก" },
{ "๐ฎ๐
", hit_tag.tag_sumerogram("ล ร") .. "-er" },
{ "๐บ๐ด๐ท๐ฟ๐
", "pa-aแธซ-แธซu-wa-ar" },
{ "๐บ๐ด๐ฏ", "pa-aแธซ-แธซur" },
{ "๐บ๐ด๐ท๐๐จ", "pa-aแธซ-แธซu-u-ur" },
{ "๐บ๐ด๐ท๐๐พ๐ญ๐", "pa-aแธซ-แธซu-e-na-an-za" },
{ "๐บ๐ด๐ท๐๐", "pa-aแธซ-แธซu-e-ni" },
{ "๐บ๐ด๐ท๐๐๐", "pa-aแธซ-แธซu-e-ni-it" },
{ "๐บ๐ด๐ท๐ญ๐ซ", "pa-aแธซ-แธซu-an-ta" },
{ "๐ฉ๐ธ๐ผ๐
๐", "แธซa-aลก-te-er-za" },
{ "๐ญ๐ซ๐๐ธ", "an-ta-ra-aลก" },
{ "๐บ๐๐ฟ", "pa-a-i" },
{ "๐๐๐", "a-a-ra" },
{ "๐๐ญ๐๐ญ๐ซ๐ญ", "a-ลกa-a-an-ta-an" },
{ "๐๐ญ๐๐ญ๐ซ๐ธ", "a-ลกa-a-an-ta-aลก" },
{ "๐๐", hit_tag.tag_sumerogram("LUGAL") .. "-uลก" },
{ "๐๐๐ฟ๐ธ", hit_tag.tag_sumerogram("LUGAL") .. "-รบ-wa-aลก" },
{ "๐ฏ๐๐ต๐ธ", "แธซar-tรกg-ga-aลก" },
{ "๐ฏ๐๐", "แธซar-tรกg-gi" },
{ "๐๐๐๐ก๐
", "za-ap-za-kaโ-ya" },
{ "๐ญ๐
๐ญ๐ญ", "แธซi-iลก-ลกa-an" },
{ "๐ฏ๐๐๐", "แธซar-tรกg-ge-eลก" },
{ "๐ผ๐๐๐พ๐
๐๐๐
", "te-ri-it-ti-tu-u-ni-iลก" },
{ "๐บ๐๐ป๐๐
๐พ๐
๐ธ", "tรน-ut-tar-ri-ya-ti-ya-aลก" },
{ "๐ญ๐
๐ฟ๐ด๐ฉ๐ธ", "an-tu-wa-aแธซ-แธซa-aลก" },
{ "๐ป๐ช๐ฟ๐ญ๐ฃ", "tar-ku-wa-an-zi" },
{ "๐ซ๐๐", "ta-a-ru" },
}
tests:iterate(test_tr, function(self, text, tr)
self:equals(hit_tag.tag_hittite(text), hit_translit.tr(text, "hit", "Xsux"), hit_tag.tag_hittite_tr(tr))
end)
end
local test_syls = {
{ "aลก", { "a", "s" } },
{ "แธซal", { "h", "l" } },
{ "pal", { "p", "l" } },
{ "bal", { "b", "l" } },
{ "ลกir", { "s", "r" } },
{ "แธซaลก", { "h", "s" } },
{ "pรกt", { "p", "t" } },
{ "gaโ
", { "g", "a" } },
{ "kaโ", { "k", "a" } },
{ "inโ", { "i", "n" } },
{ "nรฉ", { "n", "e" } },
{ "30", { "3", "0" } },
}
function tests:find_seg(func, index)
return function(self, syl, lauts)
self:equals(syl, func(syl), lauts[index])
end
end
function tests:test_2_find_onset()
tests:iterate(test_syls, tests:find_seg(hit_translit.find_onset, 1))
end
function tests:test_3_find_coda()
tests:iterate(test_syls, tests:find_seg(hit_translit.find_coda, 2))
end
function tests:test_4_hash_sign()
local test_signs = {
{
{ "it", "id", "et", "ed", hit = true },
{
{ "it", o = "i", c = "t" },
{ "id", o = "i", c = "d" },
{ "et", o = "e", c = "t" },
{ "ed", o = "e", c = "d" },
o_hash = 6,
c_hash = 192,
hit = true,
}
},
}
tests:iterate(test_signs, function(self, sign, initialized)
self:equals_deep("-", hit_translit.hash_sign(sign), initialized)
end)
end
function tests:test_5_copy_sign()
local test_signs = {
{
"๐ซ",
{
{ "paลก", c = "s", o = "p" },
{ "pรนลก", c = "s", o = "p" },
{ "piลก", c = "s", o = "p" },
{ "biลก", c = "s", o = "b" },
{ "kir", c = "r", o = "k" },
{ "gir", c = "r", o = "g" },
{ "gir", c = "r", o = "g" },
c_hash = 69632,
hit = true,
o_hash = 816
}
},
}
tests:iterate(test_signs, function(self, sign, init_copy)
self:equals_deep("-", hit_translit.copy_sign(sign), init_copy)
end)
end
return tests