From 2ccb239f13a6a57b18984dcc7b7ed5766328810a Mon Sep 17 00:00:00 2001
From: Hadrien Grasland <grasland@lal.in2p3.fr>
Date: Fri, 23 Aug 2019 10:20:32 +0200
Subject: [PATCH] An uninitialized transform is not a null transform...

---
 Tests/Core/Geometry/ConeLayerTests.cpp       | 4 ++--
 Tests/Core/Geometry/CylinderLayerTests.cpp   | 2 +-
 Tests/Core/Geometry/DiscLayerTests.cpp       | 2 +-
 Tests/Core/Geometry/LayerTests.cpp           | 2 +-
 Tests/Core/Geometry/PlaneLayerTests.cpp      | 2 +-
 Tests/Core/Surfaces/ConeSurfaceTests.cpp     | 3 +--
 Tests/Core/Surfaces/CylinderSurfaceTests.cpp | 3 +--
 Tests/Core/Surfaces/PerigeeSurfaceTests.cpp  | 2 +-
 Tests/Core/Surfaces/PlaneSurfaceTests.cpp    | 3 +--
 Tests/Core/Surfaces/StrawSurfaceTests.cpp    | 3 +--
 10 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/Tests/Core/Geometry/ConeLayerTests.cpp b/Tests/Core/Geometry/ConeLayerTests.cpp
index 3a2b589c7..59ad08120 100644
--- a/Tests/Core/Geometry/ConeLayerTests.cpp
+++ b/Tests/Core/Geometry/ConeLayerTests.cpp
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(ConeLayerConstruction) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(ConeLayerProperties /*, *utf::expected_failures(1)*/) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   auto pCone = std::make_shared<const ConeBounds>(alpha, symmetric);
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
diff --git a/Tests/Core/Geometry/CylinderLayerTests.cpp b/Tests/Core/Geometry/CylinderLayerTests.cpp
index 2dc297399..20fcd2058 100644
--- a/Tests/Core/Geometry/CylinderLayerTests.cpp
+++ b/Tests/Core/Geometry/CylinderLayerTests.cpp
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(CylinderLayerConstruction) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
diff --git a/Tests/Core/Geometry/DiscLayerTests.cpp b/Tests/Core/Geometry/DiscLayerTests.cpp
index 339c3fcc2..6f2afc390 100644
--- a/Tests/Core/Geometry/DiscLayerTests.cpp
+++ b/Tests/Core/Geometry/DiscLayerTests.cpp
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(DiscLayerConstruction) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
diff --git a/Tests/Core/Geometry/LayerTests.cpp b/Tests/Core/Geometry/LayerTests.cpp
index 8e70ca753..7aadf0d37 100644
--- a/Tests/Core/Geometry/LayerTests.cpp
+++ b/Tests/Core/Geometry/LayerTests.cpp
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(LayerProperties, *utf::expected_failures(1)) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
diff --git a/Tests/Core/Geometry/PlaneLayerTests.cpp b/Tests/Core/Geometry/PlaneLayerTests.cpp
index 1d1bb49cc..009f88972 100644
--- a/Tests/Core/Geometry/PlaneLayerTests.cpp
+++ b/Tests/Core/Geometry/PlaneLayerTests.cpp
@@ -57,7 +57,7 @@ BOOST_AUTO_TEST_CASE(PlaneLayerConstruction) {
   // bounds object, rectangle type
   auto rBounds = std::make_shared<const RectangleBounds>(1., 1.);
   /// Constructor with transform pointer
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   const std::vector<std::shared_ptr<const Surface>> aSurfaces{
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds),
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)};
diff --git a/Tests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/Core/Surfaces/ConeSurfaceTests.cpp
index 885b9c02f..35c684f42 100644
--- a/Tests/Core/Surfaces/ConeSurfaceTests.cpp
+++ b/Tests/Core/Surfaces/ConeSurfaceTests.cpp
@@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceConstruction) {
   bool symmetric(false);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   BOOST_CHECK_EQUAL(
       Surface::makeShared<ConeSurface>(pNullTransform, alpha, symmetric)
           ->type(),
@@ -94,7 +94,6 @@ BOOST_AUTO_TEST_CASE(ConeSurfaceProperties) {
   bool symmetric(false);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  // auto pNullTransform = std::make_shared<const Transform3D>();
   auto coneSurfaceObject =
       Surface::makeShared<ConeSurface>(pTransform, alpha, symmetric);
   //
diff --git a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp
index de28ad012..1e959af9a 100644
--- a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp
+++ b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp
@@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceConstruction) {
   double radius(1.0), halfZ(10.), halfPhiSector(M_PI / 8.);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   BOOST_CHECK_EQUAL(
       Surface::makeShared<CylinderSurface>(pNullTransform, radius, halfZ)
           ->type(),
@@ -90,7 +90,6 @@ BOOST_AUTO_TEST_CASE(CylinderSurfaceProperties) {
   double radius(1.0), halfZ(10.);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  // auto pNullTransform = std::make_shared<const Transform3D>();
   auto cylinderSurfaceObject =
       Surface::makeShared<CylinderSurface>(pTransform, radius, halfZ);
   //
diff --git a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp
index 0a4e3fa66..927b5925b 100644
--- a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp
+++ b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(PerigeeSurfaceConstruction) {
   /// Constructor with transform pointer, null or valid
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pNullTransform)->type(),
                     Surface::Perigee);
   BOOST_CHECK_EQUAL(Surface::makeShared<PerigeeSurface>(pTransform)->type(),
diff --git a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp
index 748bcf553..254fe4a55 100644
--- a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp
+++ b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp
@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceConstruction) {
   /// indicator
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   // constructor with nullptr transform
   BOOST_CHECK_EQUAL(
       Surface::makeShared<PlaneSurface>(pNullTransform, rBounds)->type(),
@@ -80,7 +80,6 @@ BOOST_AUTO_TEST_CASE(PlaneSurfaceProperties) {
   /// Test clone method
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  // auto pNullTransform = std::make_shared<const Transform3D>();
   auto planeSurfaceObject =
       Surface::makeShared<PlaneSurface>(pTransform, rBounds);
   //
diff --git a/Tests/Core/Surfaces/StrawSurfaceTests.cpp b/Tests/Core/Surfaces/StrawSurfaceTests.cpp
index 44c198852..1e2e0f6d4 100644
--- a/Tests/Core/Surfaces/StrawSurfaceTests.cpp
+++ b/Tests/Core/Surfaces/StrawSurfaceTests.cpp
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(StrawSurfaceConstruction) {
   double radius(1.0), halfZ(10.);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  auto pNullTransform = std::make_shared<const Transform3D>();
+  std::shared_ptr<const Transform3D> pNullTransform{};
   BOOST_CHECK_EQUAL(
       Surface::makeShared<StrawSurface>(pNullTransform, radius, halfZ)->type(),
       Surface::Straw);
@@ -87,7 +87,6 @@ BOOST_AUTO_TEST_CASE(StrawSurfaceProperties) {
   double radius(1.0), halfZ(10.);
   Translation3D translation{0., 1., 2.};
   auto pTransform = std::make_shared<const Transform3D>(translation);
-  // auto pNullTransform = std::make_shared<const Transform3D>();
   auto strawSurfaceObject =
       Surface::makeShared<StrawSurface>(pTransform, radius, halfZ);
   //
-- 
GitLab