Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63871 - sandbox/variadic_templates/libs/iostreams/test
From: cppljevans_at_[hidden]
Date: 2010-07-11 10:44:07


Author: cppljevans
Date: 2010-07-11 10:44:06 EDT (Sun, 11 Jul 2010)
New Revision: 63871
URL: http://svn.boost.org/trac/boost/changeset/63871

Log:
add test for indent_scoped_ostreambuf
Added:
   sandbox/variadic_templates/libs/iostreams/test/
   sandbox/variadic_templates/libs/iostreams/test/Jamfile.v2 (contents, props changed)
   sandbox/variadic_templates/libs/iostreams/test/indent_scoped_ostreambuf_test.cpp (contents, props changed)

Added: sandbox/variadic_templates/libs/iostreams/test/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/iostreams/test/Jamfile.v2 2010-07-11 10:44:06 EDT (Sun, 11 Jul 2010)
@@ -0,0 +1,153 @@
+# Boost.Iostreams Library test Jamfile
+
+# (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+# (C) Copyright 2004-2007 Jonathan Turkanis
+# Distributed under the Boost Software License, Version 1.0. (See accompanying
+# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+# See http://www.boost.org/libs/iostreams for documentation.
+
+#ChangeLog:
+# 2010-07-11.1257.UTC
+# 1) cp'ed from http://svn.boost.org/svn/boost/trunk/libs/iostreams/test/Jamfile.v2
+# 2) commented out all the tests.
+# 3) added the indent_scoped_ostreambuf_test.cpp test.
+#
+
+import stlport ;
+import modules ;
+
+local NO_BZIP2 = [ modules.peek : NO_BZIP2 ] ;
+local NO_ZLIB = [ modules.peek : NO_ZLIB ] ;
+local LARGE_FILE_TEMP = [ modules.peek : LARGE_FILE_TEMP ] ;
+local LARGE_FILE_KEEP = [ modules.peek : LARGE_FILE_KEEP ] ;
+
+rule test-iostreams ( sources * : requirements * ) {
+ return [
+ run
+ $(sources)
+ /boost/test//boost_unit_test_framework/<link>static
+ /boost/filesystem//boost_filesystem/<link>static
+ : # command
+ : # input files
+ : # build requirements
+ <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
+ <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>cw-9.3,<os>darwin:<runtime-link>static
+ <define>BOOST_IOSTREAMS_NO_LIB
+ <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
+ $(requirements)
+ ] ;
+}
+
+rule compile-fail-iostreams ( sources * : requirements * : target-name ? ) {
+ return [
+ compile-fail
+ $(sources)
+ /boost/test//boost_unit_test_framework/<link>static
+ /boost/filesystem//boost_filesystem/<link>static
+ : # build requirements
+ <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
+ <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
+ <toolset>cw-9.3,<os>darwin:<runtime-link>static
+ <define>BOOST_IOSTREAMS_NO_LIB
+ <link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
+ $(requirements)
+ : $(target-name)
+ ] ;
+}
+
+
+ local all-tests =
+# [ test-iostreams array_test.cpp ]
+# [ test-iostreams auto_close_test.cpp ]
+# [ test-iostreams buffer_size_test.cpp ]
+# [ test-iostreams close_test.cpp ]
+# [ test-iostreams
+# code_converter_test.cpp
+# detail/utf8_codecvt_facet.cpp ]
+# [ test-iostreams combine_test.cpp ]
+# [ test-iostreams compose_test.cpp ]
+# [ test-iostreams component_access_test.cpp ]
+# [ test-iostreams copy_test.cpp ]
+# [ test-iostreams counter_test.cpp ]
+# [ test-iostreams direct_adapter_test.cpp ]
+# [ test-iostreams example_test.cpp ]
+# [ test-iostreams execute_test.cpp ]
+# [ test-iostreams file_test.cpp ]
+# [ test-iostreams file_descriptor_test.cpp
+# ../build//boost_iostreams ]
+# [ test-iostreams deprecated_file_descriptor_test.cpp
+# ../build//boost_iostreams
+# : <define>BOOST_IOSTREAMS_USE_DEPRECATED ]
+# [ compile-fail-iostreams deprecated_file_descriptor_test.cpp
+# :
+# : deprecated_file_descriptor_fail ]
+# [ test-iostreams filtering_stream_test.cpp ]
+ [ test-iostreams indent_scoped_ostreambuf_test.cpp ]
+# [ test-iostreams finite_state_filter_test.cpp ]
+# [ test-iostreams flush_test.cpp ]
+# [ test-iostreams
+# grep_test.cpp
+# /boost/regex//boost_regex ]
+# [ test-iostreams invert_test.cpp ]
+# [ test-iostreams line_filter_test.cpp ]
+# [ test-iostreams mapped_file_test.cpp
+# ../build//boost_iostreams ]
+# [ test-iostreams newline_test.cpp ]
+# [ test-iostreams null_test.cpp ]
+# [ test-iostreams operation_sequence_test.cpp ]
+# [ test-iostreams pipeline_test.cpp ]
+# [ test-iostreams
+# regex_filter_test.cpp
+# /boost/regex//boost_regex ]
+# [ test-iostreams restrict_test.cpp ]
+# [ test-iostreams seekable_file_test.cpp ]
+# [ test-iostreams seekable_filter_test.cpp ]
+# [ test-iostreams sequence_test.cpp ]
+# [ test-iostreams slice_test.cpp ]
+# [ test-iostreams stdio_filter_test.cpp ]
+# [ test-iostreams stream_offset_32bit_test.cpp ]
+# [ test-iostreams stream_offset_64bit_test.cpp ]
+# #[ test-iostreams stream_state_test.cpp ]
+# [ test-iostreams symmetric_filter_test.cpp ]
+# [ test-iostreams tee_test.cpp ]
+# [ test-iostreams wide_stream_test.cpp ]
+ ;
+
+# if $(LARGE_FILE_KEEP)
+# {
+# all-tests +=
+# [ test-iostreams
+# large_file_test.cpp
+# ../src/file_descriptor.cpp
+# ../src/mapped_file.cpp
+# : <define>LARGE_FILE_KEEP=$(LARGE_FILE_KEEP)
+# <link>static ] ;
+# }
+# if $(LARGE_FILE_TEMP)
+# {
+# all-tests +=
+# [ test-iostreams
+# large_file_test.cpp
+# ../src/file_descriptor.cpp
+# ../src/mapped_file.cpp
+# : <define>LARGE_FILE_TEMP=$(LARGE_FILE_TEMP)
+# <link>static ] ;
+# }
+# if ! $(NO_BZIP2)
+# {
+# all-tests += [ test-iostreams
+# bzip2_test.cpp ../build//boost_iostreams ] ;
+# }
+# if ! $(NO_ZLIB)
+# {
+# all-tests +=
+# [ test-iostreams
+# gzip_test.cpp ../build//boost_iostreams ]
+# [ test-iostreams
+# zlib_test.cpp ../build//boost_iostreams ] ;
+# }
+
+ test-suite "iostreams" : $(all-tests) ;
+

