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&params=' local GBloc_lat = '53.256538' -- N local GBloc_lng = '1.799102' -- W local GBloc = GBloc_lat..'_N_'..GBloc_lng..'_W' local IEloc = '53.323786_N_6.246357_W' local GBNEloc_lat = '60.459657' -- N local GBNEloc_lng = '1.280627' -- W local GBNEloc = GBNEloc_lat..'_N_'..GBNEloc_lng..'_W' local IENEloc = '52.141158_N_9.623702_W' local GBos = 'SK135733' local GBos10 = 'SK1350073300' local GBNEos = 'HU3966875316' local IEos ='O169318'

function p:test_main self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB_dim:4083m'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']') self:preprocess_equals('', 		geohack..pagename..GBNEloc..'_region:GB_dim:41m'..' '..GBNEos..']') self:preprocess_equals('',		geohack..pagename..IEloc..'_region:IE_dim:4083m'..' '..IEos..']') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB&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&title=Example+title The Linbins]') self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB_dim:4083m'..' 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_dim:4083m'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..GBloc..'_scale:25000_region:GB'..' '..GBos..']') self:preprocess_equals('',		geohack..pagename..IEloc..'_region:IE_dim:4083m'..' '..IEos..']') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB Crooksetter]') self:preprocess_equals('',		geohack..pagename..GBNEloc..'_region:GB&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&title=Example+title The Linbins]') self:preprocess_equals('', 		geohack..pagename..GBloc..'_region:GB_dim:4083m'..' SK 135 733]') self:preprocess_equals('','Bad') self:preprocess_equals('','Nowhere') end

local before = ' ' local after = ' '

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

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

function p:test_to_osgb self:preprocess_equals('',GBos10) self:preprocess_equals('',GBos) self:preprocess_equals('',GBNEos) self:preprocess_equals_preprocess(,		) self:preprocess_equals_preprocess(,		) self:preprocess_equals_preprocess(,		) end

function p:test_to_osgb_sandbox self:preprocess_equals('',GBos10) self:preprocess_equals('',GBos) self:preprocess_equals('',GBNEos) self:preprocess_equals_preprocess(,		) self:preprocess_equals_preprocess(,		) self:preprocess_equals_preprocess(,		) end

return p