[mapguide-commits] r9655 - sandbox/jng/catch2/Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 7 08:35:59 PDT 2020


Author: jng
Date: 2020-07-07 08:35:58 -0700 (Tue, 07 Jul 2020)
New Revision: 9655

Removed:
   sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.h
Modified:
   sandbox/jng/catch2/Server/src/UnitTesting/TestGeometry.cpp
   sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.cpp
Log:
Port TestTransformMesh to catch2

Modified: sandbox/jng/catch2/Server/src/UnitTesting/TestGeometry.cpp
===================================================================
--- sandbox/jng/catch2/Server/src/UnitTesting/TestGeometry.cpp	2020-07-07 15:24:30 UTC (rev 9654)
+++ sandbox/jng/catch2/Server/src/UnitTesting/TestGeometry.cpp	2020-07-07 15:35:58 UTC (rev 9655)
@@ -25,7 +25,7 @@
 const STRING GeographicWkt = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]";
 const STRING ProjectedWkt  = L"PROJCS[\"GA-W\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",6378206.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"false_easting\",500000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"scale_factor\",0.999900000000],PARAMETER[\"central_meridian\",-84.16666666666670],PARAMETER[\"latitude_of_origin\",30.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]";
 
-MgPoint* CreatePoint()
+static MgPoint* CreatePoint()
 {
     MgGeometryFactory factory;
     Ptr<MgCoordinate> coord = factory.CreateCoordinateXYZ(5.0, 3.0, 2.0);
@@ -33,8 +33,7 @@
     return factory.CreatePoint(coord);
 }
 
-
-MgLineString* CreateLineString()
+static MgLineString* CreateLineString()
 {
     MgGeometryFactory factory;
 
@@ -51,8 +50,7 @@
     return factory.CreateLineString(coordCol);
 }
 
-
-MgLinearRing* CreateLinearRing()
+static MgLinearRing* CreateLinearRing()
 {
     MgGeometryFactory factory;
 
@@ -72,8 +70,7 @@
     return factory.CreateLinearRing(outerRingCoord);
 }
 
-
-MgPolygon* CreatePolygon()
+static MgPolygon* CreatePolygon()
 {
     MgGeometryFactory factory;
 
@@ -126,8 +123,7 @@
     return factory.CreatePolygon(extRing, intRings);
 }
 
-
-MgCurveString* CreateCurveString(double offset)
+static MgCurveString* CreateCurveString(double offset)
 {
     MgGeometryFactory factory;
 
@@ -161,8 +157,7 @@
     return factory.CreateCurveString(curveSegs);
 }
 
-
-MgCurveRing* CreateCurveRing(double offset)
+static MgCurveRing* CreateCurveRing(double offset)
 {
     // Ring is a closed entity.
     // Create and return a ring consisting of
@@ -195,8 +190,7 @@
     return factory.CreateCurveRing(curveSegs);
 }
 
-
-MgCurvePolygon* CreateCurvePolygon(double offset, int increment = 100)
+static MgCurvePolygon* CreateCurvePolygon(double offset, int increment = 100)
 {
     MgGeometryFactory factory;
 
@@ -214,8 +208,7 @@
     return factory.CreateCurvePolygon(extRing, intRings);
 }
 
-
-MgMultiPoint* CreateMultiPoint()
+static MgMultiPoint* CreateMultiPoint()
 {
     MgGeometryFactory factory;
 
@@ -236,8 +229,7 @@
     return factory.CreateMultiPoint(pnts);
 }
 
-
-MgMultiLineString* CreateMultiLineString()
+static MgMultiLineString* CreateMultiLineString()
 {
     MgGeometryFactory factory;
 
@@ -269,8 +261,7 @@
     return factory.CreateMultiLineString(lineStrings);
 }
 
-
-MgMultiPolygon* CreateMultiPolygon()
+static MgMultiPolygon* CreateMultiPolygon()
 {
     MgGeometryFactory factory;
 
@@ -284,8 +275,7 @@
     return factory.CreateMultiPolygon(polygons);
 }
 
-
-MgMultiCurveString* CreateMultiCurveString()
+static MgMultiCurveString* CreateMultiCurveString()
 {
     MgGeometryFactory factory;
 
@@ -301,8 +291,7 @@
     return factory.CreateMultiCurveString(curveStrings);
 }
 
