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