diff -r a93f1a27d831 -r d3ea191c3412 test/min_mean_cycle_test.cc --- a/test/min_mean_cycle_test.cc Mon Mar 08 08:33:41 2010 +0100 +++ b/test/min_mean_cycle_test.cc Sat Mar 13 22:01:38 2010 +0100 @@ -25,9 +25,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "test_tools.h" @@ -63,7 +63,7 @@ // Check the interface of an MMC algorithm -template +template struct MmcClassConcept { template @@ -73,30 +73,30 @@ typedef typename MMC ::template SetPath > - ::template SetLargeValue + ::template SetLargeCost ::Create MmcAlg; - MmcAlg mmc(me.g, me.length); + MmcAlg mmc(me.g, me.cost); const MmcAlg& const_mmc = mmc; typename MmcAlg::Tolerance tol = const_mmc.tolerance(); mmc.tolerance(tol); b = mmc.cycle(p).run(); - b = mmc.findMinMean(); + b = mmc.findCycleMean(); b = mmc.findCycle(); - v = const_mmc.cycleLength(); - i = const_mmc.cycleArcNum(); + v = const_mmc.cycleCost(); + i = const_mmc.cycleSize(); d = const_mmc.cycleMean(); p = const_mmc.cycle(); } - typedef concepts::ReadMap LM; + typedef concepts::ReadMap CM; GR g; - LM length; + CM cost; ListPath p; - Value v; + Cost v; int i; double d; bool b; @@ -108,13 +108,13 @@ void checkMmcAlg(const SmartDigraph& gr, const SmartDigraph::ArcMap& lm, const SmartDigraph::ArcMap& cm, - int length, int size) { + int cost, int size) { MMC alg(gr, lm); - alg.findMinMean(); - check(alg.cycleMean() == static_cast(length) / size, + alg.findCycleMean(); + check(alg.cycleMean() == static_cast(cost) / size, "Wrong cycle mean"); alg.findCycle(); - check(alg.cycleLength() == length && alg.cycleArcNum() == size, + check(alg.cycleCost() == cost && alg.cycleSize() == size, "Wrong path"); SmartDigraph::ArcMap cycle(gr, 0); for (typename MMC::Path::ArcIt a(alg.cycle()); a != INVALID; ++a) { @@ -148,28 +148,28 @@ { typedef concepts::Digraph GR; - // Karp + // KarpMmc checkConcept< MmcClassConcept, - Karp > >(); + KarpMmc > >(); checkConcept< MmcClassConcept, - Karp > >(); + KarpMmc > >(); - // HartmannOrlin + // HartmannOrlinMmc checkConcept< MmcClassConcept, - HartmannOrlin > >(); + HartmannOrlinMmc > >(); checkConcept< MmcClassConcept, - HartmannOrlin > >(); + HartmannOrlinMmc > >(); - // Howard + // HowardMmc checkConcept< MmcClassConcept, - Howard > >(); + HowardMmc > >(); checkConcept< MmcClassConcept, - Howard > >(); + HowardMmc > >(); - if (IsSameType >::LargeValue, - long_int>::result == 0) check(false, "Wrong LargeValue type"); - if (IsSameType >::LargeValue, - double>::result == 0) check(false, "Wrong LargeValue type"); + check((IsSameType > + ::LargeCost, long_int>::result == 1), "Wrong LargeCost type"); + check((IsSameType > + ::LargeCost, double>::result == 1), "Wrong LargeCost type"); } // Run various tests @@ -194,22 +194,22 @@ run(); // Karp - checkMmcAlg >(gr, l1, c1, 6, 3); - checkMmcAlg >(gr, l2, c2, 5, 2); - checkMmcAlg >(gr, l3, c3, 0, 1); - checkMmcAlg >(gr, l4, c4, -1, 1); + checkMmcAlg >(gr, l1, c1, 6, 3); + checkMmcAlg >(gr, l2, c2, 5, 2); + checkMmcAlg >(gr, l3, c3, 0, 1); + checkMmcAlg >(gr, l4, c4, -1, 1); // HartmannOrlin - checkMmcAlg >(gr, l1, c1, 6, 3); - checkMmcAlg >(gr, l2, c2, 5, 2); - checkMmcAlg >(gr, l3, c3, 0, 1); - checkMmcAlg >(gr, l4, c4, -1, 1); + checkMmcAlg >(gr, l1, c1, 6, 3); + checkMmcAlg >(gr, l2, c2, 5, 2); + checkMmcAlg >(gr, l3, c3, 0, 1); + checkMmcAlg >(gr, l4, c4, -1, 1); // Howard - checkMmcAlg >(gr, l1, c1, 6, 3); - checkMmcAlg >(gr, l2, c2, 5, 2); - checkMmcAlg >(gr, l3, c3, 0, 1); - checkMmcAlg >(gr, l4, c4, -1, 1); + checkMmcAlg >(gr, l1, c1, 6, 3); + checkMmcAlg >(gr, l2, c2, 5, 2); + checkMmcAlg >(gr, l3, c3, 0, 1); + checkMmcAlg >(gr, l4, c4, -1, 1); } return 0;