From 425ee7c0d1ccf85cdca11577ef51947ab337bbce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Berg=C3=A9?= <corentin.berge@outlook.fr>
Date: Wed, 3 Jul 2019 16:05:48 +0200
Subject: [PATCH] Try to find a way to coverage more files. Focus on
 signal-array (not Boost test). Try to understand a way to make boost test and
 analyze signal-array.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Bergé <corentin.berge@outlook.fr>
---
 include/dynamic-graph/logger.h   |  4 ++--
 src/debug/logger.cpp             |  4 +++-
 tests/command.cpp                | 19 +++++++++++++++++++
 tests/custom-entity.cpp          |  1 +
 tests/signal-array.cpp           | 28 ++++++++++++++++++++++++++++
 tests/signal-cast-registerer.cpp |  3 ++-
 tests/signal-ptr.cpp             | 29 ++++++++++++++++++++++++++++-
 7 files changed, 83 insertions(+), 5 deletions(-)
 create mode 100644 tests/command.cpp
 create mode 100644 tests/signal-array.cpp

diff --git a/include/dynamic-graph/logger.h b/include/dynamic-graph/logger.h
index 46a58ca..39e2b31 100644
--- a/include/dynamic-graph/logger.h
+++ b/include/dynamic-graph/logger.h
@@ -62,7 +62,7 @@ namespace dynamicgraph {
 #define SEND_WARNING_STREAM_MSG(msg)  SEND_MSG(msg,MSG_TYPE_WARNING_STREAM)
 #define SEND_ERROR_STREAM_MSG(msg)    SEND_MSG(msg,MSG_TYPE_ERROR_STREAM)
 
-  template<typename T>
+  /*template<typename T>
   std::string toString(const T& v, const int precision=3, const int width=-1)
   {
     std::stringstream ss;
@@ -71,7 +71,7 @@ namespace dynamicgraph {
     else
       ss<<std::fixed<<std::setprecision(precision)<<v;
     return ss.str();
-  }
+  }*/
 
   template<typename T>
   std::string toString(const std::vector<T>& v, const int precision=3, const int width=-1,
diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp
index 7aa01cc..83b54ec 100644
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
@@ -61,11 +61,13 @@ namespace dynamicgraph
        (m_lv==VERBOSITY_INFO_WARNING_ERROR && isDebugMsg(type)))
       return;
 
+    //TODO Modif ici
     // if print is allowed by current verbosity level
     if(isStreamMsg(type))
       {
+        int l = line;
         // check whether counter already exists
-        string id = file+toString(line);
+        string id = file+/*toString(line)*/+ l;
         map<string,double>::iterator it = m_stream_msg_counters.find(id);
         if(it == m_stream_msg_counters.end())
 	  {
diff --git a/tests/command.cpp b/tests/command.cpp
new file mode 100644
index 0000000..1fef6aa
--- /dev/null
+++ b/tests/command.cpp
@@ -0,0 +1,19 @@
+//
+// Created by Corentin on 7/3/19.
+//
+
+#include <sstream>
+#include <dynamic-graph/command-direct-setter.h>
+
+
+#define BOOST_TEST_MODULE command
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+using boost::test_tools::output_test_stream;
+
+struct Command : public dynamicgraph::command::DirectSetter
+{
+
+};
\ No newline at end of file
diff --git a/tests/custom-entity.cpp b/tests/custom-entity.cpp
index 54c3b13..f2c2066 100644
--- a/tests/custom-entity.cpp
+++ b/tests/custom-entity.cpp
@@ -52,6 +52,7 @@ BOOST_AUTO_TEST_CASE (constructor)
   BOOST_CHECK_EQUAL (entity->getName (), "my-entity");
   BOOST_CHECK_EQUAL (entity->Entity::getClassName (), "Entity");
   BOOST_CHECK_EQUAL (entity->getClassName (), CustomEntity::CLASS_NAME);
+
   //CustomEntity entity2 ("");
   // Deregister entities before destroying them
   dynamicgraph::PoolStorage::destroy();
diff --git a/tests/signal-array.cpp b/tests/signal-array.cpp
new file mode 100644
index 0000000..d05b81e
--- /dev/null
+++ b/tests/signal-array.cpp
@@ -0,0 +1,28 @@
+//
+// Created by corentin on 7/3/19.
+//
+
+#include <boost/foreach.hpp>
+
+#include <dynamic-graph/signal.h>
+
+
+#define BOOST_TEST_MODULE signal_array
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+using boost::test_tools::output_test_stream;
+
+typedef dynamicgraph::SignalArray_const<int> sigInt_t;
+
+template <>
+class DummyClass
+{
+public:
+    DEF_SIZE = 20;
+
+protected:
+    std::list<int> inputsig;
+    unsigned int inputsig_S,inputsig_R;
+};
\ No newline at end of file
diff --git a/tests/signal-cast-registerer.cpp b/tests/signal-cast-registerer.cpp
index 42b2b3f..0ce20ce 100644
--- a/tests/signal-cast-registerer.cpp
+++ b/tests/signal-cast-registerer.cpp
@@ -109,6 +109,7 @@ BOOST_AUTO_TEST_CASE (standard_double_registerer)
 	output_test_stream output;
 	mySignal.trace (output);
 	BOOST_CHECK (output.is_equal (test.second));
+
       }
     }
 
@@ -176,4 +177,4 @@ BOOST_AUTO_TEST_CASE (typeid_issue)
   BOOST_CHECK (typeid(vA) == typeid(vB));
   BOOST_CHECK_EQUAL (std::string (typeid(vA).name ()),
 		     std::string (typeid(vB).name ()));
-}
+}
\ No newline at end of file
diff --git a/tests/signal-ptr.cpp b/tests/signal-ptr.cpp
index 9e196ac..964ebf8 100644
--- a/tests/signal-ptr.cpp
+++ b/tests/signal-ptr.cpp
@@ -11,6 +11,32 @@
 #include <dynamic-graph/pool.h>
 #include <iostream>
 
+#define BOOST_TEST_MODULE signal_ptr
+
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+using boost::test_tools::output_test_stream;
+
+typedef dynamicgraph::SignalPtr<double, int> sigDouble_t;
+
+template<class T>
+class DummyClass
+{
+public:
+
+    std::string proname;
+
+
+
+
+
+
+
+
+
+
 
 int main( void )
 {
@@ -31,6 +57,7 @@ int main( void )
   cout << "SigPtrA = ";  sigPtrARef.get(cout); cout << std::endl;
   cout << "SigPtrB = ";  sigPtrBRef.get(cout); cout << std::endl;
 
-
   return 0;
 }
+
+
-- 
GitLab