Module:Convert to eastern arabic numerals/testcases
Appearance
![]() | This is the test cases page for the module Module:Convert to eastern arabic numerals. Results of the test cases. |
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local m = require('Module:Convert to eastern arabic numerals')
-- Example unit test.
function p:test_convert()
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|0}}', '٠')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|1}}', '١')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|2}}', '٢')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|3}}', '٣')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|4}}', '٤')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|5}}', '٥')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|6}}', '٦')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|7}}', '٧')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|8}}', '٨')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|9}}', '٩')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|10}}', '١٠')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|3.1415}}', '٣,١٤١٥')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|73}}', '٧٣')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert|311}}', '٣١١')
self:preprocess_equals('{{#invoke:Convert to eastern arabic numerals|convert}}', '')
end
function p:test__convert()
self:preprocess_equals(m._convert({0}), '٠')
self:preprocess_equals(m._convert({1}), '١')
self:preprocess_equals(m._convert({2}), '٢')
self:preprocess_equals(m._convert({3}), '٣')
self:preprocess_equals(m._convert({4}), '٤')
self:preprocess_equals(m._convert({5}), '٥')
self:preprocess_equals(m._convert({6}), '٦')
self:preprocess_equals(m._convert({7}), '٧')
self:preprocess_equals(m._convert({8}), '٨')
self:preprocess_equals(m._convert({9}), '٩')
self:preprocess_equals(m._convert({10}), '١٠')
self:preprocess_equals(m._convert({3.1415}), '٣,١٤١٥')
self:preprocess_equals(m._convert({73}), '٧٣')
self:preprocess_equals(m._convert({311}), '٣١١')
self:preprocess_equals(m._convert({}), '')
self:preprocess_equals(m._convert(nil), 'Error! Arguments provided are null')
end
return p