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

« back to all changes in this revision

Viewing changes to src/mlib/tests/foreach/call_once.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 <boost/foreach.hpp>
 
14
#include <vector>
 
15
 
 
16
// counter
 
17
static int counter = 0;
 
18
 
 
19
static std::vector<int> my_vector(4,4);
 
20
 
 
21
static std::vector<int> const &get_vector()
 
22
{
 
23
    ++counter;
 
24
    return my_vector;
 
25
}
 
26
 
 
27
 
 
28
///////////////////////////////////////////////////////////////////////////////
 
29
// test_main
 
30
//   
 
31
BOOST_AUTO_TEST_CASE( call_once )
 
32
{
 
33
    BOOST_FOREACH(int i, get_vector())
 
34
    {
 
35
        ((void)i); // no-op
 
36
    }
 
37
 
 
38
    BOOST_CHECK(1 == counter);
 
39
}