class MessageQueueTest : public CommonRuntimeTest { protected:
MessageQueueTest() { this->use_boot_image_ = true; // Make the Runtime creation cheaper.
}
};
namespace {
// Define some message types struct EmptyMessage {}; struct IntMessage { int value;
}; struct OtherIntMessage { int other_value;
}; struct TwoIntMessage { int value1; int value2;
}; struct StringMessage {
std::string message;
};
using TestMessageQueue =
MessageQueue<EmptyMessage, IntMessage, OtherIntMessage, TwoIntMessage, StringMessage>;
ASSERT_EQ(message.other_value, 43);
}, // The timeout message is here to make sure the cases can go in any order
[&]([[maybe_unused]] const TimeoutExpiredMessage& message) {
ASSERT_FALSE(timeout_received);
timeout_received = true;
},
[&](const TwoIntMessage& message) {
ASSERT_FALSE(two_int_received);
two_int_received = true;
// Send the messages for (constauto& message : messages) {
queue.SendMessage(message);
}
queue.SetTimeout(500);
// Receive the messages. Make sure they came in order, except for the TimeoutExpiredMessage, which // can come at any time. bool received_timeout = false;
size_t i = 0; while (i < messages.size()) { auto message = queue.ReceiveMessage(); if (std::holds_alternative<TimeoutExpiredMessage>(message)) {
ASSERT_FALSE(received_timeout);
received_timeout = true;
} else {
ASSERT_EQ(message.index(), messages[i].index());
i++;
}
} if (!received_timeout) { // If we have not received the timeout yet, receive one more message and make sure it's the // timeout.
ASSERT_TRUE(std::holds_alternative<TimeoutExpiredMessage>(queue.ReceiveMessage()));
}
}
} // namespace art
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.11Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.