Skip to content

v0.2.49..v0.2.50 changeset TagCriterionTest.cpp

Garret Voltz edited this page Nov 6, 2019 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/criterion/TagCriterionTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/criterion/TagCriterionTest.cpp
index 42c833c..8db1e31 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/criterion/TagCriterionTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/criterion/TagCriterionTest.cpp
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2018 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 // Hoot
@@ -39,6 +39,7 @@ class TagCriterionTest : public HootTestFixture
   CPPUNIT_TEST_SUITE(TagCriterionTest);
   CPPUNIT_TEST(runBasicTest);
   CPPUNIT_TEST(runInvalidKvpDelimiterTest);
+  CPPUNIT_TEST(runCaseSensitivityTest);
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -84,6 +85,33 @@ public:
     LOG_VART(exceptionMsg);
     CPPUNIT_ASSERT(exceptionMsg.contains("Invalid TagCriterion KVP"));
   }
+
+  void runCaseSensitivityTest()
+  {
+    TagCriterion uut;
+
+    uut.setCaseSensitive(false);
+    uut.setKvps(QStringList("key=val"));
+
+    NodePtr node(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
+    node->getTags().set("key", "val");
+    CPPUNIT_ASSERT(uut.isSatisfied(node));
+
+    node->getTags().clear();
+    node->getTags().set("key", "VAL");
+    CPPUNIT_ASSERT(uut.isSatisfied(node));
+
+    // the case sensitivity is meant for vals only and not keys
+    node->getTags().clear();
+    node->getTags().set("KEY", "val");
+    CPPUNIT_ASSERT(!uut.isSatisfied(node));
+
+    uut.setCaseSensitive(true);
+
+    node->getTags().clear();
+    node->getTags().set("key", "VAL");
+    CPPUNIT_ASSERT(!uut.isSatisfied(node));
+  }
 };
 
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TagCriterionTest, "quick");
Clone this wiki locally