GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
#include "zserio/UniquePtr.h" |
||
2 |
#include "zserio/CppRuntimeException.h" |
||
3 |
|||
4 |
#include "TrackingAllocator.h" |
||
5 |
|||
6 |
#include "gtest/gtest.h" |
||
7 |
|||
8 |
namespace zserio |
||
9 |
{ |
||
10 |
|||
11 |
namespace |
||
12 |
{ |
||
13 |
|||
14 |
struct ThrowingStruct |
||
15 |
{ |
||
16 |
1 |
ThrowingStruct() |
|
17 |
{ |
||
18 |
✓✗ | 1 |
throw CppRuntimeException("oops"); |
19 |
} |
||
20 |
}; |
||
21 |
|||
22 |
} // namespace |
||
23 |
|||
24 |
✓✗✓✗ ✓✗✗✓ |
802 |
TEST(UniquePtrTest, allocateUnique) |
25 |
{ |
||
26 |
✓✗ | 2 |
TrackingAllocator<int> alloc; |
27 |
|||
28 |
✓✗✓✗ |
2 |
unique_ptr<int, TrackingAllocator<int>> unique = allocate_unique<int>(alloc, 12345); |
29 |
✗✓✗✗ ✗✗✗✗ ✗✗✓✗ |
1 |
ASSERT_TRUE(bool(unique)); |
30 |
✓✗✗✓ ✗✗✗✗ ✗✗✓✗ |
1 |
ASSERT_EQ(12345, *unique); |
31 |
✓✗✗✓ ✗✗✗✗ ✗✗✓✗ ✓✗✗ |
1 |
ASSERT_EQ(1, alloc.numAllocs()); |
32 |
|||
33 |
✓✗✓✗ ✓✗✗✓ ✗✓✗✗ ✗✗✗✗ ✗✗✓✗ ✓✗✓✗ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ |
2 |
ASSERT_THROW(allocate_unique<ThrowingStruct>(alloc), CppRuntimeException); |
34 |
} |
||
35 |
|||
36 |
✓✗✓✗ |
2394 |
} // namespace zserio |
Generated by: GCOVR (Version 4.2) |