GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: test/lpp/test_lpp_rosprintf.cc Lines: 40 40 100.0 %
Date: 2025-03-04 18:34:12 Branches: 85 224 37.9 %

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

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



4
    ASSERT_EQ(output, "DEBUG " + EXPECTED_ERROR_MESSAGE);
16
}
17
18
4
TEST(lpp_rosprintf, ros_debug_once) {
19
2
  LOG_INIT(*test_argv);
20
21



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



4
  ASSERT_EQ(output, "DEBUG " + EXPECTED_ERROR_MESSAGE);
23
}
24
25
4
TEST(lpp_rosprintf, ros_info) {
26
2
  LOG_INIT(*test_argv);
27
28

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



4
  ASSERT_EQ(output, "INFO  " + EXPECTED_ERROR_MESSAGE);
30
}
31
32
4
TEST(lpp_rosprintf, ros_info_once) {
33
2
  LOG_INIT(*test_argv);
34
35



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



4
  ASSERT_EQ(output, "INFO  " + EXPECTED_ERROR_MESSAGE);
37
}
38
39
4
TEST(lpp_rosprintf, ros_warn) {
40
2
  LOG_INIT(*test_argv);
41
42

3
  std::string output = LPP_CAPTURE_STDOUT(ROS_WARN(ERROR_MESSAGE, 3.3, 5.5));
43



4
  ASSERT_EQ(output, "WARN  " + EXPECTED_ERROR_MESSAGE);
44
}
45
46
4
TEST(lpp_rosprintf, ros_warn_once) {
47
2
  LOG_INIT(*test_argv);
48
49



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_WARN_ONCE(ERROR_MESSAGE, 3.3, 5.5));
50



4
  ASSERT_EQ(output, "WARN  " + EXPECTED_ERROR_MESSAGE);
51
}
52
53
4
TEST(lpp_rosprintf, ros_error) {
54
2
  LOG_INIT(*test_argv);
55
56

3
  std::string output = LPP_CAPTURE_STDOUT(ROS_ERROR(ERROR_MESSAGE, 3.3, 5.5));
57



4
  ASSERT_EQ(output, "ERROR " + EXPECTED_ERROR_MESSAGE);
58
}
59
60
4
TEST(lpp_rosprintf, ros_error_once) {
61
2
  LOG_INIT(*test_argv);
62
63



3
  std::string output = LPP_CAPTURE_STDOUT(ROS_ERROR_ONCE(ERROR_MESSAGE, 3.3, 5.5));
64



4
  ASSERT_EQ(output, "ERROR " + EXPECTED_ERROR_MESSAGE);
65
}
66
67
4
TEST(lpp_rosprintf, ros_fatal) {
68
2
    LOG_INIT(*test_argv);
69
70

3
    std::string output = LPP_CAPTURE_STDOUT(ROS_FATAL(ERROR_MESSAGE, 3.3, 5.5));
71



4
    ASSERT_EQ(output, "FATAL " + EXPECTED_ERROR_MESSAGE);
72
}
73
74
2
TEST(lpp_rosprintf, ros_fatal_once) {
75
1
    LOG_INIT(*test_argv);
76
77



2
    std::string output = LPP_CAPTURE_STDOUT(ROS_FATAL_ONCE(ERROR_MESSAGE, 3.3, 5.5));
78
2
    ASSERT_EQ(output, "FATAL " + EXPECTED_ERROR_MESSAGE);
79
}