Module:Sandbox/DePiep/sandbox/testcases

-- Unit tests. local p = require('Module:UnitTests')

function p:test_basic -- basic self:preprocess_equals('', '000') self:preprocess_equals('', '000') self:preprocess_equals('', '001') self:preprocess_equals('', '010') self:preprocess_equals('', '011') self:preprocess_equals('', '100') self:preprocess_equals('', '101') self:preprocess_equals('', '110') self:preprocess_equals('', '111') self:preprocess_equals('', '111 err') end

function p:test_borders -- jj over length self:preprocess_equals('', '001') self:preprocess_equals('', '011') self:preprocess_equals('', '101') self:preprocess_equals('', '111') self:preprocess_equals('', '111 err') end

function p:test_negatives -- j neg self:preprocess_equals('', '001') self:preprocess_equals('', '011') self:preprocess_equals('', '101') self:preprocess_equals('', '111') self:preprocess_equals('', '111')

-- i neg self:preprocess_equals('', '100') self:preprocess_equals('', '101') self:preprocess_equals('', '110') self:preprocess_equals('', '111') self:preprocess_equals('', '111')

-- negative length substr self:preprocess_equals('', '010') self:preprocess_equals('', '011') self:preprocess_equals('', '011') self:preprocess_equals('', '110') self:preprocess_equals('', '011') self:preprocess_equals('', '111') self:preprocess_equals('', '111') end

function p:test_blanks --blank self:preprocess_equals('', ' ') self:preprocess_equals('', ' ') self:preprocess_equals('', ' ') end

function p:test_index_0 -- i, j =0 error self:preprocess_equals('', '0 index') self:preprocess_equals('', '0 index') self:preprocess_equals('', '0 index') end

return p