Jump to content

Module:cbk-pronunc/testcases

From Wiktionary, the free dictionary

1 of 23 tests failed. (refresh)

TextExpectedActual
test_phonetic_pron:
Passedaccidenteaɡ.siˈd̪ẽn̪.t̪eaɡ.siˈd̪ẽn̪.t̪e
Passedbancoˈbãŋ.koˈbãŋ.ko
Passedbatàˈba.t̪aʔˈba.t̪aʔ
Passedcasaˈka.saˈka.sa
PassedChavacanot͡ʃa.baˈka.not͡ʃa.baˈka.no
Passedcolegiokoˈle.xjokoˈle.xjo
PassedDiosˈd͡ʒosˈd͡ʒos
Passeddulceˈd̪ul.seˈd̪ul.se
Passedestrellases̪ˈt̪ɾe.ʎases̪ˈt̪ɾe.ʎas
PassedEstados Unidoses̪ˌt̪a.d̪os uˈni.d̪oses̪ˌt̪a.d̪os uˈni.d̪os
Passedestaciónes̪.t̪aˈʃõnes̪.t̪aˈʃõn
Passedgenteˈxẽn̪.t̪eˈxẽn̪.t̪e
Passedguerraˈɡe.raˈɡe.ra
Passedhonraˈõn.raˈõn.ra
Passedhoyˈoi̯ˈoi̯
Passedlápizˈla.pisˈla.pis
Passedpolloˈpo.ʎoˈpo.ʎo
Passedraízraˈisraˈis
Passedsolˈsolˈsol
Passedsoldaosol̪ˈd̪a.osol̪ˈd̪a.o
Passedtanqueˈt̪ãŋ.keˈt̪ãŋ.ke
Passedtierraˈt͡ʃe.raˈt͡ʃe.ra
Failedyoˈɟ͡ʝoˈʝ͡ʝo

tests = require("Module:UnitTests")
local m_cbk_pronunc = require("Module:cbk-pronunc")
local m_links = require('Module:links')

local options = { display = tag_IPA }

local cbk = require('Module:languages').getByCode('cbk')

local function cbk_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end
local function link(text)
	return m_links.full_link{ term = text, lang = cbk }
end

function tests:check_phonetic_ipa(word, expected, respelling)
	self:equals(
		link(word)  ..
			(respelling and (" (respelled " .. respelling .. ")") or ""),
		m_cbk_pronunc.IPA(word or respelling, true),
		expected,
		{ display = cbk_IPA }
	)
end

function tests:test_phonetic_pron()
	local examples = {
        { "accidente", "aɡ.siˈd̪ẽn̪.t̪e" },
        { "banco", "ˈbãŋ.ko"},
        { "batà", "ˈba.t̪aʔ" },
        { "casa", "ˈka.sa" },
        { "Chavacano", "t͡ʃa.baˈka.no" },
        { "colegio", "koˈle.xjo" },
        { "Dios", "ˈd͡ʒos" },
        { "dulce", "ˈd̪ul.se" },
        { "estrellas", "es̪ˈt̪ɾe.ʎas" },
        { "Estados Unidos", "es̪ˌt̪a.d̪os uˈni.d̪os" },
        { "estación", "es̪.t̪aˈʃõn"},
        { "gente", "ˈxẽn̪.t̪e" },
        { "guerra", "ˈɡe.ra" },
        { "honra", "ˈõn.ra"},
        { "hoy", "ˈoi̯"},
        { "lápiz", "ˈla.pis"},
        { "pollo", "ˈpo.ʎo" },
        { "raíz", "raˈis"},
        { "sol", "ˈsol" },
        { "soldao", "sol̪ˈd̪a.o" },
        { "tanque", "ˈt̪ãŋ.ke"},
        { "tierra", "ˈt͡ʃe.ra"},
        { "yo", "ˈɟ͡ʝo"},
    }
	self:iterate(examples, "check_phonetic_ipa")
end

return tests