Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved test coverage to identify problems in #552
  • Loading branch information
Peter committed Oct 23, 2015
1 parent 98dca39 commit 65b4c0c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Expand Up @@ -435,4 +435,17 @@ public void testBarrierAccess()
// no barrier! // no barrier!
assertTrue(encoder.handleNodeTags(node) == 0); assertTrue(encoder.handleNodeTags(node) == 0);
} }

@Test
public void testBarrierAccessFord()
{
OSMNode node = new OSMNode(1, -1, -1);
node.setTag("ford", "yes");
// barrier!
assertTrue(encoder.handleNodeTags(node) > 0);

node.setTag("bicycle", "yes");
// no barrier!
assertTrue(encoder.handleNodeTags(node) == 0);
}
} }
Expand Up @@ -511,7 +511,7 @@ public void testBarrierAccess()
} }


@Test @Test
public void testclassBicycle() public void testClassBicycle()
{ {
OSMWay way = new OSMWay(1); OSMWay way = new OSMWay(1);
way.setTag("highway", "tertiary"); way.setTag("highway", "tertiary");
Expand Down
Expand Up @@ -233,11 +233,11 @@ public void testPriority()
way.setTag("bicycle", "official"); way.setTag("bicycle", "official");
way.setTag("sidewalk", "no"); way.setTag("sidewalk", "no");
assertEquals(PriorityCode.AVOID_IF_POSSIBLE.getValue(), footEncoder.handlePriority(way, 0)); assertEquals(PriorityCode.AVOID_IF_POSSIBLE.getValue(), footEncoder.handlePriority(way, 0));

way.clearTags(); way.clearTags();
way.setTag("highway", "residential"); way.setTag("highway", "residential");
way.setTag("sidewalk", "yes"); way.setTag("sidewalk", "yes");
assertEquals(PriorityCode.PREFER.getValue(), footEncoder.handlePriority(way, 0)); assertEquals(PriorityCode.PREFER.getValue(), footEncoder.handlePriority(way, 0));
} }


@Test @Test
Expand Down Expand Up @@ -335,6 +335,10 @@ public void testFord()
node.setTag("ford", "yes"); node.setTag("ford", "yes");
assertTrue(footEncoder.handleNodeTags(node) > 0); assertTrue(footEncoder.handleNodeTags(node) > 0);


node.setTag("foot", "yes");
// no barrier!
assertTrue(footEncoder.handleNodeTags(node) == 0);

// Now let's allow fords for foot // Now let's allow fords for foot
footEncoder.setBlockFords(Boolean.FALSE); footEncoder.setBlockFords(Boolean.FALSE);


Expand Down

0 comments on commit 65b4c0c

Please sign in to comment.