COIN-OR::LEMON - Graph Library

Changeset 1076:67a115cdade4 in lemon-0.x for src/test


Ignore:
Timestamp:
01/12/05 13:51:30 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1472
Message:

functor->map and map->functor converters added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/maps_test.cc

    r1070 r1076  
    1010struct A {};
    1111struct B {};
     12class F
     13{
     14public:
     15  B operator()(const A &a) const {return B();}
     16};
     17
     18int func(A a) {return 3;}
    1219
    1320typedef ReadMap<A,double> DoubleMap;
     
    3239  checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
    3340
     41  checkConcept<ReadMap<A,B>, FunctorMap<A,B,F> >();
     42
     43  int a;
     44 
     45  a=mapFunctor(constMap<A,int>(2))(A());
     46  check(a==2,"Something is wrong with mapFunctor");
     47
     48  B b;
     49  b=functorMap<A,B>(F())[A()];
     50
     51  a=functorMap<A,int>(&func)[A()];
     52  check(a==3,"Something is wrong with functorMap");
     53
    3454  std::cout << __FILE__ ": All tests passed.\n";
    3555 
Note: See TracChangeset for help on using the changeset viewer.