Modul:VitosmoCode/testniprimeri

Iz Wikipedije, proste enciklopedije
-- Primer testa enote za [[Modul:VitosmoCode]]. Za izvajanje testa klikni na pogovorno stran.
local p = require('Modul:UnitTests')

function p:test_VitosmoCode()
-- tast 7
    -- ocal restring = 'year  1952 month 03 day 11'

    self:preprocess_equals('{{#invoke:VitosmoCode|getfulldate |qid=Q42 |prop=P569}}', '11 March 1952')        

    self:preprocess_equals('{{#invoke:VitosmoCode|getdate2 |qid=Q42 |prop=P569}}', 'Year = 1952, Month = 03, Day = 11')

    self:preprocess_equals('{{#invoke:VitosmoCode|getdate1 |qid=Q42 |prop=P569}}', '+1952-03-11T00:00:00Z')	
    self:preprocess_equals('{{#invoke:VitosmoCode|getdate0}}', '+1952-03-11T00:00:00Z')	
-- task 5
    self:preprocess_equals('{{#invoke:VitosmoCode|sentence4|words=its my life}}', 'Its my life')
    self:preprocess_equals('{{#invoke:VitosmoCode|sentence|words=its my life}}', 'its my life')
-- task 4
    self:preprocess_equals('{{#invoke:VitosmoCode |temperature|celsius=15}}', 
                           '15 degrees Celsius is 59 degrees Fahrenheit')
    self:preprocess_equals('{{#invoke:VitosmoCode |temperature2|celsius=15}}', 
                           '15 degrees Celsius is 59 degrees Fahrenheit - it is warm')
-- task 3
    self:preprocess_equals('{{#invoke:VitosmoCode | Hi |name=Gonzo}}', 
                           'Hello from Lua to my friend Gonzo')
    self:preprocess_equals('{{#invoke:VitosmoCode | mum|num=3}}', 'Hello Uncle Stan')
--- older
    self:preprocess_equals('{{#invoke:VitosmoCode | helloAlt}}', 'Hello, world!')
    self:preprocess_equals('{{#invoke:VitosmoCode | zivjo}}', 'zivjo, svet!')
    self:preprocess_equals('{{#invoke:VitosmoCode | HelloArg|Kako}}', 'Kako')
    self:preprocess_equals('{{#invoke:VitosmoCode | getTitle|Boris Johnson}}', 'Boris Johnson')
end
return p