kpeter@66: /* -*- C++ -*- kpeter@66: * kpeter@66: * This file is a part of LEMON, a generic C++ optimization library kpeter@66: * kpeter@66: * Copyright (C) 2003-2008 kpeter@66: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport kpeter@66: * (Egervary Research Group on Combinatorial Optimization, EGRES). kpeter@66: * kpeter@66: * Permission to use, modify and distribute this software is granted kpeter@66: * provided that this copyright notice appears in all copies. For kpeter@66: * precise terms see the accompanying LICENSE file. kpeter@66: * kpeter@66: * This software is provided "AS IS" with no warranty of any kind, kpeter@66: * express or implied, and with no claim as to its suitability for any kpeter@66: * purpose. kpeter@66: * kpeter@66: */ kpeter@66: kpeter@66: #include kpeter@66: kpeter@66: #include kpeter@66: #include "test_tools.h" kpeter@66: kpeter@66: using namespace lemon; kpeter@66: using std::cout; kpeter@66: using std::endl; kpeter@66: kpeter@66: void faulty_fn() { kpeter@66: fault("This is a fault message"); kpeter@66: } kpeter@66: kpeter@66: void exception_fn() { kpeter@66: throw Exception("This is a function throwing exception with some args: ") kpeter@66: << 5 << ", " << 18; kpeter@66: } kpeter@66: kpeter@66: void unfinished_fn() { kpeter@66: LEMON_FIXME("unfinished_fn() is unfinished!"); kpeter@66: } kpeter@66: kpeter@66: kpeter@66: int main() { kpeter@66: try { kpeter@66: faulty_fn(); kpeter@66: check(false, "A faulty function did not fail."); kpeter@66: } kpeter@66: catch(const Exception &e) { kpeter@66: cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl; kpeter@66: } kpeter@66: kpeter@66: try { kpeter@66: exception_fn(); kpeter@66: check(false, "The function did not throw Exception."); kpeter@66: } kpeter@66: catch(const Exception &e) { kpeter@66: cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl; kpeter@66: } kpeter@66: kpeter@66: try { kpeter@66: unfinished_fn(); kpeter@66: check(false, "FIXME macro does not work."); kpeter@66: } kpeter@66: catch(const Exception &e) { kpeter@66: cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl; kpeter@66: } kpeter@66: kpeter@66: return 0; kpeter@66: }