Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (C) 2010 by Thomas Moulard. | ||
2 | // | ||
3 | |||
4 | // Redistribution and use in source and binary forms, with or without | ||
5 | // modification, are permitted provided that the following conditions are | ||
6 | // met: | ||
7 | // | ||
8 | // 1. Redistributions of source code must retain the above copyright | ||
9 | // notice, this list of conditions and the following disclaimer. | ||
10 | // | ||
11 | // 2. Redistributions in binary form must reproduce the above copyright | ||
12 | // notice, this list of conditions and the following disclaimer in the | ||
13 | // documentation and/or other materials provided with the distribution. | ||
14 | // | ||
15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
16 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
17 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
18 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
21 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
22 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
23 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
25 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
26 | // DAMAGE. | ||
27 | |||
28 | #include <cassert> | ||
29 | #include <hpp/util/exception.hh> | ||
30 | #include <iostream> | ||
31 | |||
32 | #include "common.hh" | ||
33 | #include "config.h" | ||
34 | |||
35 | 1 | HPP_MAKE_EXCEPTION_NO_QUALIFIER(CustomException); | |
36 | |||
37 | int run_test(); | ||
38 | |||
39 | 1 | int run_test() { | |
40 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
3 | ::hpp::Exception exception("put your message here", "filename", 0); |
41 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::cout << exception << std::endl; |
42 | |||
43 | try { | ||
44 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
5 | HPP_THROW_EXCEPTION_("this exception should be catched"); |
45 | assert(0); | ||
46 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } catch (::hpp::Exception& exception) { |
47 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::cout << exception << std::endl; |
48 | 1 | } | |
49 | |||
50 | try { | ||
51 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
|
5 | HPP_THROW_EXCEPTION(::hpp::Exception, "this exception should be catched"); |
52 | assert(0); | ||
53 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } catch (::hpp::Exception& exception) { |
54 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::cout << exception << std::endl; |
55 | 1 | } | |
56 | |||
57 | try { | ||
58 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
|
5 | HPP_THROW_EXCEPTION(CustomException, |
59 | "this custom exception should be catched"); | ||
60 | assert(0); | ||
61 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | } catch (::hpp::Exception& exception) { |
62 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | std::cout << exception << std::endl; |
63 | 1 | } | |
64 | 1 | return 0; | |
65 | 1 | } | |
66 | |||
67 |
5/30✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
|
1 | GENERATE_TEST() |
68 |