use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testGetTagValueAlone.
@Test
public void testGetTagValueAlone() {
RuleSet rs = makeRuleSet("a<$b [0x5] a=b [0x6]");
Way w = new Way(1);
w.addTag("a", "1");
w.addTag("b", "2");
GType type = getFirstType(rs, w);
assertNotNull(type);
assertEquals(5, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testBugOrWithAndOnLeft.
@Test
public void testBugOrWithAndOnLeft() {
RuleSet rs = makeRuleSet("((a=1&b=2) | a=2) & c!=4 [0x2]");
Way w = new Way(1);
w.addTag("a", "2");
GType type = getFirstType(rs, w);
assertNotNull(type);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testFunctionWithSpaces.
@Test
public void testFunctionWithSpaces() {
RuleSet rs = makeRuleSet("A=B & length ( \n) > 91 & length\n()\n < 92 [0x5]");
Way el = getWayWithLength();
el.addTag("A", "B");
GType type = getFirstType(rs, el);
assertNotNull(type);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testBugOrWithAndOnLeft2.
@Test
public void testBugOrWithAndOnLeft2() {
RuleSet rs = makeRuleSet("(((a=1 | a=5)&b=2) | a=2) & c!=4 [0x2]");
Way w = new Way(1);
w.addTag("a", "2");
GType type = getFirstType(rs, w);
assertNotNull(type);
assertEquals(type.getType(), 2);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testOptimizeWithOr2.
/**
* Test is a simplified version of a rule in the floodblocker style.
*/
@Test
public void testOptimizeWithOr2() {
String s = "highway=*" + "& tunnel!=*" + "& (layer!=* | layer=0)" + " [0x02]\n";
RuleSet rs = makeRuleSet(s);
Element el = new Way(1);
el.addTag("highway", "primary");
GType type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
el.addTag("layer", "0");
type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
el.addTag("layer", "1");
type = getFirstType(rs, el);
assertNull(type);
}
Aggregations