Skip to content

Commit

Permalink
#1111: tests: assert that data matches on other end
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Oct 16, 2020
1 parent 16f1b6e commit 04d7e93
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/active/test_active_send_large.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,29 @@ struct LargeMsg<
typename std::enable_if_t<std::is_same<T, NonSerializedTag>::value>
> : TestStaticBytesMsg<CallbackMsg, nbytes> { };

template <typename T>
void fillMsg(T msg) {
auto arr = reinterpret_cast<int64_t*>(&msg->payload[0]);
for (std::size_t i = 0; i < msg->bytes / sizeof(int64_t); i++) {
arr[i] = i;
}
}

template <typename T>
void checkMsg(T msg) {
auto arr = reinterpret_cast<int64_t*>(&msg->payload[0]);
for (std::size_t i = 0; i < msg->bytes / sizeof(int64_t); i++) {
EXPECT_EQ(arr[i], i);
}
}

template <typename T>
struct TestActiveSendLarge : TestParallelHarness {
using TagType = typename std::tuple_element<1,T>::type;

template <typename MsgT>
static void myHandler(MsgT* m) {
checkMsg(m);
auto msg = makeMessage<RecvMsg>();
m->cb_.send(msg.get());
}
Expand Down Expand Up @@ -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<LargeMsgType>();
fillMsg(msg);
msg->cb_ = cb;
theMsg()->sendMsg<LargeMsgType, ThisType::template myHandler<LargeMsgType>>(
next_node, msg
Expand Down

0 comments on commit 04d7e93

Please sign in to comment.