//This test ensures that characters not allowed in well-formed XML get decoded as read in. //Qt's XML reading does this for us automatically. void runDecodeCharsTest() { OsmXmlReader uut; OsmMapPtr map(new OsmMap()); uut.read("test-files/io/OsmXmlReaderTest/runDecodeCharsTest.osm", map); int wayCtr = 0; for (WayMap::const_iterator it = map->getWays().begin(); it != map->getWays().end(); ++it) { const ConstWayPtr& w = it->second; if (w->getTags().get("note2") == "1") { HOOT_STR_EQUALS("1 & 2", w->getTags().get("note")); wayCtr++; } else if (w->getTags().get("note2") == "2") { HOOT_STR_EQUALS("\"3\"", w->getTags().get("note")); wayCtr++; } else if (w->getTags().get("note2") == "3") { HOOT_STR_EQUALS("0", w->getTags().get("note")); wayCtr++; } else if (w->getTags().get("note2") == "4") { HOOT_STR_EQUALS("<2>", w->getTags().get("note")); wayCtr++; } } CPPUNIT_ASSERT_EQUAL(4, wayCtr); }
/** * Creates a single match and should result in a PoiPolygonMerger */ void basicTest() { OsmMap::resetCounters(); OsmMapPtr map(new OsmMap()); Coordinate c1[] = { Coordinate(0.0, 0.0), Coordinate(20.0, 0.0), Coordinate(20.0, 20.0), Coordinate(0.0, 20.0), Coordinate(0.0, 0.0), Coordinate::getNull() }; WayPtr w1 = TestUtils::createWay(map, Status::Unknown1, c1, 5, "w1"); w1->getTags().set("area", true); w1->getTags()["name"] = "foo"; w1->getTags()["amenity"] = "bar"; NodePtr n1(new Node(Status::Unknown2, 1, 10, 10, 5)); n1->getTags()["name"] = "bar"; n1->getTags()["amenity"] = "cafe"; map->addNode(n1); PoiPolygonMatch match1( map, w1->getElementId(), n1->getElementId(), shared_ptr<MatchThreshold>()); MatchSet matches; matches.insert(&match1); vector<Merger*> mergers; PoiPolygonMergerCreator uut; uut.setOsmMap(map.get()); HOOT_STR_EQUALS(1, uut.createMergers(matches, mergers)); HOOT_STR_EQUALS(1, mergers.size()); HOOT_STR_EQUALS(1, (dynamic_cast<PoiPolygonMerger*>(mergers[0]) != 0)); }
void runTagTest() { OsmReader reader; OsmMap::resetCounters(); shared_ptr<OsmMap> map(new OsmMap()); reader.setDefaultStatus(Status::Unknown1); reader.read("test-files/conflate/unified/AllDataTypesA.osm", map); reader.setDefaultStatus(Status::Unknown2); reader.read("test-files/conflate/unified/AllDataTypesB.osm", map); vector<long> wids1 = map->findWays("REF1", "Panera"); vector<long> wids2 = map->findWays("REF2", "Panera"); set< pair<ElementId, ElementId> > pairs; for (size_t i = 0; i < wids2.size(); i++) { pairs.insert(pair<ElementId, ElementId>(ElementId::way(wids1[0]), ElementId::way(wids2[i]))); } RemoveMissVisitor v(map, "Panera"); map->visitRw(v); vector< pair<ElementId, ElementId> > replaced; BuildingMerger bm(pairs); bm.apply(map, replaced); // QDir(".").mkpath("test-output/conflate/polygon"); // OsmWriter writer; // writer.write(map, "test-output/conflate/polygon/BuildingTagTest.osm"); HOOT_STR_EQUALS("[3]{(Way:-26, Relation:-1), (Way:-25, Relation:-1), (Way:-14, Relation:-1)}", replaced); HOOT_STR_EQUALS("{\"version\": 0.6,\"generator\": \"Hootenanny\",\"elements\": [\n" "{\"type\":\"node\",\"id\":-218,\"lat\":39.593278,\"lon\":-104.80656},\n" "{\"type\":\"node\",\"id\":-219,\"lat\":39.593114,\"lon\":-104.80653},\n" "{\"type\":\"node\",\"id\":-220,\"lat\":39.593124,\"lon\":-104.80645},\n" "{\"type\":\"node\",\"id\":-221,\"lat\":39.593106,\"lon\":-104.80644},\n" "{\"type\":\"node\",\"id\":-222,\"lat\":39.593114,\"lon\":-104.8064},\n" "{\"type\":\"node\",\"id\":-223,\"lat\":39.593115,\"lon\":-104.80635},\n" "{\"type\":\"node\",\"id\":-224,\"lat\":39.593291,\"lon\":-104.80637},\n" "{\"type\":\"node\",\"id\":-225,\"lat\":39.593307,\"lon\":-104.80638},\n" "{\"type\":\"node\",\"id\":-226,\"lat\":39.593279,\"lon\":-104.80647},\n" "{\"type\":\"node\",\"id\":-227,\"lat\":39.593297,\"lon\":-104.80625},\n" "{\"type\":\"node\",\"id\":-228,\"lat\":39.593303,\"lon\":-104.80612},\n" "{\"type\":\"node\",\"id\":-229,\"lat\":39.593127,\"lon\":-104.80609},\n" "{\"type\":\"node\",\"id\":-230,\"lat\":39.593124,\"lon\":-104.80611},\n" "{\"type\":\"node\",\"id\":-231,\"lat\":39.593152,\"lon\":-104.80613},\n" "{\"type\":\"node\",\"id\":-232,\"lat\":39.593143,\"lon\":-104.80622},\n" "{\"type\":\"node\",\"id\":-233,\"lat\":39.593122,\"lon\":-104.80621},\n" "{\"type\":\"way\",\"id\":-26,\"nodes\":[-224,-227,-228,-229,-230,-231,-232,-233,-223,-224],\"tags\":{\"building:part\":\"yes\",\"error:circular\":\"15\"},\n" "{\"type\":\"way\",\"id\":-25,\"nodes\":[-218,-219,-220,-221,-222,-223,-224,-225,-226,-218],\"tags\":{\"building:part\":\"yes\",\"error:circular\":\"15\"},\n" "{\"type\":\"relation\",\"id\":-1,\"members\":[\n" "{\"type\":\"way\",\"ref\":-26,\"role\":\"part\"},\n" "{\"type\":\"way\",\"ref\":-25,\"role\":\"part\"}],\"tags\":{\"REF1\":\"Panera\",\"REF2\":\"Panera\",\"hoot:building:match\":\"true\",\"alt_name\":\"Maid-Rite;Maid-Rite Diner\",\"building\":\"yes\",\"name\":\"Panera Bread\",\"error:circular\":\"-1\"}]\n" "}\n", OsmJsonWriter(8).toString(map)); }
void runConflateTest() { OsmReader reader; shared_ptr<OsmMap> map(new OsmMap()); reader.setDefaultStatus(Status::Unknown1); reader.read("test-files/ToyBuildingsTestA.osm", map); reader.setDefaultStatus(Status::Unknown2); reader.read("test-files/ToyBuildingsTestB.osm", map); MapProjector::projectToPlanar(map); WayMap wm = map->getWays(); for (WayMap::const_iterator it = wm.begin(); it != wm.end(); ++it) { const ConstWayPtr& w = it->second; const Tags& t = w->getTags(); if (t["REF1"] != "Target" && t["REF2"] != "Target") { map->removeWay(it->first); } } Conflator uut; shared_ptr<Manipulator> m(new BuildingMergeManipulator()); deque< shared_ptr<Manipulator> > manipulators; manipulators.push_back(m); uut.setManipulators(manipulators); uut.loadSource(map); uut.conflate(); shared_ptr<OsmMap> out(new OsmMap(uut.getBestMap())); MapProjector::projectToWgs84(out); OsmWriter writer; writer.setIncludeIds(true); writer.write(out, "test-output/BuildingConflatorTest.osm"); ConstWayPtr cheddars = getWay(out, "REF1", "Cheddar's"); CPPUNIT_ASSERT_EQUAL(string("Cheddar's"), cheddars->getTags()["REF2"].toStdString()); HOOT_STR_EQUALS(Status::Conflated, cheddars->getStatus()); ConstWayPtr biondi = getWay(out, "REF1", "Biondi"); CPPUNIT_ASSERT_EQUAL(string("Biondi"), biondi->getTags()["REF2"].toStdString()); HOOT_STR_EQUALS(Status::Conflated, biondi->getStatus()); ConstWayPtr freddys = getWay(out, "REF1", "Freddy's"); CPPUNIT_ASSERT_EQUAL(false, freddys->getTags().contains("REF2")); HOOT_STR_EQUALS(Status::Unknown1, freddys->getStatus()); ConstWayPtr target = getWay(out, "REF1", "Target"); CPPUNIT_ASSERT_EQUAL(string("Target"), biondi->getTags()["REF2"].toStdString()); HOOT_STR_EQUALS(Status::Unknown1, target->getStatus()); CPPUNIT_ASSERT_EQUAL((size_t)9, out->getWays().size()); }
void runTest() { StringTokenizer uut; Settings s; s.set(ConfigOptions::getTokenKeepNonWordsKey(), false); s.set(ConfigOptions::getTokenMinSizeKey(), 2); uut.setConfiguration(s); HOOT_STR_EQUALS("[2]{Hello, World.}", uut.tokenize("Hello World.")); HOOT_STR_EQUALS("[1]{Dime}", uut.tokenize("5 & Dime")); HOOT_STR_EQUALS("[2]{Foo, Bar}", uut.tokenize("Foo ---- Bar")); s.set(ConfigOptions::getTokenKeepNonWordsKey(), true); s.set(ConfigOptions::getTokenMinSizeKey(), 1); uut.setConfiguration(s); HOOT_STR_EQUALS("[2]{Hello, World.}", uut.tokenize("Hello World.")); HOOT_STR_EQUALS("[3]{5, &, Dime}", uut.tokenize("5 & Dime")); HOOT_STR_EQUALS("[3]{Foo, ----, Bar}", uut.tokenize("Foo ---- Bar")); s.set(ConfigOptions::getTokenKeepNonWordsKey(), true); s.set(ConfigOptions::getTokenMinSizeKey(), 3); uut.setConfiguration(s); HOOT_STR_EQUALS("[2]{Hello, World.}", uut.tokenize("Hello World.")); HOOT_STR_EQUALS("[1]{Dime}", uut.tokenize("5 & Dime")); HOOT_STR_EQUALS("[3]{Foo, ----, Bar}", uut.tokenize("Foo ---- Bar")); }
void runBasicTest() { NodePtr n1(new Node(Status::Unknown1, -1, -104.8852148123, 38.8467218123, 5)); n1->getTags()["highway"] = "bus_stop"; n1->getTags()["name"] = "Bus Stop 1"; n1->getTags()["source"] = "imagery"; HOOT_STR_EQUALS("{\"type\":\"Feature\",\"properties\":{\"type\":\"node\",\"tags\":{\"error:circular\":\"5\",\"highway\":\"bus_stop\",\"name\":\"Bus Stop 1\"}},\"geometry\":{\"type\":\"Point\",\"coordinates\":[-104.8852148,38.8467218]}}", CalculateHashVisitor::toJsonString(n1)); // validated here: http://onlinemd5.com/ // for some reason the commandline sha1sum gives a different result. HOOT_STR_EQUALS("746c440be4fc11f9631d62d26cbba6aa97f73e3c", QString::fromUtf8(CalculateHashVisitor::toHash(n1).toHex().data())); }
void runCircleTest() { { LineSegment ls(-2, 0.5, 2, 0.5); Coordinate origin(0, 0); Coordinate p1, p2; BufferedLineSegmentIntersector uut; uut.circleIntersection(origin, 1, ls, p1, p2); HOOT_STR_EQUALS("0.866025 0.5, -0.866025 0.5", p1 << ", " << p2); } { LineSegment ls(-1, 2.5, 3, 2.5); Coordinate origin(1, 2); Coordinate p1, p2; BufferedLineSegmentIntersector uut; uut.circleIntersection(origin, 1, ls, p1, p2); HOOT_STR_EQUALS("1.86603 2.5, 0.133975 2.5", p1 << ", " << p2); } // tangent at the top of the circle { LineSegment ls(-1, 3, 3, 3); Coordinate origin(1, 2); Coordinate p1, p2; BufferedLineSegmentIntersector uut; uut.circleIntersection(origin, 1, ls, p1, p2); HOOT_STR_EQUALS("1 3, nan nan", p1 << ", " << p2); } // arbitrary line that was causing problems. Intersections are outside the line segment. { LineSegment ls(0.648952, 2.00472, 0.783395, 4.02088); Coordinate origin(0.686158, 1.21443); Coordinate p1, p2; BufferedLineSegmentIntersector uut; uut.circleIntersection(origin, 0.424808, ls, p1, p2); HOOT_STR_EQUALS("nan nan, nan nan", p1 << ", " << p2); } }
void runEscapeTags() { OsmMapPtr map(new OsmMap()); Coordinate coords[] = { Coordinate(0, 0), Coordinate(0, 1), Coordinate(1, 1), Coordinate(1, 0), Coordinate::getNull() }; Tags tags; tags.set("note", "<2>"); tags.set("aerialway", "t-bar"); tags.set("first name", "first name goes here"); tags.set("full_name", "\"Hacksaw\" Jim Duggan"); WayPtr way = TestUtils::createWay(map, Status::Unknown1, coords); way->setTags(tags); QList<ElementPtr> nodes; NodePtr node1(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.0, 0.1), 15)); node1->getTags().appendValue("name", "test1"); nodes.append(node1); NodePtr node2(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.1, 0.0), 15)); node2->getTags().appendValue("name", "test2"); nodes.append(node2); RelationPtr relation = TestUtils::createRelation(map, nodes); relation->setType("review"); relation->getTags().appendValue("name", "Test Review"); std::vector<RelationData::Entry> members = relation->getMembers(); members[0].role = "reviewee"; members[1].role = "reviewee"; relation->setMembers(members); QString output = OsmPgCsvWriter::toString(map); // Compare the results HOOT_STR_EQUALS(expected_runEscapeTags, output); }
void runTest() { /* * | <unassigned> | California | Hostel | in | Hollywood * <unassigned> | - | .8 | 1 | 0.5 | 1 * Hotel | 1 | 0.98 | 0.1 | 1 | 0.8 * California | 0.8 | 0.0 | 0.98 | 1 | 0.99 */ ScoreMatrix uut(5, 3); uut.set(0, 1, 1); uut.set(0, 2, 0.8); uut.set(1, 0, .8); uut.set(1, 1, .98); uut.set(1, 2, 0.0); uut.set(2, 0, 1); uut.set(2, 1, .1); uut.set(2, 2, .98); uut.set(3, 0, .5); uut.set(3, 1, 1); uut.set(3, 2, 1); uut.set(4, 0, 1); uut.set(4, 1, .8); uut.set(4, 2, .99); HOOT_STR_EQUALS(1.6, uut.minSumScore()); }
void basicTest() { OsmMapPtr map = getTestMap1(); { PoiPolygonMatchCreator uut; vector<const Match*> matches; boost::shared_ptr<const MatchThreshold> threshold(new MatchThreshold(0.5, 0.5, 0.5)); uut.createMatches(map, matches, threshold); HOOT_STR_EQUALS(2, matches.size()); HOOT_STR_EQUALS("PoiPolygonMatch Node(1) Way(-1) P: match: 1 miss: 0 review: 0, distance: 0, close match: 1, type score: 0, name score: 1, address score: -1", matches[0]->toString()); HOOT_STR_EQUALS("PoiPolygonMatch Node(2) Way(-1) P: match: 0 miss: 0 review: 1, distance: 0, close match: 1, type score: 0, name score: 0, address score: 0", matches[1]->toString()); } }
void runMatchTest() { OsmReader reader; OsmMap::resetCounters(); shared_ptr<OsmMap> map(new OsmMap()); reader.setDefaultStatus(Status::Unknown1); reader.read("test-files/ToyBuildingsTestA.osm", map); reader.setDefaultStatus(Status::Unknown2); reader.read("test-files/ToyBuildingsTestB.osm", map); MapReprojector::reprojectToPlanar(map); vector<long> wids1 = map->findWays("REF1", "Target"); vector<long> wids2 = map->findWays("REF2", "Target"); set< pair<ElementId, ElementId> > pairs; for (size_t i = 0; i < wids2.size(); i++) { pairs.insert(pair<ElementId, ElementId>(ElementId::way(wids1[0]), ElementId::way(wids2[i]))); } vector< pair<ElementId, ElementId> > replaced; BuildingMerger bm(pairs); bm.apply(map, replaced); MapReprojector::reprojectToWgs84(map); QDir(".").mkpath("test-output/conflate/polygon"); OsmWriter writer; writer.write(map, "test-output/conflate/polygon/BuildingMergerTest.osm"); HOOT_STR_EQUALS("[3]{(Way:-15, Way:-7), (Way:-14, Way:-7), (Way:-13, Way:-7)}", replaced); }
void runRemoveTest() { Way w(Status::Unknown1, -1, 10); w.addNode(1); w.addNode(2); w.addNode(2); w.addNode(3); w.addNode(2); w.addNode(4); w.addNode(5); w.removeNode(4); HOOT_STR_EQUALS("[6]{1, 2, 2, 3, 2, 5}", w.getNodeIds()); w.removeNode(2); HOOT_STR_EQUALS("[3]{1, 3, 5}", w.getNodeIds()); }
/** * Creates two matches with overlap and should create a MarkForReviewMerger */ void reviewTest() { OsmMap::resetCounters(); OsmMapPtr map(new OsmMap()); Coordinate c1[] = { Coordinate(0.0, 0.0), Coordinate(20.0, 0.0), Coordinate(20.0, 20.0), Coordinate(0.0, 20.0), Coordinate(0.0, 0.0), Coordinate::getNull() }; WayPtr w1 = TestUtils::createWay(map, Status::Unknown1, c1, 5, "w1"); w1->getTags().set("building", true); w1->getTags()["name"] = "foo"; w1->getTags()["amenity"] = "bar"; Coordinate c2[] = { Coordinate(0.0, 0.0), Coordinate(5.0, 0.0), Coordinate(5.0, 5.0), Coordinate(0.0, 5.0), Coordinate(0.0, 0.0), Coordinate::getNull() }; WayPtr w2 = TestUtils::createWay(map, Status::Unknown2, c2, 5, "w2"); w2->getTags().set("building", true); w2->getTags()["name"] = "goofie"; NodePtr n1(new Node(Status::Unknown2, 1, 19, 19, 5)); n1->getTags()["name"] = "foo"; n1->getTags()["amenity"] = "cafe"; map->addNode(n1); vector<const Match*> matchesV; PoiPolygonMatch match1(map, w1->getElementId(), n1->getElementId(), shared_ptr<MatchThreshold>()); matchesV.push_back(&match1); shared_ptr<const MatchThreshold> threshold(new MatchThreshold(0.5, 0.5, 0.5)); BuildingMatchCreator().createMatches(map, matchesV, threshold); PoiPolygonMatch match2(map, w2->getElementId(), n1->getElementId(), shared_ptr<MatchThreshold>()); LOG_VAR(match2); MatchSet matches; matches.insert(matchesV.begin(), matchesV.end()); vector<Merger*> mergers; PoiPolygonMergerCreator uut; uut.setOsmMap(map.get()); HOOT_STR_EQUALS(1, uut.createMergers(matches, mergers)); HOOT_STR_EQUALS(1, mergers.size()); LOG_VAR(*mergers[0]); HOOT_STR_EQUALS(1, (dynamic_cast<MarkForReviewMerger*>(mergers[0]) != 0)); }
void runReadByBoundsTest() { insertDataForBoundTest(); OsmApiDb database; database.open(ServicesDbTestUtils::getOsmApiDbUrl()); OsmApiDbReader reader; reader.open(ServicesDbTestUtils::getOsmApiDbUrl().toString()); OsmMapPtr map(new OsmMap()); reader.setBoundingBox("-88.1,28.91,-88.0,28.89"); reader.read(map); //quick check to see if the element counts are off...consult the test output for more detail //All but two of the seven nodes should be returned. There are five nodes outside of the //requested bounds, one of them is referenced by a way within the bounds and the other three by a //relation within the bounds. The nodes not returned is outside of the requested bounds and not //reference by any other element. CPPUNIT_ASSERT_EQUAL(5, (int)map->getNodes().size()); //Two of the five ways should be returned. The ways not returned contain nodes //that are out of bounds. CPPUNIT_ASSERT_EQUAL(2, (int)map->getWays().size()); //Two of the six relations should be returned. The relations not returned contain all //members that are out of bounds. CPPUNIT_ASSERT_EQUAL(2, (int)map->getRelations().size()); // Verify timestamps look OK WayPtr pWay = map->getWays().begin()->second; CPPUNIT_ASSERT(0 != pWay->getTimestamp()); //Need to remove timestamps, otherwise they cause issues with the compare QList<ElementAttributeType> types; types.append(ElementAttributeType(ElementAttributeType::Timestamp)); RemoveAttributesVisitor attrVis(types); map->visitRw(attrVis); TestUtils::mkpath("test-output/io/ServiceOsmApiDbReaderTest"); MapProjector::projectToWgs84(map); OsmMapWriterFactory::write(map, "test-output/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm"); HOOT_STR_EQUALS( TestUtils::readFile("test-files/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm"), TestUtils::readFile("test-output/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm")); //just want to make sure I can read against the same data twice in a row w/o crashing and also //make sure I don't get the same result again for a different bounds reader.setBoundingBox("-1,-1,1,1"); map.reset(new OsmMap()); reader.read(map); CPPUNIT_ASSERT_EQUAL(0, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getWays().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size()); reader.close(); }
void runTest() { MostEnglishName uut; HOOT_STR_EQUALS(1, MostEnglishName::getInstance()->scoreName("Foo bar")); HOOT_STR_EQUALS(1, MostEnglishName::getInstance()->scoreName("Disney World")); HOOT_STR_EQUALS(0, MostEnglishName::getInstance()->scoreName("")); HOOT_STR_EQUALS(0, MostEnglishName::getInstance()->scoreName(QString::fromUtf8("улица Ильинка"))); HOOT_STR_EQUALS(0, MostEnglishName::getInstance()->scoreName( QString::fromUtf8("улица Куйбышева (1935 г.) улица Ильинка (до 1917 г.)"))); HOOT_STR_EQUALS(.75, MostEnglishName::getInstance()->scoreName(QString::fromUtf8("street Ilinka"))); Tags t; t["name"] = "Calle Ilinka"; t["alt_name"] = QString::fromUtf8("улица Ильинка;street Ilinka"); HOOT_STR_EQUALS("street Ilinka", MostEnglishName::getInstance()->getMostEnglishName(t)); }
void runString() { OsmXmlReader reader; OsmMapPtr map(new OsmMap()); reader.setDefaultStatus(Status::Unknown1); reader.read("test-files/UndividedHighwayPreSplit.osm", map); QString output = OsmPgCsvWriter::toString(map); // Compare the results HOOT_STR_EQUALS(expected_runString, output); }
void runBasicTest() { OsmMapPtr map(new OsmMap()); OsmMapReaderFactory::getInstance().read(map, "test-files/filters/ComplexBuildings.osm"); BuildingCriterion uut; uut.setOsmMap(map.get()); HOOT_STR_EQUALS(1, uut.isSatisfied(TestUtils::getElementWithNote(map, "targetandbestbuy"))); HOOT_STR_EQUALS(0, uut.isSatisfied(TestUtils::getElementWithNote(map, "target"))); HOOT_STR_EQUALS(0, uut.isSatisfied(TestUtils::getElementWithNote(map, "bestbuy"))); HOOT_STR_EQUALS(0, uut.isSatisfied(TestUtils::getElementWithNote(map, "pho"))); HOOT_STR_EQUALS(0, uut.isSatisfied(TestUtils::getElementWithNote(map, "panera"))); HOOT_STR_EQUALS(1, uut.isSatisfied(TestUtils::getElementWithNote(map, "freddys"))); HOOT_STR_EQUALS(1, uut.isSatisfied(TestUtils::getElementWithNote(map, "jewelry"))); HOOT_STR_EQUALS(1, uut.isSatisfied(TestUtils::getElementWithNote(map, "paneragroup"))); HOOT_STR_EQUALS(0, uut.isSatisfied(TestUtils::getElementWithNote(map, "jewelryandfreddys"))); }
void uuidHashTest() { shared_ptr<PluginContext> _pc(new PluginContext()); HandleScope handleScope; Context::Scope context_scope(_pc->getContext()); // From the standard Uuid Test // QUuid r = UuidHelper::createUuid5("foo", QUuid("{6ba7b812-9dad-11d1-80b4-00c04fd430c8}")); // HOOT_STR_EQUALS("{bca95adb-b5f1-564f-96a7-6355c52d1fa7}", r.toString()); conf().set(ConfigOptions().getUuidHelperRepeatableKey(), true); HOOT_STR_EQUALS(fixQ("'{b18057ff-736d-5d20-b873-837f0c172e33}'"), _pc->eval("hoot.UuidHelper.createUuid()")); HOOT_STR_EQUALS(fixQ("'{f1a68c36-8474-5aa5-93ab-8a95ef41050b}'"), _pc->eval("hoot.UuidHelper.createUuid5('bar')")); HOOT_STR_EQUALS(fixQ("'{bca95adb-b5f1-564f-96a7-6355c52d1fa7}'"), _pc->eval("hoot.UuidHelper.createUuid5('foo', '{6ba7b812-9dad-11d1-80b4-00c04fd430c8}')")); }
void runTest() { BufferedLineSegmentIntersector uut; { LineSegment ls1(0, 0, 1, 1); LineSegment ls2(0, 0, 1, 1); LineSegment result; HOOT_STR_EQUALS(true, uut.intersect(ls1, 1, ls2, result)); HOOT_STR_EQUALS("LINESEGMENT(0 0,1 1)", result); } { LineSegment ls1(0, 1, 1, 0); LineSegment ls2(0, 0, 1, 1); LineSegment result; HOOT_STR_EQUALS(true, uut.intersect(ls1, .14142135623730950488016887242097, ls2, result)); HOOT_STR_EQUALS("LINESEGMENT(0.4 0.4,0.6 0.6)", result); } { LineSegment ls1(2, 0, 3, 2); LineSegment ls2(2, 0, 4, 4); LineSegment result; HOOT_STR_EQUALS(true, uut.intersect(ls1, .1, ls2, result)); HOOT_STR_EQUALS("LINESEGMENT(2 0,3.04472 2.08944)", result); } }
void runShpTest() { OgrWriter uut; uut.setScriptPath("test-files/io/SampleTranslation.js"); FileUtils::removeDir("test-output/io/OgrWriterTest"); uut.open("test-output/io/OgrWriterTest.shp"); uut.write(createTestMap()); QStringList nameFilter; nameFilter << "*.shp"; // make sure it created the shapefiles, we aren't actually testing for correct output. HOOT_STR_EQUALS("[4]{AAL015.shp, LAP010.shp, LAP030.shp, PAL015.shp}", QDir("test-output/io/OgrWriterTest").entryList(nameFilter)); }
void verifyFullReadOutput(OsmMapPtr map) { //nodes CPPUNIT_ASSERT_EQUAL(2, (int)map->getNodes().size()); HOOT_STR_EQUALS(true, map->containsNode(1)); NodePtr node = map->getNode(1); CPPUNIT_ASSERT_EQUAL((long)1, node->getId()); CPPUNIT_ASSERT_EQUAL(38.4, node->getY()); CPPUNIT_ASSERT_EQUAL(-106.5, node->getX()); CPPUNIT_ASSERT_EQUAL(15.0, node->getCircularError()); CPPUNIT_ASSERT_EQUAL(2, node->getTags().size()); NodePtr node1 = map->getNode(2); CPPUNIT_ASSERT_EQUAL((long)2, node1->getId()); CPPUNIT_ASSERT_EQUAL(38.0, node1->getY()); CPPUNIT_ASSERT_EQUAL(-104.0, node1->getX()); //ways HOOT_STR_EQUALS(true, map->containsWay(1)); WayPtr way = map->getWay(1); CPPUNIT_ASSERT_EQUAL((long)1, way->getId()); CPPUNIT_ASSERT_EQUAL(2, (int)way->getNodeCount()); CPPUNIT_ASSERT_EQUAL((long)1, way->getNodeId(0)); CPPUNIT_ASSERT_EQUAL((long)2, way->getNodeId(1)); CPPUNIT_ASSERT_EQUAL(15.0, way->getCircularError()); CPPUNIT_ASSERT_EQUAL(1, way->getTags().size()); //relations HOOT_STR_EQUALS(true, map->containsRelation(1)); RelationPtr relation = map->getRelation(1); CPPUNIT_ASSERT_EQUAL((long)1, relation->getId()); vector<RelationData::Entry> relationData = relation->getMembers(); CPPUNIT_ASSERT_EQUAL(2, (int)relation->getMembers().size()); HOOT_STR_EQUALS("wayrole", relationData[0].getRole()); HOOT_STR_EQUALS("noderole",relationData[1].getRole()); CPPUNIT_ASSERT_EQUAL(15.0, relation->getCircularError()); }
void runLayerNameFilterTest() { // Great bit of code taken from TranslatedTagDifferencer.cpp // We just need a standard ScriptTranslator for this test. shared_ptr<ScriptTranslator> uut(ScriptTranslatorFactory::getInstance().createTranslator( "test-files/io/SampleTranslation.js")); if (!uut) { throw HootException("Error allocating translator."); } // Check that we can access a value from a Javascript function HOOT_STR_EQUALS("Papa Smurf",uut->getLayerNameFilter()); }
/** * Create a couple of simple way strings and verify that the generated subline match is correct. */ void runTest() { OsmMapPtr map(new OsmMap()); NodePtr n1a = TestUtils::createNode(map, Status::Unknown1, 0, 0); NodePtr n1b = TestUtils::createNode(map, Status::Unknown1, 100, 0); NodePtr n1c = TestUtils::createNode(map, Status::Unknown1, 200, 0); WayPtr w1 = TestUtils::createWay(map, QList<NodePtr>() << n1a << n1b); WayPtr w2 = TestUtils::createWay(map, QList<NodePtr>() << n1b << n1c); NodePtr n2a = TestUtils::createNode(map, Status::Unknown1, 0, 10); NodePtr n2b = TestUtils::createNode(map, Status::Unknown1, 150, 10); NodePtr n2c = TestUtils::createNode(map, Status::Unknown1, 210, 10); WayPtr w3 = TestUtils::createWay(map, QList<NodePtr>() << n2a << n2b); WayPtr w4 = TestUtils::createWay(map, QList<NodePtr>() << n2c << n2b); WayStringPtr wstr1(new WayString()); wstr1->append(WaySubline(WayLocation(map, w1, 0), WayLocation::createAtEndOfWay(map, w1))); wstr1->append(WaySubline(WayLocation(map, w2, 0), WayLocation::createAtEndOfWay(map, w2))); WayStringPtr wstr2(new WayString()); wstr2->append(WaySubline(WayLocation(map, w3, 0), WayLocation::createAtEndOfWay(map, w3))); wstr2->append(WaySubline(WayLocation::createAtEndOfWay(map, w4), WayLocation(map, w4, 0))); WayMatchStringMappingPtr mapping(new NaiveWayMatchStringMapping(wstr1, wstr2)); WaySublineMatchStringPtr wsms = WayMatchStringMappingConverter(). toWaySublineMatchString(mapping); //LOG_VAR(TestUtils::toQuotedString(hoot::toString(wsms))); HOOT_STR_EQUALS("matches:\n" "subline 1: start: way(-1) index: 0 fraction: 0 end: way(-1) index: 1 fraction: 0\n" "subline 2: start: way(-3) index: 0 fraction: 0 end: way(-3) index: 0 fraction: 0.7\n" "subline 1: start: way(-2) index: 0 fraction: 0 end: way(-2) index: 0 fraction: 0.428571428571429\n" "subline 2: start: way(-3) index: 0 fraction: 0.7 end: way(-3) index: 1 fraction: 0\n" "reversed, subline 1: start: way(-2) index: 0 fraction: 0.428571428571429 end: way(-2) index: 1 fraction: 0\n" "subline 2: start: way(-4) index: 0 fraction: 0 end: way(-4) index: 1 fraction: 0", wsms); }
void runTest() { DictionaryTranslator translator; QStringList result; result << "building"; HOOT_STR_EQUALS(result, translator.toEnglishAll("gedung")); result.clear(); result << "office building"; result << "agency building"; result << "bureau building"; HOOT_STR_EQUALS(result, translator.toEnglishAll("kantor gedung")); result.clear(); result << "hospital"; HOOT_STR_EQUALS(result, translator.toEnglishAll("rumah sakit")); result.clear(); result << "general hospital office"; result << "general hospital agency"; result << "general hospital bureau"; result << "hospital office"; result << "hospital agency"; result << "hospital bureau"; HOOT_STR_EQUALS(result, translator.toEnglishAll("rumah sakit umum kantor")); result.clear(); result << "ryba office bar"; result << "ryba agency bar"; result << "ryba bureau bar"; HOOT_STR_EQUALS(result, translator.toEnglishAll(QString::fromUtf8("рыба kantor bar"))); result.clear(); result << "embassy hungaria"; HOOT_STR_EQUALS(result, translator.toEnglishAll(QString::fromUtf8("Kedutaan Besar Hungaria"))); }
void runPartialReadTest() { //The differences in tag counts here when compared to //ServiceHootApiDbReaderTest::runPartialReadTest are due to differences between the way //HootApiDbWriter and OsmApiDbBulkInserter handle metadata tags, which is by design. populatePartialMap(); OsmApiDbReader reader; const int chunkSize = 3; reader.setMaxElementsPerMap(chunkSize); reader.open(ServicesDbTestUtils::getOsmApiDbUrl().toString()); reader.initializePartial(); int ctr = 0; OsmMapPtr map(new OsmMap()); //3 nodes CPPUNIT_ASSERT(reader.hasMoreElements()); reader.readPartial(map); CPPUNIT_ASSERT_EQUAL(3, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getWays().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size()); NodePtr node = map->getNode(1); CPPUNIT_ASSERT_EQUAL((long)1, node->getId()); CPPUNIT_ASSERT_EQUAL(0.0, node->getX()); CPPUNIT_ASSERT_EQUAL(0.0, node->getY()); CPPUNIT_ASSERT_EQUAL(0, node->getTags().size()); node = map->getNode(2); CPPUNIT_ASSERT_EQUAL((long)2, node->getId()); CPPUNIT_ASSERT_EQUAL(0.1, node->getX()); CPPUNIT_ASSERT_EQUAL(0.0, node->getY()); CPPUNIT_ASSERT_EQUAL(1, node->getTags().size()); HOOT_STR_EQUALS("n2b", node->getTags().get("noteb")); node = map->getNode(3); CPPUNIT_ASSERT_EQUAL((long)3, node->getId()); CPPUNIT_ASSERT_EQUAL(0.2, node->getX()); CPPUNIT_ASSERT_EQUAL(0.0, node->getY()); CPPUNIT_ASSERT_EQUAL(1, node->getTags().size()); HOOT_STR_EQUALS("n3", node->getTags().get("note")); ctr++; //2 nodes, 1 way map.reset(new OsmMap()); CPPUNIT_ASSERT(reader.hasMoreElements()); reader.readPartial(map); CPPUNIT_ASSERT_EQUAL(2, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(1, (int)map->getWays().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size()); node = map->getNode(4); CPPUNIT_ASSERT_EQUAL((long)4, node->getId()); CPPUNIT_ASSERT_EQUAL(0.3, node->getX()); CPPUNIT_ASSERT_EQUAL(0.0, node->getY()); CPPUNIT_ASSERT_EQUAL(1, node->getTags().size()); HOOT_STR_EQUALS("n4", node->getTags().get("note")); node = map->getNode(5); CPPUNIT_ASSERT_EQUAL((long)5, node->getId()); CPPUNIT_ASSERT_EQUAL(0.4, node->getX()); CPPUNIT_ASSERT_EQUAL(0.0, node->getY()); CPPUNIT_ASSERT_EQUAL(0, node->getTags().size()); WayPtr way = map->getWay(1); CPPUNIT_ASSERT_EQUAL((long)1, way->getId()); CPPUNIT_ASSERT(way->hasNode(1)); CPPUNIT_ASSERT(way->hasNode(2)); CPPUNIT_ASSERT_EQUAL(1, way->getTags().size()); HOOT_STR_EQUALS("w1b", way->getTags().get("noteb")); ctr++; //2 ways, 1 relation map.reset(new OsmMap()); CPPUNIT_ASSERT(reader.hasMoreElements()); reader.readPartial(map); CPPUNIT_ASSERT_EQUAL(0, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(2, (int)map->getWays().size()); CPPUNIT_ASSERT_EQUAL(1, (int)map->getRelations().size()); way = map->getWay(2); CPPUNIT_ASSERT_EQUAL((long)2, way->getId()); CPPUNIT_ASSERT(way->hasNode(2)); CPPUNIT_ASSERT(way->hasNode(3)); CPPUNIT_ASSERT_EQUAL(1, way->getTags().size()); HOOT_STR_EQUALS("w2", way->getTags().get("note")); way = map->getWay(3); CPPUNIT_ASSERT_EQUAL((long)3, way->getId()); CPPUNIT_ASSERT(way->hasNode(2)); CPPUNIT_ASSERT_EQUAL(0, way->getTags().size()); RelationPtr relation = map->getRelation(1); CPPUNIT_ASSERT_EQUAL((long)1, relation->getId()); CPPUNIT_ASSERT_EQUAL(size_t(2), relation->getMembers().size()); CPPUNIT_ASSERT(relation->contains(ElementId::node(1))); CPPUNIT_ASSERT(relation->contains(ElementId::way(1))); RelationData::Entry member = relation->getMembers().at(0); HOOT_STR_EQUALS("n1", member.role); CPPUNIT_ASSERT_EQUAL((long)1, member.getElementId().getId()); member = relation->getMembers().at(1); HOOT_STR_EQUALS("w1", member.role); CPPUNIT_ASSERT_EQUAL((long)1, member.getElementId().getId()); CPPUNIT_ASSERT_EQUAL(1, relation->getTags().size()); HOOT_STR_EQUALS("r1", relation->getTags().get("note")); ctr++; //1 relation map.reset(new OsmMap()); CPPUNIT_ASSERT(reader.hasMoreElements()); reader.readPartial(map); CPPUNIT_ASSERT_EQUAL(0, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(0, (int)map->getWays().size()); CPPUNIT_ASSERT_EQUAL(1, (int)map->getRelations().size()); relation = map->getRelation(2); CPPUNIT_ASSERT_EQUAL((long)2, relation->getId()); HOOT_STR_EQUALS("", relation->getType()); CPPUNIT_ASSERT(relation->contains(ElementId::node(2))); CPPUNIT_ASSERT_EQUAL(size_t(1), relation->getMembers().size()); member = relation->getMembers().at(0); HOOT_STR_EQUALS("n2", member.role); CPPUNIT_ASSERT_EQUAL((long)2, member.getElementId().getId()); CPPUNIT_ASSERT_EQUAL(0, relation->getTags().size()); ctr++; CPPUNIT_ASSERT(!reader.hasMoreElements()); reader.finalizePartial(); CPPUNIT_ASSERT_EQUAL(4, ctr); }
void runUseStatusTest() { OsmXmlReader uut; OsmMapPtr map(new OsmMap()); uut.setUseDataSourceIds(true); uut.setUseFileStatus(true); uut.setDefaultStatus(Status::Invalid); uut.read("test-files/io/OsmXmlReaderUseStatusTest.osm", map); CPPUNIT_ASSERT_EQUAL(104, (int)map->getNodes().size()); CPPUNIT_ASSERT_EQUAL(17, (int)map->getWays().size()); HOOT_STR_EQUALS(Status::Unknown1, map->getWay(-12)->getStatus().getEnum()); HOOT_STR_EQUALS(Status::Conflated, map->getWay(-13)->getStatus().getEnum()); HOOT_STR_EQUALS(Status::Unknown2, map->getWay(-51)->getStatus().getEnum()); HOOT_STR_EQUALS(Status::EnumEnd + 1, map->getWay(-14)->getStatus().getEnum()); HOOT_STR_EQUALS(Status::EnumEnd + 2, map->getWay(-15)->getStatus().getEnum()); HOOT_STR_EQUALS(0, map->getWay(-12)->getStatus().getInput()); HOOT_STR_EQUALS(1, map->getWay(-51)->getStatus().getInput()); HOOT_STR_EQUALS(2, map->getWay(-14)->getStatus().getInput()); HOOT_STR_EQUALS(3, map->getWay(-15)->getStatus().getInput()); HOOT_STR_EQUALS("Unknown1", map->getWay(-12)->getStatus().toString()); HOOT_STR_EQUALS("Unknown2", map->getWay(-51)->getStatus().toString()); HOOT_STR_EQUALS("Input003", map->getWay(-14)->getStatus().toString()); HOOT_STR_EQUALS("Input004", map->getWay(-15)->getStatus().toString()); }
void runToOsmTest() { // Great bit of code taken from TranslatedTagDifferencer.cpp shared_ptr<ScriptTranslator> st(ScriptTranslatorFactory::getInstance().createTranslator( "test-files/io/SampleTranslation.js")); shared_ptr<ScriptToOgrTranslator>uut = dynamic_pointer_cast<ScriptToOgrTranslator>(st); if (!uut) { throw HootException("Error allocating translator. the translation script must support " "converting to OGR."); } shared_ptr<const Schema> schema = uut->getOgrOutputSchema(); // JavaScriptTranslator::TranslatedFeature tf; ScriptToOgrTranslator::TranslatedFeature tf; QString layer; Tags t; t.clear(); t["building"] = "yes"; t["name"] = "foo"; tf = uut->translateToOgr(t, ElementType::Node, GEOS_POINT)[0]; HOOT_STR_EQUALS("PAL015", tf.tableName); HOOT_STR_EQUALS("[2]{(ARA, -999999), (NAM, foo)}", tf.feature->getValues()); t.clear(); t["building"] = "yes"; t["name"] = "foo"; tf = uut->translateToOgr(t, ElementType::Way, GEOS_POLYGON)[0]; HOOT_STR_EQUALS("AAL015", tf.tableName); HOOT_STR_EQUALS("[2]{(ARA, 10), (NAM, foo)}", tf.feature->getValues()); t.clear(); t["highway"] = "track"; t["name"] = "bar"; tf = uut->translateToOgr(t, ElementType::Way, GEOS_LINESTRING)[0]; HOOT_STR_EQUALS("LAP010", tf.tableName); HOOT_STR_EQUALS("[3]{(ARA, -999999), (NAM, bar), (PCF, 1)}", tf.feature->getValues()); t.clear(); t["highway"] = "road"; t["name"] = "bar"; tf = uut->translateToOgr(t, ElementType::Way, GEOS_LINESTRING)[0]; HOOT_STR_EQUALS("LAP030", tf.tableName); HOOT_STR_EQUALS("[4]{(ARA, -999999), (LTN, 2), (NAM, bar), (PCF, 2)}", tf.feature->getValues()); // throw an exception because the BAD field shouldn't be there. t.clear(); t["tableName"] = "PAL015"; t["NAM"] = "foo"; t["BAD"] = "tag"; t["ARA"] = "-999999"; CPPUNIT_ASSERT_THROW(uut->translateToOgr(t, ElementType::Node, GEOS_POINT), FieldDefinition::InvalidValueException); // throw an exception because ARA can't be -1. t.clear(); t["tableName"] = "PAL015"; t["NAM"] = "foo"; t["ARA"] = "-1"; CPPUNIT_ASSERT_THROW(uut->translateToOgr(t, ElementType::Node, GEOS_POINT), FieldDefinition::InvalidValueException); // throw an exception because the NAM field is missing. t.clear(); t["tableName"] = "PAL015"; t["ARA"] = "-999999"; CPPUNIT_ASSERT_THROW(uut->translateToOgr(t, ElementType::Node, GEOS_POINT), FieldDefinition::InvalidValueException); // throw an exception because the PCF field has an invalid value. t.clear(); t["tableName"] = "LAP030"; t["ARA"] = "-999999"; t["NAM"] = "foo"; t["LTN"] = "2"; t["PCF"] = "3"; CPPUNIT_ASSERT_THROW(uut->translateToOgr(t, ElementType::Way, GEOS_LINESTRING), FieldDefinition::InvalidValueException); }
/** * Basic set of tests to see if the merged elements look as expected. */ void basicTest() { QString testJsonStr = "{ \n" " 'elements': [ \n" " { 'type': 'node', 'id': -1, 'lat': 2.0, 'lon': -3.0, \n" " 'tags': { 'amenity': 'pub', 'name': 'my restaurant', 'hoot:hash': 'AAA' } },\n" " { 'type': 'node', 'id': -2, 'lat': 3.0, 'lon': -3.0, \n" " 'tags': { 'amenity': 'pub', 'name': 'My Restaurant', 'hoot:hash': 'BBB' } },\n" " { 'type': 'node', 'id': -3, 'lat': 14.0, 'lon': -3.0, \n" " 'tags': { 'amenity': 'pub', 'name': 'Not the same', 'hoot:hash': 'CCC' } },\n" " { 'type': 'node', 'id': -4, 'lat': 14.0, 'lon': -3.0, \n" " 'tags': { 'place': 'locality', 'name': 'Not the same', 'hoot:hash': 'DDD' } },\n" " { 'type': 'node', 'id': -5, 'lat': 14.0, 'lon': -3.0, \n" " 'tags': { 'military': 'yes', 'name': 'Not the same', 'hoot:hash': 'EEE' } }\n" "] \n" "} \n"; OsmMapPtr map = OsmJsonReader().loadFromString(testJsonStr); map->setProjection(MapProjector::createOrthographic(0, 0)); map->getNode(-1)->setStatus(Status::fromInput(0)); map->getNode(-2)->setStatus(Status::fromInput(1)); map->getNode(-3)->setStatus(Status::fromInput(2)); map->getNode(-4)->setStatus(Status::fromInput(3)); map->getNode(-5)->setStatus(Status::fromInput(4)); TestUtils::resetEnvironment(); // have to do this or getInstance will re-register the default match creators. MatchFactory& matchFactory = MatchFactory::getInstance(); matchFactory.reset(); matchFactory.registerCreator("hoot::ScriptMatchCreator,MultiaryPoiGeneric.js"); boost::shared_ptr<MergerCreator> mergerCreator( Factory::getInstance().constructObject<MergerCreator>( QString("hoot::ScriptMergerCreator"))); MergerFactory& mergerFactory = MergerFactory::getInstance(); mergerFactory.reset(); mergerFactory.registerCreator(mergerCreator.get()); boost::shared_ptr<MatchCreator> matchCreator = matchFactory.getCreators()[0]; MultiaryPoiMergeCache cache(map, matchCreator, mergerCreator); // compare a cluster of 2 to a cluster of 1. This isn't strictly the way it will operate // under real conditions, but it makes a reasonable test. { MultiaryClusterPtr mc1(new MultiaryCluster()); mc1->append(map->getNode(-2)); mc1->append(map->getNode(-3)); MultiaryClusterPtr mc2(new MultiaryCluster()); mc2->append(map->getNode(-1)); MultiaryClusterPtr out = cache.merge(mc1, mc2); // -1 is the first element by input number. HOOT_STR_EQUALS(-1, out->mergedElement->getId()); // while the IDs are the same, the merged element should be a new instance. HOOT_STR_EQUALS("hoot:hash = AAA\nname = my restaurant\namenity = pub\n", map->getNode(-1)->getTags()); HOOT_STR_EQUALS("hoot:hash = \nsource:hash = AAA;BBB;CCC\nalt_name = My Restaurant;Not the same\nname = my restaurant\namenity = pub\n", out->mergedElement->getTags()); } // make sure the merger isn't deleted twice. Kinda kludgy. mergerFactory.reset(); }
void uuid5Test() { QUuid r = UuidHelper::createUuid5("foo", QUuid("{6ba7b812-9dad-11d1-80b4-00c04fd430c8}")); HOOT_STR_EQUALS("{bca95adb-b5f1-564f-96a7-6355c52d1fa7}", r.toString()); }
void runLocateAfterTest() { OsmMap::resetCounters(); shared_ptr<OsmMap> map(new OsmMap()); Coordinate c[] = { Coordinate(0.0, 0.0), Coordinate(100.0, 0.0), Coordinate(100.0, 10.0), Coordinate(0.0, 10.0), Coordinate::getNull() }; WayPtr w = TestUtils::createWay(map, Unknown1, c, 1, ""); WayLocation wl(w, 0, 0); HOOT_STR_EQUALS("way: -1 index: 0 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(0,0), wl)); HOOT_STR_EQUALS("way: -1 index: 0 fraction: 0.1", LocationOfPoint(w).locateAfter(Coordinate(0,0), WayLocation(w, 10.0))); HOOT_STR_EQUALS("way: -1 index: 0 fraction: 0.1", LocationOfPoint(w).locateAfter(Coordinate(10,0), WayLocation(w, 0.0))); HOOT_STR_EQUALS("way: -1 index: 0 fraction: 0.2", LocationOfPoint(w).locateAfter(Coordinate(20,0), WayLocation(w, 0.0))); HOOT_STR_EQUALS("way: -1 index: 0 fraction: 0.5", LocationOfPoint(w).locateAfter(Coordinate(50,0), WayLocation(w, 20.0))); HOOT_STR_EQUALS("way: -1 index: 2 fraction: 0.5", LocationOfPoint(w).locateAfter(Coordinate(50,10), WayLocation(w, 0.0))); HOOT_STR_EQUALS("way: -1 index: 2 fraction: 0.5", LocationOfPoint(w).locateAfter(Coordinate(50,0), WayLocation(w, 100.0))); HOOT_STR_EQUALS("way: -1 index: 1 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(100,0), WayLocation(w, 0.0))); HOOT_STR_EQUALS("way: -1 index: 1 fraction: 0.2", LocationOfPoint(w).locateAfter(Coordinate(100,0), WayLocation(w, 102.0))); HOOT_STR_EQUALS("way: -1 index: 1 fraction: 0.2", LocationOfPoint(w).locateAfter(Coordinate(100,2), WayLocation(w, 100.0))); HOOT_STR_EQUALS("way: -1 index: 2 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(100,10), WayLocation(w, 110.0))); HOOT_STR_EQUALS("way: -1 index: 2 fraction: 0.5", LocationOfPoint(w).locateAfter(Coordinate(50,10), WayLocation(w, 110.0))); HOOT_STR_EQUALS("way: -1 index: 3 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(0,10), WayLocation(w, 0.0))); HOOT_STR_EQUALS("way: -1 index: 3 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(0,0), WayLocation(w, 3, 0))); HOOT_STR_EQUALS("way: -1 index: 3 fraction: 0", LocationOfPoint(w).locateAfter(Coordinate(0,10), WayLocation(w, 2, 0.3))); }