COIN-OR::LEMON - Graph Library

Changeset 1675:fa89ffb27a6d in lemon-0.x for test


Ignore:
Timestamp:
09/08/05 16:34:50 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2193
Message:

Redesign of the map adaptors.
/smart reference handling only used by functions/

Better handling of the function objects and functions.


\todo May we use operators instead of the addMap, subMap...?

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/map_test.h

    r1435 r1675  
    5050      map[nodes.back()] = 23;
    5151    }
     52    map = constMap<Node>(12);
     53    for (int i = 0; i < (int)nodes.size(); ++i) {
     54      check(map[nodes[i]] == 12, "Wrong map constructor.");     
     55    }   
    5256    graph.clear();
    5357    nodes.clear();
     
    8791      }
    8892    }
     93    map = constMap<Edge>(12);
     94    for (int i = 0; i < (int)edges.size(); ++i) {
     95      check(map[edges[i]] == 12, "Wrong map constructor.");     
     96    }   
    8997    graph.clear();
    9098    edges.clear();   
  • test/maps_test.cc

    r1435 r1675  
    1010struct A {};
    1111struct B {};
    12 class F
    13 {
     12
     13class F {
    1414public:
     15  typedef A argument_type;
     16  typedef B result_type;
     17
    1518  B operator()(const A &) const {return B();}
    1619};
    1720
    1821int func(A) {return 3;}
     22
     23int binc(int, B) {return 4;}
    1924
    2025typedef ReadMap<A,double> DoubleMap;
     
    3944  checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
    4045
    41   checkConcept<ReadMap<A,B>, FunctorMap<A,B,F> >();
     46  checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >();
    4247
    4348  int a;
     
    4752
    4853  B b;
    49   b=functorMap<A,B>(F())[A()];
     54  b=functorMap(F())[A()];
    5055
    51   a=functorMap<A,int>(&func)[A()];
     56  a=functorMap(&func)[A()];
    5257  check(a==3,"Something is wrong with functorMap");
     58
     59  a=combineMap(constMap<B, int, 1>(), identityMap<B>(), &binc)[B()];
     60  check(a==4,"Something is wrong with combineMap");
     61 
    5362
    5463  std::cout << __FILE__ ": All tests passed.\n";
Note: See TracChangeset for help on using the changeset viewer.