Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51092 - trunk/libs/graph/test
From: asutton_at_[hidden]
Date: 2009-02-08 09:25:32


Author: asutton
Date: 2009-02-08 09:25:32 EST (Sun, 08 Feb 2009)
New Revision: 51092
URL: http://svn.boost.org/trac/boost/changeset/51092

Log:
Integrating SOC 2007 code
Added:
   trunk/libs/graph/test/test_graphs.cpp (contents, props changed)
Text files modified:
   trunk/libs/graph/test/Jamfile.v2 | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/libs/graph/test/Jamfile.v2
==============================================================================
--- trunk/libs/graph/test/Jamfile.v2 (original)
+++ trunk/libs/graph/test/Jamfile.v2 2009-02-08 09:25:32 EST (Sun, 08 Feb 2009)
@@ -94,7 +94,7 @@
     [ run metric_tsp_approx.cpp : metric_tsp_approx.txt ]
     [ compile dimacs.cpp ]
 
- [ run undirected_graph.cpp ]
+ [ run test_graphs.cpp ]
     $(optional_tests)
     ;
 

Added: trunk/libs/graph/test/test_graphs.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/graph/test/test_graphs.cpp 2009-02-08 09:25:32 EST (Sun, 08 Feb 2009)
@@ -0,0 +1,49 @@
+
+#include <iostream>
+
+#include <boost/mpl/bool.hpp>
+#include <boost/graph/undirected_graph.hpp>
+#include <boost/graph/directed_graph.hpp>
+
+using namespace std;
+using namespace boost;
+
+struct node
+{
+ node() : n() { }
+ node(int n) : n(n) { }
+
+ bool operator==(node const& x) const { return n == x.n; }
+ bool operator<(node const& x) const { return n < x.n; }
+
+ int n;
+};
+
+struct arc
+{
+ arc() : n() { }
+ arc(int n) : n(n) { }
+
+ bool operator==(arc const& x) const { return n == x.n; }
+
+ int n;
+};
+
+// TODO: Finish implementing this test. Actually, generalize the test so that
+// it works for lots of different graph types.
+
+template <typename Graph>
+void test()
+{
+ typedef typename Graph::vertex_descriptor Vertex;
+ Graph g;
+ BOOST_ASSERT(num_vertices(g) == 0);
+
+}
+
+int main()
+{
+ test< undirected_graph<node, arc> >();
+ test< directed_graph<node, arc> >();
+}
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk