GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
// |
||
2 |
// Created by 4c3y (acey) on 06.09.22. |
||
3 |
// |
||
4 |
|||
5 |
#include <gtest/gtest.h> |
||
6 |
#include <test_utils.h> |
||
7 |
#include <log++.h> |
||
8 |
|||
9 |
4 |
TEST(lpp_LogEveryN, lpp_syntax_severity_debug) { |
|
10 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
11 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY(D, 3, "Test" << 123)); |
12 |
|||
13 |
✓✓ | 10 |
if (i % 3 == 0) { |
14 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
15 |
} else { |
||
16 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
17 |
} |
||
18 |
} |
||
19 |
} |
||
20 |
|||
21 |
4 |
TEST(lpp_LogEveryN, lpp_syntax_severity_info) { |
|
22 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
23 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY(I, 3, "Test" << 123)); |
24 |
|||
25 |
✓✓ | 10 |
if (i % 3 == 0) { |
26 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "INFO Test123\n"); |
27 |
} else { |
||
28 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
29 |
} |
||
30 |
} |
||
31 |
} |
||
32 |
|||
33 |
4 |
TEST(lpp_LogEveryN, lpp_syntax_severity_warning) { |
|
34 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
35 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY(W, 3, "Test" << 123)); |
36 |
|||
37 |
✓✓ | 10 |
if (i % 3 == 0) { |
38 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "WARN Test123\n"); |
39 |
} else { |
||
40 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
41 |
} |
||
42 |
} |
||
43 |
} |
||
44 |
|||
45 |
4 |
TEST(lpp_LogEveryN, lpp_syntax_severity_error) { |
|
46 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
47 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY(E, 3, "Test" << 123)); |
48 |
|||
49 |
✓✓ | 10 |
if (i % 3 == 0) { |
50 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "ERROR Test123\n"); |
51 |
} else { |
||
52 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
53 |
} |
||
54 |
} |
||
55 |
} |
||
56 |
|||
57 |
4 |
TEST(lpp_LogEveryN, lpp_syntax_severity_fatal) { |
|
58 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
59 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ ✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY(F, 3, "Test" << 123)); |
60 |
|||
61 |
✓✓ | 10 |
if (i % 3 == 0) { |
62 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "FATAL Test123\n"); |
63 |
} else { |
||
64 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
65 |
} |
||
66 |
} |
||
67 |
} |
||
68 |
|||
69 |
4 |
TEST(lpp_LogEveryN, glog_syntax_severity_debug) { |
|
70 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
71 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(DLOG_EVERY_N(INFO, 3) << "Test" << 123); |
72 |
|||
73 |
✓✓ | 10 |
if (i % 3 == 0) { |
74 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "DEBUG Test123\n"); |
75 |
} else { |
||
76 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
77 |
} |
||
78 |
} |
||
79 |
} |
||
80 |
|||
81 |
4 |
TEST(lpp_LogEveryN, glog_syntax_severity_info) { |
|
82 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
83 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY_N(INFO, 3) << "Test" << 123); |
84 |
|||
85 |
✓✓ | 10 |
if (i % 3 == 0) { |
86 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "INFO Test123\n"); |
87 |
} else { |
||
88 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
89 |
} |
||
90 |
} |
||
91 |
} |
||
92 |
|||
93 |
4 |
TEST(lpp_LogEveryN, glog_syntax_severity_warning) { |
|
94 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
95 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY_N(WARNING, 3) << "Test" << 123); |
96 |
|||
97 |
✓✓ | 10 |
if (i % 3 == 0) { |
98 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "WARN Test123\n"); |
99 |
} else { |
||
100 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
101 |
} |
||
102 |
} |
||
103 |
} |
||
104 |
|||
105 |
4 |
TEST(lpp_LogEveryN, glog_syntax_severity_error) { |
|
106 |
✓✓ | 12 |
for (int i = 0; i < 5; i++) { |
107 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
15 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY_N(ERROR, 3) << "Test" << 123); |
108 |
|||
109 |
✓✓ | 10 |
if (i % 3 == 0) { |
110 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
4 |
ASSERT_EQ(output, "ERROR Test123\n"); |
111 |
} else { |
||
112 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
6 |
ASSERT_EQ(output, ""); |
113 |
} |
||
114 |
} |
||
115 |
} |
||
116 |
|||
117 |
2 |
TEST(lpp_LogEveryN, glog_syntax_severity_fatal) { |
|
118 |
6 |
for (int i = 0; i < 5; i++) { |
|
119 |
✓✗✓✗ ✓✗✓✗ ✓✗ |
10 |
std::string output = LPP_CAPTURE_STDOUT(LOG_EVERY_N(FATAL, 3) << "Test" << 123); |
120 |
|||
121 |
5 |
if (i % 3 == 0) { |
|
122 |
2 |
ASSERT_EQ(output, "FATAL Test123\n"); |
|
123 |
} else { |
||
124 |
3 |
ASSERT_EQ(output, ""); |
|
125 |
} |
||
126 |
} |
||
127 |
} |
Generated by: GCOVR (Version 4.2) |