Changeset 8496 in josm for trunk/test


Ignore:
Timestamp:
2015-06-19T20:23:18+02:00 (4 years ago)
Author:
simon04
Message:

fix #11505 - Download objects: load a range of OSM objects (modified patch by windu.2b)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/SimplePrimitiveIdTest.groovy

    r8194 r8496  
    2424    }
    2525
     26    void testBad() {
     27        shouldFail { SimplePrimitiveId.fromString("foobar") }
     28    }
     29
    2630    void testFuzzy() {
    2731        assert SimplePrimitiveId.fuzzyParse("foo relation/123 bar").toString() == "[relation 123]"
    2832        assert SimplePrimitiveId.fuzzyParse("foo relation/123 and way/345 but also node/789").toString() == "[relation 123, way 345, node 789]"
     33        assert SimplePrimitiveId.fuzzyParse("foo relation/123-24 and way/345-346 but also node/789").toString() == "[relation 123, relation 124, way 345, way 346, node 789]"
    2934    }
    3035
     
    3439        assert SimplePrimitiveId.fromString("relation 123") == new SimplePrimitiveId(123, OsmPrimitiveType.RELATION)
    3540    }
     41
     42    void testMultipleIDs() {
     43        assert SimplePrimitiveId.multipleFromString("node/234").toString() == "[node 234]"
     44        assert SimplePrimitiveId.multipleFromString("node/234-234").toString() == "[node 234]"
     45        assert SimplePrimitiveId.multipleFromString("node/2-1").toString() == "[]"
     46        assert SimplePrimitiveId.multipleFromString("node/123-124").toString() == "[node 123, node 124]"
     47        assert SimplePrimitiveId.multipleFromString("n/123-124").toString() == "[node 123, node 124]"
     48        assert SimplePrimitiveId.multipleFromString("node123-126").toString() == "[node 123, node 124, node 125, node 126]"
     49        assert SimplePrimitiveId.multipleFromString("way/123-123").toString() == "[way 123]"
     50        assert SimplePrimitiveId.multipleFromString("w/123-127").toString() == "[way 123, way 124, way 125, way 126, way 127]"
     51        assert SimplePrimitiveId.multipleFromString("way123-125").toString() == "[way 123, way 124, way 125]"
     52        assert SimplePrimitiveId.multipleFromString("relation/123-125").toString() == "[relation 123, relation 124, relation 125]"
     53        assert SimplePrimitiveId.multipleFromString("r/123-125").toString() == "[relation 123, relation 124, relation 125]"
     54        assert SimplePrimitiveId.multipleFromString("relation123-125").toString() == "[relation 123, relation 124, relation 125]"
     55        assert SimplePrimitiveId.multipleFromString("node/234-5").toString() == "[node 234, node 235]"
     56        assert SimplePrimitiveId.multipleFromString("node/234-35").toString() == "[node 234, node 235]"
     57        assert SimplePrimitiveId.multipleFromString("node/234-235").toString() == "[node 234, node 235]"
     58        assert SimplePrimitiveId.multipleFromString("node/998-1001").toString() == "[node 998, node 999, node 1000, node 1001]"
     59        shouldFail { SimplePrimitiveId.multipleFromString("foo node123 bar") }
     60    }
    3661}
Note: See TracChangeset for help on using the changeset viewer.