Skip to content

v0.2.52..v0.2.53 changeset AddressScoreExtractorTest.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/algorithms/extractors/AddressScoreExtractorTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/algorithms/extractors/AddressScoreExtractorTest.cpp
index 731c9e0..99b3e38 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/algorithms/extractors/AddressScoreExtractorTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/algorithms/extractors/AddressScoreExtractorTest.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, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 // Hoot
@@ -79,6 +79,10 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    // The cache needs to be disabled since its static and all of these tests will run as threads
+    // within the same process, thus sharing the cache. If we weren't using the same element IDs
+    // across tests, then it wouldn't have to be disabled.
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -102,6 +106,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -129,6 +134,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -166,6 +172,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -201,6 +208,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -223,6 +231,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
 
     OsmMapPtr map(new OsmMap());
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -255,6 +264,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -302,6 +312,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     OsmMapPtr map(new OsmMap());
 
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -383,6 +394,7 @@ public:
     settings.set("language.translation.translator", "hoot::ToEnglishDictionaryTranslator");
     settings.set("address.use.default.language.translation.only", "false");
     uut.setConfiguration(settings);
+    uut.setCacheEnabled(false);
     std::shared_ptr<ToEnglishDictionaryTranslator> dictTranslator =
       std::dynamic_pointer_cast<ToEnglishDictionaryTranslator>(
         ToEnglishAddressTranslator::_translator);
@@ -410,6 +422,7 @@ public:
 
     settings.set("address.translate.to.english", "false");
     uut.setConfiguration(settings);
+    uut.setCacheEnabled(false);
      CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, uut.extract(*map, node1, way1), 0.0);
   }
 
@@ -417,6 +430,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
     QSet<QString> additionalTagKeys;
     additionalTagKeys.insert("note");
     additionalTagKeys.insert("description");
@@ -457,6 +471,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
 
     OsmMapPtr map(new OsmMap());
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -491,6 +506,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
 
     OsmMapPtr map(new OsmMap());
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
@@ -529,6 +545,7 @@ public:
   {
     AddressScoreExtractor uut;
     uut.setConfiguration(conf());
+    uut.setCacheEnabled(false);
 
     OsmMapPtr map(new OsmMap());
     NodePtr node1(new Node(Status::Unknown1, -1, Coordinate(0.0, 0.0), 15.0));
Clone this wiki locally