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");
68 auto t0 = std::chrono::steady_clock::time_point();
69 auto t1 = t0 + std::chrono::milliseconds(500);
71 parser.
processString(
"\e[33mThis is a warning message without its end!\n", t0);
80 CHECK(lastEvent.
message ==
"\e[33mThis is a warning message without its end!");
87 auto t0 = std::chrono::steady_clock::time_point();
89 parser.
processString(
"\e[33mThis is a warning message without its end!\n", t0);
99 CHECK(lastEvent.
message ==
"\e[33mThis is a warning message without its end!");
void setCallback(const std::function< void(Event &&)> &cb)
void checkPending(const std::chrono::steady_clock::time_point &time=std::chrono::steady_clock::now())
void processString(const std::string &str, const std::chrono::steady_clock::time_point &time=std::chrono::steady_clock::now())
TEST_CASE("LogParser", "[log_parser]")