src/test/maps_test.cc
changeset 1076 67a115cdade4
parent 1070 6aa1520a0f2f
child 1375 ebdce4f68ac4
     1.1 --- a/src/test/maps_test.cc	Tue Jan 11 17:16:29 2005 +0000
     1.2 +++ b/src/test/maps_test.cc	Wed Jan 12 12:51:30 2005 +0000
     1.3 @@ -9,6 +9,13 @@
     1.4  
     1.5  struct A {};
     1.6  struct B {};
     1.7 +class F
     1.8 +{
     1.9 +public:
    1.10 +  B operator()(const A &a) const {return B();}
    1.11 +};
    1.12 +
    1.13 +int func(A a) {return 3;}
    1.14  
    1.15  typedef ReadMap<A,double> DoubleMap;
    1.16  
    1.17 @@ -31,6 +38,19 @@
    1.18    
    1.19    checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
    1.20  
    1.21 +  checkConcept<ReadMap<A,B>, FunctorMap<A,B,F> >();
    1.22 +
    1.23 +  int a;
    1.24 +  
    1.25 +  a=mapFunctor(constMap<A,int>(2))(A());
    1.26 +  check(a==2,"Something is wrong with mapFunctor");
    1.27 +
    1.28 +  B b;
    1.29 +  b=functorMap<A,B>(F())[A()];
    1.30 +
    1.31 +  a=functorMap<A,int>(&func)[A()];
    1.32 +  check(a==3,"Something is wrong with functorMap");
    1.33 +
    1.34    std::cout << __FILE__ ": All tests passed.\n";
    1.35    
    1.36    return 0;