Half-done, but I want to continue from home.
1 #include <lemon/concept_check.h>
2 #include <lemon/concept/maps.h>
3 #include <lemon/maps.h>
5 #include "test_tools.h"
8 using namespace lemon::concept;
15 B operator()(const A &) const {return B();}
18 int func(A) {return 3;}
20 typedef ReadMap<A,double> DoubleMap;
23 { // checking graph components
25 checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
26 checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
27 checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
28 checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
30 checkConcept<ReadMap<A,double>, AddMap<DoubleMap,DoubleMap> >();
31 checkConcept<ReadMap<A,double>, SubMap<DoubleMap,DoubleMap> >();
32 checkConcept<ReadMap<A,double>, MulMap<DoubleMap,DoubleMap> >();
33 checkConcept<ReadMap<A,double>, DivMap<DoubleMap,DoubleMap> >();
34 checkConcept<ReadMap<A,double>, NegMap<DoubleMap> >();
35 checkConcept<ReadMap<A,double>, AbsMap<DoubleMap> >();
36 checkConcept<ReadMap<A,double>, ShiftMap<DoubleMap> >();
37 checkConcept<ReadMap<A,double>, ScaleMap<DoubleMap> >();
39 checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
41 checkConcept<ReadMap<A,B>, FunctorMap<A,B,F> >();
45 a=mapFunctor(constMap<A,int>(2))(A());
46 check(a==2,"Something is wrong with mapFunctor");
49 b=functorMap<A,B>(F())[A()];
51 a=functorMap<A,int>(&func)[A()];
52 check(a==3,"Something is wrong with functorMap");
54 std::cout << __FILE__ ": All tests passed.\n";