10 #include <gtest/gtest.h>
11 #include "../../include/message_bus.hpp"
13 TEST(message_test, test_push_message_and_get_one_message) {
15 test_subject->push_message(
new message(1, make_data(23)));
16 auto message = test_subject->get_next_message();
18 ASSERT_FALSE(test_subject->get_next_message());
21 delete (test_subject);
24 TEST(message_test, test_push_message_and_get_100_messages) {
26 for (uint16_t i = 0; i < 100; i++) {
27 test_subject->push_message(
new message(1, make_data(i)));
29 for (uint16_t i = 0; i < 100; i++) {
30 auto message = test_subject->get_next_message();
35 ASSERT_FALSE(test_subject->get_next_message());
36 delete (test_subject);
39 int main(
int argc,
char **argv) {
40 ::testing::InitGoogleTest(&argc, argv);
41 return RUN_ALL_TESTS();
A message object passed around in the message bus. Holds anything created with make_data<>().
This class handles a small queue for messages.