Boost logo

Boost-Commit :

From: ghost_at_[hidden]
Date: 2007-10-25 13:08:28


Author: vladimir_prus
Date: 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
New Revision: 40463
URL: http://svn.boost.org/trac/boost/changeset/40463

Log:
Don't use boost.test for testing.
Added:
   trunk/libs/program_options/test/minitest.hpp (contents, props changed)
Text files modified:
   trunk/libs/program_options/test/Jamfile.v2 | 2 +-
   trunk/libs/program_options/test/cmdline_test.cpp | 7 +++----
   trunk/libs/program_options/test/options_description_test.cpp | 7 +++----
   trunk/libs/program_options/test/parsers_test.cpp | 7 +++----
   trunk/libs/program_options/test/positional_options_test.cpp | 5 +++--
   trunk/libs/program_options/test/test_convert.cpp | 4 ++--
   trunk/libs/program_options/test/unicode_test.cpp | 7 +++----
   trunk/libs/program_options/test/variable_map_test.cpp | 16 ++--------------
   trunk/libs/program_options/test/winmain.cpp | 4 ++--
   9 files changed, 22 insertions(+), 37 deletions(-)

Modified: trunk/libs/program_options/test/Jamfile.v2
==============================================================================
--- trunk/libs/program_options/test/Jamfile.v2 (original)
+++ trunk/libs/program_options/test/Jamfile.v2 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -2,8 +2,8 @@
 project
     : requirements
     <library>../build//boost_program_options
- <library>/boost/test//boost_test_exec_monitor/<link>static
     <link>static
+ <variant>debug
     
 # <define>_GLIBCXX_CONCEPT_CHECKS
 # <define>_GLIBCXX_DEBUG

Modified: trunk/libs/program_options/test/cmdline_test.cpp
==============================================================================
--- trunk/libs/program_options/test/cmdline_test.cpp (original)
+++ trunk/libs/program_options/test/cmdline_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -9,15 +9,14 @@
 using namespace boost::program_options;
 using boost::program_options::detail::cmdline;
 
-
-#include <boost/test/test_tools.hpp>
-
 #include <iostream>
 #include <sstream>
 #include <vector>
 #include <cassert>
 using namespace std;
 
+#include "minitest.hpp"
+
 /* To facilitate testing, declare a number of error codes. Otherwise,
    we'd have to specify the type of exception that should be thrown.
 */
@@ -600,7 +599,7 @@
     // It's not clear yet, so I'm leaving the decision till later.
 }
 
