source: josm/trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy@ 6592

Last change on this file since 6592 was 6592, checked in by simon04, 10 years ago

fix #8519 - Validator: validate :lanes values

File size: 1.4 KB
Line 
1package org.openstreetmap.josm.data.validation.tests
2
3import org.openstreetmap.TestUtils
4
5class LanesTest extends GroovyTestCase {
6
7 def lanes = new Lanes()
8
9 @Override
10 void setUp() {
11 lanes.initialize()
12 lanes.startTest(null)
13 }
14
15 void testLanesCount() {
16 assert lanes.getLanesCount("") == 0
17 assert lanes.getLanesCount("left") == 1
18 assert lanes.getLanesCount("left|right") == 2
19 assert lanes.getLanesCount("yes|no|yes") == 3
20 }
21
22 void test1() {
23 lanes.check(TestUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes"))
24 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent"
25 }
26
27 void test2() {
28 lanes.check(TestUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated"))
29 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent in forward direction"
30 }
31
32 void test3() {
33 lanes.check(TestUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left"))
34 assert lanes.errors.isEmpty()
35 }
36
37 void test4() {
38 lanes.check(TestUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3"))
39 assert lanes.errors.get(0).getMessage() == "Number of lane dependent values inconsistent in forward direction"
40 }
41}
Note: See TracBrowser for help on using the repository browser.