GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
// |
||
2 |
// Created by acey on 07.09.23. |
||
3 |
// |
||
4 |
|||
5 |
#include <gtest/gtest.h> |
||
6 |
#include <log++.h> |
||
7 |
#include <test_utils.h> |
||
8 |
|||
9 |
4 |
TEST(nolog_log_string, severity_info) { |
|
10 |
2 |
LOG_INIT(*test_argv); |
|
11 |
|||
12 |
2 |
std::vector<std::string> errors; |
|
13 |
|||
14 |
✓✗ | 4 |
LOG_STRING(INFO, &errors) << "LOG_STRING: " |
15 |
✓✗✓✗ |
2 |
<< "collected info"; |
16 |
✗✓✗✗ ✗✗✗✗ ✗✗ |
2 |
ASSERT_TRUE(errors.empty()); |
17 |
} |
||
18 |
|||
19 |
4 |
TEST(nolog_log_string, severity_info_null) { |
|
20 |
2 |
LOG_INIT(*test_argv); |
|
21 |
|||
22 |
std::string output = |
||
23 |
✓✗✓✗ ✓✗ |
3 |
LPP_CAPTURE_STDOUT(LOG_STRING(INFO, nullptr) << "LOG_STRING: " |
24 |
<< "collected info"); |
||
25 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
26 |
} |
||
27 |
|||
28 |
4 |
TEST(nolog_log_string, severity_warning) { |
|
29 |
2 |
LOG_INIT(*test_argv); |
|
30 |
|||
31 |
2 |
std::vector<std::string> errors; |
|
32 |
|||
33 |
✓✗ | 4 |
LOG_STRING(WARNING, &errors) << "LOG_STRING: " |
34 |
✓✗✓✗ |
2 |
<< "collected warn"; |
35 |
✗✓✗✗ ✗✗✗✗ ✗✗ |
2 |
ASSERT_TRUE(errors.empty()); |
36 |
} |
||
37 |
|||
38 |
4 |
TEST(nolog_log_string, severity_warning_null) { |
|
39 |
2 |
LOG_INIT(*test_argv); |
|
40 |
|||
41 |
std::string output = |
||
42 |
✓✗✓✗ ✓✗ |
3 |
LPP_CAPTURE_STDOUT(LOG_STRING(WARNING, nullptr) << "LOG_STRING: " |
43 |
<< "collected warn"); |
||
44 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
45 |
} |
||
46 |
|||
47 |
4 |
TEST(nolog_log_string, severity_error) { |
|
48 |
2 |
LOG_INIT(*test_argv); |
|
49 |
|||
50 |
2 |
std::vector<std::string> errors; |
|
51 |
|||
52 |
✓✗ | 4 |
LOG_STRING(ERROR, &errors) << "LOG_STRING: " |
53 |
✓✗✓✗ |
2 |
<< "collected error"; |
54 |
✗✓✗✗ ✗✗✗✗ ✗✗ |
2 |
ASSERT_TRUE(errors.empty()); |
55 |
} |
||
56 |
|||
57 |
4 |
TEST(nolog_log_string, severity_error_null) { |
|
58 |
2 |
LOG_INIT(*test_argv); |
|
59 |
|||
60 |
std::string output = |
||
61 |
✓✗✓✗ ✓✗ |
3 |
LPP_CAPTURE_STDOUT(LOG_STRING(ERROR, nullptr) << "LOG_STRING: " |
62 |
<< "collected error"); |
||
63 |
✓✗✗✓ ✗✗✗✗ ✗✗ |
2 |
ASSERT_EQ(output, ""); |
64 |
} |
||
65 |
|||
66 |
4 |
TEST(nolog_log_string, severity_fatal) { |
|
67 |
2 |
LOG_INIT(*test_argv); |
|
68 |
|||
69 |
2 |
std::vector<std::string> errors; |
|
70 |
|||
71 |
✓✗ | 4 |
LOG_STRING(ERROR, &errors) << "LOG_STRING: " |
72 |
✓✗✓✗ |
2 |
<< "collected error"; |
73 |
✗✓✗✗ ✗✗✗✗ ✗✗ |
2 |
ASSERT_TRUE(errors.empty()); |
74 |
} |
||
75 |
|||
76 |
2 |
TEST(nolog_log_string, severity_fatal_null) { |
|
77 |
1 |
LOG_INIT(*test_argv); |
|
78 |
|||
79 |
std::string output = |
||
80 |
✓✗✓✗ |
2 |
LPP_CAPTURE_STDOUT(LOG_STRING(FATAL, nullptr) << "LOG_STRING: " |
81 |
<< "collected fatal"); |
||
82 |
1 |
ASSERT_EQ(output, ""); |
|
83 |
} |
Generated by: GCOVR (Version 4.2) |