Module:es-headword/testcases

Definition from Wiktionary, the free dictionary
Jump to navigation Jump to search

5 tests failed. (refresh)

Text Expected Actual
test_adjective_forms:
ending in -o
Passed ponzoñoso ponzoñoso, ponzoñosos, ponzoñosa, ponzoñosas ponzoñoso, ponzoñosos, ponzoñosa, ponzoñosas
ending in -a
Passed química químico, químicos, química, químicas químico, químicos, química, químicas
ending in -e
Passed tolerable tolerable, tolerables, tolerable, tolerables tolerable, tolerables, tolerable, tolerables
ending in -ista
Passed culturalista culturalista, culturalistas, culturalista, culturalistas culturalista, culturalistas, culturalista, culturalistas
ending in -z
Passed feliz feliz, felices, feliz, felices feliz, felices, feliz, felices
ending in -or
Passed ahorrador ahorrador, ahorradores, ahorradora, ahorradoras ahorrador, ahorradores, ahorradora, ahorradoras
Passed ahorradora ahorrador, ahorradores, ahorradora, ahorradoras ahorrador, ahorradores, ahorradora, ahorradoras
Passed superior superior, superiores, superior, superiores superior, superiores, superior, superiores
ending in -ón
Passed alegrón alegrón, alegrones, alegrón, alegrones alegrón, alegrones, alegrón, alegrones
ending in -ín
Passed cantarín cantarín, cantarines, cantarina, cantarinas cantarín, cantarines, cantarina, cantarinas
ending in -l
Passed aluvial aluvial, aluviales, aluvial, aluviales aluvial, aluviales, aluvial, aluviales
Passed civil civil, civiles, civil, civiles civil, civiles, civil, civiles
ending in -ar
Passed auxiliar auxiliar, auxiliares, auxiliar, auxiliares auxiliar, auxiliares, auxiliar, auxiliares
ending in -és
Passed francés francés, franceses, francesa, francesas francés, franceses, francesa, francesas
ending in -án
Passed alemán alemán, alemanes, alemana, alemanas alemán, alemanes, alemana, alemanas
Text Expected Actual
test_noun_plurals:
nouns ending in unstressed vowel or á, é, ó
Passed pera peras peras
Passed bota botas botas
Passed sonido sonidos sonidos
Passed panti pantis pantis
Passed café cafés cafés
Passed papá papás papás
Passed buró burós burós
nouns ending in í or ú
Passed tisú tisús, tisúes tisús, tisúes
Passed tabú tabús, tabúes tabús, tabúes
Passed israelí israelís, israelíes israelís, israelíes
Passed marroquí marroquís, marroquíes marroquís, marroquíes
nouns ending in a vowel + y, l, r, n, d, j, or ch
Passed rey reyes reyes
Passed panel paneles paneles
Passed color colores colores
Failed alféizar alféizares alféizar
Passed can canes canes
Passed césped céspedes céspedes
Passed reloj relojes relojes
Passed sándwich sándwiches sándwiches
Passed orden órdenes órdenes
Passed volumen volúmenes volúmenes
Passed brasil brasiles brasiles
Passed níquel níqueles níqueles
Failed íleon íleones íleon
single syllable, ending in s or x
Passed mes meses meses
Passed fax faxes faxes
nouns ending in a vowel + z
Passed luz luces luces
Passed lápiz lápices lápices
Passed actriz actrices actrices
Passed voz voces voces
Passed maíz maíces maíces
noun ending in tz
Passed kibbutz kibbutz kibbutz
nouns ending in a stressed vowel + consonant
Passed botón botones botones
Passed compás compases compases
Passed acreditación acreditaciones acreditaciones
Passed champiñón champiñones champiñones
Failed tahúr tahúres tahures
nouns ending in a consonant cluster
Passed iceberg icebergs icebergs
nouns ending in a vowel + a consonant other than l, r, n, d, z, j, s, x, or ch
Passed esnob esnobs esnobs
Passed zigzag zigzags zigzags
Passed crac cracs cracs
Passed mamut mamuts mamuts
nouns ending in s or x with more than 1 syllable, last syllable unstressed
Passed análisis análisis análisis
Passed jueves jueves jueves
Passed lunes lunes lunes
Passed tórax tórax tórax
Passed cóccix cóccix cóccix
Passed ibex ibex ibex
Passed carcax carcax carcax
Passed bíceps bíceps bíceps
nouns ending in l, r, n, d, z, j, 3 or more syllables, accented on third to last syllable
Passed polisíndeton polisíndeton polisíndeton
noun + adjective
Passed número arábigo números arábigos números arábigos
Passed fórmula química fórmulas químicas fórmulas químicas
Passed accidente cerebrovascular accidentes cerebrovasculares accidentes cerebrovasculares
Passed arándano azul arándanos azules arándanos azules
Passed avión común aviones comunes aviones comunes
Passed católica romana católicas romanas católicas romanas
noun + prepositional phrase (de, del)
Passed hombre de letras hombres de letras hombres de letras
Passed hombre del mundo hombres del mundo hombres del mundo
Passed acero al carbono aceros al carbono aceros al carbono
other
Passed esmoquin esmóquines esmóquines
Failed guion guiones guíones
Failed ciempiés ciempiés ciempieses

