GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: test/nolog/test_nolog_first_n.cc Lines: 75 75 100.0 %
Date: 2025-03-04 18:34:12 Branches: 90 236 38.1 %

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_LogFirstN, lpp_syntax_severity_debug) {
10
2
  LOG_INIT(*test_argv);
11
12
12
  for (int i = 0; i < 5; i++) {
13
15
    std::string output = LPP_CAPTURE_STDOUT(LOG_FIRST(D, 3, "Test" << 123));
14


10
    ASSERT_EQ(output, "");
15
  }
16
}
17
18
4
TEST(nolog_LogFirstN, lpp_syntax_severity_info) {
19
2
  LOG_INIT(*test_argv);
20
21
12
  for (int i = 0; i < 5; i++) {
22
15
    std::string output = LPP_CAPTURE_STDOUT(LOG_FIRST(I, 3, "Test" << 123));
23


10
    ASSERT_EQ(output, "");
24
  }
25
}
26
27
4
TEST(nolog_LogFirstN, lpp_syntax_severity_warning) {
28
2
  LOG_INIT(*test_argv);
29
30
12
  for (int i = 0; i < 5; i++) {
31
15
    std::string output = LPP_CAPTURE_STDERR(LOG_FIRST(W, 3, "Test" << 123));
32


10
    ASSERT_EQ(output, "");
33
  }
34
}
35
36
4
TEST(nolog_LogFirstN, lpp_syntax_severity_error) {
37
2
  LOG_INIT(*test_argv);
38
39
12
  for (int i = 0; i < 5; i++) {
40
15
    std::string output = LPP_CAPTURE_STDERR(LOG_FIRST(E, 3, "Test" << 123));
41


10
    ASSERT_EQ(output, "");
42
  }
43
}
44
45
4
TEST(nolog_LogFirstN, lpp_syntax_severity_fatal) {
46
2
  LOG_INIT(*test_argv);
47
48
12
  for (int i = 0; i < 5; i++) {
49
15
    std::string output = LPP_CAPTURE_STDERR(LOG_FIRST(F, 3, "Test" << 123));
50


10
    ASSERT_EQ(output, "");
51
  }
52
}
53
54
4
TEST(nolog_LogFirstN, glog_syntax_severity_debug) {
55
2
  LOG_INIT(*test_argv);
56
57
12
  for (int i = 0; i < 5; i++) {
58
    std::string output =
59

15
        LPP_CAPTURE_STDOUT(DLOG_FIRST_N(INFO, 3) << "Test" << 123);
60


10
    ASSERT_EQ(output, "");
61
  }
62
}
63
64
4
TEST(nolog_LogFirstN, glog_syntax_severity_info) {
65
2
  LOG_INIT(*test_argv);
66
67
12
  for (int i = 0; i < 5; i++) {
68
    std::string output =
69

15
        LPP_CAPTURE_STDOUT(LOG_FIRST_N(INFO, 3) << "Test" << 123);
70


10
    ASSERT_EQ(output, "");
71
  }
72
}
73
74
4
TEST(nolog_LogFirstN, glog_syntax_severity_warning) {
75
2
  LOG_INIT(*test_argv);
76
77
12
  for (int i = 0; i < 5; i++) {
78
    std::string output =
79

15
        LPP_CAPTURE_STDERR(LOG_FIRST_N(WARNING, 3) << "Test" << 123);
80


10
    ASSERT_EQ(output, "");
81
  }
82
}
83
84
4
TEST(nolog_LogFirstN, glog_syntax_severity_error) {
85
2
  LOG_INIT(*test_argv);
86
87
12
  for (int i = 0; i < 5; i++) {
88
    std::string output =
89

15
        LPP_CAPTURE_STDERR(LOG_FIRST_N(ERROR, 3) << "Test" << 123);
90


10
    ASSERT_EQ(output, "");
91
  }
92
}
93
94
4
TEST(nolog_LogFirstN, glog_syntax_severity_fatal) {
95
2
  LOG_INIT(*test_argv);
96
97
12
  for (int i = 0; i < 5; i++) {
98
    std::string output =
99

15
        LPP_CAPTURE_STDERR(LOG_FIRST_N(FATAL, 3) << "Test" << 123);
100


10
    ASSERT_EQ(output, "");
101
  }
102
}
103
104
4
TEST(nolog_LogFirstN, ros_debug_once) {
105
2
  LOG_INIT(*test_argv);
106
107
12
  for (int i = 0; i < 5; i++) {
108

15
    std::string output = LPP_CAPTURE_STDERR(ROS_DEBUG_ONCE("Test123"));
109


10
    ASSERT_EQ(output, "");
110
  }
111
}
112
113
4
TEST(nolog_LogFirstN, ros_info_once) {
114
2
  LOG_INIT(*test_argv);
115
116
12
  for (int i = 0; i < 5; i++) {
117

15
    std::string output = LPP_CAPTURE_STDOUT(ROS_INFO_ONCE("Test123"));
118


10
    ASSERT_EQ(output, "");
119
  }
120
}
121
122
4
TEST(nolog_LogFirstN, ros_warn_once) {
123
2
  LOG_INIT(*test_argv);
124
125
12
  for (int i = 0; i < 5; i++) {
126

15
    std::string output = LPP_CAPTURE_STDERR(ROS_WARN_ONCE("Test123"));
127


10
    ASSERT_EQ(output, "");
128
  }
129
}
130
131
4
TEST(nolog_LogFirstN, ros_error_once) {
132
2
  LOG_INIT(*test_argv);
133
134
12
  for (int i = 0; i < 5; i++) {
135

15
    std::string output = LPP_CAPTURE_STDERR(ROS_ERROR_ONCE("Test123"));
136


10
    ASSERT_EQ(output, "");
137
  }
138
}
139
140
2
TEST(nolog_LogFirstN, ros_fatal_once) {
141
1
  LOG_INIT(*test_argv);
142
143
6
  for (int i = 0; i < 5; i++) {
144

10
    std::string output = LPP_CAPTURE_STDERR(ROS_FATAL_ONCE("Test123"));
145
5
    ASSERT_EQ(output, "");
146
  }
147
}