COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/test/error_test.cc @ 926:b53cb2242a42

Last change on this file since 926:b53cb2242a42 was 921:818510fa3d99, checked in by Alpar Juttner, 20 years ago

hugo -> lemon

File size: 1.5 KB
RevLine 
[906]1/* -*- C++ -*-
[921]2 * src/test/error_test.cc - Part of LEMON, a generic C++ optimization library
[906]3 *
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
6 *
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
10 *
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
13 * purpose.
14 *
15 */
16
[489]17#include <iostream>
18
[921]19#include <lemon/error.h>
[727]20#include "test_tools.h"
[921]21using namespace lemon;
[489]22using std::cout;
23using std::endl;
24
25void faulty_fn() {
26  fault("This is a fault message");
27}
28
29void exception_fn() {
30  throw Exception("This is a fn throwing excpt with some args: ")
31    << 5 << ", " << 18;
32}
33
34void unfinished_fn() {
35  FIXME("unfinished_fn() is unfinished!");
36}
37
38
39int main() {
40  try {
41    faulty_fn();
[727]42    check(false, "A faulty function did not fail.");
[489]43  }
44  catch(const Exception &e) {
[727]45    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
[489]46  }
47
48  try {
49    exception_fn();
[727]50    check(false, "The function did not throw Exception.");
[489]51  }
52  catch(const Exception &e) {
[727]53    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
[489]54  }
55
56  try {
57    unfinished_fn();
[727]58    check(false, "FIXME macro does not work.");
[489]59  }
60  catch(const Exception &e) {
[727]61    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
[489]62  }
63
[727]64  return 0;
[489]65}
Note: See TracBrowser for help on using the repository browser.