|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56551 - sandbox/itl/libs/itl/test
From: afojgo_at_[hidden]
Date: 2009-10-03 07:34:59
Author: jofaber
Date: 2009-10-03 07:34:59 EDT (Sat, 03 Oct 2009)
New Revision: 56551
URL: http://svn.boost.org/trac/boost/changeset/56551
Log:
Portability: Adjusted test code for std::inserter support for gcc-3.4.4. Stable {msvc-8.0, 9.0, gcc-3.4.4}
Text files modified:
sandbox/itl/libs/itl/test/test_functions.hpp | 14 ++++++++++----
sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 12 +++++++-----
2 files changed, 17 insertions(+), 9 deletions(-)
Modified: sandbox/itl/libs/itl/test/test_functions.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_functions.hpp (original)
+++ sandbox/itl/libs/itl/test/test_functions.hpp 2009-10-03 07:34:59 EDT (Sat, 03 Oct 2009)
@@ -5,6 +5,10 @@
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------+
+Auxiliary functions to reduce redundancies in test case code.
++-----------------------------------------------------------------------------*/
#ifndef BOOST_ITL_TEST_FUNCTIONS_H_JOFA_091003
#define BOOST_ITL_TEST_FUNCTIONS_H_JOFA_091003
@@ -29,8 +33,7 @@
void itl_map_copy(const SequenceT& segments,
IntervalMap<T,U,Trt>& destination)
{
- //CL typedef Sequence<std::pair<itl::interval<T>,U> > SequenceT;
- ITL_const_FORALL(SequenceT, segment_, segments)
+ ITL_const_FORALL(typename SequenceT, segment_, segments)
destination.insert(*segment_);
}
@@ -46,10 +49,13 @@
>class IntervalMap,
class SequenceT
>
-void test_interval_map_copy_via_inserter(const SequenceT& segments)
+void test_interval_map_copy_via_inserter(const SequenceT& segments, IntervalMap<T,U,Trt>& std_copied_map)
{
+ // The second parameter (std_copied_map) could be omitted and only held as a
+ // local variable. I is there to help gcc-3.4.4 resolving the function template type.
typedef IntervalMap<T,U,Trt> IntervalMapT;
- IntervalMapT looped_copied_map, std_copied_map;
+ IntervalMapT looped_copied_map;
+ std_copied_map.clear();
itl_map_copy(segments, looped_copied_map);
std::copy(segments.begin(), segments.end(), std::inserter(std_copied_map, std_copied_map.end()));
BOOST_CHECK_EQUAL( looped_copied_map, std_copied_map );
Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2009-10-03 07:34:59 EDT (Sat, 03 Oct 2009)
@@ -1210,25 +1210,27 @@
// Check equality of copying using handcoded loop or std::copy via inserter.
typedef std::pair<interval<T>, U> SegmentT;
std::vector<SegmentT> seg_vec_a;
+ IntervalMapT std_copied_map;
// For an empty sequence
- test_interval_map_copy_via_inserter<T,U,Trt,IntervalMap,std::vector<SegmentT> >(seg_vec_a);
+ test_interval_map_copy_via_inserter(seg_vec_a, std_copied_map);
// For an singleton sequence
seg_vec_a.push_back(IDv(0,1,1));
- test_interval_map_copy_via_inserter<T,U,Trt,IntervalMap,std::vector<SegmentT> >(seg_vec_a);
+ test_interval_map_copy_via_inserter(seg_vec_a, std_copied_map);
// Two separate segments
seg_vec_a.push_back(IDv(3,5,1));
- test_interval_map_copy_via_inserter<T,U,Trt,IntervalMap,std::vector<SegmentT> >(seg_vec_a);
+ test_interval_map_copy_via_inserter(seg_vec_a, std_copied_map);
// Touching case
seg_vec_a.push_back(IDv(5,7,1));
- test_interval_map_copy_via_inserter<T,U,Trt,IntervalMap,std::vector<SegmentT> >(seg_vec_a);
+ test_interval_map_copy_via_inserter(seg_vec_a, std_copied_map);
// Overlapping case
seg_vec_a.push_back(IDv(6,9,1));
- test_interval_map_copy_via_inserter<T,U,Trt,IntervalMap,std::vector<SegmentT> >(seg_vec_a);
+ test_interval_map_copy_via_inserter(seg_vec_a, std_copied_map);
+
}
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