COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/test/error_test.cc @ 776:f2994a2b10b2

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