Jump to content

Module:Infobox dim/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Hike395 (talk | contribs) at 12:21, 4 October 2024 (create test cases for dim). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')

-- Example unit test.
function p:test_dim()
	self:preprocess_equals('{{#invoke:Infobox dim | dim |length_km=20|width_km=30}}','15km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |length_mi=20|width_mi=30}}','24km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |width_km=20|length_km=30}}','15km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |width_mi=20|length_mi=30}}','24km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |length_km=20}}','10km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |length_mi=20}}','16km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |width_km=30}}','15km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |width_mi=30}}','24km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |area_km2=300}}','17km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |area_mi2=200}}','22km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |area_ha=30,000}}','17km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |area_acre=75,000}}','17km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |dim=50km}}','50km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |scale=100000}}','24km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |type=mountain}}','24km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |type=city|population=100000}}','11km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim |type=mountain|length_km=20}}','10km')
	self:preprocess_equals('{{#invoke:Infobox dim | dim }}','')
end

return p