Skip to content

v0.2.51..v0.2.52 changeset OsmApiChangesetTest.cpp

Garret Voltz edited this page Jan 15, 2020 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiChangesetTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiChangesetTest.cpp
index 5fc5cf8..03bce31 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiChangesetTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/io/OsmApiChangesetTest.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 //  Hoot
@@ -214,6 +214,7 @@ public:
     bool found = false;
     long id = 0;
     long id2 = 0;
+    std::vector<long> ids;
     ElementType::Type type = ElementType::Unknown;
     ElementType::Type type2 = ElementType::Unknown;
     QString hint;
@@ -236,7 +237,7 @@ public:
     id2 = 0;
     type = ElementType::Unknown;
     type2 = ElementType::Unknown;
-    hint = "Placeholder Way not found for reference -12257 in relation -51";
+    hint = "Placeholder Way not found for reference -12257 in Relation -51";
     found = changeset.matchesPlaceholderFailure(hint, id, type, id2, type2);
     CPPUNIT_ASSERT_EQUAL(true, found);
     CPPUNIT_ASSERT_EQUAL(-12257L, id);
@@ -279,6 +280,21 @@ public:
     CPPUNIT_ASSERT_EQUAL(7699L, id2);
     CPPUNIT_ASSERT_EQUAL(ElementType::Way, type);
 
+    //  Test multi relation failure with relation ID
+    id = 0;
+    ids.clear();
+    type = ElementType::Unknown;
+    hint = "Relation -2 requires the relations with id in 1707148,1707249,1707264,1707653,1707654,1707655,1707656,1707657,1707658,1707699,1707700, which either do not exist, or are not visible.";
+    found = changeset.matchesMultiRelationFailure(hint, id, ids, type);
+    std::vector<long> expected_ids { 1707148,1707249,1707264,1707653,1707654,1707655,1707656,1707657,1707658,1707699,1707700 };
+    CPPUNIT_ASSERT_EQUAL(true, found);
+    CPPUNIT_ASSERT_EQUAL(-2L, id);
+    CPPUNIT_ASSERT_EQUAL(ElementType::Relation, type);
+    CPPUNIT_ASSERT_EQUAL(11, (int)ids.size());
+    for (int i = 0; i < (int)ids.size(); ++i)
+      CPPUNIT_ASSERT_EQUAL(expected_ids[i], ids[i]);
+
+
     //  Test relation failure with empty string
     id = 0;
     id2 = 0;
Clone this wiki locally