Module:Factorization/testcases
Appearance
This is the test cases page for the module Module:Factorization. Results of the test cases. |
-- 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 | -20}}', '- 2<sup>2</sup>· 5')
self:preprocess_equals('{{#invoke:Factorization | factor | -10}}', '- 2 · 5')
self:preprocess_equals('{{#invoke:Factorization | factor | -3}}', '-3')
self:preprocess_equals('{{#invoke:Factorization | factor | -1}}', '-1')
self:preprocess_equals('{{#invoke:Factorization | factor | 0}}', '0')
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 · 5')
self:preprocess_equals('{{#invoke:Factorization | factor | 25}}', '5<sup>2</sup>')
self:preprocess_equals('{{#invoke:Factorization | factor | 40}}', '2<sup>3</sup>· 5')
self:preprocess_equals('{{#invoke:Factorization | factor | 111}}', '3 · 37')
self:preprocess_equals('{{#invoke:Factorization | factor | 1000000001}}', '7· 11· 13· 19· 52579') -- max 1,000,000,---
self:preprocess_equals('{{#invoke:Factorization | factor | 4.5}}', '2 · 2')
self:preprocess_equals('{{#invoke:Factorization | factor | -9.9}}', '-2 · 5')
self:preprocess_equals('{{#invoke:Factorization | factor | 20|product=*}}', '2<sup>2</sup>* 5')
self:preprocess_equals('{{#invoke:Factorization | factor | 20|big=y}}', '<span style="font-size:165%">2<sup>2</sup>· 5</span>')
self:preprocess_equals('{{#invoke:Factorization | factor | 20|serif=yes|bold=true}}', '<span class="texhtml"><b>2<sup>2</sup>· 5</b></span>')
end
function p:test_factorSandbox()
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | -20}}', '- 2<sup>2</sup>· 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | -10}}', '- 2 · 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | -3}}', '-3')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | -1}}', '-1')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 0}}', '0')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 1}}', '1')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 2}}', '2')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 5}}', '5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 10}}', '2 · 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 25}}', '5<sup>2</sup>')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 40}}', '2<sup>3</sup>· 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 111}}', '3 · 37')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 1000000001}}', '7· 11· 13· 19· 52579') -- max 1,000,000,---
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 4.5}}', '2 · 2')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | -9.9}}', '-2 · 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 20|product=*}}', '2<sup>2</sup>* 5')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 20|big=y}}', '<span style="font-size:165%">2<sup>2</sup>· 5</span>')
self:preprocess_equals('{{#invoke:Factorization/sandbox | factor | 20|serif=yes|bold=true}}', '<span class="texhtml"><b>2<sup>2</sup>· 5</b></span>')
end
return p