Jump to content

Module:Factorization/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ypnypn (talk | contribs) at 01:21, 26 April 2013. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Example Unit tests for [[Module:Factorization]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_factor()
    self:preprocess_equals('{{#invoke:Factorization | factor | 1}}', '1')
    self:preprocess_equals('{{#invoke:Factorization | factor | 2}}', '2')
    self:preprocess_equals('{{#invoke:Factorization | factor | 5}}', '5')
    self:preprocess_equals('{{#invoke:Factorization | factor | 10}}', '2 \\cdot 5')
    self:preprocess_equals('{{#invoke:Factorization | factor | 25}}', '5^2')
    self:preprocess_equals('{{#invoke:Factorization | factor | 40}}', '2^3 \\cdot 5')
    self:preprocess_equals('{{#invoke:Factorization | factor | 111}}', '3 \\cdot 37')
    self:preprocess_equals('{{#invoke:Factorization | factor | 1000001}}', '1000001') -- max 1,000,000
end

return p