Módulu:Coordenaes/tests
La documentación pa esti módulu pue crease en Módulu:Coordenaes/tests/usu
-- 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:Coordenaes|coord|', '}}',
'{{coord/zona de pruebes|', '}}', {
{'57|18|22|N|4|27|32|W', '57|18|22|N|4|27|32|W'},
{'57|18|22|N|4|27|32|O', '57|18|22|N|4|27|32|O'},
{'44.112|N|87.913|W', '44.112|N|87.913|W'},
{'44.112|-87.913', '44.112|-87.913'},
{'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'},
{'44.117|-87.913|dim:30_region:US-WI_type:landmark|nom=Name testcase', '44.117|-87.913|dim:30_region:US-WI_type:landmark|nom=Name testcase'},
{'10.2|-20.3|display=inline', '10.2|-20.3|display=inline'},
{'10.2|-20.3', '10.2|-20.3'},
{'-35.5|150.1|type:landmark_region:AU', '-35.5|150.1|type:landmark_region:AU'},
{'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'},
{'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'},
{'35|00|N|105|00|E', '35|00|N|105|00|E'},
{'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'},
{'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'},
{'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'},
{'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|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'},
{'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'},
{'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'},
{'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