Boost logo

Boost-Commit :

From: dwalker07_at_[hidden]
Date: 2008-08-23 20:17:22


Author: dlwalker
Date: 2008-08-23 20:17:21 EDT (Sat, 23 Aug 2008)
New Revision: 48336
URL: http://svn.boost.org/trac/boost/changeset/48336

Log:
Removed custom macros for printing XML test data, since I figured out how to use the corresponding Boost.Test run-time parameter; used custom XML tag name for one test
Text files modified:
   sandbox/md5/libs/coding/test/md5_computer_test.cpp | 30 ++++++++----------------------
   sandbox/md5/libs/coding/test/md5_digest_test.cpp | 23 +++++------------------
   2 files changed, 13 insertions(+), 40 deletions(-)

Modified: sandbox/md5/libs/coding/test/md5_computer_test.cpp
==============================================================================
--- sandbox/md5/libs/coding/test/md5_computer_test.cpp (original)
+++ sandbox/md5/libs/coding/test/md5_computer_test.cpp 2008-08-23 20:17:21 EDT (Sat, 23 Aug 2008)
@@ -22,25 +22,11 @@
 #include <algorithm> // for std::reverse, for_each
 #include <climits> // for CHAR_BIT
 #include <cstddef> // for std::size_t
-#include <iostream> // for std::cout
 #include <istream> // for std::basic_istream
-#include <ostream> // for std::endl, basic_ostream
+#include <ostream> // for std::basic_ostream
 #include <sstream> // for std::stringstream
 
 
-// Control if XML code will be printed conventionally, or just logged.
-#ifndef CONTROL_SHOW_XML
-#define CONTROL_SHOW_XML 0
-#endif
-
-// Logging
-#if CONTROL_SHOW_XML
-#define PRIVATE_SHOW_MESSAGE( m ) std::cout << m << std::endl
-#else
-#define PRIVATE_SHOW_MESSAGE( m ) BOOST_TEST_MESSAGE( m )
-#endif
-
-
 #pragma mark Intro stuff
 
 // Put any using-ed types & templates, and typedefs here
@@ -612,7 +598,7 @@
     BOOST_REQUIRE_NE( test, c2 );
 
     // Read from an archive
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
 
     // Confirm the change and proper read-back
@@ -628,7 +614,7 @@
     write_xml_archive( ss, test, "test" );
     test.reset();
     BOOST_REQUIRE_NE( test, c2 );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c2 );
 
@@ -641,7 +627,7 @@
     write_xml_archive( ss, test, "test" );
     test.reset();
     BOOST_REQUIRE_NE( test, c2 );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c2 );
 
@@ -664,7 +650,7 @@
     write_xml_archive( ss, test, "test" );
     test.reset();
     BOOST_REQUIRE_NE( test, c2 );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c2 );
 
@@ -678,7 +664,7 @@
     write_xml_archive( ss, test, "test" );
     test.reset();
     BOOST_REQUIRE_NE( test, c2 );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c2 );
 
@@ -686,7 +672,7 @@
     BOOST_REQUIRE_NE( test, c1 );
     ss.str( "" );
     write_xml_archive( ss, c1, "test" );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c1 );
     BOOST_CHECK_NE( test, c2 );
@@ -739,7 +725,7 @@
     std::stringstream ss;
 
     write_xml_archive( ss, c1, "test" );
- PRIVATE_SHOW_MESSAGE( ss.str() );
+ BOOST_TEST_MESSAGE( ss.str() );
     read_xml_archive( ss, test, "test" );
     BOOST_CHECK_EQUAL( test, c1 );
     BOOST_CHECK_NE( test, c2 );

Modified: sandbox/md5/libs/coding/test/md5_digest_test.cpp
==============================================================================
--- sandbox/md5/libs/coding/test/md5_digest_test.cpp (original)
+++ sandbox/md5/libs/coding/test/md5_digest_test.cpp 2008-08-23 20:17:21 EDT (Sat, 23 Aug 2008)
@@ -23,27 +23,13 @@
 #include <cwchar> // for WEOF, std::wint_t
 #include <iomanip> // for std::setfill, setw
 #include <ios> // for std::left, uppercase
-#include <iostream> // for std::cout
 #include <istream> // for std::basic_istream
 #include <memory> // for std::auto_ptr [for xcode_config]
-#include <ostream> // for std::endl, basic_ostream
+#include <ostream> // for std::basic_ostream
 #include <sstream> // for std::[w](o|i)stringstream
 #include <string> // for std::string, wstring
 
 
-// Control if XML code will be printed conventionally, or just logged.
-#ifndef CONTROL_SHOW_XML
-#define CONTROL_SHOW_XML 0
-#endif
-
-// Logging
-#if CONTROL_SHOW_XML
-#define PRIVATE_SHOW_MESSAGE( m ) std::cout << m << std::endl
-#else
-#define PRIVATE_SHOW_MESSAGE( m ) BOOST_TEST_MESSAGE( m )
-#endif
-
-
 #pragma mark Intro stuff
 
 // Put any using-ed types & templates, and typedefs here
@@ -328,10 +314,11 @@
     // Write to archive
     std::stringstream ss;
     md5_digest test = md5_initial;
+ char const key[] = "test-digest";
 
     BOOST_REQUIRE_NE( test, zeros );
     BOOST_REQUIRE_EQUAL( test, md5_initial );
- write_xml_archive( ss, test, "test" );
+ write_xml_archive( ss, test, key );
 
     // Ensure receiving object's value is different
     test = zeros;
@@ -339,8 +326,8 @@
     BOOST_REQUIRE_EQUAL( test, zeros );
 
     // Read from archive
- PRIVATE_SHOW_MESSAGE( ss.str() );
- read_xml_archive( ss, test, "test" );
+ BOOST_TEST_MESSAGE( ss.str() );
+ read_xml_archive( ss, test, key );
 
     // Confirm the change and proper read-back
     BOOST_CHECK_NE( test, zeros );


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