2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-31 20:22:09 +00:00
Files
graph/test/test_graphs.cpp
2009-04-15 12:24:21 +00:00

53 lines
1.1 KiB
C++

// (C) Copyright 2007-2009 Andrew Sutton
//
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0 (See accompanying file
// LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/directed_graph.hpp>
// TODO: Finish implementing this test module. In theory, this will become a
// generic testing facility for any kind of graph declaration.
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;
};
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> >();
}