GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: test/roslog/test_roslog_rosprintf.cc Lines: 60 60 100.0 %
Date: 2025-03-04 18:34:12 Branches: 184 434 42.4 %

Line Branch Exec Source
1
#include <gtest/gtest.h>
2
#include <test_utils.h>
3
#include <log++.h>
4
5
using namespace lpp::rosprintf;
6
using namespace lpp::testing;
7
8
4
TEST(roslog_rosprintf, ros_debug) {
9
2
  LOG_INIT(*test_argv);
10
11



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG(ERROR_MESSAGE, 3.3, 5.5));
12



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
13
}
14
15
4
TEST(roslog_rosprintf, ros_debug_once) {
16
2
  LOG_INIT(*test_argv);
17
18



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG_ONCE(ERROR_MESSAGE, 3.3, 5.5));
19



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
20
}
21
22
4
TEST(roslog_rosprintf, ros_debug_throttle) {
23
2
  LOG_INIT(*test_argv);
24
25




3
  std::string output = LPP_CAPTURE_STDOUT(ROS_DEBUG_THROTTLE(1, ERROR_MESSAGE, 3.3, 5.5));
26



4
  ASSERT_EQ(debug, removeNumbersFromString(output));
27
}
28
29
4
TEST(roslog_rosprintf, ros_info) {
30
2
  LOG_INIT(*test_argv);
31
32



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_INFO(ERROR_MESSAGE, 3.3, 5.5));
33



4
  ASSERT_EQ(info, removeNumbersFromString(output));
34
}
35
36
4
TEST(roslog_rosprintf, ros_info_once) {
37
2
  LOG_INIT(*test_argv);
38
39



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_INFO_ONCE(ERROR_MESSAGE, 3.3, 5.5));
40



4
  ASSERT_EQ(info, removeNumbersFromString(output));
41
}
42
43
4
TEST(roslog_rosprintf, ros_info_throttle) {
44
2
  LOG_INIT(*test_argv);
45
46




3
  std::string output = LPP_CAPTURE_STDOUT(ROS_INFO_THROTTLE(1, ERROR_MESSAGE, 3.3, 5.5));
47



4
  ASSERT_EQ(info, removeNumbersFromString(output));
48
}
49
50
4
TEST(roslog_rosprintf, ros_warn) {
51
2
  LOG_INIT(*test_argv);
52
53



3
  std::string output = LPP_CAPTURE_STDERR(ROS_WARN(ERROR_MESSAGE, 3.3, 5.5));
54



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
55
}
56
57
4
TEST(roslog_rosprintf, ros_warn_once) {
58
2
  LOG_INIT(*test_argv);
59
60



3
  std::string output = LPP_CAPTURE_STDERR(ROS_WARN_ONCE(ERROR_MESSAGE, 3.3, 5.5));
61



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
62
}
63
64
4
TEST(roslog_rosprintf, ros_warn_throttle) {
65
2
  LOG_INIT(*test_argv);
66
67




3
  std::string output = LPP_CAPTURE_STDERR(ROS_WARN_THROTTLE(1, ERROR_MESSAGE, 3.3, 5.5));
68



4
  ASSERT_EQ(warning, removeNumbersFromString(output));
69
}
70
71
4
TEST(roslog_rosprintf, ros_error) {
72
2
  LOG_INIT(*test_argv);
73
74



3
  std::string output = LPP_CAPTURE_STDERR(ROS_ERROR(ERROR_MESSAGE, 3.3, 5.5));
75



4
  ASSERT_EQ(error, removeNumbersFromString(output));
76
}
77
78
4
TEST(roslog_rosprintf, ros_error_once) {
79
2
  LOG_INIT(*test_argv);
80
81



3
  std::string output = LPP_CAPTURE_STDERR(ROS_ERROR_ONCE(ERROR_MESSAGE, 3.3, 5.5));
82



4
  ASSERT_EQ(error, removeNumbersFromString(output));
83
}
84
85
4
TEST(roslog_rosprintf, ros_error_throttle) {
86
2
  LOG_INIT(*test_argv);
87
88




3
  std::string output = LPP_CAPTURE_STDERR(ROS_ERROR_THROTTLE(1, ERROR_MESSAGE, 3.3, 5.5));
89



4
  ASSERT_EQ(error, removeNumbersFromString(output));
90
}
91
92
4
TEST(roslog_rosprintf, ros_fatal) {
93
2
  LOG_INIT(*test_argv);
94
95



3
  std::string output = LPP_CAPTURE_STDERR(ROS_FATAL(ERROR_MESSAGE, 3.3, 5.5));
96



4
  ASSERT_EQ(fatal, removeNumbersFromString(output));
97
}
98
99
4
TEST(roslog_rosprintf, ros_fatal_once) {
100
2
  LOG_INIT(*test_argv);
101
102



3
  std::string output = LPP_CAPTURE_STDERR(ROS_FATAL_ONCE(ERROR_MESSAGE, 3.3, 5.5));
103



4
  ASSERT_EQ(fatal, removeNumbersFromString(output));
104
}
105
106
2
TEST(roslog_rosprintf, ros_fatal_throttle) {
107
1
  LOG_INIT(*test_argv);
108
109




2
  std::string output = LPP_CAPTURE_STDERR(ROS_FATAL_THROTTLE(1, ERROR_MESSAGE, 3.3, 5.5));
110
2
  ASSERT_EQ(fatal, removeNumbersFromString(output));
111
}