From 98a0858d2b5bafe3fbd57a9707f8dac4b12e6e77 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Mon, 11 Jul 2022 13:46:51 +0200
Subject: [PATCH] Try to fix MAC link problems on github for examples

---
 DDTest/src/test_PolarGridRPhi2.cc |  4 +---
 DDTest/src/test_bitfield64.cc     | 10 ++--------
 DDTest/src/test_bitfieldcoder.cc  |  8 +++-----
 DDTest/src/test_example.cc        | 22 +++++-----------------
 4 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/DDTest/src/test_PolarGridRPhi2.cc b/DDTest/src/test_PolarGridRPhi2.cc
index eb3979660..14d2d151a 100644
--- a/DDTest/src/test_PolarGridRPhi2.cc
+++ b/DDTest/src/test_PolarGridRPhi2.cc
@@ -7,9 +7,6 @@
 #include <algorithm>
 #include <exception>
 
-
-static dd4hep::DDTest test( "PolarGridRPhi2" ) ;
-
 class TestTuple {
 public:
   double    _r;
@@ -20,6 +17,7 @@ public:
 };
 
 int main() {
+  dd4hep::DDTest test( "PolarGridRPhi2" ) ;
   try{
 
     dd4hep::DDSegmentation::PolarGridRPhi2 seg("system:8,layer:8,barrel:3,layer:8,slice:5,r:16,phi:16");
diff --git a/DDTest/src/test_bitfield64.cc b/DDTest/src/test_bitfield64.cc
index 0067bdde3..49ea6109f 100644
--- a/DDTest/src/test_bitfield64.cc
+++ b/DDTest/src/test_bitfield64.cc
@@ -6,25 +6,19 @@
 
 #include "DDSegmentation/BitField64.h"
 
-
 using namespace std ;
 using namespace dd4hep ;
 using namespace DDSegmentation ;
 
-// this should be the first line in your test
-static DDTest test( "bitfield64" ) ; 
-
 //=============================================================================
-
 int main(int /* argc */, char** /* argv */ ){
     
+  DDTest test( "bitfield64" ) ; 
+
   try{
-    
     // ----- write your tests in here -------------------------------------
-
     test.log( "test bitfield64" );
 
-
     // initialize with a string that uses all 64 bits :
     BitField64 bf("system:5,side:-2,layer:9,module:8,sensor:8,x:32:-16,y:-16" ) ;
 
diff --git a/DDTest/src/test_bitfieldcoder.cc b/DDTest/src/test_bitfieldcoder.cc
index d548613c0..e6f6bae59 100644
--- a/DDTest/src/test_bitfieldcoder.cc
+++ b/DDTest/src/test_bitfieldcoder.cc
@@ -11,13 +11,11 @@ using namespace std ;
 using namespace dd4hep ;
 using namespace DDSegmentation ;
 
-// this should be the first line in your test
-static DDTest test( "bitfield64" ) ; 
-
 //=============================================================================
-
 int main(int /* argc */, char** /* argv */ ){
-    
+  // this should be the first line in your test
+  DDTest test( "bitfield64" );
+ 
   try{
     
     // ----- write your tests in here -------------------------------------
diff --git a/DDTest/src/test_example.cc b/DDTest/src/test_example.cc
index 16d5e7037..b41adde32 100644
--- a/DDTest/src/test_example.cc
+++ b/DDTest/src/test_example.cc
@@ -4,15 +4,11 @@
 #include <assert.h>
 #include <cmath>
 
-using namespace std ;
-using namespace dd4hep ;
-
-// this should be the first line in your test
-static DDTest test( "example" ) ; 
-
 //=============================================================================
-
 int main(int /* argc */, char** /* argv */ ){
+
+  // this should be the first line in your test
+  dd4hep::DDTest test( "example" ) ; 
     
   try{
     
@@ -26,11 +22,8 @@ int main(int /* argc */, char** /* argv */ ){
 
     //test( "Example", "BadExample", "example test - string comparison " ); //  this test will fail
 
-
-
     double pi_d = M_PI ;
     float  pi_f = M_PI ;
-
     // ----- example for test of an expresssion - not using equality
 
     test(  1.1 * pi_f > pi_d   , " example comparison:  1.1* float(M_PI)  > double( M_PI) " ) ;  
@@ -41,16 +34,11 @@ int main(int /* argc */, char** /* argv */ ){
     // test(  pi_f >  pi_d  , " example comparison:  float(M_PI)  > double( M_PI) " ) ;  
 
     // --------------------------------------------------------------------
-
-
-  } catch( exception &e ){
-    //} catch( ... ){
-
+  }
+  catch( std::exception &e ){
     test.log( e.what() );
     test.error( "exception occurred" );
   }
-
   return 0;
 }
-
 //=============================================================================
-- 
GitLab