GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: test/nolog/test_nolog_every_n.cc Lines: 50 50 100.0 %
Date: 2025-03-04 18:34:12 Branches: 55 146 37.7 %

Line Branch Exec Source
1
//
2
// Created by acey on 06.09.23.
3
//
4
5
#include <gtest/gtest.h>
6
#include <log++.h>
7
#include <test_utils.h>
8
9
4
TEST(nolog_LogEveryN, 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_EVERY(D, 3, "Test" << 123));
14


10
    ASSERT_EQ(output, "");
15
  }
16
}
17
18
4
TEST(nolog_LogEveryN, 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_EVERY(I, 3, "Test" << 123));
23


10
    ASSERT_EQ(output, "");
24
  }
25
}
26
27
4
TEST(nolog_LogEveryN, 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_EVERY(W, 3, "Test" << 123));
32


10
    ASSERT_EQ(output, "");
33
  }
34
}
35
36
4
TEST(nolog_LogEveryN, 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_EVERY(E, 3, "Test" << 123));
41


10
    ASSERT_EQ(output, "");
42
  }
43
}
44
45
4
TEST(nolog_LogEveryN, 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_EVERY(F, 3, "Test" << 123));
50


10
    ASSERT_EQ(output, "");
51
  }
52
}
53
54
4
TEST(nolog_LogEveryN, 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_EVERY_N(INFO, 3) << "Test" << 123);
60


10
    ASSERT_EQ(output, "");
61
  }
62
}
63
64
4
TEST(nolog_LogEveryN, 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_EVERY_N(INFO, 3) << "Test" << 123);
70


10
    ASSERT_EQ(output, "");
71
  }
72
}
73
74
4
TEST(nolog_LogEveryN, 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_EVERY_N(WARNING, 3) << "Test" << 123);
80


10
    ASSERT_EQ(output, "");
81
  }
82
}
83
84
4
TEST(nolog_LogEveryN, 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_EVERY_N(ERROR, 3) << "Test" << 123);
90


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

10
        LPP_CAPTURE_STDERR(LOG_EVERY_N(FATAL, 3) << "Test" << 123);
100
5
    ASSERT_EQ(output, "");
101
  }
102
}