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)
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