local tests = require("Module:UnitTests")
local make_plural_noun = require("Module:es-headword").make_plural_noun
local adjective_forms = require("Module:es-headword").adjective_forms

local function link(word)
	return "[[" .. word .. "#Spanish|" .. word .. "]]"
end

function tests:check_noun_plurals(singular, expected_plural, gender)
	local r = make_plural_noun(singular, gender)
	local test = r.pl
	if r.pl2 then test = test .. ", " .. r.pl2 end
	
	self:equals(link(singular),
		test,
		expected_plural)
end

function tests:check_adjective_forms(singular, expected_forms, gender)
	local forms = adjective_forms(singular, gender)
	
	self:equals(link(singular),
		forms.ms .. ", " .. forms.mp .. ", " .. forms.fs .. ", " .. forms.fp,
		expected_forms.ms .. ", " .. expected_forms.mp .. ", " .. expected_forms.fs .. ", " .. expected_forms.fp)
end

function tests:test_noun_plurals()
	local examples = {
		"nouns ending in unstressed vowel or á, é, ó",
		{"pera", "peras"},
		{"bota", "botas"},
		{"sonido", "sonidos"},
		{"panti", "pantis"},
		{"café", "cafés"},
		{"papá", "papás"},
		{"buró", "burós"},
		
		"nouns ending in í or ú",
		{"tisú", "tisús, tisúes"},
		{"tabú", "tabús, tabúes"},
		{"israelí", "israelís, israelíes"},
		{"marroquí", "marroquís, marroquíes"},
		
		"nouns ending in a vowel + y, l, r, n, d, j, or ch",
		{"rey", "reyes"},
		{"panel", "paneles"},
		{"color", "colores"},
		{"alféizar", "alféizares"},
		{"can", "canes"},
		{"césped", "céspedes"},
		{"reloj", "relojes"},
		{"sándwich", "sándwiches"},
		{"orden", "órdenes"},
		{"volumen", "volúmenes"},
		{"brasil", "brasiles"},
		{"níquel", "níqueles"}, -- maybe shouldn't have a plural, but ...
		{"íleon", "íleones"},

		"single syllable, ending in s or x",
		{"mes", "meses"},
		{"fax", "faxes"},
		
		"nouns ending in a vowel + z",
		{"luz", "luces"},
		{"lápiz", "lápices"},
		{"actriz", "actrices"},
		{"voz", "voces"},
		{"maíz", "maíces"},
		
		"noun ending in tz",
		{"kibbutz", "kibbutz"},
		
		"nouns ending in a stressed vowel + consonant",
		{"botón", "botones"},
		{"compás", "compases"},
		{"acreditación", "acreditaciones"},
		{"champiñón", "champiñones"},
		{"tahúr", "tahúres"},
		
		"nouns ending in a consonant cluster",
		{"iceberg", "icebergs"},
		
		"nouns ending in a vowel + a consonant other than l, r, n, d, z, j, s, x, or ch",
		{"esnob", "esnobs"},
		{"zigzag", "zigzags"},
		{"crac", "cracs"},
		{"mamut", "mamuts"},
		
		"nouns ending in s or x with more than 1 syllable, last syllable unstressed",
		{"análisis", "análisis"},
		{"jueves", "jueves"},
		{"lunes", "lunes"},
		{"tórax", "tórax"},
		{"cóccix", "cóccix"},
		{"ibex", "ibex"},
		{"carcax", "carcax"},
		{"bíceps", "bíceps"},
		
		"nouns ending in l, r, n, d, z, j, 3 or more syllables, accented on third to last syllable",
		{"polisíndeton", "polisíndeton"},
		
		"noun + adjective",
		{"número arábigo", "números arábigos", "m"},
		{"fórmula química", "fórmulas químicas", "f"},
		{"accidente cerebrovascular", "accidentes cerebrovasculares", "m"},
		{"arándano azul", "arándanos azules", "m"},
		{"avión común", "aviones comunes", "m"},
		{"católica romana", "católicas romanas", "f"},
		
		"noun + prepositional phrase (de, del)",
		{"hombre de letras", "hombres de letras"},
		{"hombre del mundo", "hombres del mundo"},
		{"acero al carbono", "aceros al carbono"},

		"other",
		{"esmoquin", "esmóquines"},
		{"guion", "guiones"},
		{"ciempiés", "ciempiés"}
	}
	
	tests:iterate(examples, "check_noun_plurals")
