ಮಾಡ್ಯೂಲ್:Coordinates/testcases
Documentation for this module may be created at ಮಾಡ್ಯೂಲ್:Coordinates/testcases/doc
-- Unit tests for [[Module:Coordinates]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_coord()
self:preprocess_equals_preprocess_many('{{#invoke:Coordinates/sandbox|coord|', '}}',
'{{#invoke:Coordinates|coord|', '}}', {
{'57|18|22|N|4|27|32|W', '57|18|22|N|4|27|32|W'},
{'44.112|N|87.913|W', '44.112|N|87.913|W'},
{'44.112|-87.913', '44.112|-87.913'},
{'44.117|-87.913|dim:30_region:US-WI_type:landmark|name=Klann Road', '44.117|-87.913|dim:30_region:US-WI_type:landmark|name=Klann Road'},
{'10.2|-20.3|display=inline', '10.2|-20.3|display=inline'},
{'10.2|-20.3', '10.2|-20.3'},
{'44.4|-111.1|type:city_region:US', '44.4|-111.1|type:city_region:US'},
{'51.01234|-1.56789|type:landmark_region:GB', '51.01234|-1.56789|type:landmark_region:GB'},
{'-35.5|150.1|type:landmark_region:AU', '-35.5|150.1|type:landmark_region:AU'},
{'12|34|12|N|45|33|45|W', '12|34|12|N|45|33|45|W'},
{'43.651234|-79.383333', '43.651234|-79.383333'},
{'43.65|-79.38', '43.65|-79.38'},
{'43.6500|-79.3800', '43.6500|-79.3800'},
{'43.651234|N|79.383333|W', '43.651234|N|79.383333|W'},
{'43|29|N|79|23|W', '43|29|N|79|23|W'},
{'43|29|4|N|79|23|0|W', '43|29|4|N|79|23|0|W'},
{'43|29|4.5|N|79|23|0.5|W', '43|29|4.5|N|79|23|0.5|W'},
{'55.752222|N|37.615556|E', '55.752222|N|37.615556|E'},
{'55.752222|N|37.615556|E|format=dms', '55.752222|N|37.615556|E|format=dms'},
{'39.098095|-94.587307|format=dms', '39.098095|-94.587307|format=dms'},
{'55.752222|N|37.615556|E|format=dec|name=Moscow', '55.752222|N|37.615556|E|format=dec|name=Moscow'},
{'33|55|S|18|25|E', '33|55|S|18|25|E'},
{'35|00|N|105|00|E', '35|00|N|105|00|E'},
{'22|54|30|S|43|14|37|W', '22|54|30|S|43|14|37|W'},
{'22|S|43|W', '22|S|43|W'},
{'52|28|59|N|1|53|37|W|display=inline,title|region:GB_type:city', '52|28|59|N|1|53|37|W|display=inline,title|region:GB_type:city'},
{'46|43|N|7|58|E|type:mountain', '46|43|N|7|58|E|type:mountain'},
{'51.500611|N|0.124611|W|scale:1000', '51.500611|N|0.124611|W|scale:1000'},
{'51.500611|N|0.124611|W|scale:10000', '51.500611|N|0.124611|W|scale:10000'},
{'51.500611|N|0.124611|W|scale:100000', '51.500611|N|0.124611|W|scale:100000'},
{'51.500611|N|0.124611|W|scale:1000000', '51.500611|N|0.124611|W|scale:1000000'},
{'0|N|90|W|dim:10000000', '0|N|90|W|dim:10000000'},
{'40.5|-82.5|dim:400000', '40.5|-82.5|dim:400000'},
{'51.033|13.73|dim:20000', '51.033|13.73|dim:20000'},
{'40.6892|-74.0445|dim:100', '40.6892|-74.0445|dim:100'},
{'45.516194|-122.673226|dim:0.6', '45.516194|-122.673226|dim:0.6'},
{'46.9524|N|7.4396|E|region:CH', '46.9524|N|7.4396|E|region:CH'},
{'52.5164|N|13.3775|E|region:DE-BE', '52.5164|N|13.3775|E|region:DE-BE'},
{'0|40|26.69|N|23|28|22.69|E|globe:moon', '0|40|26.69|N|23|28|22.69|E|globe:moon'},
{'48.269|N|225.990|W|globe:mars', '48.269|N|225.990|W|globe:mars'},
{'7.5|S|303|E|globe:venus', '7.5|S|303|E|globe:venus'},
{'8|N|190.5|W|globe:mercury', '8|N|190.5|W|globe:mercury'},
{'52.5164|N|13.3775|E|region:DE-BE', '52.5164|N|13.3775|E|region:DE-BE'},
{'20.4|S|20.4|W|name=Test case SW-1a: 20.4d S 20.4d W (-20.4, -20.4)', '20.4|S|20.4|W|name=Test case SW-1a: 20.4d S 20.4d W (-20.4, -20.4)'},
{'-20.4|N|-20.4|E|name=Test case SW-1b: -20.4d N -20.4d E (-20.4, -20.4)', '-20.4|N|-20.4|E|name=Test case SW-1b: -20.4d N -20.4d E (-20.4, -20.4)'},
{'-20.4|-20.4|name=Test case SW-1c: -20.4d -20.4d (-20.4, -20.4)', '-20.4|-20.4|name=Test case SW-1c: -20.4d -20.4d (-20.4, -20.4)'},
{'20|20|S|20|20|W|name=Test case SW-2a: 20d 20m S 20d 20m W (-20.3333, -20.3333)', '20|20|S|20|20|W|name=Test case SW-2a: 20d 20m S 20d 20m W (-20.3333, -20.3333)'},
{'-20|20|N|-20|20|E|name=Test case SW-2b: -20d 20m N -20d 20m E (-20.3333, -20.3333)', '-20|20|N|-20|20|E|name=Test case SW-2b: -20d 20m N -20d 20m E (-20.3333, -20.3333)'},
{'-20||N|-20||E|name=Test case SW-2c: -20d N -20d E (-20, -20)', '-20||N|-20||E|name=Test case SW-2c: -20d N -20d E (-20, -20)'},
{'20|20|20|S|20|20|20|W|name=Test case SW-3a: 20d 20m 20s S 20d 20m 20s W (-20.33889, -20.33889)', '20|20|20|S|20|20|20|W|name=Test case SW-3a: 20d 20m 20s S 20d 20m 20s W (-20.33889, -20.33889)'},
{'-20|20|20|N|-20|20|20|E|name=Test case SW-3b: -20d 20m 20s N -20d 20m 20s E (-20.33889, -20.33889)', '-20|20|20|N|-20|20|20|E|name=Test case SW-3b: -20d 20m 20s N -20d 20m 20s E (-20.33889, -20.33889)'},
{'-20||20|N|-20||20|E|name=Test case SW-3c: -20d 20s N -20d 20s E', '-20||20|N|-20||20|E|name=Test case SW-3c: -20d 20s N -20d 20s E'},
{'-20|20||N|-20|20||E|name=Test case SW-3d: -20d 20m N -20d 20m E', '-20|20||N|-20|20||E|name=Test case SW-3d: -20d 20m N -20d 20m E'},
{'-20|||N|-20|||E|name=Test case SW-3e: -20d N -20d E (-20, -20)', '-20|||N|-20|||E|name=Test case SW-3e: -20d N -20d E (-20, -20)'},
{'20.4|N|20.4|E|name=Test case NE-1a: 20.4d N 20.4d E (20.4, 20.4)', '20.4|N|20.4|E|name=Test case NE-1a: 20.4d N 20.4d E (20.4, 20.4)'},
{'-20.4|S|-20.4|W|name=Test case NE-1b: -20.4d S 20.4d W (20.4, 20.4) (rev.1)', '-20.4|S|-20.4|W|name=Test case NE-1b: -20.4d S 20.4d W (20.4, 20.4) (rev.1)'},
{'20.4|20.4|name=Test case NE-1c: 20.4d 20.4d (20.4, 20.4) (rev.1)', '20.4|20.4|name=Test case NE-1c: 20.4d 20.4d (20.4, 20.4) (rev.1)'},
{'20|20|N|20|20|E|name=Test case NE-2a: 20d 20m N 20d 20m E (20.3333, 20.3333)', '20|20|N|20|20|E|name=Test case NE-2a: 20d 20m N 20d 20m E (20.3333, 20.3333)'},
{'-20|20|S|-20|20|W|name=Test case NE-2b: -20d 20m S -20d 20m W (20.3333, 20.3333)', '-20|20|S|-20|20|W|name=Test case NE-2b: -20d 20m S -20d 20m W (20.3333, 20.3333)'},
{'20|20|20|N|20|20|20|E|name=Test case NE-3a: 20d 20m 20s N 20d 20m 20s E (20.33889, 20.33889) (rev.1)', '20|20|20|N|20|20|20|E|name=Test case NE-3a: 20d 20m 20s N 20d 20m 20s E (20.33889, 20.33889) (rev.1)'},
{'-20|20|20|S|-20|20|20|W|name=Test case NE-3b: -20d 20m 20s S -20d 20m 20s W (20.33889, 20.33889)(rev.1)', '-20|20|20|S|-20|20|20|W|name=Test case NE-3b: -20d 20m 20s S -20d 20m 20s W (20.33889, 20.33889)(rev.1)'},
{'20.4|S|180.4|W|name=Test case W>180: 20.4d S 180.4d W (-20.4, -180.4)', '20.4|S|180.4|W|name=Test case W>180: 20.4d S 180.4d W (-20.4, -180.4)'},
{'20.4|N|180.4|E|name=Test case E>180: 20.4d N 180.4d E ( 20.4, 180.4)', '20.4|N|180.4|E|name=Test case E>180: 20.4d N 180.4d E ( 20.4, 180.4)'},
{'90.1|1|name=Test case N>+90 dec', '90.1|1|name=Test case N>+90 dec'},
{'-90.1|1|name=Test case N<-90 dec', '-90.1|1|name=Test case N<-90 dec'},
{'1|360|name=Test case E>=+360 dec', '1|360|name=Test case E>=+360 dec'},
{'1|-360|name=Test case E<=-360 dec', '1|-360|name=Test case E<=-360 dec'},
{'1|2|dim=10000|name=Test case dim= dec', '1|2|dim=10000|name=Test case dim= dec'},
{'1|2|globe=moon|name=Test case globe= dec', '1|2|globe=moon|name=Test case globe= dec'},
{'1|2|region=CA-QC|name=Test case region= dec', '1|2|region=CA-QC|name=Test case region= dec'},
{'1|2|scale=100000|name=Test case scale= dec', '1|2|scale=100000|name=Test case scale= dec'},
{'1|2|source=gnis|name=Test case source= dec', '1|2|source=gnis|name=Test case source= dec'},
{'1|2|type=city|name=Test case type= dec', '1|2|type=city|name=Test case type= dec'},
{'90.1|S|1|W|name=Test case S>+90 d', '90.1|S|1|W|name=Test case S>+90 d'},
{'90.1|N|1|E|name=Test case N>+90 d', '90.1|N|1|E|name=Test case N>+90 d'},
{'-90.1|N|1|W|name=Test case N<-90 d', '-90.1|N|1|W|name=Test case N<-90 d'},
{'1|N|360|W|name=Test case W>=+360 d', '1|N|360|W|name=Test case W>=+360 d'},
{'1|N|-360|E|name=Test case E<=-360 d', '1|N|-360|E|name=Test case E<=-360 d'},
{'1|S|2|W|type:city|region:XZ|name=Test case extra d', '1|S|2|W|type:city|region:XZ|name=Test case extra d'},
{'91|0|N|1|2|E|name=Test case dN>+90 dm', '91|0|N|1|2|E|name=Test case dN>+90 dm'},
{'-91|0|N|1|2|E|name=Test case dN<-90 dm', '-91|0|N|1|2|E|name=Test case dN<-90 dm'},
{'1|2|S|360|0|E|name=Test case dE>=+360 dm', '1|2|S|360|0|E|name=Test case dE>=+360 dm'},
{'1|2|S|-360|0|E|name=Test case dE<=-360 dm', '1|2|S|-360|0|E|name=Test case dE<=-360 dm'},
{'1|60|S|2|3|W|name=Test case mS>=60 dm', '1|60|S|2|3|W|name=Test case mS>=60 dm'},
{'1|-1|S|2|3|W|name=Test case mS<0 dm', '1|-1|S|2|3|W|name=Test case mS<0 dm'},
{'1|2|S|3|60|W|name=Test case mW>=60 dm', '1|2|S|3|60|W|name=Test case mW>=60 dm'},
{'1|2|S|3|-1|W|name=Test case mW<0 dm', '1|2|S|3|-1|W|name=Test case mW<0 dm'},
{'1|2|S|3|4|W|type:city|region:XZ|name=Test case extra dm', '1|2|S|3|4|W|type:city|region:XZ|name=Test case extra dm'},
{'91|0|0|N|1|2|3|E|name=Test case dN>+90 dms', '91|0|0|N|1|2|3|E|name=Test case dN>+90 dms'},
{'-91|0|0|N|1|2|3|E|name=Test case dN<-90 dms', '-91|0|0|N|1|2|3|E|name=Test case dN<-90 dms'},
{'1|2|3|S|360|0|0|E|name=Test case dE>=+360 dms', '1|2|3|S|360|0|0|E|name=Test case dE>=+360 dms'},
{'1|2|3|S|-360|0|0|E|name=Test case dE<=-360 dms', '1|2|3|S|-360|0|0|E|name=Test case dE<=-360 dms'},
{'1|60|0|S|2|3|4|W|name=Test case mS>=60 dms', '1|60|0|S|2|3|4|W|name=Test case mS>=60 dms'},
{'1|-1|2|S|3|4|5|W|name=Test case mS<0 dms', '1|-1|2|S|3|4|5|W|name=Test case mS<0 dms'},
{'1|2|3|S|4|60|0|W|name=Test case mW>=60 dms', '1|2|3|S|4|60|0|W|name=Test case mW>=60 dms'},
{'1|2|3|S|4|-1|5|W|name=Test case mW<0 dms', '1|2|3|S|4|-1|5|W|name=Test case mW<0 dms'},
{'1|2|60|S|3|4|5|W|name=Test case sS>=60 dms', '1|2|60|S|3|4|5|W|name=Test case sS>=60 dms'},
{'1|2|-1|S|3|4|5|W|name=Test case sS<0 dms', '1|2|-1|S|3|4|5|W|name=Test case sS<0 dms'},
{'1|2|3|S|3|4|60|W|name=Test case sW>=60 dms', '1|2|3|S|3|4|60|W|name=Test case sW>=60 dms'},
{'1|2|3|S|3|4|-1|W|name=Test case sW<0 dms', '1|2|3|S|3|4|-1|W|name=Test case sW<0 dms'},
{'1|2|3|S|3|4|5|W|type:city|region:XZ|name=Test case extra dms', '1|2|3|S|3|4|5|W|type:city|region:XZ|name=Test case extra dms'},
{'1|2|3|4', '1|2|3|4'},
{'1|2|3|E|4|5|6|N', '1|2|3|E|4|5|6|N'},
{'1|2|E|3|4|N', '1|2|E|3|4|N'},
{'', ''},
{'|-2', '|-2'},
{'1|', '1|'},
{'1|N||W', '1|N||W'},
{'1|2|N||4|W', '1|2|N||4|W'},
{'1|2|3|N||5|6|W', '1|2|3|N||5|6|W'},
{'1||N|3||E|name=Test case DM blank M', '1||N|3||E|name=Test case DM blank M'},
{'1|2||N|5|6||E|name=Test case DMS blank S', '1|2||N|5|6||E|name=Test case DMS blank S'},
{'1|||N|5|||E|name=Test case DMS blank M and S', '1|||N|5|||E|name=Test case DMS blank M and S'},
{'1|2|dispenser=|name=Test case DMS blank M and S', '1|2|dispenser=|name=Test case DMS blank M and S'},
{' 51 | 02 | 21 |N| 116 | 26 | 34 |W|name=Test case extra blanks', ' 51 | 02 | 21 |N| 116 | 26 | 34 |W|name=Test case extra blanks'},
{'0|0|N|0|0|E', '0|0|N|0|0|E'},
{'0|0|0|N|0|0|0|E', '0|0|0|N|0|0|0|E'},
{'0|0|N|180|0|E', '0|0|N|180|0|E'},
{'0|0|0|N|180|0|0|E', '0|0|0|N|180|0|0|E'},
{'0|59|N|179|59|W', '0|59|N|179|59|W'},
{'0|59|59|S|179|59|59|W', '0|59|59|S|179|59|59|W'},
})
end
return p