blob: 9e30afbe128d763cd385ef5dc4cce8c2d4fecbbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include "kernel/tests/log_buffer.hpp"
#include <algorithm>
#include <string>
#include <vector>
namespace kernel::tests::log_buffer
{
namespace
{
std::vector<std::string> recorded_messages{};
}
auto append(std::string const & message) -> void
{
recorded_messages.push_back(message);
}
auto clear() -> void
{
recorded_messages.clear();
}
auto flat_messages() -> std::string
{
return std::ranges::fold_left(recorded_messages, std::string{},
[](std::string accumulator, std::string const & message) {
accumulator += message;
return accumulator;
});
}
auto messages() -> std::vector<std::string> const &
{
return recorded_messages;
}
} // namespace kernel::tests::log_buffer
|