Changeset 1675:fa89ffb27a6d in lemon-0.x for test
- Timestamp:
- 09/08/05 16:34:50 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2193
- Location:
- test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/map_test.h
r1435 r1675 50 50 map[nodes.back()] = 23; 51 51 } 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 } 52 56 graph.clear(); 53 57 nodes.clear(); … … 87 91 } 88 92 } 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 } 89 97 graph.clear(); 90 98 edges.clear(); -
test/maps_test.cc
r1435 r1675 10 10 struct A {}; 11 11 struct B {}; 12 class F 13 {12 13 class F { 14 14 public: 15 typedef A argument_type; 16 typedef B result_type; 17 15 18 B operator()(const A &) const {return B();} 16 19 }; 17 20 18 21 int func(A) {return 3;} 22 23 int binc(int, B) {return 4;} 19 24 20 25 typedef ReadMap<A,double> DoubleMap; … … 39 44 checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >(); 40 45 41 checkConcept<ReadMap<A,B>, FunctorMap< A,B,F> >();46 checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >(); 42 47 43 48 int a; … … 47 52 48 53 B b; 49 b=functorMap <A,B>(F())[A()];54 b=functorMap(F())[A()]; 50 55 51 a=functorMap <A,int>(&func)[A()];56 a=functorMap(&func)[A()]; 52 57 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 53 62 54 63 std::cout << __FILE__ ": All tests passed.\n";
Note: See TracChangeset
for help on using the changeset viewer.