Module:Range/testcases

-- Unit tests for Module:Range. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_iswitch self:preprocess_equals_many('', {       {' value = 7 | 0..10 = pass | 20 = fail | default = fail ', 'pass'},        {' value = 1e6 | 0..100 = fail | 1e5..1e7 = pass | default = fail', 'pass'},        {' value = -44 | 8 9 10 -44 = pass | 15 16 100..1e12 = fail| default = fail', 'pass'},        {' value = 12.44 | 1..12.4399999 = fail | 12.44000001..40 50 60 = fail | default = pass ', 'pass'},        {' value = 7 | 1 = fail | -500..0.8 = fail | 7 = pass ', 'pass'},        {' value = 1 | 1 = pass | -500..0.8 = fail | 7 = fail ', 'pass'},        {' value = 20 | 1..20) = fail | default = pass ', 'pass' }, {' value = 20 | (20..200 = fail | default = pass ', 'pass' },       {' value = -1e9 | ..20 = pass | default = fail ', 'pass' },        {' value = 1e9 | 1.5.. = pass | default = fail ', 'pass' },        {' value = 1 | blablabla = faill | default = fail ', 'Script error' }, -- bad range        {' value = Hey Jude | 14 = fail | default = fail ', 'Script error' }, -- value is not a nubmer        {' 12 = faill | default = fail ', 'Script error' }, -- no "value" parameter

}) end return p