Difference between revisions of "Module:User:DePiep/sandbox/testcases"

From blackwiki
Jump to navigation Jump to search
blackwiki>DePiep
blackwiki>DePiep
Line 1: Line 1:
-- Unit tests. Click talk page to run tests.
+
-- Unit tests.
 
local p = require('Module:UnitTests')
 
local p = require('Module:UnitTests')
  
Line 14: Line 14:
 
     self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|}}', '110 todo')
 
     self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|}}', '110 todo')
 
     self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|7}}', '111 todo')
 
     self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|7}}', '111 todo')
 +
 +
-- jj over length
 +
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|||13}}', '001 todo')
 +
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||4|13}}', '011 todo')
 +
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||13}}', '101 todo')
 +
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|10|4|13}}', '111 todo')
  
 
-- negative substr
 
-- negative substr

Revision as of 15:29, 22 March 2013

Documentation for this module may be created at Module:User:DePiep/sandbox/testcases/doc

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


function p:test_ss()
-- basic
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij}}', '000 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|||}}', '000 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|||7}}', '001 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||4|}}', '010 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||4|7}}', '011 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||}}', '100 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||7}}', '101 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|}}', '110 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|4|7}}', '111 todo')

-- jj over length
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|||13}}', '001 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||4|13}}', '011 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||13}}', '101 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|10|4|13}}', '111 todo')

-- negative substr
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||-4|}}', '010 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij||-4|7}}', '011 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|-4|}}', '110 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|-4|7}}', '111 todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|10|-4|7}}', '111 todo')


--
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||7}}', 'todo')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2||7}}', 'todo')

--blank
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss||2||7}}', '<blank>')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss||2|0|7}}', '<blank>')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|ss|abcdefghij|2|0|7}}', '<blank>')
end

function p:test_hw()
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|hw}}', 'Hello my own world')
    self:preprocess_equals('{{#invoke:User:DePiep/sandbox|sub|abcdefghij|2||7}}', 'bcdefg')
end

return p