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 00:53, 26 April 2013 (Created page with '-- Example Unit tests for Module:Factorization. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_factor() self:prepro...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
-- 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')
end

return p