Boost logo

Boost-Commit :

From: dannyh_at_[hidden]
Date: 2007-05-21 21:41:40


Author: dannyh
Date: 2007-05-21 21:41:40 EDT (Mon, 21 May 2007)
New Revision: 4165
URL: http://svn.boost.org/trac/boost/changeset/4165

Log:
updated some testcases for "strm << container_format() % c" format. Now, precision of doubles and floats can be manipulated in one line.

Text files modified:
   sandbox/explore/libs/explore/test/simple_types.cpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: sandbox/explore/libs/explore/test/simple_types.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/simple_types.cpp (original)
+++ sandbox/explore/libs/explore/test/simple_types.cpp 2007-05-21 21:41:40 EDT (Mon, 21 May 2007)
@@ -11,11 +11,13 @@
 #include <boost/test/unit_test.hpp>
 #include <string>
 #include <sstream>
+#include <iomanip>
 #include <boost/lexical_cast.hpp>
 #include "../../../boost/explore/explore.hpp"
 
 BOOST_AUTO_TEST_CASE( int_test )
 {
+
         std::stringstream str_out;
         int i = 123;
         
@@ -40,7 +42,7 @@
         std::stringstream str_out;
         float f = 1.234f;
         
- explore::print(f, str_out);
+ str_out << std::setprecision( 4) << explore::container_format() % f;
         BOOST_CHECK_EQUAL(str_out.str(), "1.234");
         
         BOOST_CHECK_MESSAGE(false, "Test min precision");
@@ -52,8 +54,8 @@
         std::stringstream str_out;
         double d = 1.2341234f;
         
- explore::print(d, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "1.2341234");
+ str_out << std::setprecision(7) << explore::container_format() % d;
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
         
         BOOST_CHECK_MESSAGE(false, "Test min precision");
         BOOST_CHECK_MESSAGE(false, "Test max precision");
@@ -64,7 +66,7 @@
         std::stringstream str_out;
         bool b = true;
         
- explore::print(b, str_out);
+ str_out << std::boolalpha << explore::container_format() %b;
         BOOST_CHECK_EQUAL(str_out.str(), "true");
         
         str_out.str("");


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