Module:sh-IPA/testcases
Appearance
- The following documentation is located at Module:sh-IPA/testcases/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
2 of 28 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
Words chosen at random | |||
аеробиоло̀гија aerobiològija | /aerobiolǒɡija/ | /aerobiolǒɡija/ | |
аба̀жӯр abàžūr | /abǎʒuːr/ | /abǎʒuːr/ | |
ђа̏вољӣ đȁvoljī | /d͡ʑâʋoʎiː/ | /d͡ʑâʋoʎiː/ | |
адсо̀рпцӣјскӣ adsòrpcījskī | /adsǒrpt͡siːjskiː/ | /adsǒrpt͡siːjskiː/ | |
адвентѝстичкӣ adventìstičkī | /adʋentǐstit͡ʃkiː/ | /adʋentǐstit͡ʃkiː/ | |
о̀риз òriz | /ǒriz/ | /ǒriz/ | |
а̏баџија ȁbadžija | /âbad͡ʒija/ | /âbad͡ʒija/ | |
грје̏шка grjȅška | /ɡrjêʃka/ | /ɡrjêʃka/ | |
сло̀вӣнскӣ slòvīnskī | /slǒʋiːnskiː/ | /slǒʋiːnskiː/ | |
ју̏трошњӣ jȕtrošnjī | /jûtroʃɲiː/ | /jûtroʃɲiː/ | |
ћа̏ћа ćȁća | /t͡ɕât͡ɕa/ | /t͡ɕât͡ɕa/ | |
Аборѝџиница Aborìdžinica | /aborǐd͡ʒinit͡sa/ | /aborǐd͡ʒinit͡sa/ | |
False digraphs | |||
наджи́вјети (над'жи́вјети) nadžívjeti (nad'žívjeti) | /nadʒǐːʋjeti/ | /nadʒǐːʋjeti/ | |
надја̀чати nadjàčati | /nadjǎt͡ʃati/ | /nadjǎt͡ʃati/ | |
Syllabic sonorants | |||
цр̑н cȓn | /t͡sr̩̂ːn/ | /t͡sr̩̂ːn/ | |
вр́ба vŕba | /ʋř̩ːba/ | /ʋř̩ːba/ | |
р̀ђати r̀đati | /ř̩d͡ʑati/ | /ř̩d͡ʑati/ | |
зар̀ђати zar̀đati | /zař̩d͡ʑati/ | /zař̩d͡ʑati/ | |
брзѝна brzìna | /br̩zǐna/ | /br̩zǐna/ | |
маса̀кр masàkr | /masǎkr̩/ | /masǎkr̩/ | |
бицѝкл bicìkl | /bit͡sǐkl̩/ | /bit͡sǐkl̩/ | |
кловн klovn | /kloʋn̩/ | /kloʋn̩/ | |
жа̏нр žȁnr | /ʒânr̩/ | /ʒânr̩/ | |
кре̏мљ krȅmlj | /krêmʎ̩/ | /krêmʎ̩/ | |
Montenegrin letters | |||
с́у̏тра śȕtra | /ɕûtra/ | /ɕûtra/ | |
Torlakian | |||
аба́ити abáiti | /aˈbaiti/ | /abǎːiti/ | |
понаѕр́нѕити ponadzŕndziti | /ponaˈdzr̩ndziti/ | /ponadzř̩ːndziti/ | |
кьт kăt | /kət/ | /kət/ |
local tests = require("Module:UnitTests")
local to_IPA = require("Module:sh-IPA").to_IPA
local decompose = mw.ustring.toNFD
local ugsub = mw.ustring.gsub
local diacritic = "[" .. decompose("ȁàȃáāã"):gsub("a", "") .. "]"
local function make_entry_name(text)
return ugsub(decompose(text), "([aeiourаеиоур])" .. diacritic, "%1")
end
local function link(text, script)
return '<span class="' .. script .. '" lang="sh">[[' .. make_entry_name(text) .. '#Serbo-Croatian|' .. text .. ']]</span>'
end
local function tag(text, script)
return '<span class="' .. script .. '" lang="sh">' .. text .. '</span>'
end
local function show_link_and_respelling(entry, respelling, script)
return link(entry, script)
.. (respelling and " (" .. tag(respelling, script) .. ")" or "")
end
local options = {
display = function(text)
return '<span class="IPA">' .. text .. '</span>'
end
}
function tests:check(Cyrillic, Latin, IPA, Cyrillic_respelling, Latin_respelling)
local IPA1, IPA2 =
to_IPA(Cyrillic_respelling or Cyrillic), to_IPA(Latin_respelling or Latin)
if IPA1 == IPA2 then
self:equals(show_link_and_respelling(Cyrillic, Cyrillic_respelling, "Cyrl")
.. "<br>" .. show_link_and_respelling(Latin, Latin_respelling, "Latn"),
IPA1, IPA, options)
else
self:equals(show_link_and_respelling(Cyrillic, Cyrillic_respelling, "Cyrl"),
IPA1, IPA, options)
self:equals(show_link_and_respelling(Latin, Latin_respelling, "Latn"),
IPA2, IPA, options)
end
end
function tests:test()
local examples = {
"Words chosen at random",
{ "аеробиоло̀гија", "aerobiològija", "/aerobiolǒɡija/" },
{ "аба̀жӯр", "abàžūr", "/abǎʒuːr/" },
{ "ђа̏вољӣ", "đȁvoljī", "/d͡ʑâʋoʎiː/" },
{ "адсо̀рпцӣјскӣ", "adsòrpcījskī", "/adsǒrpt͡siːjskiː/" },
{ "адвентѝстичкӣ", "adventìstičkī", "/adʋentǐstit͡ʃkiː/" },
{ "о̀риз", "òriz", "/ǒriz/" },
{ "а̏баџија", "ȁbadžija", "/âbad͡ʒija/" },
{ "грје̏шка", "grjȅška", "/ɡrjêʃka/" },
{ "сло̀вӣнскӣ", "slòvīnskī", "/slǒʋiːnskiː/" },
{ "ју̏трошњӣ", "jȕtrošnjī", "/jûtroʃɲiː/" },
{ "ћа̏ћа", "ćȁća", "/t͡ɕât͡ɕa/" },
{ "Аборѝџиница", "Aborìdžinica", "/aborǐd͡ʒinit͡sa/" },
"False digraphs",
{ "наджи́вјети", "nadžívjeti", "/nadʒǐːʋjeti/", "над'жи́вјети", "nad'žívjeti", },
{ "надја̀чати", "nadjàčati", "/nadjǎt͡ʃati/" },
"Syllabic sonorants",
{ "цр̑н", "cȓn", "/t͡sr̩̂ːn/" },
{ "вр́ба", "vŕba", "/ʋř̩ːba/" },
{ "р̀ђати", "r̀đati", "/ř̩d͡ʑati/" },
{ "зар̀ђати", "zar̀đati", "/zař̩d͡ʑati/" },
{ "брзѝна", "brzìna", "/br̩zǐna/" },
{ "маса̀кр", "masàkr", "/masǎkr̩/" },
{ "бицѝкл", "bicìkl", "/bit͡sǐkl̩/" },
{ "кловн", "klovn", "/kloʋn̩/" }, --not sure of pitch accent
{ "жа̏нр", "žȁnr", "/ʒânr̩/" },
{ "кре̏мљ", "krȅmlj", "/krêmʎ̩/" },
"Montenegrin letters",
{ "с́у̏тра", "śȕtra", "/ɕûtra/" },
"Torlakian",
{ "аба́ити", "abáiti", "/aˈbaiti/" },
{ "понаѕр́нѕити", "ponadzŕndziti", "/ponaˈdzr̩ndziti/" },
{ "кьт", "kăt", "/kət/" },
}
self:iterate(examples, "check")
end
return tests