]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/bidir_remove_edge.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / graph / test / bidir_remove_edge.cpp
1 // (C) Copyright Jeremy Siek 2004
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 #include <iostream>
7 #include <boost/graph/adjacency_list.hpp>
8 #include <boost/cstdlib.hpp>
9 #include <boost/detail/lightweight_test.hpp>
10
11 struct edge_prop
12 {
13 int weight;
14 };
15
16 int main(int, char*[])
17 {
18 {
19 typedef boost::adjacency_list< boost::vecS, boost::vecS,
20 boost::bidirectionalS, boost::no_property, edge_prop >
21 graph;
22 typedef boost::graph_traits< graph >::edge_descriptor edge;
23
24 graph g(2);
25
26 edge_prop p = { 42 };
27 edge e;
28 bool b;
29 boost::tie(e, b) = add_edge(0, 1, p, g);
30 BOOST_TEST(num_edges(g) == 1);
31 BOOST_TEST(g[e].weight == 42);
32 remove_edge(e, g);
33 BOOST_TEST(num_edges(g) == 0);
34 }
35 {
36 typedef boost::adjacency_list< boost::vecS, boost::vecS,
37 boost::bidirectionalS >
38 graph;
39 typedef boost::graph_traits< graph >::edge_descriptor edge;
40
41 graph g(2);
42
43 edge e;
44 bool b;
45 boost::tie(e, b) = add_edge(0, 1, g);
46 BOOST_TEST(num_edges(g) == 1);
47 remove_edge(e, g);
48 BOOST_TEST(num_edges(g) == 0);
49 }
50 return boost::report_errors();
51 }