23 #include <gtest/gtest.h> 26 #include <rosgraph_msgs/Log.h> 38 Aws::Utils::Logging::LogLevel log_level)
40 logger->Log(log_level, tag, message);
44 TEST(AWSROSLoggerTest, TestLogMethod)
46 aws_logger_t logger = std::make_shared<AWSROSLogger>(Aws::Utils::Logging::LogLevel::Error);
49 CreateTestLog(logger,
"test_tag_1",
"test_log_message_1", Aws::Utils::Logging::LogLevel::Error);
51 CreateTestLog(logger,
"test_tag_2",
"test_log_message_2", Aws::Utils::Logging::LogLevel::Fatal);
56 std::string expected_msg_1 =
"[test_tag_1] test_log_message_1";
57 std::string expected_msg_2 =
"[test_tag_2] test_log_message_2";
59 EXPECT_EQ(published_log.msg.compare(expected_msg_1) == 0 ||
60 published_log.msg.compare(expected_msg_2) == 0,
67 int main(
int argc,
char ** argv)
69 testing::InitGoogleTest(&argc, argv);
77 int ret = RUN_ALL_TESTS();
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void CreateTestLog(aws_logger_t logger, const char *tag, const char *message, Aws::Utils::Logging::LogLevel log_level)
ROSCPP_DECL CallbackQueue * getGlobalCallbackQueue()
std::shared_ptr< AWSLogSystem > aws_logger_t
TEST(AWSROSLoggerTest, TestLogMethod)
void RosoutLoggerCallback(const rosgraph_msgs::Log &published_log)
std::atomic< int > message_count
int main(int argc, char **argv)