Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/foreach/test/cstr_byref.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.5 KB
Line 
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)
5
6/*
7 Revision history:
8   25 August 2005 : Initial version.
9*/
10
11#include <boost/test/minimal.hpp>
12#include <boost/foreach.hpp>
13
14///////////////////////////////////////////////////////////////////////////////
15// define the container types, used by utility.hpp to generate the helper functions
16typedef char *foreach_container_type;
17typedef char const *foreach_const_container_type;
18typedef char foreach_value_type;
19typedef char &foreach_reference_type;
20typedef char const &foreach_const_reference_type;
21
22#include "./utility.hpp"
23
24///////////////////////////////////////////////////////////////////////////////
25// define come containers
26//
27char my_ntcs_buffer[] = "\1\2\3\4\5";
28char *my_ntcs  = my_ntcs_buffer;
29char const *my_const_ntcs  = my_ntcs;
30
31///////////////////////////////////////////////////////////////////////////////
32// test_main
33//   
34int test_main( int, char*[] )
35{
36    // non-const containers by reference
37    BOOST_CHECK(sequence_equal_byref_n(my_ntcs, "\1\2\3\4\5"));
38
39    // const containers by reference
40    BOOST_CHECK(sequence_equal_byref_c(my_const_ntcs, "\1\2\3\4\5"));
41
42    // mutate the mutable collections
43    mutate_foreach_byref(my_ntcs);
44
45    // compare the mutated collections to the actual results
46    BOOST_CHECK(sequence_equal_byref_n(my_ntcs, "\2\3\4\5\6"));
47
48    return 0;
49}
Note: See TracBrowser for help on using the repository browser.