From 04d7e933722d1f4cfc7e464dafeb53a3ee805688 Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Thu, 15 Oct 2020 19:29:02 -0700 Subject: [PATCH] #1111: tests: assert that data matches on other end --- tests/unit/active/test_active_send_large.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/unit/active/test_active_send_large.cc b/tests/unit/active/test_active_send_large.cc index 014e39b400..1ce1292e12 100644 --- a/tests/unit/active/test_active_send_large.cc +++ b/tests/unit/active/test_active_send_large.cc @@ -76,12 +76,29 @@ struct LargeMsg< typename std::enable_if_t::value> > : TestStaticBytesMsg { }; +template +void fillMsg(T msg) { + auto arr = reinterpret_cast(&msg->payload[0]); + for (std::size_t i = 0; i < msg->bytes / sizeof(int64_t); i++) { + arr[i] = i; + } +} + +template +void checkMsg(T msg) { + auto arr = reinterpret_cast(&msg->payload[0]); + for (std::size_t i = 0; i < msg->bytes / sizeof(int64_t); i++) { + EXPECT_EQ(arr[i], i); + } +} + template struct TestActiveSendLarge : TestParallelHarness { using TagType = typename std::tuple_element<1,T>::type; template static void myHandler(MsgT* m) { + checkMsg(m); auto msg = makeMessage(); m->cb_.send(msg.get()); } @@ -113,6 +130,7 @@ TYPED_TEST_P(TestActiveSendLarge, test_large_bytes_msg) { vt::runInEpochCollective([&]{ NodeType next_node = (this_node + 1) % num_nodes; auto msg = makeMessage(); + fillMsg(msg); msg->cb_ = cb; theMsg()->sendMsg>( next_node, msg