-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.54..v0.2.55 changeset CalculateStatsOpTest.cpp
Garret Voltz edited this page Aug 14, 2020
·
1 revision
diff --git a/hoot-core-test/src/test/cpp/hoot/core/ops/CalculateStatsOpTest.cpp b/hoot-core-test/src/test/cpp/hoot/core/ops/CalculateStatsOpTest.cpp
index 3669cf7..f68db4d 100644
--- a/hoot-core-test/src/test/cpp/hoot/core/ops/CalculateStatsOpTest.cpp
+++ b/hoot-core-test/src/test/cpp/hoot/core/ops/CalculateStatsOpTest.cpp
@@ -44,6 +44,10 @@
namespace hoot
{
+/*
+ * There may be some newer stats in here that are unaccounted for. However, we may have enough
+ * coverage for them in the command tests.
+ */
class CalculateStatsOpTest : public HootTestFixture
{
CPPUNIT_TEST_SUITE(CalculateStatsOpTest);
@@ -75,12 +79,20 @@ public:
ConfigOptions::getStatsTranslateScriptDefaultValue());
}
- // This is here to prevent inadvertant removal of stats and to make sure any new stats get added
- // to this test.
void runStatsNumTest()
{
std::shared_ptr<CalculateStatsOp> calcStatsOp = _calcStats(_inputPath + "all-data-types.osm");
- CPPUNIT_ASSERT_EQUAL(196, calcStatsOp->getStats().size());
+
+ // This is here to prevent inadvertent removal of stats and to make sure any new stats get added
+ // to this test.
+ CPPUNIT_ASSERT_EQUAL(208, calcStatsOp->getStats().size());
+
+ // This lets you know if the total stat calls made don't match what was predicted by
+ // _initStatCalc.
+ // TODO: These don't quite match up yet...off by one...not sure where, though.
+ LOG_VART(calcStatsOp->_currentStatCalcIndex);
+ LOG_VART(calcStatsOp->_totalStatCalcs);
+ //CPPUNIT_ASSERT(calcStatsOp->_currentStatCalcIndex == calcStatsOp->_totalStatCalcs);
}
void runStatsTest()
@@ -133,7 +145,7 @@ public:
CPPUNIT_ASSERT_DOUBLES_EQUAL(
61.29, calcStatsOp->getSingleStat("Percentage of Total Features Unmatched"), 1e-1);
- CPPUNIT_ASSERT_EQUAL(12.0, calcStatsOp->getSingleStat("Match Creators"));
+ CPPUNIT_ASSERT_EQUAL(13.0, calcStatsOp->getSingleStat("Match Creators"));
//we're parsing a conflated output map here, so all conflatable counts are equal to zero;
//counts for PoiPolygon are broken up by type in addition to being shown as total
CPPUNIT_ASSERT_EQUAL(
@@ -243,21 +255,21 @@ public:
CPPUNIT_ASSERT_DOUBLES_EQUAL(
100.0, calcStatsOp->getSingleStat("Percentage of Unmatched Polygon Conflatable POIs"), 1e-1);
- CPPUNIT_ASSERT_EQUAL(12.0, calcStatsOp->getSingleStat("Polygons"));
+ CPPUNIT_ASSERT_EQUAL(14.0, calcStatsOp->getSingleStat("Polygons"));
CPPUNIT_ASSERT_EQUAL(0.0, calcStatsOp->getSingleStat("Conflatable Polygons"));
CPPUNIT_ASSERT_EQUAL(5.0, calcStatsOp->getSingleStat("Conflated Polygons"));
CPPUNIT_ASSERT_EQUAL(0.0, calcStatsOp->getSingleStat("Polygons Marked for Review"));
CPPUNIT_ASSERT_EQUAL(0.0, calcStatsOp->getSingleStat("Polygon Reviews to be Made"));
- CPPUNIT_ASSERT_EQUAL(7.0, calcStatsOp->getSingleStat("Unmatched Polygons"));
+ CPPUNIT_ASSERT_EQUAL(9.0, calcStatsOp->getSingleStat("Unmatched Polygons"));
CPPUNIT_ASSERT_DOUBLES_EQUAL(
14810.8,
calcStatsOp->getSingleStat("Meters Squared of Polygons Processed by Conflation"), 1e-1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(
- 41.67, calcStatsOp->getSingleStat("Percentage of Polygons Conflated"), 1e-1);
+ 35.71, calcStatsOp->getSingleStat("Percentage of Polygons Conflated"), 1e-1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(
0.0, calcStatsOp->getSingleStat("Percentage of Polygons Marked for Review"), 1e-1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(
- 58.33, calcStatsOp->getSingleStat("Percentage of Unmatched Polygons"), 1e-1);
+ 64.29, calcStatsOp->getSingleStat("Percentage of Unmatched Polygons"), 1e-1);
CPPUNIT_ASSERT_EQUAL(2.0, calcStatsOp->getSingleStat("Areas"));
CPPUNIT_ASSERT_EQUAL(0.0, calcStatsOp->getSingleStat("Conflatable Areas"));
@@ -394,7 +406,7 @@ public:
CPPUNIT_ASSERT_DOUBLES_EQUAL(
62.07, calcStatsOp->getSingleStat("Percentage of Total Features Unmatched"), 1e-1);
- CPPUNIT_ASSERT_EQUAL(12.0, calcStatsOp->getSingleStat("Match Creators"));
+ CPPUNIT_ASSERT_EQUAL(13.0, calcStatsOp->getSingleStat("Match Creators"));
//we're parsing a conflated output map here, so all conflatable counts are equal to zero;
//counts for PoiPolygon are broken up by type in addition to being shown as total
CPPUNIT_ASSERT_EQUAL(
@@ -602,8 +614,8 @@ private:
reader.read(inputFile, map);
std::shared_ptr<CalculateStatsOp> calcStatsOp(new CalculateStatsOp());
- //If we figure out the error messages logged by the script translator related stats are
- //invalid and fix them, then this log disablement can be removed.
+ // If we figure out the error messages logged by the script translator related stats are
+ // invalid and fix them, then this log disablement can be removed.
{
DisableLog dl(Log::Fatal);
calcStatsOp->apply(map);