[nemiver] Fix tests to work with Boost.Test 1.37



commit b231a8e6a9f7f4ac527c4ae42981dca941d221ca
Author: Dodji Seketeli <dodji redhat com>
Date:   Fri Mar 13 22:26:12 2009 +0100

    Fix tests to work with Boost.Test 1.37
    
    	* tests/Makefile.am (runtestbreakpoint,
    	runtestderef, runtestlocalvarslist,
    	runtestglobalvariables): Don't link the tests with
    	libboost_test_exec_monitor.
    	* tests/test-breakpoint.cc: Don't include
    	boost/test/test_tools.hpp. To use this, we actually need
    	to drag in more that what we would like. And that won't be
    	available in boost <= 1.34. We should only use the minimal test
    	functionality, embedded inline in boost/test/minimal.hpp.
    	This is what boost recommends for tests that are not proper unit tests.
    	So don't use BOOST_REQUIRE_MESSAGE either, as it is provided by
    	boost/test/test_tools.hpp. We should just use BOOST_REQUIRE that is
    	provided by boost/test/minimal.
    	* tests/test-deref.cc: Likewise.
    	* tests/test-global-variables.cc: Likewise.
    	* tests/test-local-vars-list.cc: Likewise.
---
 tests/Makefile.am              |    8 ++++----
 tests/test-breakpoint.cc       |    5 ++---
 tests/test-deref.cc            |   27 +++++++++++----------------
 tests/test-global-variables.cc |    1 -
 tests/test-local-vars-list.cc  |   16 ++++++----------
 5 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 87e89e3..7c8998a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,7 +45,7 @@ fooprog_SOURCES=fooprog.cc
 fooprog_LDADD=
 
 runtestbreakpoint_SOURCES=test-breakpoint.cc
-runtestbreakpoint_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
+runtestbreakpoint_LDADD= NEMIVERCOMMON_LIBS@ \
 $(top_builddir)/src/common/libnemivercommon.la
 
 runtestoverloads_SOURCES=test-overloads.cc
@@ -80,15 +80,15 @@ runtestvarwalker_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
 $(top_builddir)/src/common/libnemivercommon.la
 
 runtestderef_SOURCES=test-deref.cc
-runtestderef_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
+runtestderef_LDADD= NEMIVERCOMMON_LIBS@ \
 $(top_builddir)/src/common/libnemivercommon.la
 
 runtestlocalvarslist_SOURCES=test-local-vars-list.cc
-runtestlocalvarslist_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
+runtestlocalvarslist_LDADD= NEMIVERCOMMON_LIBS@  \
 $(top_builddir)/src/common/libnemivercommon.la
 
 runtestglobalvariables_SOURCES=test-global-variables.cc
-runtestglobalvariables_LDADD= NEMIVERCOMMON_LIBS@ @BOOST_TEST_EXEC_MONITOR_LIB@ \
+runtestglobalvariables_LDADD= NEMIVERCOMMON_LIBS@ \
 $(top_builddir)/src/common/libnemivercommon.la
 
 runtestcpplexer_SOURCES=test-cpp-lexer.cc
diff --git a/tests/test-breakpoint.cc b/tests/test-breakpoint.cc
index 1f131ee..3b0576e 100644
--- a/tests/test-breakpoint.cc
+++ b/tests/test-breakpoint.cc
@@ -1,5 +1,4 @@
 #include <iostream>
-#include <boost/test/test_tools.hpp>
 #include <boost/test/minimal.hpp>
 #include <glibmm.h>
 #include "common/nmv-initializer.h"
@@ -27,8 +26,8 @@ on_program_finished_signal ()
 {
     MESSAGE ("program finished") ;
     MESSAGE ("nb of breakpoint hit: " <<  (int)nb_bp);
-    BOOST_REQUIRE_MESSAGE (nb_bp == 5, "nb of breakpoint hits was: " << nb_bp) ;
-    BOOST_REQUIRE_MESSAGE (nb_stops > 5, "nb of stops was: " << nb_stops) ;
+    BOOST_REQUIRE(nb_bp == 5) ;
+    BOOST_REQUIRE(nb_stops > 5) ;
     loop->quit () ;
 }
 
diff --git a/tests/test-deref.cc b/tests/test-deref.cc
index 1908016..adabf2b 100644
--- a/tests/test-deref.cc
+++ b/tests/test-deref.cc
@@ -1,6 +1,5 @@
 #include <iostream>
 #include <boost/test/minimal.hpp>
-#include <boost/test/test_tools.hpp>
 #include <glibmm.h>
 #include "nmv-i-debugger.h"
 #include "common/nmv-initializer.h"
