Skip to content

Commit

Permalink
#2212: tests: add a simple test for message properties
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Nov 9, 2023
1 parent 96689ec commit 5547342
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/vt/messaging/pending_send.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ struct PendingSend final {
*/
void release();

/**
* \internal \brief Get the message stored in the pending send
*
* \note Used for testing purposes
*
* \return a reference to the message
*/
MsgPtr<BaseMsgType>& getMsg() { return msg_; }

private:

/**
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/active/test_active_send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,21 @@ TEST_F(TestActiveSend, test_active_message_serialization) {
EXPECT_EQ(handler_count, num_msg_sent);
}

void testPropertiesHandler(int a, double b) {
// do nothing
}

TEST_F(TestActiveSend, test_active_message_properties) {
auto const this_node = theContext()->getNode();
auto const num_nodes = theContext()->getNumNodes();
NodeType const next_node = (this_node + 1) % num_nodes;

if (num_nodes > 1) {
auto ps = theMsg()->send<testPropertiesHandler>(
vt::Node{next_node}, MsgProps().asTerminationMsg(), 10, 20.0
);
EXPECT_TRUE(messaging::envelopeIsTerm(ps.getMsg()->env));
}
}

}}}} // end namespace vt::tests::unit::send

0 comments on commit 5547342

Please sign in to comment.