use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testComplexRegex.
/**
* The main point of this test is to ensure that all the examples compile.
*/
@Test
public void testComplexRegex() {
RuleSet rs = makeRuleSet(// "a~b [0x0]" +
"a~b & c=d [0x1]" + "a~b & c~d & e=f [0x2]" + "(a~b | c~d) & e=f [0x3]" + "(a~b | c~d) & e=f & g=h [0x4]" + "((a~b | c~d) & e=f) & g=h [0x5]" + "e=f & g=h & (a~b | c~'d.*') [0x6]" + "(e=f & g=h) & (a~b | c~'d.*') [0x7]" + "a=* & b=* & c=d [0x8]" + "a=* & (b=* | c=d) [0x9]" + "");
Way el = new Way(1);
el.addTag("c", "df");
el.addTag("g", "h");
el.addTag("e", "f");
GType type = getFirstType(rs, el);
assertNotNull("matches a rule", type);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testSelfReference.
/**
* This simply is to make sure that actions that affect their own
* conditions do not hang. There are no defined semantics for this.
*/
@Test
public void testSelfReference() {
RuleSet rs = makeRuleSet("iii=* { set iii=no }");
// Rule rule = rs.getMap().get("foot=*");
Way el = new Way(1);
el.addTag("foot", "yes");
el.addTag("iii", "xyz");
getFirstType(rs, el);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testDecimalAndDecimalCompare.
@Test
public void testDecimalAndDecimalCompare() {
RuleSet rs = makeRuleSet("z=yes & a < 3.5 [0x1]");
Way el = new Way(1);
el.addTag("z", "yes");
// Is less than so
el.addTag("a", "3.49");
GType type = getFirstType(rs, el);
assertNotNull("a is less than 3.5", type);
el.addTag("a", "3.55");
type = getFirstType(rs, el);
assertNull("a is greater than 3.5", type);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testDecimalValues.
/**
* Test values such as 3.5 in comparisons.
* Originally non-integer values were not allowed and were not even recognised.
*/
@Test
public void testDecimalValues() {
RuleSet rs = makeRuleSet("z=yes & a < 3.5 [0x1]");
Way el = new Way(1);
el.addTag("z", "yes");
// Is less than so
el.addTag("a", "2");
GType type = getFirstType(rs, el);
assertNotNull("a is less than 3.5", type);
el.addTag("a", "4");
type = getFirstType(rs, el);
assertNull("a is greater than 3.5", type);
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testRegexAtTop.
/**
* Some operations could not originally be used by themselves but now they are converted
* into expressions that can be handled automatically. The following few tests verify this.
*/
@Test
public void testRegexAtTop() {
RuleSet rs = makeRuleSet("QUOTA ~ ' [05]00\\.0+' [0x2]");
Element el = new Way(1);
el.addTag("QUOTA", " 500.0");
GType type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
}
Aggregations