COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/test/error_test.cc @ 565:18787f6db0db

Last change on this file since 565:18787f6db0db was 542:69bde1d90c04, checked in by Akos Ladanyi, 21 years ago

Set up automake environment.

File size: 1017 bytes
RevLine 
[489]1#include <iostream>
2
[542]3#include <hugo/error.h>
[489]4
5using namespace hugo;
6using std::cout;
7using std::endl;
8
9void faulty_fn() {
10  fault("This is a fault message");
11}
12
13void exception_fn() {
14  throw Exception("This is a fn throwing excpt with some args: ")
15    << 5 << ", " << 18;
16}
17
18void unfinished_fn() {
19  FIXME("unfinished_fn() is unfinished!");
20}
21
22
23int main() {
24  bool no_errors = false;
25
26  try {
27    cout << "Trying a faulty function\n";
28    faulty_fn();
29    no_errors = true;
30    cout << "FAILED!\n";
31  }
32  catch(const Exception &e) {
33    cout << "E: " << e.what() << endl;
34  }
35
36  try {
37    cout << "Trying a function throwing Exception\n";
38    exception_fn();
39    no_errors = true;
40    cout << "FAILED!\n";
41  }
42  catch(const Exception &e) {
43    cout << "E: " << e.what() << endl;
44  }
45
46  try {
47    cout << "Trying a function using FIXME\n";
48    unfinished_fn();
49    no_errors = true;
50    cout << "FAILED!\n";
51  }
52  catch(const Exception &e) {
53    cout << "E: " << e.what() << endl;
54  }
55
56  return no_errors ? 1 : 0;
57}
Note: See TracBrowser for help on using the repository browser.