blob: 0dd4b8c1ba4876fd1afd53cc240b0e0d1a7c168c (
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
40
41
42
43
|
#include <kapi/cio.hpp>
#include "kernel/tests/log_buffer.hpp"
#include <iostream>
#include <string>
#include <string_view>
namespace kapi::cio
{
namespace
{
class test_output_device : public output_device
{
public:
test_output_device() = default;
auto write(output_stream stream, std::string_view text) -> void override
{
auto & standard_stream = stream == output_stream::stdout ? std::cout : std::cerr;
standard_stream << text;
if (text != "\n")
{
kernel::tests::log_buffer::append(std::string{text});
}
}
} device{};
} // namespace
auto init() -> void
{
set_output_device(device);
}
auto reset() -> void
{
kernel::tests::log_buffer::clear();
}
} // namespace kapi::cio
|