全部測試及格。 (刷新)

文字 預期 實際 Differs at Comments
test_ipa:
Passed będąc bæ̃dɑ̃t͡s bæ̃dɑ̃t͡s
Passed przykład (respelled przykła:d) pr̝ikɫaːt pr̝ikɫaːt 10th-15th CE
Passed przykład (respelled przykła:d) pr̝ikɫɒt pr̝ikɫɒt 15th CE
Passed aczżeż ad͡ʒʒɛʃ ad͡ʒʒɛʃ
Passed bleń blʲɛɲ blʲɛɲ
Passed elkierz ɛlʲkjɛr̝ ɛlʲkjɛr̝
Passed dobrzemówić dɔbr̝ɛmɔːvit͡ɕ dɔbr̝ɛmɔːvit͡ɕ 10th-15th CE
Passed dobrzemówić dɔbr̝ɛmovit͡ɕ dɔbr̝ɛmovit͡ɕ 15th CE
Passed połam (respelled poła:ḿ) pɔɫaːmʲ pɔɫaːmʲ 10th-15th CE
Passed połam (respelled poła:ḿ) pɔɫɒmʲ pɔɫɒmʲ 15th CE
Passed gołąb (respelled gołą) ɡɔɫɑ̃pʲ ɡɔɫɑ̃pʲ
Passed brew (respelled breẃ) brɛfʲ brɛfʲ
Passed drap (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
Passed wspowiedź (respelled wspowie?dź) fspɔvjɛ(ː)t͡ɕ fspɔvjɛ(ː)t͡ɕ 10th-15th CE
Passed wspowiedź (respelled wspowie?dź) fspɔvjɛt͡ɕ, fspɔvjet͡ɕ fspɔvjɛt͡ɕ, fspɔvjet͡ɕ 15th CE
Passed człowiectwo t͡ʃɫɔvjɛt͡stfɔ t͡ʃɫɔvjɛt͡stfɔ
Passed kocieł kɔt͡ɕɛɫ kɔt͡ɕɛɫ
Passed barzo (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łą"},
		{"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