-
-MgMultiCurvePolygon* CreateMultiCurvePolygon(INT32 numCurvePolys, double offset)
+static MgMultiCurvePolygon* CreateMultiCurvePolygon(INT32 numCurvePolys, double offset)
 {
     MgGeometryFactory factory;
 
@@ -316,8 +305,7 @@
     return factory.CreateMultiCurvePolygon(curvePolys);
 }
 
-
-MgMultiGeometry* CreateMultiGeometry()
+static MgMultiGeometry* CreateMultiGeometry()
 {
     MgGeometryFactory factory;
 
@@ -350,8 +338,7 @@
     return factory.CreateMultiGeometry(geometries);
 }
 
-
-MgCoordinateSystemMeasure* CreateMeasureArbitrary()
+static MgCoordinateSystemMeasure* CreateMeasureArbitrary()
 {
     MgCoordinateSystemFactory factory;
     Ptr<MgCoordinateSystem> pCoordSys = factory.Create(ArbitraryWkt);
@@ -358,8 +345,7 @@
     return pCoordSys->GetMeasure();
 }
 
-
-MgCoordinateSystemMeasure* CreateMeasureGeographic()
+static MgCoordinateSystemMeasure* CreateMeasureGeographic()
 {
     MgCoordinateSystemFactory factory;
     Ptr<MgCoordinateSystem> pCoordSys = factory.Create(GeographicWkt);
@@ -366,8 +352,7 @@
     return pCoordSys->GetMeasure();
 }
 
-
-MgCoordinateSystemMeasure* CreateMeasureProjected()
+static MgCoordinateSystemMeasure* CreateMeasureProjected()
 {
     MgCoordinateSystemFactory factory;
     Ptr<MgCoordinateSystem> pCoordSys = factory.Create(ProjectedWkt);
@@ -374,29 +359,25 @@
     return pCoordSys->GetMeasure();
 }
 
-
-MgCoordinateSystem* CreateCoordinateSystemArbitrary()
+static MgCoordinateSystem* CreateCoordinateSystemArbitrary()
 {
     MgCoordinateSystemFactory factory;
     return factory.Create(ArbitraryWkt);
 }
 
-
-MgCoordinateSystem* CreateCoordinateSystemGeographic()
+static MgCoordinateSystem* CreateCoordinateSystemGeographic()
 {
     MgCoordinateSystemFactory factory;
     return factory.Create(GeographicWkt);
 }
 
-
-MgCoordinateSystem* CreateCoordinateSystemProjected()
+static MgCoordinateSystem* CreateCoordinateSystemProjected()
 {
     MgCoordinateSystemFactory factory;
     return factory.Create(ProjectedWkt);
 }
 
-
-bool CheckGeometry(MgGeometry* geom, CREFSTRING wkt)
+static bool CheckGeometry(MgGeometry* geom, CREFSTRING wkt)
 {
     bool success = true;
     MgWktReaderWriter readerWriter;
@@ -420,8 +401,7 @@
     return success;
 }
 
-
-bool CheckGeometry(CREFSTRING calculated, CREFSTRING base)
+static bool CheckGeometry(CREFSTRING calculated, CREFSTRING base)
 {
     bool bResult = true;
 

Modified: sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.cpp
===================================================================
--- sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.cpp	2020-07-07 15:24:30 UTC (rev 9654)
+++ sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.cpp	2020-07-07 15:35:58 UTC (rev 9655)
@@ -16,15 +16,15 @@
 //
 
 #include "MapGuideCommon.h"
-#include "TestTransformMesh.h"
-#include "CppUnitExtensions.h"
+#include "CatchHelperMacros.h"
 
 #include "TransformMesh.h"
 #include "MgCSTrans.h"
 #include "Bounds.h"
 #include "FoundationDefs.h"
+#include "TestServiceFactory.h"
+#include "catch.hpp"
 
-
 const STRING GeographicWkt      = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]";
 const STRING ProjectedWkt       = L"PROJCS[\"GA-W\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",6378206.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"false_easting\",500000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"scale_factor\",0.999900000000],PARAMETER[\"central_meridian\",-84.16666666666670],PARAMETER[\"latitude_of_origin\",30.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]";
 const STRING ArbitraryWkt       = L"LOCAL_CS [ \"Non-Earth (Meter)\", LOCAL_DATUM [\"Local Datum\", 0], UNIT [\"Meter\", 1.0], AXIS [\"X\", EAST], AXIS[\"Y\", NORTH]]";
