Jump to content

Module:Color/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ftrebien (talk | contribs) at 21:57, 10 January 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local p = require('Module:UnitTests')

function p:test01_rgb()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToRgbTriplet|fefdfc}}',
		'{{#invoke:Color|hexToRgbTriplet|fefdfc}}'
    )
end

function p:test02_hsl_black()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsl|precision=3|000}}',
		'{{#invoke:Color        |hexToHsl|precision=3|000}}'
    )
end

function p:test03_hsl_white()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsl|precision=3|FFF}}',
		'{{#invoke:Color        |hexToHsl|precision=3|FFF}}'
    )
end

function p:test04_hsl_crimson()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsl|precision=3|DC143C}}',
		'{{#invoke:Color        |hexToHsl|precision=3|DC143C}}'
    )
end

function p:test05_hsl_msgreen()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsl|precision=3|00FA9A}}',
		'{{#invoke:Color        |hexToHsl|precision=3|00FA9A}}'
    )
end

function p:test06_hsl_rblue()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsl|precision=3|4169E1}}',
		'{{#invoke:Color        |hexToHsl|precision=3|4169E1}}'
    )
end

function p:test07_hsv_black()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsv|precision=3|000}}',
		'{{#invoke:Color        |hexToHsv|precision=3|000}}'
    )
end

function p:test08_hsv_white()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsv|precision=3|FFF}}',
		'{{#invoke:Color        |hexToHsv|precision=3|FFF}}'
    )
end

function p:test09_hsv_crimson()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsv|precision=3|DC143C}}',
		'{{#invoke:Color        |hexToHsv|precision=3|DC143C}}'
    )
end

function p:test10_hsv_msgreen()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsv|precision=3|00FA9A}}',
		'{{#invoke:Color        |hexToHsv|precision=3|00FA9A}}'
    )
end

function p:test11_hsv_rblue()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToHsv|precision=3|4169E1}}',
		'{{#invoke:Color        |hexToHsv|precision=3|4169E1}}'
    )
end

function p:test12_cielch_black()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|000}}',
		'{{#invoke:Color        |hexToCielch|precision=3|000}}'
    )
end

function p:test13_cielch_white()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|FFF}}',
		'{{#invoke:Color        |hexToCielch|precision=3|FFF}}'
    )
end

function p:test14_cielch_red()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|F00}}',
		'{{#invoke:Color        |hexToCielch|precision=3|F00}}'
    )
end

function p:test15_cielch_yellow()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|FF0}}',
		'{{#invoke:Color        |hexToCielch|precision=3|FF0}}'
    )
end

function p:test16_cielch_green()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|0F0}}',
		'{{#invoke:Color        |hexToCielch|precision=3|0F0}}'
    )
end

function p:test17_cielch_cyan()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|0FF}}',
		'{{#invoke:Color        |hexToCielch|precision=3|0FF}}'
    )
end

function p:test18_cielch_blue()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|00F}}',
		'{{#invoke:Color        |hexToCielch|precision=3|00F}}'
    )
end

function p:test19_cielch_magenta()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|F0F}}',
		'{{#invoke:Color        |hexToCielch|precision=3|F0F}}'
    )
end

function p:test20_cielch_grey()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|808080}}',
		'{{#invoke:Color        |hexToCielch|precision=3|808080}}'
    )
end

function p:test21_cielch_awhite()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|FAEBD7}}',
		'{{#invoke:Color        |hexToCielch|precision=3|FAEBD7}}'
    )
end

function p:test22_cielch_onyx()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|353839}}',
		'{{#invoke:Color        |hexToCielch|precision=3|353839}}'
    )
end

function p:test23_cielch_licorice()
	self:preprocess_equals_preprocess(
		'{{#invoke:Color/sandbox|hexToCielch|precision=3|1A1110}}',
		'{{#invoke:Color        |hexToCielch|precision=3|1A1110}}'
    )
end

return p