From 2b2eb97e39bfeede791aa9a3c5440acf58b7969e Mon Sep 17 00:00:00 2001
From: Markus Frank <markus.frank@cern.ch>
Date: Fri, 11 Dec 2015 08:24:13 +0000
Subject: [PATCH] Remove CppCheck warnings

---
 DDTest/src/test_surface.cc | 27 +--------------------------
 DDTest/src/test_units.cc   | 24 +-----------------------
 2 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/DDTest/src/test_surface.cc b/DDTest/src/test_surface.cc
index 29f4a2c7a..bbd645e41 100644
--- a/DDTest/src/test_surface.cc
+++ b/DDTest/src/test_surface.cc
@@ -6,11 +6,10 @@
 #include "DD4hep/Detector.h"
 
 #include "DDRec/Surface.h"
-//#include "DDSurfaces/ISurface.h"
+#include "STR.h"
 
 #include <exception>
 #include <iostream>
-#include <sstream>
 #include <assert.h>
 #include <cmath>
 
@@ -23,30 +22,6 @@ using namespace DDSurfaces ;
 
 // this should be the first line in your test
 DDTest test = DDTest( "surface" ) ; 
-
-//=============================================================================
-/** Helper class for floating point comparisons using string representations */
-class STR {
-  STR() {} 
-  float _val ;
-  std::string _str ;
-public:
-  STR ( float val ) : _val( val ), _str() {
-    std::stringstream s1 ; 
-    s1 << _val ;
-    _str = s1.str() ;
-  }
-  std::string str() const { return _str ; }
-  
-  bool operator==( const STR& s2) const {
-    return this->str() == s2.str() ;
-  }
-};
-
-std::ostream& operator<<(std::ostream& os , const STR& s) {
-  os << s.str() ;
-  return os ;
-} 
 //=============================================================================
 
 int main(int argc, char** argv ){
diff --git a/DDTest/src/test_units.cc b/DDTest/src/test_units.cc
index d3cc02e54..a3b81bfc1 100644
--- a/DDTest/src/test_units.cc
+++ b/DDTest/src/test_units.cc
@@ -2,10 +2,10 @@
 
 #include "DD4hep/LCDD.h"
 #include "DD4hep/DD4hepUnits.h"
+#include "STR.h"
 
 #include <exception>
 #include <iostream>
-#include <sstream>
 #include <assert.h>
 #include <cmath>
 
@@ -18,28 +18,6 @@ using namespace dd4hep ;
 DDTest test = DDTest( "units" ) ; 
 
 //=============================================================================
-/** Helper class for floating point comparisons using string representations */
-class STR {
-  STR() {} 
-  float _val ;
-  std::string _str ;
-public:
-  STR ( float val ) : _val(val), _str() {
-    std::stringstream s1 ; 
-    s1 << _val ;
-    _str = s1.str() ;
-  }
-  std::string str() const { return _str ; }
-  
-  bool operator==( const STR& s2) const {
-    return this->str() == s2.str() ;
-  }
-};
-
-std::ostream& operator<<(std::ostream& os , const STR& s) {
-  os << s.str() ;
-  return os ;
-} 
 //=============================================================================
 
 int main(int argc, char** argv ){
-- 
GitLab