Module:Sandbox/isaacl/ColourSpace/testcases explained

-- Unit test cases for .-- Click on talk page to run tests.

local me = require('Module:UnitTests')

local cs = require('Module:Sandbox/isaacl/ColourSpace')

function me:test_Colour_convert_template_identity self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "127---0---255") self:preprocess_equals('', "#7F, #00, #FF") self:preprocess_equals('', "49.8039291568627%, 0%, 100%") self:preprocess_equals('', "#7F00FF")end

function me:test_Colour_convert_template_sRGB self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "#7F, #00, #FF") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "#7F, #00, #FF") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "#7F00FF")end

function me:test_Colour_convert_template_sRGB24bit self:preprocess_equals('', "49.803921568627%, 0%, 100%") self:preprocess_equals('', "49.803921568627%:0%:100%") self:preprocess_equals('', "49.803921568627%, 0%, 100%")

self:preprocess_equals('', "49.803921568627%, 0%, 100%") self:preprocess_equals('', "49.803921568627%:0%:100%") self:preprocess_equals('', "49.803921568627%, 0%, 100%")

self:preprocess_equals('', "#7F00FF")

end

function me:test_Colour_convert_template_sRGB24bitHex self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "49.803921568627%, 0%, 100%")

self:preprocess_equals('', "#7F00FF")

end

function me:test_Colour_convert_template_sRGB24bitHexString self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "49.803921568627%, 0%, 100%") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "170, 34, 255") self:preprocess_equals('', "#AA, #22, #FF")

self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "49.803921568627%, 0%, 100%") self:preprocess_equals('', "127, 0, 255") self:preprocess_equals('', "170, 34, 255") self:preprocess_equals('', "#AA, #22, #FF")

end

function me:test_Colour_convert_template_W3Cnames self:preprocess_equals('', "steelblue") self:preprocess_equals('', "springgreen") self:preprocess_equals('', "mediumaquamarine") self:preprocess_equals('', "rebeccapurple")

self:preprocess_equals('', "70, 130, 180") self:preprocess_equals('', "0, 255, 127") self:preprocess_equals('', "102, 205, 170") self:preprocess_equals('', "102, 51, 153")

self:preprocess_equals('', "40%, 80.392156862745%, 66.666666666667%")

self:preprocess_equals('', "InvalidValue badInputValues") self:preprocess_equals('', "InvalidValue conversionError 112, 205, 170")

self:preprocess_equals('', "#663399") self:preprocess_equals('', "rebeccapurple")

end

function me:test_ColourSpaceModule self:preprocess_equals('', "49.803921568627%, 0%, 100%") self:preprocess_equals('', "49.803921568627%, 0%, 100%")

self:preprocess_equals('', "#7F, #00, #FF")

end

return me