1 // (C) Copyright Eric Niebler 2004.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 25 August 2005 : Initial version.
11 #include <boost/test/minimal.hpp>
12 #include <boost/foreach.hpp>
14 ///////////////////////////////////////////////////////////////////////////////
15 // define the container types, used by utility.hpp to generate the helper functions
16 typedef char *foreach_container_type
;
17 typedef char const *foreach_const_container_type
;
18 typedef char foreach_value_type
;
19 typedef char &foreach_reference_type
;
20 typedef char const &foreach_const_reference_type
;
22 #include "./utility.hpp"
24 ///////////////////////////////////////////////////////////////////////////////
25 // define some containers
27 char my_ntcs_buffer
[] = "\1\2\3\4\5";
28 char *my_ntcs
= my_ntcs_buffer
;
29 char const *my_const_ntcs
= my_ntcs
;
31 ///////////////////////////////////////////////////////////////////////////////
34 int test_main( int, char*[] )
36 // non-const containers by reference
37 BOOST_CHECK(sequence_equal_byref_n_r(my_ntcs
, "\5\4\3\2\1"));
39 // const containers by reference
40 BOOST_CHECK(sequence_equal_byref_c_r(my_const_ntcs
, "\5\4\3\2\1"));
42 // mutate the mutable collections
43 mutate_foreach_byref_r(my_ntcs
);
45 // compare the mutated collections to the actual results
46 BOOST_CHECK(sequence_equal_byref_n_r(my_ntcs
, "\6\5\4\3\2"));