Jump to content

Module:Escape/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
speed benchmark
Line 1: Line 1:
p = {}
local p = require('Module:UnitTests')


function p.test_string()
function p.test_string()
Line 11: Line 11:
function p.test_string_module(frame)
function p.test_string_module(frame)
return (p['test_string' .. (frame.args[1] or '')]():gsub('\\', '\\\\'))
return (p['test_string' .. (frame.args[1] or '')]():gsub('\\', '\\\\'))
end

function p.test_kill500(frame)
local esc = require('Module:Escape')
for k = 1, 500 do
local v = esc:kill(p.test_string(), 'test')
end
return os.clock(esc)
end
end



Revision as of 20:11, 15 January 2015

p = {}

function p.test_string()
 return 'test, \\test, \\{,test\\\\ \\\\ \\\\\\\\'
end

function p.test_string2()
 return 'test { test {\\{ test, \\test, \\{,test\\ \\ \\ {\\'
end

function p.test_string_module(frame)
 return (p['test_string' .. (frame.args[1] or '')]():gsub('\\', '\\\\'))
end

function p.test_kill500(frame)
 local esc = require('Module:Escape')
 for k = 1, 500 do
  local v = esc:kill(p.test_string(), 'test')
 end
 return os.clock(esc)
end

return p