Module:NumberScripts/testcases
Jump to navigation
Jump to search
CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules
Lua
Documentation for this module may be created at Module:NumberScripts/testcases/doc
Code
-- Unit tests for [[Module:Sandbox]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_persian_to_european()
self:preprocess_equals_many('{{#invoke:NumberScripts|persian_to_european|','}}', {
{'۱۲۳۴۵۶۷۸۹۰', '1234567890'},
{'123', '123'},
{'a string', 'a string'}
})
end
function p:test_european_to_persian()
self:preprocess_equals_many('{{#invoke:NumberScripts|european_to_persian|','}}', {
{'۱۲۳۴۵۶۷۸۹۰', '۱۲۳۴۵۶۷۸۹۰'},
{'1234567890', '۱۲۳۴۵۶۷۸۹۰'},
{'a string', 'a string'}
})
end
function p:test_arabic_to_european()
self:preprocess_equals_many('{{#invoke:NumberScripts|arabic_to_european|','}}', {
{'١٢٣٤٥٦٧٨٩٠', '1234567890'},
{'123', '123'},
{'a string', 'a string'}
})
end
function p:test_european_to_arabic()
self:preprocess_equals_many('{{#invoke:NumberScripts|european_to_arabic|','}}', {
{'١٢٣٤٥٦٧٨٩٠', '١٢٣٤٥٦٧٨٩٠'},
{'1234567890', '١٢٣٤٥٦٧٨٩٠'},
{'a string', 'a string'}
})
end
return p