Module:Ordnance Survey coordinates/testcases

local p = require('Module:UnitTests')

local geohack='[https://geohack.toolforge.org/geohack.php?' local pagename='pagename=Module_talk:Ordnance_Survey_coordinates/testcases&#x26;params=' local GBloc = '53.256537528703_N_1.7991023201338_W' local IEloc = '53.323792633602_N_6.2463579903284_W' local GBNEloc = '60.459656359818_N_1.280627981272_W' local IENEloc = '52.141163081547_N_9.6237020674491_W' local GBos = 'SK135733' local IEos ='O169318'

function p:test_main self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..IEloc..'_region:IE'..' '..IEos..']') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB&#x26;title=Example+title Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB-SCT_scale:25000 Crooksetter]') self:preprocess_equals('',		geohack..pagename..IENEloc..'_region:IE The Linbins]') self:preprocess_equals('',       geohack..pagename..IENEloc..'_scale:25000_region:IE The Linbins]') self:preprocess_equals('',       geohack..pagename..IENEloc..'_scale:25000_region:IE&#x26;title=Example+title The Linbins]') self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB'..' SK 135 733]') self:preprocess_equals('','Bad') self:preprocess_equals('','Nowhere') end

function p:test_main_sandbox self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..IEloc..'_region:IE'..' '..IEos..']') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB&#x26;title=Example+title Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB-SCT_scale:25000 Crooksetter]') self:preprocess_equals('',		geohack..pagename..IENEloc..'_region:IE The Linbins]') self:preprocess_equals('',       geohack..pagename..IENEloc..'_scale:25000_region:IE The Linbins]') self:preprocess_equals('',       geohack..pagename..IENEloc..'_scale:25000_region:IE&#x26;title=Example+title The Linbins]') self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB'..' SK 135 733]') self:preprocess_equals('','Bad') self:preprocess_equals('','Nowhere') end

local before = '&#x3c;span class="plainlinks nourlexpansion" style="white-space: nowrap"&#x3e;' local after = '&#x3c;/span&#x3e;'

function p:test_oscoord self:preprocess_equals('', 		before..geohack..pagename..GBloc..'_region:GB'..' '..GBos..']'..after) self:preprocess_equals('',		before..geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']'..after) self:preprocess_equals('',		before..geohack..pagename..IEloc..'_region:IE'..' '..IEos..']'..after) end

function p:test_oscoord_sandbox self:preprocess_equals('', 		before..geohack..pagename..GBloc..'_region:GB'..' '..GBos..']'..after) self:preprocess_equals('',		before..geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']'..after) self:preprocess_equals('',		before..geohack..pagename..IEloc..'_region:IE'..' '..IEos..']'..after) end

return p