GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: test/roslog/test_roslog_basic.cc Lines: 80 80 100.0 %
Date: 2025-03-04 18:34:12 Branches: 208 512 40.6 %

Line Branch Exec Source
1
//
2
// Created by acey on 30.08.22.
3
//
4
5
#include <gtest/gtest.h>
6
#include <test_utils.h>
7
#include <log++.h>
8
9
using namespace lpp::rostest;
10
11
4
TEST(roslog_basic, glog_syntax_severity_debug) {
12
2
  LOG_INIT(*test_argv);
13
14

3
  std::string output = LPP_CAPTURE_STDOUT(DLOG(INFO) << "Test");
15



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
16
}
17
18
4
TEST(roslog_basic, glog_syntax_severity_info) {
19
2
  LOG_INIT(*test_argv);
20
21

3
  std::string output = LPP_CAPTURE_STDOUT(LOG(INFO) << "Test123");
22



4
  ASSERT_EQ(info, removeNumbersFromString(output));
23
}
24
25
4
TEST(roslog_basic, glog_syntax_severity_warning) {
26
2
  LOG_INIT(*test_argv);
27
28

3
  std::string output = LPP_CAPTURE_STDERR(LOG(WARNING) << "Test");
29



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
30
}
31
32
4
TEST(roslog_basic, glog_syntax_severity_error) {
33
2
  LOG_INIT(*test_argv);
34
35

3
  std::string output = LPP_CAPTURE_STDERR(LOG(ERROR) << "Test");
36



4
  ASSERT_EQ(error, removeNumbersFromString(output));
37
}
38
39
4
TEST(roslog_basic, glog_syntax_severity_fatal) {
40
2
  LOG_INIT(*test_argv);
41
42

3
  std::string output = LPP_CAPTURE_STDERR(LOG(FATAL) << "Test");
43



4
  ASSERT_EQ(fatal, removeNumbersFromString(output));
44
}
45
46
//! ################ lpp ################
47
4
TEST(roslog_basic, lpp_syntax_severity_debug) {
48
2
  LOG_INIT(*test_argv);
49
50

3
  std::string output = LPP_CAPTURE_STDOUT(LOG(D, "" << "Test"));
51



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
52
}
53
54
4
TEST(roslog_basic, lpp_syntax_severity_info) {
55
2
  LOG_INIT(*test_argv);
56
57

3
  std::string output = LPP_CAPTURE_STDOUT(LOG(I, "" << "Test"));
58



4
  ASSERT_EQ(info, removeNumbersFromString(output));
59
}
60
61
4
TEST(roslog_basic, lpp_syntax_severity_warning) {
62
2
  LOG_INIT(*test_argv);
63
64

3
  std::string output = LPP_CAPTURE_STDERR(LOG(W, "" << "Test"));
65



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
66
}
67
68
4
TEST(roslog_basic, lpp_syntax_severity_error) {
69
2
  LOG_INIT(*test_argv);
70
71

3
  std::string output = LPP_CAPTURE_STDERR(LOG(E, "" << "Test"));
72



4
  ASSERT_EQ(error, removeNumbersFromString(output));
73
}
74
75
4
TEST(roslog_basic, lpp_syntax_severity_fatal) {
76
2
  LOG_INIT(*test_argv);
77
78

3
  std::string output = LPP_CAPTURE_STDERR(LOG(F, "" << "Test"));
79



4
  ASSERT_EQ(fatal, removeNumbersFromString(output));
80
}
81
82
//! ################ Roslog ################
83
4
TEST(roslog_basic, roslog_syntax_severity_debug) {
84
2
  LOG_INIT(*test_argv);
85
86



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG("Test"));
87



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
88
}
89
90
4
TEST(roslog_basic, roslog_syntax_severity_debug_stream) {
91
2
  LOG_INIT(*test_argv);
92
93




4
  std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG_STREAM("Test"));
94



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
95
}
96
97
4
TEST(roslog_basic, roslog_syntax_severity_info) {
98
2
  LOG_INIT(*test_argv);
99
100



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_INFO("Test"));
101



4
  ASSERT_EQ(info, removeNumbersFromString(output));
102
}
103
104
4
TEST(roslog_basic, roslog_syntax_severity_info_stream) {
105
2
  LOG_INIT(*test_argv);
106
107





4
  std::string output = LPP_CAPTURE_STDOUT(ROS_INFO_STREAM("" << "Test"));
108



4
  ASSERT_EQ(info, removeNumbersFromString(output));
109
}
110
111
4
TEST(roslog_basic, roslog_syntax_severity_warn) {
112
2
  LOG_INIT(*test_argv);
113
114



3
  std::string output = LPP_CAPTURE_STDERR(ROS_WARN("Test"));
115



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
116
}
117
118
4
TEST(roslog_basic, roslog_syntax_severity_warn_stream) {
119
2
  LOG_INIT(*test_argv);
120
121





4
  std::string output = LPP_CAPTURE_STDERR(ROS_WARN_STREAM("" << "Test"));
122



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
123
}
124
125
4
TEST(roslog_basic, roslog_syntax_severity_error) {
126
2
  LOG_INIT(*test_argv);
127
128



3
  std::string output = LPP_CAPTURE_STDERR(ROS_ERROR("Test"));
129



4
  ASSERT_EQ(error, removeNumbersFromString(output));
130
}
131
132
4
TEST(roslog_basic, roslog_syntax_severity_error_stream) {
133
2
  LOG_INIT(*test_argv);
134
135





4
  std::string output = LPP_CAPTURE_STDERR(ROS_ERROR_STREAM("" << "Test"));
136



4
  ASSERT_EQ(error, removeNumbersFromString(output));
137
}
138
139
4
TEST(roslog_basic, roslog_syntax_severity_fatal) {
140
2
  LOG_INIT(*test_argv);
141
142



3
  std::string output = LPP_CAPTURE_STDERR(ROS_FATAL("Test"));
143



4
  ASSERT_EQ(fatal, removeNumbersFromString(output));
144
}
145
146
2
TEST(roslog_basic, roslog_syntax_severity_fatal_stream) {
147
1
  LOG_INIT(*test_argv);
148
149





3
  std::string output = LPP_CAPTURE_STDERR(ROS_FATAL_STREAM("" << "Test"));
150
2
  ASSERT_EQ(fatal, removeNumbersFromString(output));
151
}