v0.2.54..v0.2.55 changeset TestUtils.h
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/TestUtils.h b/hoot-core-test/src/test/cpp/hoot/core/TestUtils.h
index 5200334..387f8c3 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/TestUtils.h
+++ b/hoot-core-test/src/test/cpp/hoot/core/TestUtils.h
@@ -38,6 +38,7 @@
#include <hoot/core/elements/OsmMap.h>
#include <hoot/core/util/Log.h>
#include <hoot/core/util/ConfPath.h>
+#include <hoot/core/util/FileUtils.h>
// Qt
#include <QString>
@@ -61,11 +62,11 @@ inline QString toQString(const std::string& s)
return QString::fromStdString(s);
}
-#define HOOT_STR_EQUALS(v1, v2) \
+#define HOOT_STR_EQUALS(expected, actual) \
{ \
std::stringstream ss1, ss2; \
- ss1 << v1; \
- ss2 << v2; \
+ ss1 << expected; \
+ ss2 << actual; \
CPPUNIT_ASSERT_EQUAL(ss1.str(), ss2.str()); \
} \
@@ -154,7 +155,7 @@ public:
/**
* Return the singleton instance.
*/
- static std::shared_ptr<TestUtils> getInstance();
+ static TestUtils& getInstance();
/**
* Register a way to reset the environment. This is most useful in plugins to avoid circular
@@ -184,13 +185,6 @@ public:
const QString& stdFilePath, const QString& outFilePath);
/**
- * Creates a folder path using QDir::mkpath in a more thread-safe way
- * @param path relative or absolute path to create (think `mkdir -p`)
- * @return true if successful
- */
- static bool mkpath(const QString& path);
-
- /**
* This is a snapshot of the option, conflate.pre.ops (circa 2/12/20), for testing purposes.
*
* @return a list of operator class names
@@ -213,7 +207,8 @@ public:
/**
* Runs a conflate op reduction test which tests for which superfluous conflate pre/post/cleaning
- * ops are removed by ConflateCmd
+ * ops are removed by SuperfluousConflateOpRemover. This is in TestUtils b/c it is shared by
+ * SuperfluousConflateOpRemoveTest in hoot-core and SuperfluousConflateOpRemoveJsTest in hoot-js.
*
* @param matchCreators the match creator class names involved in the conflation job
* @param expectedPreOpSize the expected number of conflation pre ops after op reduction
@@ -242,7 +237,7 @@ public:
AutoRegisterResetInstance()
{
- TestUtils::getInstance()->registerReset(this);
+ TestUtils::getInstance().registerReset(this);
}
virtual void reset()
@@ -272,7 +267,7 @@ protected:
_reset(ResetNone)
{
if (outputPath != UNUSED_PATH)
- TestUtils::mkpath(_outputPath);
+ FileUtils::makeDir(_outputPath);
}
/**