Added: sandbox/variadic_templates/libs/iostreams/test/indent_scoped_ostreambuf_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/iostreams/test/indent_scoped_ostreambuf_test.cpp 2010-07-11 10:44:06 EDT (Sun, 11 Jul 2010)
@@ -0,0 +1,61 @@
+#include <boost/iostreams/utility/indent_scoped_ostreambuf.hpp>
+#include <sstream>
+#include <boost/test/unit_test.hpp>
+
+
+void indent_scoped_ostreambuf_test(void)
+{
+ std::ostringstream mout;
+ mout<<"line1\n";
+
+ {
+ boost::iostreams::indent_scoped_ostreambuf<char> indent_outbuf(mout,4);
+ mout<<indent_buf_in;
+ mout<<"line1.1"<<std::endl;
+ {
+ #if 1
+ //This shows that repeating the indent_scoped_ostreambuf construction
+ //doesn't affect output.
+ boost::iostreams::indent_scoped_ostreambuf<char> indent_outbuf(mout,4);
+ #endif
+ mout<<indent_buf_in;
+ mout<<"line1.1.1"<<std::endl;
+ mout<<"line1.1.2"<<std::endl;
+ mout<<indent_buf_out;
+ unsigned u=22;
+ mout<<"line1.2:unsigned="<<u<<std::endl;
+ }
+ float f=3.1416;
+ mout<<"line1.3:float="<<f<<std::endl;
+ mout<<indent_buf_out;
+ mout<<indent_buf_out;
+ mout<<"line2\n";
+ mout<<indent_buf_in;
+ mout<<"line3\n";
+ }
+ mout<<"line4\n";
+ std::string eout="\
+line1\n\
+ line1.1\n\
+ line1.1.1\n\
+ line1.1.2\n\
+ line1.2:unsigned=22\n\
+ line1.3:float=3.1416\n\
+line2\n\
+ line3\n\
+line4\n\
+";
+ BOOST_CHECK_MESSAGE(
+ std::string(mout.str()) == eout,
+ "failed mout==eout"
+ );
+}
+
+using boost::unit_test::test_suite;
+
+test_suite* init_unit_test_suite(int, char* [])
+{
+ test_suite* test = BOOST_TEST_SUITE("indent_scoped_ostreambuf test");
+ test->add(BOOST_TEST_CASE(&indent_scoped_ostreambuf_test));
+ return test;
+}


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