end

function tests:test_adjective_forms()
	local examples = {
		"ending in -o",
		{"ponzoñoso", {["ms"] = "ponzoñoso", ["mp"] = "ponzoñosos", ["fs"] = "ponzoñosa", ["fp"] = "ponzoñosas"}},
		
		"ending in -a",
		{"química", {["ms"] = "químico", ["mp"] = "químicos", ["fs"] = "química", ["fp"] = "químicas"}, "f"},
		
		"ending in -e",
		{"tolerable",  {["ms"] = "tolerable", ["mp"] = "tolerables", ["fs"] = "tolerable", ["fp"] = "tolerables"}},
		
		"ending in -ista",
		{"culturalista",  {["ms"] = "culturalista", ["mp"] = "culturalistas", ["fs"] = "culturalista", ["fp"] = "culturalistas"}},
		
		"ending in -z",
		{"feliz",  {["ms"] = "feliz", ["mp"] = "felices", ["fs"] = "feliz", ["fp"] = "felices"}},
		
		"ending in -or",
		{"ahorrador",  {["ms"] = "ahorrador", ["mp"] = "ahorradores", ["fs"] = "ahorradora", ["fp"] = "ahorradoras"}, "m"},
		{"ahorradora", {["ms"] = "ahorrador", ["mp"] = "ahorradores", ["fs"] = "ahorradora", ["fp"] = "ahorradoras"}, "f"},
		{"superior",  {["ms"] = "superior", ["mp"] = "superiores", ["fs"] = "superior", ["fp"] = "superiores"}, "m"},
		
		"ending in -ón",
		{"alegrón",  {["ms"] = "alegrón", ["mp"] = "alegrones", ["fs"] = "alegrón", ["fp"] = "alegrones"}},
		
		"ending in -ín",
		{"cantarín",  {["ms"] = "cantarín", ["mp"] = "cantarines", ["fs"] = "cantarina", ["fp"] = "cantarinas"}},
		
		"ending in -l",
		{"aluvial",  {["ms"] = "aluvial", ["mp"] = "aluviales", ["fs"] = "aluvial", ["fp"] = "aluviales"}},
		{"civil",  {["ms"] = "civil", ["mp"] = "civiles", ["fs"] = "civil", ["fp"] = "civiles"}},
		
		"ending in -ar",
		{"auxiliar", {["ms"]= "auxiliar", ["mp"] = "auxiliares", ["fs"] = "auxiliar", ["fp"] = "auxiliares"}},
		
		"ending in -és",
		{"francés", {["ms"] = "francés", ["mp"] = "franceses", ["fs"] = "francesa", ["fp"] = "francesas"}},
		
		"ending in -án",
		{"alemán", {["ms"] = "alemán", ["mp"] = "alemanes", ["fs"] = "alemana", ["fp"] = "alemanas"}}
	}
	
	tests:iterate(examples, "check_adjective_forms")
end
		
return tests