4 #include <catch_ros/catch.hpp>
6 #include "../../src/monitor/log_parser.h"
19 lastEvent = std::move(event);
30 CHECK(lastEvent.
message ==
"This is an info message");
34 parser.
processString(
"\e[31mThis is an error message\e[0m\n");
37 CHECK(lastEvent.
message ==
"This is an error message");
44 CHECK(lastEvent.
message ==
"This is a debug message");
48 parser.
processString(
"\e[33mThis is a warning message\e[0m\n");
51 CHECK(lastEvent.
message ==
"This is a warning message");
58 parser.
processString(
"This is a raw \e[31mred\e[0m message\n");
61 CHECK(lastEvent.
message ==
"This is a raw \e[31mred\e[0m message");
65 parser.
processString(
"\e[33mThis is a warning message with an end\e[0m and another start \e[33m and another end!\e[0m\n");
68 CHECK(lastEvent.
message ==
"\e[33mThis is a warning message with an end\e[0m and another start \e[33m and another end!\e[0m");
75 auto t0 = std::chrono::steady_clock::time_point();
76 auto t1 = t0 + std::chrono::milliseconds(500);
78 parser.
processString(
"\e[33mThis is a warning message without its end!\n", t0);
87 CHECK(lastEvent.
message ==
"\e[33mThis is a warning message without its end!");
94 auto t0 = std::chrono::steady_clock::time_point();
96 parser.
processString(
"\e[33mThis is a warning message without its end!\n", t0);
101 CHECK(captures == 0);
104 CHECK(captures == 1);
106 CHECK(lastEvent.
message ==
"\e[33mThis is a warning message without its end!");