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

« back to all changes in this revision

Viewing changes to src/mlib/tests/foreach/rvalue_const_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_CONST_RVALUE_DETECTION
 
17
// ignore error during Microsoft Code Analysis
 
18
#if !defined(_PREFAST_)
 
19
# error Expected failure : const rvalues disallowed
 
20
#endif
 
21
#else
 
22
 
 
23
static std::vector<int> const get_vector()
 
24
{
 
25
    return std::vector<int>(4, 4);
 
26
}
 
27
 
 
28
///////////////////////////////////////////////////////////////////////////////
 
29
// test_main
 
30
//   
 
31
BOOST_AUTO_TEST_CASE( rvalue_const_r )
 
32
{
 
33
    int counter = 0;
 
34
 
 
35
    BOOST_REVERSE_FOREACH(int i, get_vector())
 
36
    {
 
37
        counter += i;
 
38
    }
 
39
 
 
40
    BOOST_CHECK(16 == counter);
 
41
}
 
42
 
 
43
#endif