COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/test/error_test.cc @ 808:9cabbdd73375

Last change on this file since 808:9cabbdd73375 was 727:aada518af30f, checked in by Alpar Juttner, 20 years ago
  • Better Makefile.am. (I hope.)
  • Some more tests
File size: 981 bytes
Line 
1#include <iostream>
2
3#include <hugo/error.h>
4#include "test_tools.h"
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  try {
25    faulty_fn();
26    check(false, "A faulty function did not fail.");
27  }
28  catch(const Exception &e) {
29    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
30  }
31
32  try {
33    exception_fn();
34    check(false, "The function did not throw Exception.");
35  }
36  catch(const Exception &e) {
37    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
38  }
39
40  try {
41    unfinished_fn();
42    check(false, "FIXME macro does not work.");
43  }
44  catch(const Exception &e) {
45    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
46  }
47
48  return 0;
49}
Note: See TracBrowser for help on using the repository browser.