31
|
1 |
// Copyright (C) 2002 Trustees of Indiana University
|
|
2 |
|
|
3 |
// Distributed under the Boost Software License, Version 1.0.
|
|
4 |
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
5 |
// http://www.boost.org/LICENSE_1_0.txt)
|
|
6 |
/*
|
|
7 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
|
8 |
*/
|
|
9 |
|
|
10 |
#include <boost/graph/adjacency_list.hpp>
|
|
11 |
#include <boost/graph/dag_shortest_paths.hpp>
|
|
12 |
#include <boost/vector_property_map.hpp>
|
|
13 |
#include <boost/test/minimal.hpp>
|
|
14 |
#ifdef __SYMBIAN32__
|
|
15 |
#include "std_log_result.h"
|
|
16 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
|
17 |
#endif
|
|
18 |
using namespace boost;
|
|
19 |
|
|
20 |
#include <iostream>
|
|
21 |
using namespace std;
|
|
22 |
|
|
23 |
int test_main(int, char*[])
|
|
24 |
{
|
|
25 |
typedef adjacency_list<vecS, vecS, directedS, no_property,
|
|
26 |
property<edge_weight_t, int> > Graph;
|
|
27 |
|
|
28 |
Graph graph;
|
|
29 |
|
|
30 |
#ifdef __ARMCC__
|
|
31 |
#pragma diag_suppress 550
|
|
32 |
#endif
|
|
33 |
Graph::vertex_descriptor v1, v2, v3, v4;
|
|
34 |
|
|
35 |
|
|
36 |
v1 = add_vertex(graph);
|
|
37 |
v2 = add_vertex(graph);
|
|
38 |
v3 = add_vertex(graph);
|
|
39 |
v4 = add_vertex(graph);
|
|
40 |
|
|
41 |
Graph::edge_descriptor e;
|
|
42 |
|
|
43 |
e = add_edge(0, 1, graph).first;
|
|
44 |
put(edge_weight, graph, e, 1);
|
|
45 |
|
|
46 |
e = add_edge(1, 2, graph).first;
|
|
47 |
put(edge_weight, graph, e, 1);
|
|
48 |
|
|
49 |
e = add_edge(3, 1, graph).first;
|
|
50 |
put(edge_weight, graph, e, 5);
|
|
51 |
|
|
52 |
vector_property_map<int> distance;
|
|
53 |
|
|
54 |
#ifdef __SYMBIAN32__
|
|
55 |
dag_shortest_paths(graph, 0,
|
|
56 |
distance_map(distance)
|
|
57 |
.distance_compare(std::greater<int>())
|
|
58 |
.distance_inf((std::numeric_limits<int>::min)())
|
|
59 |
);
|
|
60 |
#else
|
|
61 |
dag_shortest_paths(graph, 0,
|
|
62 |
distance_map(distance)
|
|
63 |
.distance_compare(std::greater<int>())
|
|
64 |
.distance_inf((std::numeric_limits<int>::min)())
|
|
65 |
.distance_zero(0));
|
|
66 |
#endif
|
|
67 |
cout << distance[2] << "\n";
|
|
68 |
|
|
69 |
BOOST_CHECK(distance[2] == 2);
|
|
70 |
|
|
71 |
#ifdef __SYMBIAN32__
|
|
72 |
std_log(LOG_FILENAME_LINE,"[End Test Case ]");
|
|
73 |
|
|
74 |
testResultXml("dag_longest_paths");
|
|
75 |
close_log_file();
|
|
76 |
#endif
|
|
77 |
return 0;
|
|
78 |
}
|
|
79 |
|
|
80 |
|
|
81 |
|