|
Boost-Commit : |
From: asutton_at_[hidden]
Date: 2007-08-10 12:24:48
Author: asutton
Date: 2007-08-10 12:24:48 EDT (Fri, 10 Aug 2007)
New Revision: 38575
URL: http://svn.boost.org/trac/boost/changeset/38575
Log:
Added subdir and frameworf for concept-coverage tests
Added:
sandbox/SOC/2007/graphs/libs/graph/test/concept/
sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 (contents, props changed)
sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp (contents, props changed)
sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp (contents, props changed)
Added: sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 2007-08-10 12:24:48 EDT (Fri, 10 Aug 2007)
@@ -0,0 +1,12 @@
+
+import testing ;
+
+project
+ : requirements
+ <include>../../../../
+ <include>$BOOST_ROOT
+ ;
+
+test-suite graph_test :
+ [ compile degree_centrality_check.cpp ]
+ ;
\ No newline at end of file
Added: sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp 2007-08-10 12:24:48 EDT (Fri, 10 Aug 2007)
@@ -0,0 +1,115 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// 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)
+
+
+#ifndef BOOST_GRAPH_CONCEPT_CHECK_ARCHETYPES_HPP
+#define BOOST_GRAPH_CONCEPT_CHECK_ARCHETYPES_HPP
+
+#include <utility>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/graph_archetypes.hpp>
+
+namespace boost
+{
+ struct descriptor_archetype
+ : public
+ default_constructible_archetype<
+ copy_constructible_archetype<
+ sgi_assignable_archetype<
+ equality_comparable_archetype<> > > >
+ {
+ descriptor_archetype() { }
+ descriptor_archetype(detail::dummy_constructor) { }
+ };
+
+ // Apparently, the Boost.Graph library doesn't have a bidirectional
+ // archetype - kind of a strange oversight. This is actually derived
+ // from incidence graph archetype in order have access to its
+ // archetypical functions and members
+ template <typename Vertex,
+ typename Directed,
+ typename Parallel,
+ typename Base = detail::null_graph_archetype >
+ struct bidirectional_graph_archetype : public Base
+ {
+ struct traversal_category
+ : public bidirectional_graph_tag
+ , public Base::traversal_category
+ { };
+
+ typedef descriptor_archetype vertex_descriptor;
+ typedef descriptor_archetype edge_descriptor;
+
+ typedef unsigned int degree_size_type;
+ typedef unsigned int vertices_size_type;
+ typedef unsigned int edges_size_type;
+
+ typedef input_iterator_archetype<edge_descriptor> out_edge_iterator;
+ typedef input_iterator_archetype<edge_descriptor> in_edge_iterator;
+
+ typedef Directed directed_category;
+ typedef Parallel edge_parallel_category;
+
+ typedef void adjacency_iterator;
+ typedef void vertex_iterator;
+ typedef void edge_iterator;
+ };
+
+ /*
+ template <typename V, typename D, typename P, typename B>
+ typename bidirectional_graph_archetype<V,D,P,B>::vertex_descriptor
+ source(typename bidirectional_graph_archetype<V,D,P,B>::edge_descriptor,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ {
+ return V(static_object<detail::dummy_constructor>::get());
+ }
+
+ template <typename V, typename D, typename P, typename B>
+ typename bidirectional_graph_archetype<V,D,P,B>::vertex_descriptor
+ target(typename bidirectional_graph_archetype<V,D,P,B>::edge_descriptor,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ {
+ return V(static_object<detail::dummy_constructor>::get());
+ }
+
+ template <typename V, typename D, typename P, typename B>
+ std::pair<typename bidirectional_graph_archetype<V,D,P,B>::out_edge_iterator,
+ typename bidirectional_graph_archetype<V,D,P,B>::out_edge_iterator>
+ out_edges(typename bidirectional_graph_archetype<V,D,P,B>::vertex_descriptor,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ {
+ typedef typename bidirectional_graph_archetype<V,D,P,B>::out_edge_iterator Iter;
+ return std::make_pair(Iter(), Iter());
+ }
+
+ template <typename V, typename D, typename P, typename B>
+ typename bidirectional_graph_archetype<V,D,P,B>::degree_size_type
+ out_degree(typename bidirectional_graph_archetype<V,D,P,B>::vertex_descriptor,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ { return 0; }
+ */
+
+ template <typename V, typename D, typename P, typename B>
+ std::pair<typename bidirectional_graph_archetype<V,D,P,B>::in_edge_iterator,
+ typename bidirectional_graph_archetype<V,D,P,B>::in_edge_iterator>
+ in_edges(typename bidirectional_graph_archetype<V,D,P,B>::vertex_descriptor,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ {
+ typedef typename incidence_graph_archetype<V,D,P,B>::in_edge_iterator Iter;
+ return std::make_pair(Iter(), Iter());
+ }
+
+ template <typename V, typename D, typename P, typename B>
+ typename bidirectional_graph_archetype<V,D,P,B>::degree_size_type
+ in_degree(typename bidirectional_graph_archetype<V,D,P,B>::vertex_desriptior,
+ const bidirectional_graph_archetype<V,D,P,B>&)
+ {
+ return 0;
+ }
+}
+
+#endif
Added: sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp 2007-08-10 12:24:48 EDT (Fri, 10 Aug 2007)
@@ -0,0 +1,75 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// 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 "archetypes.hpp"
+#include <boost/graph/degree_centrality.hpp>
+
+using namespace boost;
+
+int
+main(int argc, char *argv[])
+{
+ {
+ typedef descriptor_archetype vertex_type;
+ typedef incidence_graph_archetype<
+ vertex_type,
+ undirected_tag,
+ allow_parallel_edge_tag
+ > incidence_graph_type;
+ typedef vertex_list_graph_archetype<
+ vertex_type,
+ undirected_tag,
+ allow_parallel_edge_tag,
+ incidence_graph_type
+ > graph_type;
+ typedef graph_traits<graph_type>::degree_size_type degree_type;
+ typedef read_write_property_map_archetype<
+ vertex_type,
+ degree_type
+ > centrality_map_type;
+
+ graph_type& g = static_object<graph_type>::get();
+ centrality_map_type cm;
+
+ degree_centrality(g, cm);
+ degree_centrality(g, cm, measure_influence(g));
+ }
+
+ // There isn't a bidirectional graph archetype so I don't really know
+ // how to test this. Even If I build one, it won't compile very
+ // easily.
+ {
+ typedef descriptor_archetype vertex_type;
+ typedef bidirectional_graph_archetype<
+ vertex_type,
+ directed_tag,
+ allow_parallel_edge_tag
+ > bidirectional_graph_type;
+ typedef vertex_list_graph_archetype<
+ vertex_type,
+ directed_tag,
+ allow_parallel_edge_tag,
+ bidirectional_graph_type
+ > graph_type;
+ typedef graph_traits<graph_type>::degree_size_type degree_type;
+ typedef read_write_property_map_archetype<
+ vertex_type,
+ degree_type
+ > centrality_map_type;
+
+ graph_type& g = static_object<graph_type>::get();
+ centrality_map_type cm;
+
+ // These don't actually work - apparently, it's not very easy
+ // to generate archetypes across concept hierarchies and have
+ // them concept-checked very easily.
+
+ // degree_centrality(g, cm);
+ // degree_centrality(g, cm, measure_prestige(g));
+ }
+
+ return 0;
+}
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