GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
// |
||
2 |
// Created by 4c3y (acey) on 27.09.22. |
||
3 |
// |
||
4 |
|||
5 |
#include <gtest/gtest.h> |
||
6 |
#include <log++.h> |
||
7 |
#include <test_utils.h> |
||
8 |
|||
9 |
4 |
TEST(lpp_vlog, glog_syntax_severity_v1) { |
|
10 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
11 |
2 |
FLAGS_v = 3; |
|
12 |
|||
13 |
✓✗✓✗ ✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG(1) << "Test" << 123); |
14 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
15 |
} |
||
16 |
|||
17 |
4 |
TEST(lpp_vlog, glog_syntax_severity_v3) { |
|
18 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
19 |
2 |
FLAGS_v = 3; |
|
20 |
|||
21 |
✓✗✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG(3) << "Test123"); |
22 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
23 |
} |
||
24 |
|||
25 |
4 |
TEST(lpp_vlog, glog_syntax_severity_v5) { |
|
26 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
27 |
2 |
FLAGS_v = 3; |
|
28 |
|||
29 |
✓✗✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG(5) << "Test123"); |
30 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
31 |
} |
||
32 |
|||
33 |
4 |
TEST(lpp_vlog, glog_syntax_severity_if_v1) { |
|
34 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
35 |
2 |
FLAGS_v = 3; |
|
36 |
|||
37 |
✓✗✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(1, true) << "Test123"); |
38 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
39 |
} |
||
40 |
|||
41 |
4 |
TEST(lpp_vlog, glog_syntax_severity_if_v3) { |
|
42 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
43 |
2 |
FLAGS_v = 3; |
|
44 |
|||
45 |
✓✗✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(1, true) << "Test123"); |
46 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
47 |
} |
||
48 |
|||
49 |
4 |
TEST(lpp_vlog, glog_syntax_severity_if_v5) { |
|
50 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
51 |
2 |
FLAGS_v = 3; |
|
52 |
|||
53 |
✓✗✓✗ |
3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(5, true) << "Test123"); |
54 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
55 |
} |
||
56 |
|||
57 |
4 |
TEST(lpp_vlog, glog_syntax_severity_ifnot_v1) { |
|
58 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
59 |
2 |
FLAGS_v = 3; |
|
60 |
|||
61 |
✓✗ | 3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(1, false) << "Test123"); |
62 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
63 |
} |
||
64 |
|||
65 |
4 |
TEST(lpp_vlog, glog_syntax_severity_ifnot_v3) { |
|
66 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
67 |
2 |
FLAGS_v = 3; |
|
68 |
|||
69 |
✓✗ | 3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(3, false) << "Test123"); |
70 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
71 |
} |
||
72 |
|||
73 |
4 |
TEST(lpp_vlog, glog_syntax_severity_ifnot_v5) { |
|
74 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
75 |
2 |
FLAGS_v = 3; |
|
76 |
|||
77 |
✓✗ | 3 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_IF(5, false) << "Test123"); |
78 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
79 |
} |
||
80 |
|||
81 |
|||
82 |
4 |
TEST(lpp_vlog, glog_syntax_every_n_severity_v1) { |
|
83 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
84 |
2 |
FLAGS_v = 3; |
|
85 |
|||
86 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
87 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_EVERY_N(1, 3) << "Test" << 123); |
88 |
|||
89 |
✓✓ | 10 |
if (i % 3 == 0) { |
90 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
91 |
} else { |
||
92 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
93 |
} |
||
94 |
} |
||
95 |
} |
||
96 |
|||
97 |
4 |
TEST(lpp_vlog, glog_syntax_every_n_severity_v3) { |
|
98 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
99 |
2 |
FLAGS_v = 3; |
|
100 |
|||
101 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
102 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_EVERY_N(3, 3) << "Test" << 123); |
103 |
|||
104 |
✓✓ | 10 |
if (i % 3 == 0) { |
105 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
106 |
} else { |
||
107 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
108 |
} |
||
109 |
} |
||
110 |
} |
||
111 |
|||
112 |
4 |
TEST(lpp_vlog, glog_syntax_every_n_severity_v5) { |
|
113 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
114 |
2 |
FLAGS_v = 3; |
|
115 |
|||
116 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
117 |
✓✓✗✗ ✗✗✗✗ ✗✗✗✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(VLOG_EVERY_N(5, 3) << "Test" << 123); |
118 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
10 |
ASSERT_EQ(output, ""); |
119 |
} |
||
120 |
} |
||
121 |
|||
122 |
4 |
TEST(lpp_vlog, glog_syntax_if_every_n_severity_v1) { |
|
123 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
124 |
2 |
FLAGS_v = 3; |
|
125 |
|||
126 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
127 |
✓✗ | 10 |
testing::internal::CaptureStdout(); |
128 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
10 |
VLOG_IF_EVERY_N(1, i <= 3, 3) << "Test" << 123; |
129 |
✓✗ | 10 |
std::string output = testing::internal::GetCapturedStdout(); |
130 |
|||
131 |
✓✓✓✓ |
10 |
if (i <= 3 && i % 3 == 0) { |
132 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
8 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
133 |
} else { |
||
134 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
135 |
} |
||
136 |
} |
||
137 |
} |
||
138 |
|||
139 |
4 |
TEST(lpp_vlog, glog_syntax_if_every_n_severity_v3) { |
|
140 |
✓✗ | 2 |
LOG_INIT(*test_argv); |
141 |
2 |
FLAGS_v = 3; |
|
142 |
|||
143 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
144 |
✓✗ | 10 |
testing::internal::CaptureStdout(); |
145 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
10 |
VLOG_IF_EVERY_N(3, i <= 3, 3) << "Test" << 123; |
146 |
✓✗ | 10 |
std::string output = testing::internal::GetCapturedStdout(); |
147 |
|||
148 |
✓✓✓✓ |
10 |
if (i <= 3 && i % 3 == 0) { |
149 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
8 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
150 |
} else { |
||
151 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
152 |
} |
||
153 |
} |
||
154 |
} |
||
155 |
|||
156 |
2 |
TEST(lpp_vlog, glog_syntax_if_every_n_severity_v5) { |
|
157 |
1 |
LOG_INIT(*test_argv); |
|
158 |
1 |
FLAGS_v = 3; |
|
159 |
|||
160 |
6 |
for (int i = 0; i < 5; i++) { |
|
161 |
5 |
testing::internal::CaptureStdout(); |
|
162 |
5 |
VLOG_IF_EVERY_N(5, i <= 3, 3) << "Test" << 123; |
|
163 |
5 |
std::string output = testing::internal::GetCapturedStdout(); |
|
164 |
|||
165 |
5 |
ASSERT_EQ(output, ""); |
|
166 |
} |
||
167 |
} |
Generated by: GCOVR (Version 4.2) |