| Line |  | 
|---|
| 1 | #include <iostream> | 
|---|
| 2 |  | 
|---|
| 3 | #include <hugo/error.h> | 
|---|
| 4 | #include "test_tools.h" | 
|---|
| 5 | using namespace hugo; | 
|---|
| 6 | using std::cout; | 
|---|
| 7 | using std::endl; | 
|---|
| 8 |  | 
|---|
| 9 | void faulty_fn() { | 
|---|
| 10 | fault("This is a fault message"); | 
|---|
| 11 | } | 
|---|
| 12 |  | 
|---|
| 13 | void exception_fn() { | 
|---|
| 14 | throw Exception("This is a fn throwing excpt with some args: ") | 
|---|
| 15 | << 5 << ", " << 18; | 
|---|
| 16 | } | 
|---|
| 17 |  | 
|---|
| 18 | void unfinished_fn() { | 
|---|
| 19 | FIXME("unfinished_fn() is unfinished!"); | 
|---|
| 20 | } | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | int 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.