Jump to content

Module:ms-pron/testcases

From Wiktionary, the free dictionary

1 of 25 tests failed. (refresh)

TextExpectedActual
test_phonetic_pron:
Passedairˈa.erˈa.er
Passedanjingˈaɲ.d͡ʒeŋˈaɲ.d͡ʒeŋ
Passedbaikˈba.eʔˈba.eʔ
Passedbukaˈbu.kəˈbu.kə
Passedcuciˈt͡ʃu.t͡ʃiˈt͡ʃu.t͡ʃi
Passeddatangˈda.t̪aŋˈda.t̪aŋ
PassedFebruarifep.ruˈa.rifep.ruˈa.ri
Passedgajahˈɡa.d͡ʒahˈɡa.d͡ʒah
Passedgerejaɡəˈre.d͡ʒəɡəˈre.d͡ʒə
Passedgunungˈɡu.noŋˈɡu.noŋ
Passedhijauˈhi.d͡ʒau̯ˈhi.d͡ʒau̯
Passedkhidmatˈxit̪.mat̪ˈxit̪.mat̪
Passedlautˈla.ot̪ˈla.ot̪
Passednasionalismena.sjo.naˈlis.məna.sjo.naˈlis.mə
Passednikmatˈniʔ.mat̪ˈniʔ.mat̪
Passed-nyaɲəɲə
Passedpakaianpaˈka.janpaˈka.jan
Passedpantaiˈpan.t̪ai̯ˈpan.t̪ai̯
Failedperiapəˈrjəˈpə.rjə
Passedpulauˈpu.lau̯ˈpu.lau̯
PassedQur'anquˈranquˈran
Passedrakyatˈraʔ.jat̪ˈraʔ.jat̪
Passedselamatsəˈla.mat̪səˈla.mat̪
Passedsyaratˈʃa.rat̪ˈʃa.rat̪
Passedtidakˈt̪i.daʔˈt̪i.daʔ

local tests = require("Module:UnitTests")
local m_ms_pron = require("Module:ms-pron")

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

local options = { display = Ms_IPA }

function tests:check_phonetic_ipa(text, expected, respelling)
	self:equals(
		"[[" .. text .. "#Malay|" .. text .. "]]",
		m_ms_pron.IPA(respelling, true),
		expected,
		{ display = ms_IPA }
	)
end

function tests:test_phonetic_pron()
	local examples = {
        { "air", "ˈa.er", "aér" },
        { "anjing", "ˈaɲ.d͡ʒeŋ", "anjéng" },
        { "baik", "ˈba.eʔ", "baék" },
        { "buka", "ˈbu.kə", "būke" },
        { "cuci","ˈt͡ʃu.t͡ʃi", "cuci"},
		{ "datang","ˈda.t̪aŋ", "datang" },
        { "Februari","fep.ruˈa.ri", "Fébru.ari" },
        { "gajah", "ˈɡa.d͡ʒah", "gajah" },
		{ "gereja","ɡəˈre.d͡ʒə", "geréje" },
		{ "gunung","ˈɡu.noŋ", "gunong" },
        { "hijau","ˈhi.d͡ʒau̯", "hijau" },
		{ "khidmat", "ˈxit̪.mat̪", "khidmat"},
        { "laut", "ˈla.ot̪", "laot" },
        { "nasionalisme", "na.sjo.naˈlis.mə", "na.sionalisme" },
        { "nikmat", "ˈniʔ.mat̪", "ni7mat" },
        { "-nya","ɲə", "-nye" },
        { "pakaian","paˈka.jan", "pakaian" },
        { "pantai", "ˈpan.t̪ai̯", "pantai" },
		{ "peria", "pəˈrjə", "perie"},
        { "pulau", "ˈpu.lau̯", "pulau" },
		{ "Qur'an", "quˈran", "qurān"},
        { "rakyat", "ˈraʔ.jat̪", "rak.yat" },
		{ "selamat", "səˈla.mat̪", "selamat"},
		{ "syarat", "ˈʃa.rat̪", "syarat"},
		{ "tidak", "ˈt̪i.daʔ", "tidak"},
	}
	self:iterate(examples, "check_phonetic_ipa")
end

return tests