@@ -36,63 +36,29 @@
 const STRING GeographicWkt_LL84 = L"GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]";
 const STRING ProjectedWkt_GAW   = L"PROJCS[\"GA-W\",GEOGCS[\"LL27\",DATUM[\"NAD27\",SPHEROID[\"CLRK66\",6378206.400,294.97869821]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"false_easting\",500000.000],PARAMETER[\"false_northing\",0.000],PARAMETER[\"scale_factor\",0.999900000000],PARAMETER[\"central_meridian\",-84.16666666666670],PARAMETER[\"latitude_of_origin\",30.00000000000000],UNIT[\"Foot_US\",0.30480060960122]]";
 
-
-
-const STRING TEST_LOCALE = L"en";
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestTransformMesh, "TestTransformMesh");
-
-void TestTransformMesh::setUp()
+static MgCoordinateSystem* CreateCoordinateSystem(const STRING wkt)
 {
+    MgCoordinateSystemFactory factory;
+    return factory.Create(wkt);
 }
 
-
-void TestTransformMesh::tearDown()
+static MgCoordinateSystem* CreateCoordinateSystemArbitrary()
 {
-}
-
-
-void TestTransformMesh::TestStart()
-{
-    ACE_DEBUG((LM_INFO, ACE_TEXT("\nRunning Transform Mesh tests.\n")));
-}
-
-
-void TestTransformMesh::TestEnd()
-{
-    ACE_DEBUG((LM_INFO, ACE_TEXT("\nTransform Mesh tests completed.\n\n")));
-}
-
-
-TestTransformMesh::TestTransformMesh()
-{
-}
-
-
-MgCoordinateSystem* TestTransformMesh::CreateCoordinateSystemArbitrary()
-{
     return CreateCoordinateSystem(ArbitraryWkt);
 }
 
-MgCoordinateSystem* TestTransformMesh::CreateCoordinateSystemGeographic()
+static MgCoordinateSystem* CreateCoordinateSystemGeographic()
 {
     return CreateCoordinateSystem(GeographicWkt);
 }
 
-
-MgCoordinateSystem* TestTransformMesh::CreateCoordinateSystemProjected()
+static MgCoordinateSystem* CreateCoordinateSystemProjected()
 {
     return CreateCoordinateSystem(ProjectedWkt);
 }
 
