~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/spirit/phoenix/test/container/container_tests6b.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=============================================================================
 
2
    Copyright (c) 2004 Angus Leeming
 
3
 
 
4
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 
5
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
6
==============================================================================*/
 
7
#include "container_tests.hpp"
 
8
#include <boost/static_assert.hpp>
 
9
 
 
10
std::map<int, int> const build_map()
 
11
{
 
12
    typedef std::map<int, int> int_map;
 
13
    typedef std::vector<int> int_vector;
 
14
 
 
15
    int_map result;
 
16
    int_vector const data = build_vector();
 
17
    int_vector::const_iterator it = data.begin();
 
18
    int_vector::const_iterator const end = data.end();
 
19
    for (; it != end; ++it) {
 
20
      int const value = *it;
 
21
      result[value] = 100 * value;
 
22
    }
 
23
    return result;
 
24
}
 
25
 
 
26
std::multimap<int, int> const build_multimap()
 
27
{
 
28
    typedef std::map<int, int> int_map;
 
29
    typedef std::multimap<int, int> int_multimap;
 
30
    int_map const data = build_map();
 
31
    return int_multimap(data.begin(), data.end());
 
32
}
 
33
 
 
34
std::vector<int> const init_vector()
 
35
{
 
36
    typedef std::vector<int> int_vector;
 
37
    int const data[] = { -4, -3, -2, -1, 0 };
 
38
    int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]);
 
39
    return int_vector(data, data + data_size);
 
40
}
 
41
 
 
42
std::vector<int> const build_vector()
 
43
{
 
44
    typedef std::vector<int> int_vector;
 
45
    static int_vector data = init_vector();
 
46
    int_vector::size_type const size = data.size();
 
47
    int_vector::iterator it = data.begin();
 
48
    int_vector::iterator const end = data.end();
 
49
    for (; it != end; ++it)
 
50
      *it += size;
 
51
    return data;
 
52
}
 
53
 
 
54
int
 
55
main()
 
56
{
 
57
    std::multimap<int, int> const data = build_multimap();
 
58
    test_multimap_insert(data);
 
59
    test_key_comp(data);
 
60
    test_max_size(data);
 
61
    test_rbegin(data);
 
62
    test_rend(data);
 
63
    test_size(data);
 
64
    test_value_comp(data);
 
65
    return boost::report_errors();
 
66
}
 
67
 
 
68
 
 
69
 
 
70