1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertFalse;
|
---|
5 | import static org.junit.Assert.assertTrue;
|
---|
6 |
|
---|
7 | import org.junit.Rule;
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
10 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Unit tests of {@link RightAndLefthandTraffic} class.
|
---|
14 | */
|
---|
15 | public class RightAndLefthandTrafficTest {
|
---|
16 | /**
|
---|
17 | * Test rules.
|
---|
18 | */
|
---|
19 | @Rule
|
---|
20 | public JOSMTestRules rules = new JOSMTestRules().platform().projection().commands();
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Test of {@link RightAndLefthandTraffic#isRightHandTraffic} method.
|
---|
24 | */
|
---|
25 | @Test
|
---|
26 | public void testIsRightHandTraffic() {
|
---|
27 | assertTrue("Paris", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(48.8567, 2.3508)));
|
---|
28 | assertTrue("Berlin", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(52.5167, 13.383)));
|
---|
29 | assertTrue("New York", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(40.7127, -74.0059)));
|
---|
30 | assertTrue("Papeete", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-17.5419, -149.5617)));
|
---|
31 | assertTrue("Guantanamo", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(19.912, -75.209)));
|
---|
32 | assertTrue("Guadeloupe", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(16.243, -61.533)));
|
---|
33 | assertTrue("Martinique", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(14.604, -61.069)));
|
---|
34 | assertTrue("Madagascar", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-20.119, 46.316)));
|
---|
35 | assertTrue("Shangai", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(31.196, 121.36)));
|
---|
36 |
|
---|
37 | assertFalse("London", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(51.507222, -0.1275)));
|
---|
38 | assertFalse("Valetta (Malta)", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(35.897778, 14.5125)));
|
---|
39 | assertFalse("Jersey", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(49.19, -2.11)));
|
---|
40 | assertFalse("Isle of Man", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(54.25, -4.5)));
|
---|
41 | assertFalse("Dublin (Ireland)", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(53.347778, -6.259722)));
|
---|
42 | assertFalse("Guernsey", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(49.45, -2.6)));
|
---|
43 | assertFalse("Nicosia (Cyprus)", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(35.166667, 33.366667)));
|
---|
44 | assertFalse("Georgetown (Guyana)", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(6.8, -58.166667)));
|
---|
45 | assertFalse("Paramaribo (Suriname)", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(5.866667, -55.166667)));
|
---|
46 | assertFalse("Anguilla", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(18.22723, -63.04899)));
|
---|
47 | assertFalse("Antigua and Barbuda", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(17.05, -61.8)));
|
---|
48 | assertFalse("Bahamas", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(24.25, -76)));
|
---|
49 | assertFalse("Barbados", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(13.166667, -59.55)));
|
---|
50 | assertFalse("British Virgin Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(18.5, -64.5)));
|
---|
51 | assertFalse("Cayman Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(19.5, -80.5)));
|
---|
52 | assertFalse("Dominica", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(15.416667, -61.333333)));
|
---|
53 | assertFalse("Grenada", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(12.116667, -61.666667)));
|
---|
54 | assertFalse("Jamaica", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(18, -77)));
|
---|
55 | assertFalse("Montserrat", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(16.75, -62.2)));
|
---|
56 | assertFalse("Saint Kitts and Nevis", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(17.333333, -62.75)));
|
---|
57 | assertFalse("Saint Lucia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(13.883333, -60.966667)));
|
---|
58 | assertFalse("Saint Vincent and the Grenadines", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(13.25, -61.2)));
|
---|
59 | assertFalse("Trinidad and Tobago", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(11.249285, -60.652557)));
|
---|
60 | assertFalse("Turks and Caicos Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(21.75, -71.583333)));
|
---|
61 | assertFalse("United States Virgin Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(18.35, -64.933333)));
|
---|
62 | assertFalse("Bermuda", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(32.333333, -64.75)));
|
---|
63 | assertFalse("Falkland Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-51.683333, -59.166667)));
|
---|
64 | assertFalse("Saint Helena, Ascension and Tristan da Cunha", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-15.933, -5.717)));
|
---|
65 | assertFalse("South Georgia and the South Sandwich Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-54.25, -36.75)));
|
---|
66 | assertFalse("Maldives", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(3.2, 73.22)));
|
---|
67 | assertFalse("Mauritius", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-20.2, 57.5)));
|
---|
68 | assertFalse("Seychelles", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-4.583333, 55.666667)));
|
---|
69 | assertFalse("Bangladesh", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(23.8, 90.3)));
|
---|
70 | assertFalse("Bhutan", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(27.417, 90.435)));
|
---|
71 | assertFalse("Brunei", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(4.5, 114.666667)));
|
---|
72 | assertFalse("East Timor", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-8.833333, 125.916667)));
|
---|
73 | assertFalse("Hong Kong", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(22.3, 114.2)));
|
---|
74 | assertFalse("Indonesia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-5, 120)));
|
---|
75 | assertFalse("India", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(21, 78)));
|
---|
76 | assertFalse("Japan", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(35, 136)));
|
---|
77 | assertFalse("Macau", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(22.166667, 113.55)));
|
---|
78 | assertFalse("Malaysia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(2.5, 112.5)));
|
---|
79 | assertFalse("Nepal", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(28.166667, 84.25)));
|
---|
80 | assertFalse("Pakistan", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(30, 70)));
|
---|
81 | assertFalse("Singapore", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(1.3, 103.8)));
|
---|
82 | assertFalse("Sri Lanka", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(7, 81)));
|
---|
83 | assertFalse("Thailand", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(15.4, 101.3)));
|
---|
84 | assertFalse("Botswana", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-24.658333, 25.908333)));
|
---|
85 | assertFalse("Kenya", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(1, 38)));
|
---|
86 | assertFalse("Lesotho", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-29.6, 28.3)));
|
---|
87 | assertFalse("Malawi", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-13.5, 34)));
|
---|
88 | assertFalse("Mauritius", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-20.2, 57.5)));
|
---|
89 | assertFalse("Mozambique", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-18.25, 35)));
|
---|
90 | assertFalse("Namibia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-22, 17)));
|
---|
91 | assertFalse("South Africa", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-30, 25)));
|
---|
92 | assertFalse("Swaziland", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-26.5, 31.5)));
|
---|
93 | assertFalse("Tanzania", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-6.307, 34.854)));
|
---|
94 | assertFalse("Uganda", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(1, 32)));
|
---|
95 | assertFalse("Zambia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-15, 30)));
|
---|
96 | assertFalse("Zimbabwe", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-20, 30)));
|
---|
97 | assertFalse("Australia", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-27, 133)));
|
---|
98 | assertFalse("Christmas Island", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-10.483333, 105.633333)));
|
---|
99 | assertFalse("Cocos (Keeling) Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-12.116667, 96.9)));
|
---|
100 | assertFalse("Cook Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-21.233333, -159.766667)));
|
---|
101 | assertFalse("Fiji", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-18, 179)));
|
---|
102 | assertFalse("Kiribati", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(1.416667, 173)));
|
---|
103 | assertFalse("Nauru", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-0.533333, 166.933333)));
|
---|
104 | assertFalse("New Zealand", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-42, 174)));
|
---|
105 | assertFalse("Niue", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-19.05, -169.916667)));
|
---|
106 | assertFalse("Norfolk Island", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-29.033333, 167.95)));
|
---|
107 | assertFalse("Papua New Guinea", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-6, 147)));
|
---|
108 | assertFalse("Pitcairn Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-25.066667, -130.1)));
|
---|
109 | assertFalse("Solomon Islands", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-8, 159)));
|
---|
110 | assertFalse("Samoa", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-13.583333, -172.333333)));
|
---|
111 | assertFalse("Tokelau", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-9.166667, -171.833333)));
|
---|
112 | assertFalse("Tonga", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-20, -175)));
|
---|
113 | assertFalse("Tuvalu", RightAndLefthandTraffic.isRightHandTraffic(new LatLon(-8, 178)));
|
---|
114 | }
|
---|
115 | }
|
---|