local p = require('Module:UnitTests')
local geohack = 'realPagename = 'Module_talk:Ordnance_Survey_coordinates/testcases'local pagename='pagename=Module_talk:Ordnance_Survey_coordinates/testcases¶ms='local GBloc_lat = '53.256538' -- Nlocal GBloc_lng = '1.799102' -- Wlocal GBloc = GBloc_lat..'_N_'..GBloc_lng..'_W'local IEloc_lat = '53.323786' -- Nlocal IEloc_lng = '6.246357' -- Wlocal IEloc = IEloc_lat..'_N_'..IEloc_lng..'_W'local GBNEloc_lat = '60.459657' -- Nlocal GBNEloc_lng = '1.280627' -- Wlocal GBNEloc = GBNEloc_lat..'_N_'..GBNEloc_lng..'_W'local IENEloc_lat = '52.141158' -- Nlocal IENEloc_lng = '9.623702' -- Wlocal IENEloc = IENEloc_lat..'_N_'..IENEloc_lng..'_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..'
function p:test_main_sandbox self:preprocess_equals('', geohack..pagename..GBloc..'_region:GB_dim:4083m'..' '..GBos..']') self:preprocess_equals('[{{#invoke:Ordnance Survey coordinates/sandbox | main | '..GBos..'|rawurl=1}}]', geohack..pagename..GBloc..'_region:GB_dim:4083m]') 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 bing = 'GBlocDirect1 = GBloc_lat..'~-'..GBloc_lnglocal GBlocDirect2 = GBloc_lat..'_-'..GBloc_lnglocal GBNElocDirect1 = GBNEloc_lat..'~-'..GBNEloc_lnglocal GBNElocDirect2 = GBNEloc_lat..'_-'..GBNEloc_lnglocal IElocDirect1 = IEloc_lat..'~-'..IEloc_lnglocal IElocDirect2 = IEloc_lat..'_-'..IEloc_lnglocal IENElocDirect1 = IENEloc_lat..'~-'..IENEloc_lnglocal IENElocDirect2 = IENEloc_lat..'_-'..IENEloc_lnglocal lvl12 = '&lvl=12&sp=Point.'local lvl13 = '&lvl=13&sp=Point.'local lvl14 = '&lvl=14&sp=Point.'local lvl17 = '&lvl=17&sp=Point.'local directPagename = '_Module+talk%3AOrdnance+Survey+coordinates%2Ftestcases'local example = '_Example+title'local suffix = '&sty=s&style=s' function p:test_direct self:preprocess_equals('', bing..GBlocDirect1..lvl13..GBlocDirect2..directPagename..suffix..' '..GBos..'
function p:test_direct_sandbox self:preprocess_equals('', bing..GBlocDirect1..lvl13..GBlocDirect2..directPagename..suffix..' '..GBos..']') self:preprocess_equals('[{{#invoke:Ordnance Survey coordinates/sandbox | main | '..GBos..'|rawurl=1|direct=1}}]', bing..GBlocDirect1..lvl13..GBlocDirect2..directPagename..suffix..']') self:preprocess_equals('', bing..GBlocDirect1..lvl14..GBlocDirect2..directPagename..suffix..' '..GBos..']') self:preprocess_equals('', bing..GBNElocDirect1..lvl17..GBNElocDirect2..directPagename..suffix..' '..GBNEos..']') self:preprocess_equals('', bing..IElocDirect1..lvl13..IElocDirect2..directPagename..suffix..' '..IEos..']') self:preprocess_equals('', bing..GBNElocDirect1..lvl12..GBNElocDirect2..directPagename..suffix..' Crooksetter]') self:preprocess_equals('', bing..GBNElocDirect1..lvl12..GBNElocDirect2..example..suffix..' Crooksetter]') self:preprocess_equals('', bing..GBNElocDirect1..lvl14..GBNElocDirect2..directPagename..suffix..' Crooksetter]') self:preprocess_equals('', bing..IENElocDirect1..lvl12..IENElocDirect2..directPagename..suffix..' The Linbins]') self:preprocess_equals('', bing..IENElocDirect1..lvl14..IENElocDirect2..directPagename..suffix..' The Linbins]') self:preprocess_equals('', bing..IENElocDirect1..lvl14..IENElocDirect2..example..suffix..' The Linbins]') self:preprocess_equals('', bing..GBlocDirect1..lvl13..GBlocDirect2..directPagename..suffix..' 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