-int test_main(int ac, char* av[])
+int main(int ac, char* av[])
 {
     test_long_options();
     test_short_options();

Added: trunk/libs/program_options/test/minitest.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/program_options/test/minitest.hpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -0,0 +1,25 @@
+#ifndef BOOST_PROGRAM_OPTIONS_MINITEST
+#define BOOST_PROGRAM_OPTIONS_MINITEST
+
+#include <assert.h>
+#include <iostream>
+#include <stdlib.h>
+
+#define BOOST_REQUIRE(b) assert(b)
+#define BOOST_CHECK(b) assert(b)
+#define BOOST_CHECK_EQUAL(a, b) assert(a == b)
+#define BOOST_ERROR(description) std::cerr << description; std::cerr << "\n"; abort();
+#define BOOST_CHECK_THROW(expression, exception) \
+ try \
+ { \
+ expression; \
+ BOOST_ERROR("expected exception not thrown");\
+ throw 10; \
+ } \
+ catch(exception &) \
+ { \
+ }
+
+
+
+#endif

Modified: trunk/libs/program_options/test/options_description_test.cpp
==============================================================================
--- trunk/libs/program_options/test/options_description_test.cpp (original)
+++ trunk/libs/program_options/test/options_description_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -10,14 +10,13 @@
 #include <boost/function.hpp>
 using namespace boost;
 
-#define BOOST_INCLUDE_MAIN // for testing, include rather than link
-#include <boost/test/test_tools.hpp>
-
 #include <utility>
 #include <string>
 #include <sstream>
 using namespace std;
 
+#include "minitest.hpp"
+
 void test_type()
 {
     options_description desc;
@@ -77,7 +76,7 @@
     ss << desc;
 }
 
-int test_main(int, char* [])
+int main(int, char* [])
 {
     test_type();
     test_approximation();

Modified: trunk/libs/program_options/test/parsers_test.cpp
==============================================================================
--- trunk/libs/program_options/test/parsers_test.cpp (original)
+++ trunk/libs/program_options/test/parsers_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -14,9 +14,6 @@
 #include <boost/function.hpp>
 using namespace boost;
 
-#define BOOST_INCLUDE_MAIN // for testing, include rather than link
-#include <boost/test/test_tools.hpp>
-
 #include <sstream>
 #include <iostream>
 using namespace std;
@@ -27,6 +24,8 @@
 #include <cstdlib> // for putenv
 #endif
 
+#include "minitest.hpp"
+
 #define TEST_CHECK_THROW(expression, exception, description) \
     try \
     { \
@@ -259,7 +258,7 @@
     check_value(a3[1], "m1.v1", "1");
 }
 
-int test_main(int, char* [])
+int main(int, char* [])
 {
     test_command_line();
     test_config_file();

Modified: trunk/libs/program_options/test/positional_options_test.cpp
==============================================================================
--- trunk/libs/program_options/test/positional_options_test.cpp (original)
+++ trunk/libs/program_options/test/positional_options_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -12,7 +12,8 @@
 
 
 #include <boost/limits.hpp>
-#include <boost/test/test_tools.hpp>
+
+#include "minitest.hpp"
 
 #include <vector>
 using namespace std;
@@ -81,7 +82,7 @@
                       too_many_positional_options_error);
 }
 
-int test_main(int, char* [])
+int main(int, char* [])
 {
     test_positional_options();
     test_parsing();

Modified: trunk/libs/program_options/test/test_convert.cpp
==============================================================================
--- trunk/libs/program_options/test/test_convert.cpp (original)
+++ trunk/libs/program_options/test/test_convert.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -15,7 +15,7 @@
 #include <boost/program_options/detail/convert.hpp>
 #include <boost/program_options/detail/utf8_codecvt_facet.hpp>
 
-#include <boost/test/test_tools.hpp>
+#include "minitest.hpp"
 
 using namespace std;
 
@@ -121,7 +121,7 @@
     BOOST_CHECK(ref == input);
 }
 
-int test_main(int ac, char* av[])
+int main(int ac, char* av[])
 {
     std::string input = file_content("utf8.txt");
     std::string expected = file_content("ucs2.txt");

Modified: trunk/libs/program_options/test/unicode_test.cpp
==============================================================================
--- trunk/libs/program_options/test/unicode_test.cpp (original)
+++ trunk/libs/program_options/test/unicode_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -15,12 +15,11 @@
 #include <boost/function.hpp>
 using namespace boost;
 
-#define BOOST_INCLUDE_MAIN // for testing, include rather than link
-#include <boost/test/test_tools.hpp>
-
 #include <sstream>
 using namespace std;
 
+#include "minitest.hpp"
+
 // Test that unicode input is forwarded to unicode option without
 // problems.
 void test_unicode_to_unicode()
@@ -149,7 +148,7 @@
     BOOST_CHECK(vm["foo"].as<string>() == "\xD1\x8F");
 }
 
-int test_main(int, char* [])
+int main(int, char* [])
 {
     test_unicode_to_unicode();
     test_unicode_to_native();

Modified: trunk/libs/program_options/test/variable_map_test.cpp
==============================================================================
--- trunk/libs/program_options/test/variable_map_test.cpp (original)
+++ trunk/libs/program_options/test/variable_map_test.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -15,22 +15,10 @@
 #include <boost/function.hpp>
 using namespace boost;
 
-#define BOOST_INCLUDE_MAIN // for testing, include rather than link
-#include <boost/test/test_tools.hpp>
-
 #include <sstream>
 using namespace std;
 
-#define TEST_CHECK_THROW(expression, exception, description) \
- try \
- { \
- expression; \
- BOOST_ERROR(description);\
- throw 10; \
- } \
- catch(exception &) \
- { \
- }
+#include "minitest.hpp"
 
 vector<string> sv(char* array[], unsigned size)
 {
@@ -288,7 +276,7 @@
 
 }
 
-int test_main(int, char* [])
+int main(int, char* [])
 {
     test_variable_map();
     test_semantic_values();

Modified: trunk/libs/program_options/test/winmain.cpp
==============================================================================
--- trunk/libs/program_options/test/winmain.cpp (original)
+++ trunk/libs/program_options/test/winmain.cpp 2007-10-25 13:08:27 EDT (Thu, 25 Oct 2007)
@@ -45,13 +45,13 @@
     TEST("1\\\\1 ", {"1\\\\1"});
 }
 
-int test_main(int, char*[])
+int main(int, char*[])
 {
     test_winmain();
     return 0;
 }
 #else
-int test_main(int, char*[])
+int main(int, char*[])
 {
     return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk