test/max_matching_test.cc
changeset 590 b61354458b59
parent 440 88ed40ad0d4f
child 593 7ac52d6a268e
     1.1 --- a/test/max_matching_test.cc	Wed Apr 15 07:13:30 2009 +0100
     1.2 +++ b/test/max_matching_test.cc	Wed Apr 15 12:01:14 2009 +0200
     1.3 @@ -20,12 +20,14 @@
     1.4  #include <sstream>
     1.5  #include <vector>
     1.6  #include <queue>
     1.7 -#include <lemon/math.h>
     1.8  #include <cstdlib>
     1.9  
    1.10  #include <lemon/max_matching.h>
    1.11  #include <lemon/smart_graph.h>
    1.12 +#include <lemon/concepts/graph.h>
    1.13 +#include <lemon/concepts/maps.h>
    1.14  #include <lemon/lgf_reader.h>
    1.15 +#include <lemon/math.h>
    1.16  
    1.17  #include "test_tools.h"
    1.18  
    1.19 @@ -110,6 +112,108 @@
    1.20    "5 2  6      539\n",
    1.21  };
    1.22  
    1.23 +void checkMaxMatchingCompile()
    1.24 +{
    1.25 +  typedef concepts::Graph Graph;
    1.26 +  typedef Graph::Node Node;
    1.27 +  typedef Graph::Edge Edge;
    1.28 +  typedef Graph::EdgeMap<bool> MatMap;
    1.29 +
    1.30 +  Graph g;
    1.31 +  Node n;
    1.32 +  Edge e;
    1.33 +  MatMap mat(g);
    1.34 +
    1.35 +  MaxMatching<Graph> mat_test(g);
    1.36 +  const MaxMatching<Graph>&
    1.37 +    const_mat_test = mat_test;
    1.38 +
    1.39 +  mat_test.init();
    1.40 +  mat_test.greedyInit();
    1.41 +  mat_test.matchingInit(mat);
    1.42 +  mat_test.startSparse();
    1.43 +  mat_test.startDense();
    1.44 +  mat_test.run();
    1.45 +  
    1.46 +  const_mat_test.matchingSize();
    1.47 +  const_mat_test.matching(e);
    1.48 +  const_mat_test.matching(n);
    1.49 +  const_mat_test.mate(n);
    1.50 +
    1.51 +  MaxMatching<Graph>::Status stat = 
    1.52 +    const_mat_test.decomposition(n);
    1.53 +  const_mat_test.barrier(n);
    1.54 +  
    1.55 +  ignore_unused_variable_warning(stat);
    1.56 +}
    1.57 +
    1.58 +void checkMaxWeightedMatchingCompile()
    1.59 +{
    1.60 +  typedef concepts::Graph Graph;
    1.61 +  typedef Graph::Node Node;
    1.62 +  typedef Graph::Edge Edge;
    1.63 +  typedef Graph::EdgeMap<int> WeightMap;
    1.64 +
    1.65 +  Graph g;
    1.66 +  Node n;
    1.67 +  Edge e;
    1.68 +  WeightMap w(g);
    1.69 +
    1.70 +  MaxWeightedMatching<Graph> mat_test(g, w);
    1.71 +  const MaxWeightedMatching<Graph>&
    1.72 +    const_mat_test = mat_test;
    1.73 +
    1.74 +  mat_test.init();
    1.75 +  mat_test.start();
    1.76 +  mat_test.run();
    1.77 +  
    1.78 +  const_mat_test.matchingValue();
    1.79 +  const_mat_test.matchingSize();
    1.80 +  const_mat_test.matching(e);
    1.81 +  const_mat_test.matching(n);
    1.82 +  const_mat_test.mate(n);
    1.83 +  
    1.84 +  int k = 0;
    1.85 +  const_mat_test.dualValue();
    1.86 +  const_mat_test.nodeValue(n);
    1.87 +  const_mat_test.blossomNum();
    1.88 +  const_mat_test.blossomSize(k);
    1.89 +  const_mat_test.blossomValue(k);
    1.90 +}
    1.91 +
    1.92 +void checkMaxWeightedPerfectMatchingCompile()
    1.93 +{
    1.94 +  typedef concepts::Graph Graph;
    1.95 +  typedef Graph::Node Node;
    1.96 +  typedef Graph::Edge Edge;
    1.97 +  typedef Graph::EdgeMap<int> WeightMap;
    1.98 +
    1.99 +  Graph g;
   1.100 +  Node n;
   1.101 +  Edge e;
   1.102 +  WeightMap w(g);
   1.103 +
   1.104 +  MaxWeightedPerfectMatching<Graph> mat_test(g, w);
   1.105 +  const MaxWeightedPerfectMatching<Graph>&
   1.106 +    const_mat_test = mat_test;
   1.107 +
   1.108 +  mat_test.init();
   1.109 +  mat_test.start();
   1.110 +  mat_test.run();
   1.111 +  
   1.112 +  const_mat_test.matchingValue();
   1.113 +  const_mat_test.matching(e);
   1.114 +  const_mat_test.matching(n);
   1.115 +  const_mat_test.mate(n);
   1.116 +  
   1.117 +  int k = 0;
   1.118 +  const_mat_test.dualValue();
   1.119 +  const_mat_test.nodeValue(n);
   1.120 +  const_mat_test.blossomNum();
   1.121 +  const_mat_test.blossomSize(k);
   1.122 +  const_mat_test.blossomValue(k);
   1.123 +}
   1.124 +
   1.125  void checkMatching(const SmartGraph& graph,
   1.126                     const MaxMatching<SmartGraph>& mm) {
   1.127    int num = 0;