/* -*- C++ -*- * * This file is a part of LEMON, a generic C++ optimization library * * Copyright (C) 2003-2006 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted * provided that this copyright notice appears in all copies. For * precise terms see the accompanying LICENSE file. * * This software is provided "AS IS" with no warranty of any kind, * express or implied, and with no claim as to its suitability for any * purpose. * */ #include #include #include #include "test_tools.h" using namespace lemon; using namespace lemon::concept; struct A {}; struct B {}; class F { public: typedef A argument_type; typedef B result_type; B operator()(const A &) const {return B();} }; int func(A) {return 3;} int binc(int, B) {return 4;} typedef ReadMap DoubleMap; int main() { // checking graph components checkConcept, ReadMap >(); checkConcept, WriteMap >(); checkConcept, ReadWriteMap >(); checkConcept, ReferenceMap >(); checkConcept, AddMap >(); checkConcept, SubMap >(); checkConcept, MulMap >(); checkConcept, DivMap >(); checkConcept, NegMap >(); checkConcept, AbsMap >(); checkConcept, ShiftMap >(); checkConcept, ScaleMap >(); checkConcept, ComposeMap > >(); checkConcept, FunctorMap >(); int a; a=mapFunctor(constMap(2))(A()); check(a==2,"Something is wrong with mapFunctor"); B b; b=functorMap(F())[A()]; a=functorMap(&func)[A()]; check(a==3,"Something is wrong with functorMap"); a=combineMap(constMap(), identityMap(), &binc)[B()]; check(a==4,"Something is wrong with combineMap"); std::cout << __FILE__ ": All tests passed.\n"; return 0; }