$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: kbelco_at_[hidden]
Date: 2007-12-26 19:37:52
Author: noel_belcourt
Date: 2007-12-26 19:37:52 EST (Wed, 26 Dec 2007)
New Revision: 42311
URL: http://svn.boost.org/trac/boost/changeset/42311
Log:
Add missing iostreams files from iostreams_dev branch.
Re-enable these two tests.
Added:
   trunk/libs/iostreams/test/stream_offset_32bit_test.cpp   (contents, props changed)
   trunk/libs/iostreams/test/stream_offset_64bit_test.cpp   (contents, props changed)
Text files modified: 
   trunk/libs/iostreams/test/Jamfile.v2 |     4 ++--                                    
   1 files changed, 2 insertions(+), 2 deletions(-)
Modified: trunk/libs/iostreams/test/Jamfile.v2
==============================================================================
--- trunk/libs/iostreams/test/Jamfile.v2	(original)
+++ trunk/libs/iostreams/test/Jamfile.v2	2007-12-26 19:37:52 EST (Wed, 26 Dec 2007)
@@ -79,8 +79,8 @@
           [ test-iostreams seekable_filter_test.cpp ]
           [ test-iostreams sequence_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_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 ]
Added: trunk/libs/iostreams/test/stream_offset_32bit_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/iostreams/test/stream_offset_32bit_test.cpp	2007-12-26 19:37:52 EST (Wed, 26 Dec 2007)
@@ -0,0 +1,50 @@
+/*
+ * 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.
+
+ * File:        libs/iostreams/test/stream_offset_32bit_test.cpp
+ * Date:        Sun Dec 23 21:11:23 MST 2007
+ * Copyright:   2007 CodeRage
+ * Author:      Jonathan Turkanis
+ *
+ * Tests the functions defined in the header "boost/iostreams/positioning.hpp"
+ * with small (32-bit) file offsets.
+ */
+
+#include <boost/iostreams/positioning.hpp>
+#include <boost/test/test_tools.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/type_traits/is_integral.hpp>
+
+using namespace std;
+using namespace boost;
+using namespace boost::iostreams;
+using boost::unit_test::test_suite;
+
+void stream_offset_32bit_test()
+{
+    stream_offset  small_file = 1000000;
+    stream_offset  off = -small_file;
+    streampos      pos = offset_to_position(off);
+
+    while (off < small_file)
+    {
+        BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
+        BOOST_CHECK(pos == offset_to_position(position_to_offset(pos)));
+        off += 20000;
+        pos += 20000;
+        BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
+        BOOST_CHECK(pos == offset_to_position(position_to_offset(pos)));
+        off -= 10000;
+        pos -= 10000;
+    }
+}
+
+test_suite* init_unit_test_suite(int, char* [])
+{
+    test_suite* test = BOOST_TEST_SUITE("stream_offset 32-bit test");
+    test->add(BOOST_TEST_CASE(&stream_offset_32bit_test));
+    return test;
+}
Added: trunk/libs/iostreams/test/stream_offset_64bit_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/iostreams/test/stream_offset_64bit_test.cpp	2007-12-26 19:37:52 EST (Wed, 26 Dec 2007)
@@ -0,0 +1,50 @@
+/*
+ * 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.
+
+ * File:        libs/iostreams/test/stream_offset_64bit_test.cpp
+ * Date:        Sun Dec 23 21:11:23 MST 2007
+ * Copyright:   2007 CodeRage
+ * Author:      Jonathan Turkanis
+ *
+ * Tests the functions defined in the header "boost/iostreams/positioning.hpp"
+ * with large (64-bit) file offsets.
+ */
+
+#include <boost/config.hpp>  // BOOST_MSVC
+#include <boost/iostreams/positioning.hpp>
+#include <boost/test/test_tools.hpp>
+#include <boost/test/unit_test.hpp>
+
+using namespace std;
+using namespace boost;
+using namespace boost::iostreams;
+using boost::unit_test::test_suite;
+
+#ifdef BOOST_MSVC
+# pragma warning(disable:4127)
+#endif
+
+void stream_offset_64bit_test()
+{    
+    stream_offset  large_file = (stream_offset) 100 *
+                                (stream_offset) 1024 *
+                                (stream_offset) 1024 *
+                                (stream_offset) 1024;
+    stream_offset  first = -large_file - (-large_file) % 10000000;
+    stream_offset  last = large_file - large_file % 10000000;
+
+    for (stream_offset off = first; off < last; off += 10000000)
+    {                                           
+        BOOST_REQUIRE(off == position_to_offset(offset_to_position(off)));
+    }
+}
+
+test_suite* init_unit_test_suite(int, char* [])
+{
+    test_suite* test = BOOST_TEST_SUITE("stream_offset 64-bit test");
+    test->add(BOOST_TEST_CASE(&stream_offset_64bit_test));
+    return test;
+}