@@ -31,17 +30,13 @@ on_variable_derefed_signal (const IDebugger::VariableSafePtr &a_var,
     ++nb_derefed ;
 
     if (a_var->name () == "foo_ptr") {
-        BOOST_REQUIRE_MESSAGE
-            (a_var->get_dereferenced ()->members ().size () == 1,
-             "got: " << a_var->get_dereferenced ()->members ().size ()) ;
+        BOOST_REQUIRE (a_var->get_dereferenced ()->members ().size () == 1) ;
     } else if (a_var->name () == "bar_ptr") {
-        BOOST_REQUIRE_MESSAGE
-            (a_var->get_dereferenced ()->members ().size () == 1,
-             "got: " << a_var->get_dereferenced ()->members ().size ()) ;
+        BOOST_REQUIRE
+            (a_var->get_dereferenced ()->members ().size () == 1) ;
     } else if (a_var->name () == "baz_ptr") {
-        BOOST_REQUIRE_MESSAGE
-            (a_var->get_dereferenced ()->members ().size () == 2,
-             "got: " << a_var->get_dereferenced ()->members ().size ()) ;
+        BOOST_REQUIRE
+            (a_var->get_dereferenced ()->members ().size () == 2) ;
     }
     a_debugger->step_over () ;
 }
@@ -63,7 +58,8 @@ on_variable_value_signal (const UString &a_var_name,
         a_var_name == "baz_ptr") {
         a_debugger->get_variable_type (a_var) ;
     } else {
-        BOOST_FAIL ("Got variable name: " << a_var_name) ;
+        UString msg = "Got variable name " + a_var_name;
+        BOOST_FAIL (msg.c_str ()) ;
     }
 }
 
@@ -91,7 +87,8 @@ on_variable_type_set_signal (const IDebugger::VariableSafePtr &a_var,
         BOOST_REQUIRE (lang_trait->is_type_a_pointer (a_var->type ())) ;
         a_debugger->dereference_variable (a_var) ;
     } else {
-        BOOST_FAIL ("Got variable name: " << a_var->name ()) ;
+        UString msg = "Got variable name: "+ a_var->name ();
+        BOOST_FAIL (msg.c_str ()) ;
     }
 }
 void
@@ -107,10 +104,8 @@ on_stopped_signal (IDebugger::StopReason a_reason,
 
     if (a_reason == IDebugger::EXITED_NORMALLY) {
         loop->quit ();
-        BOOST_REQUIRE_MESSAGE (nb_derefed == 3,
-                               "nb_derefed is " << nb_derefed) ;
-        BOOST_REQUIRE_MESSAGE (nb_type_set == 3,
-                               "nb_type_set is " << nb_type_set) ;
+        BOOST_REQUIRE (nb_derefed == 3) ;
+        BOOST_REQUIRE (nb_type_set == 3) ;
         return;
     }
     ++nb_stops;
diff --git a/tests/test-global-variables.cc b/tests/test-global-variables.cc
index c91a42c..e4575b6 100644
--- a/tests/test-global-variables.cc
+++ b/tests/test-global-variables.cc
@@ -2,7 +2,6 @@
 #include <map>
 #include <string>
 #include <boost/test/minimal.hpp>
-#include <boost/test/test_tools.hpp>
 #include <glibmm.h>
 #include "common/nmv-initializer.h"
 #include "common/nmv-exception.h"
diff --git a/tests/test-local-vars-list.cc b/tests/test-local-vars-list.cc
index e6b2cdb..6b23f4e 100644
--- a/tests/test-local-vars-list.cc
+++ b/tests/test-local-vars-list.cc
@@ -1,6 +1,5 @@
 #include <iostream>
 #include <boost/test/minimal.hpp>
-#include <boost/test/test_tools.hpp>
 #include <glibmm.h>
 #include "common/nmv-initializer.h"
 #include "common/nmv-exception.h"
@@ -34,18 +33,14 @@ on_stopped_signal (IDebugger::StopReason a_reason,
     if (a_reason == IDebugger::EXITED_NORMALLY) {
         //okay, time to get out. Let's check if the overall test
         //went like we want
-        BOOST_REQUIRE_MESSAGE (nb_var_type_set == 3,
-                               "got nb_var_type_set: " << nb_var_type_set) ;
-        BOOST_REQUIRE_MESSAGE (nb_var_value_set == 3,
-                               "got nb_var_value_set: " << nb_var_value_set) ;
-        BOOST_REQUIRE_MESSAGE (a_var_list->get_raw_list ().size () == 3,
-                               "size:"
-                                << (int)a_var_list->get_raw_list ().size ()) ;
+        BOOST_REQUIRE (nb_var_type_set == 3) ;
+        BOOST_REQUIRE (nb_var_value_set == 3) ;
+        BOOST_REQUIRE (a_var_list->get_raw_list ().size () == 3) ;
         IDebugger::VariableSafePtr var ;
         BOOST_REQUIRE (a_var_list->find_variable ("foo_ptr", var)) ;
         BOOST_REQUIRE (var) ;
         BOOST_REQUIRE (var->name () != "") ;
-        BOOST_REQUIRE_MESSAGE (var->type () != "", "var: " << var->name ()) ;
+        BOOST_REQUIRE (var->type () != "") ;
 
         BOOST_REQUIRE (a_var_list->find_variable ("bar_ptr", var)) ;
         BOOST_REQUIRE (var) ;
@@ -106,7 +101,8 @@ on_var_type_set (const IDebugger::VariableSafePtr &a_var)
         MESSAGE ("variable type set: "
                  <<a_var->name () << ":" << a_var->type ()) ;
     } else {
-        BOOST_FAIL ("unexpected variable: " << a_var->name ()) ;
+        UString msg = "unexpected variable: " + a_var->name ();
+        BOOST_FAIL (msg.c_str ()) ;
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]