GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
// |
||
2 |
// Created by 4c3y (acey) on 06.09.22. |
||
3 |
// |
||
4 |
|||
5 |
#include <test_utils.h> |
||
6 |
#include <gtest/gtest.h> |
||
7 |
#include <log++.h> |
||
8 |
|||
9 |
//! LPP syntax |
||
10 |
|||
11 |
4 |
TEST(lpp_basic, lpp_syntax_severity_debug) { |
|
12 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
13 |
|||
14 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(D, "Test" << 123)); |
15 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
16 |
} |
||
17 |
|||
18 |
4 |
TEST(lpp_basic, lpp_syntax_severity_info) { |
|
19 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
20 |
|||
21 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(I, "Test" << 123)); |
22 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "INFO Test123\n"); |
23 |
} |
||
24 |
|||
25 |
4 |
TEST(lpp_basic, lpp_syntax_severity_warning) { |
|
26 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
27 |
|||
28 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(W, "Test" << 123)); |
29 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "WARN Test123\n"); |
30 |
} |
||
31 |
|||
32 |
4 |
TEST(lpp_basic, lpp_syntax_severity_error) { |
|
33 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
34 |
|||
35 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(E, "Test" << 123)); |
36 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "ERROR Test123\n"); |
37 |
} |
||
38 |
|||
39 |
4 |
TEST(lpp_basic, lpp_syntax_severity_fatal) { |
|
40 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
41 |
|||
42 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(F, "Test" << 123)); |
43 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "FATAL Test123\n"); |
44 |
} |
||
45 |
|||
46 |
|||
47 |
//! Glog syntax |
||
48 |
4 |
TEST(lpp_basic, glog_syntax_severity_debug) { |
|
49 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
50 |
|||
51 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(DLOG(INFO) << "Test" << 123); |
52 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
53 |
} |
||
54 |
|||
55 |
4 |
TEST(lpp_basic, glog_syntax_severity_info) { |
|
56 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
57 |
|||
58 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(INFO) << "Test" << 123); |
59 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "INFO Test123\n"); |
60 |
} |
||
61 |
|||
62 |
4 |
TEST(lpp_basic, glog_syntax_severity_warning) { |
|
63 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
64 |
|||
65 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(WARNING) << "Test" << 123); |
66 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "WARN Test123\n"); |
67 |
} |
||
68 |
|||
69 |
4 |
TEST(lpp_basic, glog_syntax_severity_error) { |
|
70 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
71 |
|||
72 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(ERROR) << "Test" << 123); |
73 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "ERROR Test123\n"); |
74 |
} |
||
75 |
|||
76 |
4 |
TEST(lpp_basic, glog_syntax_severity_fatal) { |
|
77 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
78 |
|||
79 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(LOG(FATAL) << "Test" << 123); |
80 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "FATAL Test123\n"); |
81 |
} |
||
82 |
|||
83 |
|||
84 |
//! Roslog syntax |
||
85 |
4 |
TEST(lpp_basic, roslog_syntax_severity_debug) { |
|
86 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
87 |
|||
88 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG("Test123")); |
89 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
90 |
} |
||
91 |
|||
92 |
4 |
TEST(lpp_basic, roslog_syntax_severity_debug_stream) { |
|
93 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
94 |
|||
95 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG_STREAM("Test" << 123)); |
96 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
97 |
} |
||
98 |
|||
99 |
4 |
TEST(lpp_basic, roslog_syntax_severity_info) { |
|
100 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
101 |
|||
102 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_INFO("Test123")); |
103 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "INFO Test123\n"); |
104 |
} |
||
105 |
|||
106 |
4 |
TEST(lpp_basic, roslog_syntax_severity_info_stream) { |
|
107 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
108 |
|||
109 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_INFO_STREAM("Test" << 123)); |
110 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "INFO Test123\n"); |
111 |
} |
||
112 |
|||
113 |
4 |
TEST(lpp_basic, roslog_syntax_severity_warning) { |
|
114 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
115 |
|||
116 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_WARN("Test123")); |
117 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "WARN Test123\n"); |
118 |
} |
||
119 |
|||
120 |
4 |
TEST(lpp_basic, roslog_syntax_severity_warning_stream) { |
|
121 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
122 |
|||
123 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_WARN_STREAM("Test" << 123)); |
124 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "WARN Test123\n"); |
125 |
} |
||
126 |
|||
127 |
4 |
TEST(lpp_basic, roslog_syntax_severity_error) { |
|
128 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
129 |
|||
130 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_ERROR("Test123")); |
131 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "ERROR Test123\n"); |
132 |
} |
||
133 |
|||
134 |
4 |
TEST(lpp_basic, roslog_syntax_severity_error_stream) { |
|
135 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
136 |
|||
137 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_ERROR_STREAM("Test" << 123)); |
138 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "ERROR Test123\n"); |
139 |
} |
||
140 |
|||
141 |
4 |
TEST(lpp_basic, roslog_syntax_severity_fatal) { |
|
142 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
143 |
|||
144 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(ROS_FATAL("Test123")); |
145 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "FATAL Test123\n"); |
146 |
} |
||
147 |
|||
148 |
2 |
TEST(lpp_basic, roslog_syntax_severity_fatal_stream) { |
|
149 |
1 |
LOG_INIT(*test_argv); |
|
150 |
|||
151 |
✓✗✓✗ |
2 |
std::string output = LPP_CAPTURE_STDOUT(ROS_FATAL_STREAM("Test" << 123)); |
152 |
1 |
ASSERT_EQ(output, "FATAL Test123\n"); |
|
153 |
} |
Generated by: GCOVR (Version 4.2) |