]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/adj_list_test.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / graph / test / adj_list_test.cpp
1 //=======================================================================
2 // Copyright 2002 Indiana University.
3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //=======================================================================
9
10 #include <iostream>
11 #include <fstream>
12 #include <string>
13 #include <cstdlib>
14
15 // This is meant to be executed from the current directory
16
17 std::string container_types [] = { "vecS", "listS", "setS" };
18 const int N = sizeof(container_types)/sizeof(std::string);
19
20 std::string directed_types[] = { "bidirectionalS", "directedS", "undirectedS"};
21 const int D = sizeof(directed_types)/sizeof(std::string);
22
23 int
24 main()
25 {
26 int i, j, k, ret = 0, rc, t = 0;
27 for (i = 0; i < N; ++i)
28 for (j = 0; j < N; ++j)
29 for (k = 0; k < D; ++k, ++t) {
30
31 std::string file_name = "graph_type.hpp";
32 system("rm -f graph_type.hpp");
33 std::ofstream header(file_name.c_str());
34 if (!header) {
35 std::cerr << "could not open file " << file_name << std::endl;
36 return -1;
37 }
38
39 header << "#include <boost/graph/adjacency_list.hpp>" << std::endl
40 << "typedef boost::adjacency_list<boost::" << container_types[i]
41 << ", boost::" << container_types[j]
42 << ", boost::" << directed_types[k]
43 << ", boost::property<vertex_id_t, std::size_t>"
44 << ", boost::property<edge_id_t, std::size_t> > Graph;"
45 << std::endl
46 << "typedef boost::property<vertex_id_t, std::size_t> VertexId;"
47 << std::endl
48 << "typedef boost::property<edge_id_t, std::size_t> EdgeID;"
49 << std::endl;
50 system("rm -f graph.exe graph.o graph.obj");
51 // the following system call should be replaced by a
52 // portable "compile" command.
53 //const char* compile = "g++ -I.. -O2 -Wall -Wno-long-long -ftemplate-depth-30 ../libs/graph/test/graph.cpp -o graph.exe";
54 const char* compile = "g++ -I/u/jsiek/boost graph.cpp -o graph.exe";
55 std::cout << compile << std::endl;
56 rc = system(compile);
57 if (rc != 0) {
58 std::cerr << "compile failed for " << container_types[i] << " "
59 << container_types[j] << " " << directed_types[k]
60 << std::endl;
61 ret = -1;
62 } else {
63 rc = system("./graph.exe");
64 if (rc != 0) {
65 std::cerr << "run failed for " << container_types[i] << " "
66 << container_types[j] << " " << directed_types[k]
67 << std::endl;
68 ret = -1;
69 } else {
70 std::cout << (t+1) << " of " << (N*N*D) << " tests passed."
71 << std::endl;
72 }
73 }
74 }
75
76 return ret;
77 }