Module:zlw-opl-IPA/testcases

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

All tests passed. (refresh)

TextExpectedActualDiffers atComments
test_ipa:
Passedbędącbæ̃dɑ̃t͡sbæ̃dɑ̃t͡s
Passedprzykład (respelled przykła:d)pr̝ikɫaːtpr̝ikɫaːt10th-15th CE
Passedprzykład (respelled przykła:d)pr̝ikɫɒtpr̝ikɫɒt15th CE
Passedaczżeżad͡ʒʲʒʲɛʃad͡ʒʲʒʲɛʃ
Passedbleńblʲɛɲblʲɛɲ
Passedelkierzɛlʲkjɛr̝ɛlʲkjɛr̝
Passeddobrzemówićdɔbr̝ɛmɔːvit͡ɕdɔbr̝ɛmɔːvit͡ɕ10th-15th CE
Passeddobrzemówićdɔbr̝ɛmovit͡ɕdɔbr̝ɛmovit͡ɕ15th CE
Passedpołam (respelled poła:ḿ)pɔɫaːmʲpɔɫaːmʲ10th-15th CE
Passedpołam (respelled poła:ḿ)pɔɫɒmʲpɔɫɒmʲ15th CE
Passedgołąb (respelled gołąb́)ɡɔɫɑ̃pʲɡɔɫɑ̃pʲ
Passedbrew (respelled breẃ)brɛfʲbrɛfʲ
Passeddrap (respelled draṕ)drapʲdrapʲ
Passedżołdnierz (respelled żołdnie?rz)ʒʲɔɫdɲɛ(ː)r̝ʒʲɔɫdɲɛ(ː)r̝10th-15th CE
Passedżołdnierz (respelled żołdnie?rz)ʒʲɔɫdɲɛr̝, ʒʲɔɫdɲer̝ʒʲɔɫdɲɛr̝, ʒʲɔɫdɲer̝15th CE
Passedwspowiedź (respelled wspowie?dź)fspɔvjɛ(ː)t͡ɕfspɔvjɛ(ː)t͡ɕ10th-15th CE
Passedwspowiedź (respelled wspowie?dź)fspɔvjɛt͡ɕ, fspɔvjet͡ɕfspɔvjɛt͡ɕ, fspɔvjet͡ɕ15th CE
Passedczłowiectwot͡ʃʲɫɔvjɛt͡stfɔt͡ʃʲɫɔvjɛt͡stfɔ
Passedkociełkɔt͡ɕɛɫkɔt͡ɕɛɫ
Passedbarzo (respelled bar-zo)barzɔbarzɔ

local tests = require("Module:UnitTests")
local m_IPA = require("Module:zlw-opl-IPA")
local m_table = require("Module:table")
local lang = require("Module:languages").getByCode("zlw-opl")

function link(term)
	return require("Module:links").full_link {
		term = term,
		lang = lang
	}
end

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

local options = {display = tag_IPA}

function tests:check_ipa(term, expected_pre, expected_post, respelling)
	if expected_post == nil then
		expected_post = expected_pre
	end

	local pre = m_IPA.phonemic(respelling or term)
	local post = m_IPA.phonemic(respelling or term, true)
	local show_both = not m_table.deepEquals(pre, post)

	options.comment = show_both and "10<sup>th</sup>-15<sup>th</sup> CE"
	tests:equals(
		link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),
		m_table.sparseConcat(pre, ", "),
		expected_pre,
		options
	)

	if show_both then
		options.comment = show_both and "15<sup>th</sup> CE"
		tests:equals(
			link(term) .. (respelling and (" (respelled " .. respelling .. ")") or ""),
			m_table.sparseConcat(post, ", "),
			expected_post,
			options
		)
	end
end

function tests:test_ipa()
	local examples = {
		{"będąc", "bæ̃dɑ̃t͡s"},
		{"przykład", "pr̝ikɫaːt", "pr̝ikɫɒt", "przykła:d"},
		{"aczżeż", "ad͡ʒʲʒʲɛʃ"},
		{"bleń", "blʲɛɲ"},
		{"elkierz", "ɛlʲkjɛr̝"},
		{"dobrzemówić", "dɔbr̝ɛmɔːvit͡ɕ", "dɔbr̝ɛmovit͡ɕ"},
		{"połam", "pɔɫaːmʲ", "pɔɫɒmʲ", "poła:ḿ"},
		{"gołąb", "ɡɔɫɑ̃pʲ", "ɡɔɫɑ̃pʲ", "gołąb́"},
		{"brew", "brɛfʲ", "brɛfʲ", "breẃ"},
		{"drap", "drapʲ", "drapʲ", "draṕ"},
		{"żołdnierz", "ʒʲɔɫdɲɛ(ː)r̝", "ʒʲɔɫdɲɛr̝, ʒʲɔɫdɲer̝", "żołdnie?rz"},
		{"wspowiedź", "fspɔvjɛ(ː)t͡ɕ", "fspɔvjɛt͡ɕ, fspɔvjet͡ɕ", "wspowie?dź"},
		{"człowiectwo", "t͡ʃʲɫɔvjɛt͡stfɔ"},
		{"kocieł", "kɔt͡ɕɛɫ"},
		{"barzo", "barzɔ", "barzɔ", "bar-zo"}
	}

	tests:iterate(examples, "check_ipa")
end

return tests