-MgCoordinateSystem* TestTransformMesh::CreateCoordinateSystem(const STRING wkt)
+static bool CheckTransformMeshSize(int srcWidth, int srcHeight, TransformMesh* xformMesh)
 {
-    MgCoordinateSystemFactory factory;
-    return factory.Create(wkt);
-}
-
-bool TestTransformMesh::CheckTransformMeshSize(int srcWidth, int srcHeight, TransformMesh* xformMesh)
-{
     bool result = false;
 
     if (xformMesh->GetTotalPoints() == ((int)(srcHeight / xformMesh->GetGridSizeHeight()) + 1) * ((int)(srcWidth / xformMesh->GetGridSizeWidth()) + 1)
@@ -105,24 +71,24 @@
     return result;
 }
 
-void TestTransformMesh::TestCase_TransformMesh_DefaultConstructor()
+TEST_CASE("TransformMesh default ctor", "[TransformMesh]")
 {
     try
     {
         TransformMesh xformMesh;
 
-        CPPUNIT_ASSERT(xformMesh.GetTotalPoints() == 0);
-        CPPUNIT_ASSERT(xformMesh.GetTotalVerticalPoints() == 0);
-        CPPUNIT_ASSERT(xformMesh.GetTotalHorizontalPoints() == 0);
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == true);
+        REQUIRE(xformMesh.GetTotalPoints() == 0);
+        REQUIRE(xformMesh.GetTotalVerticalPoints() == 0);
+        REQUIRE(xformMesh.GetTotalHorizontalPoints() == 0);
+        REQUIRE(xformMesh.IsYAxisInverted() == true);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {
@@ -130,7 +96,7 @@
     }
 }
 
-void TestTransformMesh::TestCase_TransformMesh_LL84_to_WAG()
+TEST_CASE("TransformMesh LL84 to WAG", "[TransformMesh]")
 {
     try
     {
@@ -152,16 +118,16 @@
 
         TransformMesh xformMesh(gridSize, minGridSize, gridSizeOverride, srcExt, srcWidth, srcHeight, destExt, destWidth, destHeight, &xformer);
 
-        CPPUNIT_ASSERT(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == true);
+        REQUIRE(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
+        REQUIRE(xformMesh.IsYAxisInverted() == true);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {
@@ -169,7 +135,7 @@
     }
 }
 
-void TestTransformMesh::TestCase_TransformMesh_LL84_to_LL84()
+TEST_CASE("TransformMesh LL84 to LL84", "[TransformMesh]")
 {
     try
     {
@@ -178,7 +144,7 @@
         Ptr<MgCoordinateSystem> dst = CreateCoordinateSystem(GeographicWkt_LL84);
 
         MgCSTrans xformer(src, dst);
-        CPPUNIT_ASSERT(xformer.GetLinearScale() == 1);
+        REQUIRE(xformer.GetLinearScale() == 1);
 
         int gridSize = 100;
         int minGridSize = 10;
@@ -192,26 +158,26 @@
 
         TransformMesh xformMesh(gridSize, minGridSize, gridSizeOverride, srcExt, srcWidth, srcHeight, srcExt, destWidth, destHeight, &xformer, false);
 
-        CPPUNIT_ASSERT(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == false);
+        REQUIRE(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
+        REQUIRE(xformMesh.IsYAxisInverted() == false);
 
         // check to see that the source pt and dest pt are the same
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {
@@ -219,7 +185,7 @@
     }
 }
 
-void TestTransformMesh::TestCase_TransformMesh_ArbXYM_to_ArbXYM()
+TEST_CASE("TransformMesh ArbXYM to ArbXYM", "[TransformMesh]")
 {
     try
     {
@@ -228,7 +194,7 @@
         Ptr<MgCoordinateSystem> dst = CreateCoordinateSystem(ArbitraryWkt_Meter);
 
         MgCSTrans xformer(src, dst);
-        CPPUNIT_ASSERT(xformer.GetLinearScale() == 1);
+        REQUIRE(xformer.GetLinearScale() == 1);
 
         int gridSize = 100;
         int minGridSize = 10;
@@ -242,26 +208,26 @@
 
         TransformMesh xformMesh(gridSize, minGridSize, gridSizeOverride, srcExt, srcWidth, srcHeight, srcExt, destWidth, destHeight, &xformer, false);
 
-        CPPUNIT_ASSERT(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == false);
+        REQUIRE(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
+        REQUIRE(xformMesh.IsYAxisInverted() == false);
 
         // check to see that the source pt and dest pt are the same
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {
@@ -269,7 +235,7 @@
     }
 }
 
-void TestTransformMesh::TestCase_TransformMesh_ArbXYKM_to_ArbXYM()
+TEST_CASE("TransformMesh ArbXYKM to ArbXYM", "[TransformMesh]")
 {
     try
     {
@@ -278,7 +244,7 @@
 
         MgCSTrans xformer(src, dst);
         double dLinearScale = xformer.GetLinearScale();
-        CPPUNIT_ASSERT(dLinearScale == 1000);
+        REQUIRE(dLinearScale == 1000);
 
         int gridSize = 100;
         int minGridSize = 10;
@@ -292,8 +258,8 @@
 
         TransformMesh xformMesh(gridSize, minGridSize, gridSizeOverride, srcExt, srcWidth, srcHeight, srcExt, destWidth, destHeight, &xformer, false);
 
-        CPPUNIT_ASSERT(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == false);
+        REQUIRE(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
+        REQUIRE(xformMesh.IsYAxisInverted() == false);
 
         // pt1----pt2
         // |        |
@@ -302,26 +268,26 @@
         // pt0----pt3
 
         // pt0 should be the same
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
 
         // the pt1, pt2, pt3 should be scaled by dLinearScale (1000)
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
 
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
 
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {
@@ -329,7 +295,8 @@
     }
 }
 
-void TestTransformMesh::TestCase_TransformMesh_Small_Image_01()
+//void TestTransformMesh::TestCase_TransformMesh_Small_Image_01()
+TEST_CASE("TransformMesh Small Image 01", "[TransformMesh]")
 {
     try
     {
@@ -338,7 +305,7 @@
 
         MgCSTrans xformer(src, dst);
         double dLinearScale = xformer.GetLinearScale();
-        CPPUNIT_ASSERT(dLinearScale == 1000);
+        REQUIRE(dLinearScale == 1000);
 
         int gridSize = 100;
         int minGridSize = 10;
@@ -352,8 +319,8 @@
 
         TransformMesh xformMesh(gridSize, minGridSize, gridSizeOverride, srcExt, srcWidth, srcHeight, srcExt, destWidth, destHeight, &xformer, false);
 
-        CPPUNIT_ASSERT(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
-        CPPUNIT_ASSERT(xformMesh.IsYAxisInverted() == false);
+        REQUIRE(CheckTransformMeshSize(srcWidth, srcHeight, &xformMesh));
+        REQUIRE(xformMesh.IsYAxisInverted() == false);
 
         // pt1----pt2
         // |        |
@@ -362,26 +329,26 @@
         // pt0----pt3
 
         // pt0 should be the same
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.x == xformMesh.GetMeshPoint(0).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(0).pt_src.y == xformMesh.GetMeshPoint(0).pt_dest.y);
 
         // the pt1, pt2, pt3 should be scaled by dLinearScale (1000)
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
+        REQUIRE(xformMesh.GetMeshPoint(1).pt_src.x == xformMesh.GetMeshPoint(1).pt_dest.x);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(1).pt_src.y == xformMesh.GetMeshPoint(1).pt_dest.y);
 
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
-        CPPUNIT_ASSERT(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(2).pt_src.x == xformMesh.GetMeshPoint(2).pt_dest.x);
+        REQUIRE(xformMesh.GetMeshPoint(2).pt_src.y == xformMesh.GetMeshPoint(2).pt_dest.y);
 
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
-        CPPUNIT_ASSERT(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.x == xformMesh.GetMeshPoint(3).pt_dest.x);
+        REQUIRE(dLinearScale * xformMesh.GetMeshPoint(3).pt_src.y == xformMesh.GetMeshPoint(3).pt_dest.y);
 
-        CPPUNIT_ASSERT(true);
+        REQUIRE(true);
     }
     catch (MgException* e)
     {
-        STRING message = e->GetDetails(TEST_LOCALE);
+        STRING message = e->GetDetails(TestServiceFactory::TEST_LOCALE);
         SAFE_RELEASE(e);
-        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+        FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
     }
     catch (...)
     {

Deleted: sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.h
===================================================================
--- sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.h	2020-07-07 15:24:30 UTC (rev 9654)
+++ sandbox/jng/catch2/Server/src/UnitTesting/TestTransformMesh.h	2020-07-07 15:35:58 UTC (rev 9655)
@@ -1,70 +0,0 @@
-//
-//  Copyright (C) 2004-2011 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef TESTTRANSFORMMESH_H_
-#define TESTTRANSFORMMESH_H_
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#ifndef _WIN32
-//Linux: different naming for string functions
-#define stricmp strcasecmp
-#endif
-
-class TransformMesh;
-
-class TestTransformMesh : public CppUnit::TestFixture
-{
-    CPPUNIT_TEST_SUITE(TestTransformMesh);
-    CPPUNIT_TEST(TestStart); // This must be the very first unit test
-
-    CPPUNIT_TEST(TestCase_TransformMesh_DefaultConstructor);
-    CPPUNIT_TEST(TestCase_TransformMesh_LL84_to_WAG);
-    CPPUNIT_TEST(TestCase_TransformMesh_LL84_to_LL84);
-    CPPUNIT_TEST(TestCase_TransformMesh_ArbXYM_to_ArbXYM);
-    CPPUNIT_TEST(TestCase_TransformMesh_ArbXYKM_to_ArbXYM);
-    CPPUNIT_TEST(TestCase_TransformMesh_Small_Image_01);
-
-    CPPUNIT_TEST(TestEnd); // This must be the very last unit test
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-    TestTransformMesh();
-
-    void setUp();
-    void tearDown();
-    void TestStart();
-    void TestEnd();
-
-    MgCoordinateSystem* CreateCoordinateSystemArbitrary();
-    MgCoordinateSystem* CreateCoordinateSystemGeographic();
-    MgCoordinateSystem* CreateCoordinateSystemProjected();
-    MgCoordinateSystem* CreateCoordinateSystem(const STRING wkt);
-
-    bool CheckTransformMeshSize(int srcWidth, int srcHeight, TransformMesh* xform);
-
-    void TestCase_TransformMesh_DefaultConstructor();
-    void TestCase_TransformMesh_LL84_to_WAG();
-    void TestCase_TransformMesh_LL84_to_LL84();
-    void TestCase_TransformMesh_ArbXYM_to_ArbXYM();
-    void TestCase_TransformMesh_ArbXYKM_to_ArbXYM();
-    void TestCase_TransformMesh_Small_Image_01();
-
-
-};
-
-#endif



More information about the mapguide-commits mailing list