มอดูล:ThaiToArabicNum/testcases
หน้าตา
เอกสารการใช้งานสำหรับมอดูลนี้อาจสร้างขึ้นที่ มอดูล:ThaiToArabicNum/testcases/doc
-- Unit tests for [[Module:ThaiToArabicNum]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local function err(msg)
-- Generates wikitext error messages.
return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end
function p:test_2_thai_to_arabic__2table_compare_by_char_method__preserved_for_bug_report()
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๑}}', '1')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๒}}', '2')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๓}}', '3')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๔}}', '4')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๕}}', '5')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๖}}', '6')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๗}}', '7')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๘}}', '8')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๙}}', '9')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๑๐}}', '10')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๒๐}}', '20')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|๒๒๓๔}}', '2234')
end
function p:test_3_arabic_to_thai___sanity_check_in_inverse_of_function__preserved_for_bug_report()
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|1|inverse=true}}', '๑')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|2|inverse=true}}', '๒')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|3|inverse=true}}', '๓')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|4|inverse=true}}', '๔')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|5|inverse=true}}', '๕')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|6|inverse=true}}', '๖')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|7|inverse=true}}', '๗')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|8|inverse=true}}', '๘')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|9|inverse=true}}', '๙')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|10|inverse=true}}', '๑๐')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|20|inverse=true}}', '๒๐')
self:preprocess_equals('{{#invoke:ThaiToArabicNum/sandbox|main|2234|inverse=true}}', '๒๒๓๔')
end
function p:test_1_thai_to_arabic__string_gsub_method()
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๑}}', '1')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๒}}', '2')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๓}}', '3')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๔}}', '4')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๕}}', '5')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๖}}', '6')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๗}}', '7')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๘}}', '8')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๙}}', '9')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๑๐}}', '10')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๒๐}}', '20')
self:preprocess_equals('{{#invoke:ThaiToArabicNum|main|๒๒๓๔}}', '2234')
end
return p