コード例 #1
0
  @Test
  public void testRoundabout() {
    long flags = encoder.setAccess(0, true, true);
    long resFlags = encoder.setBool(flags, FlagEncoder.K_ROUNDABOUT, true);
    assertTrue(encoder.isBool(resFlags, FlagEncoder.K_ROUNDABOUT));
    assertTrue(encoder.isForward(resFlags));
    assertTrue(encoder.isBackward(resFlags));

    resFlags = encoder.setBool(flags, FlagEncoder.K_ROUNDABOUT, false);
    assertFalse(encoder.isBool(resFlags, FlagEncoder.K_ROUNDABOUT));
    assertTrue(encoder.isForward(resFlags));
    assertTrue(encoder.isBackward(resFlags));

    ReaderWay way = new ReaderWay(1);
    way.setTag("highway", "motorway");
    flags = encoder.handleWayTags(way, encoder.acceptBit, 0);
    assertTrue(encoder.isForward(flags));
    assertTrue(encoder.isBackward(flags));
    assertFalse(encoder.isBool(flags, FlagEncoder.K_ROUNDABOUT));

    way.setTag("junction", "roundabout");
    flags = encoder.handleWayTags(way, encoder.acceptBit, 0);
    assertTrue(encoder.isForward(flags));
    assertFalse(encoder.isBackward(flags));
    assertTrue(encoder.isBool(flags, FlagEncoder.K_ROUNDABOUT));
  }
コード例 #2
0
  @Test
  public void testSetAccess() {
    assertTrue(encoder.isForward(encoder.setProperties(0, true, true)));
    assertTrue(encoder.isBackward(encoder.setProperties(0, true, true)));

    assertTrue(encoder.isForward(encoder.setProperties(0, true, false)));
    assertFalse(encoder.isBackward(encoder.setProperties(0, true, false)));

    assertFalse(encoder.isForward(encoder.setProperties(0, false, true)));
    assertTrue(encoder.isBackward(encoder.setProperties(0, false, true)));

    assertTrue(encoder.isForward(encoder.flagsDefault(true, true)));
    assertTrue(encoder.isBackward(encoder.flagsDefault(true, true)));

    assertTrue(encoder.isForward(encoder.flagsDefault(true, false)));
    assertFalse(encoder.isBackward(encoder.flagsDefault(true, false)));

    long flags = encoder.flagsDefault(true, true);
    // disable access
    assertFalse(encoder.isForward(encoder.setAccess(flags, false, false)));
    assertFalse(encoder.isBackward(encoder.setAccess(flags, false, false)));
  }