~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to src/mlib/tests/foreach/rvalue_nonconst_r.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  (C) Copyright Eric Niebler 2005.
 
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 <mlib/tests/_pc_.h>
 
12
//#include <boost/test/minimal.hpp>
 
13
#include <vector>
 
14
#include <boost/foreach.hpp>
 
15
 
 
16
#ifdef BOOST_FOREACH_NO_RVALUE_DETECTION
 
17
# error Expected failure : rvalues disallowed
 
18
#else
 
19
 
 
20
static std::vector<int> get_vector()
 
21
{
 
22
    return std::vector<int>(4, 4);
 
23
}
 
24
 
 
25
///////////////////////////////////////////////////////////////////////////////
 
26
// test_main
 
27
//   
 
28
BOOST_AUTO_TEST_CASE( rvalue_nonconst_r )
 
29
{
 
30
    int counter = 0;
 
31
 
 
32
    BOOST_REVERSE_FOREACH(int i, get_vector())
 
33
    {
 
34
        counter += i;
 
35
    }
 
36
 
 
37
    BOOST_CHECK(16 == counter);
 
38
}
 
39
 
 
40
#endif