Bug fixes in min cost flow files.
Use enum type instead of static constants in NetworkSimplex to avoid
linker errors.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2008
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
22 #include <lemon/concept_check.h>
23 #include <lemon/concepts/maps.h>
24 #include <lemon/maps.h>
26 #include "test_tools.h"
28 using namespace lemon;
29 using namespace lemon::concepts;
32 inline bool operator<(A, A) { return true; }
37 typedef A argument_type;
38 typedef B result_type;
40 B operator()(const A &) const {return B();}
43 int func(A) {return 3;}
45 int binc(int, B) {return 4;}
47 typedef ReadMap<A,double> DoubleMap;
48 typedef ReadWriteMap<A, double> WriteDoubleMap;
50 typedef ReadMap<A,bool> BoolMap;
51 typedef ReadWriteMap<A, bool> BoolWriteMap;
54 { // checking graph components
56 checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
57 checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
58 checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
59 checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
61 checkConcept<ReadMap<A,double>, AddMap<DoubleMap,DoubleMap> >();
62 checkConcept<ReadMap<A,double>, SubMap<DoubleMap,DoubleMap> >();
63 checkConcept<ReadMap<A,double>, MulMap<DoubleMap,DoubleMap> >();
64 checkConcept<ReadMap<A,double>, DivMap<DoubleMap,DoubleMap> >();
65 checkConcept<ReadMap<A,double>, NegMap<DoubleMap> >();
66 checkConcept<ReadWriteMap<A,double>, NegWriteMap<WriteDoubleMap> >();
67 checkConcept<ReadMap<A,double>, AbsMap<DoubleMap> >();
68 checkConcept<ReadMap<A,double>, ShiftMap<DoubleMap> >();
69 checkConcept<ReadWriteMap<A,double>, ShiftWriteMap<WriteDoubleMap> >();
70 checkConcept<ReadMap<A,double>, ScaleMap<DoubleMap> >();
71 checkConcept<ReadWriteMap<A,double>, ScaleWriteMap<WriteDoubleMap> >();
72 checkConcept<ReadMap<A,double>, ForkMap<DoubleMap, DoubleMap> >();
73 checkConcept<ReadWriteMap<A,double>,
74 ForkWriteMap<WriteDoubleMap, WriteDoubleMap> >();
76 checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
78 checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >();
80 checkConcept<ReadMap<A, bool>, NotMap<BoolMap> >();
81 checkConcept<ReadWriteMap<A, bool>, NotWriteMap<BoolWriteMap> >();
83 checkConcept<WriteMap<A, bool>, StoreBoolMap<A*> >();
84 checkConcept<WriteMap<A, bool>, BackInserterBoolMap<std::deque<A> > >();
85 checkConcept<WriteMap<A, bool>, FrontInserterBoolMap<std::deque<A> > >();
86 checkConcept<WriteMap<A, bool>, InserterBoolMap<std::set<A> > >();
87 checkConcept<WriteMap<A, bool>, FillBoolMap<WriteMap<A, B> > >();
88 checkConcept<WriteMap<A, bool>, SettingOrderBoolMap<WriteMap<A, int> > >();
92 a=mapFunctor(constMap<A,int>(2))(A());
93 check(a==2,"Something is wrong with mapFunctor");
96 b=functorMap(F())[A()];
98 a=functorMap(&func)[A()];
99 check(a==3,"Something is wrong with functorMap");
101 a=combineMap(constMap<B, int, 1>(), identityMap<B>(), &binc)[B()];
102 check(a==4,"Something is wrong with combineMap");
105 std::cout << __FILE__ ": All tests passed.\n";