Jump to content

Module:hit-translit/testcases

From Wiktionary, the free dictionary

4 of 57 tests failed. (refresh)

TextExpectedActual
test_1_tr:
Passed𒊭𒁉𒅅𒆪𒍑𒋫ša-pí-ik-ku-uš-taša-pí-ik-ku-uš-ta
Passed𒄿𒅀𒀜𒋫i-ya-at-tai-ya-at-ta
Passed𒀠𒉺𒀸al-pa-ašal-pa-aš
Failed𒆠𒅕ke-erki-ir
Passed𒋼𒀀𒋾𒅀𒀸kar-ti-ya-aškar-ti-ya-aš
Failed𒊮𒅕ŠÀ-erŠÀ-ir
Passed𒉺𒄴𒄷𒉿𒅈pa-aḫ-ḫu-wa-arpa-aḫ-ḫu-wa-ar
Failed𒉺𒄴𒄯pa-aḫ-ḫurpa-aḫ-ḫar
Passed𒉺𒄴𒄷𒌋𒌨pa-aḫ-ḫu-u-urpa-aḫ-ḫu-u-ur
Passed𒉺𒄴𒄷𒂊𒈾𒀭𒍝pa-aḫ-ḫu-e-na-an-zapa-aḫ-ḫu-e-na-an-za
Passed𒉺𒄴𒄷𒂊𒉌pa-aḫ-ḫu-e-nipa-aḫ-ḫu-e-ni
Passed𒉺𒄴𒄷𒂊𒉌𒀉pa-aḫ-ḫu-e-ni-itpa-aḫ-ḫu-e-ni-it
Passed𒉺𒄴𒄷𒀭𒋫pa-aḫ-ḫu-an-tapa-aḫ-ḫu-an-ta
Passed𒄩𒀸𒋼𒅕𒍝ḫa-aš-te-er-zaḫa-aš-te-er-za
Passed𒀭𒋫𒊏𒀸an-ta-ra-ašan-ta-ra-aš
Passed𒉺𒀀𒄿pa-a-ipa-a-i
Passed𒀀𒀀𒊏a-a-raa-a-ra
Passed𒀀𒊭𒀀𒀭𒋫𒀭a-ša-a-an-ta-ana-ša-a-an-ta-an
Passed𒀀𒊭𒀀𒀭𒋫𒀸a-ša-a-an-ta-aša-ša-a-an-ta-aš
Passed𒈗𒍑LUGAL-ušLUGAL-uš
Passed𒈗𒌑𒉿𒀸LUGAL-ú-wa-ašLUGAL-ú-wa-aš
Passed𒄯𒁖𒂵𒀸ḫar-tág-ga-ašḫar-tág-ga-aš
Passed𒄯𒁖𒄀ḫar-tág-giḫar-tág-gi
Passed𒍝𒀊𒍝𒋡𒅀za-ap-za-ka₄-yaza-ap-za-ka₄-ya
Passed𒄭𒅖𒊭𒀭ḫi-iš-ša-anḫi-iš-ša-an
Failed𒄯𒁖𒄀𒌍ḫar-tág-ge-ešḫar-tág-gi-ìš
Passed𒋼𒊑𒀉𒋾𒌅𒌋𒉌𒅖te-ri-it-ti-tu-u-ni-ište-ri-it-ti-tu-u-ni-iš
Passed𒁺𒌓𒋻𒊑𒅀𒋾𒅀𒀸tù-ut-tar-ri-ya-ti-ya-aštù-ut-tar-ri-ya-ti-ya-aš
Passed𒀭𒌅𒉿𒄴𒄩𒀸an-tu-wa-aḫ-ḫa-ašan-tu-wa-aḫ-ḫa-aš
Passed𒋻𒆪𒉿𒀭𒍣tar-ku-wa-an-zitar-ku-wa-an-zi
Passed𒋫𒀀𒊒ta-a-ruta-a-ru
TextExpectedActual
test_2_find_onset:
Passedaa
Passedḫalhh
Passedpalpp
Passedbalbb
Passedširss
Passedḫašhh
Passedpátpp
Passedga₅gg
Passedka₄kk
Passedin₄ii
Passednn
Passed3033
TextExpectedActual
test_3_find_coda:
Passedss
Passedḫalll
Passedpalll
Passedballl
Passedširrr
Passedḫašss
Passedpáttt
Passedga₅aa
Passedka₄aa
Passedin₄nn
Passedee
Passed3000
TextExpectedActual
test_4_hash_sign:
Passed-{{"it", c="t", o="i"}, {"id", c="d", o="i"}, {"et", c="t", o="e"}, {"ed", c="d", o="e"}, c_hash=192, hit=true, o_hash=6}{{"it", c="t", o="i"}, {"id", c="d", o="i"}, {"et", c="t", o="e"}, {"ed", c="d", o="e"}, c_hash=192, hit=true, o_hash=6}
TextExpectedActual
test_5_copy_sign:
Passed-{{"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}{{"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}

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