Skip to content

Commit

Permalink
#1736: Tests: Move test body of test_construct_1 and test_construct_d…
Browse files Browse the repository at this point in the history
…istributed_1 to separate functions and then use them in corresponding .cc files for both test_construct.cc and test_construct_no_idx.extended.cc
  • Loading branch information
JacobDomagala committed Apr 18, 2022
1 parent d3e4ce0 commit ab48080
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
11 changes: 4 additions & 7 deletions tests/unit/collection/test_collection_construct_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ struct ConstructParams {
TYPED_TEST_SUITE_P(TestConstruct);
TYPED_TEST_SUITE_P(TestConstructDist);

TYPED_TEST_P(TestConstruct, test_construct_1) {
using ColType = TypeParam;
template<typename ColType>
void test_construct_1() {
using MsgType = typename ColType::MsgType;

auto const& this_node = theContext()->getNode();
Expand All @@ -121,8 +121,8 @@ TYPED_TEST_P(TestConstruct, test_construct_1) {
}
}

TYPED_TEST_P(TestConstructDist, test_construct_distributed_1) {
using ColType = TypeParam;
template<typename ColType>
void test_construct_distributed_1() {
using MsgType = typename ColType::MsgType;

auto const& col_size = 32;
Expand All @@ -134,9 +134,6 @@ TYPED_TEST_P(TestConstructDist, test_construct_distributed_1) {
>();
}

REGISTER_TYPED_TEST_SUITE_P(TestConstruct, test_construct_1);
REGISTER_TYPED_TEST_SUITE_P(TestConstructDist, test_construct_distributed_1);

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

#endif /*INCLUDED_UNIT_COLLECTION_TEST_COLLECTION_CONSTRUCT_COMMON_H*/
11 changes: 11 additions & 0 deletions tests/unit/collection/test_construct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ struct ColMsg : CollectionMessage<TestCol> { };
using CollectionTestTypes = testing::Types<default_::TestCol>;
using CollectionTestDistTypes = testing::Types<default_::TestCol>;

TYPED_TEST_P(TestConstruct, test_construct_basic_1) {
test_construct_1<TypeParam>();
}

TYPED_TEST_P(TestConstructDist, test_construct_distributed_basic_1) {
test_construct_distributed_1<TypeParam>();
}

REGISTER_TYPED_TEST_SUITE_P(TestConstruct, test_construct_basic_1);
REGISTER_TYPED_TEST_SUITE_P(TestConstructDist, test_construct_distributed_basic_1);

INSTANTIATE_TYPED_TEST_SUITE_P(
test_construct_simple, TestConstruct, CollectionTestTypes, DEFAULT_NAME_GEN
);
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/collection/test_construct_no_idx.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ struct ColMsg : CollectionMessage<TestCol> {};

using CollectionTestTypes = testing::Types<multi_param_no_idx_::TestCol>;

TYPED_TEST_P(TestConstruct, test_construct_no_idx_extended_1) {
test_construct_1<TypeParam>();
}

TYPED_TEST_P(TestConstructDist, test_construct_distributed_no_idx_extended_1) {
test_construct_distributed_1<TypeParam>();
}

REGISTER_TYPED_TEST_SUITE_P(TestConstruct, test_construct_no_idx_extended_1);
REGISTER_TYPED_TEST_SUITE_P(TestConstructDist, test_construct_distributed_no_idx_extended_1);

INSTANTIATE_TYPED_TEST_SUITE_P(
test_construct_no_idx, TestConstruct, CollectionTestTypes, DEFAULT_NAME_GEN
);
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/collection/test_send.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ struct TestCollectionSendMem : TestParallelHarness {};
TYPED_TEST_SUITE_P(TestCollectionSend);
TYPED_TEST_SUITE_P(TestCollectionSendMem);

template<typename TypeParam>
template<typename ColType>
void test_collection_send_1() {
using ColType = TypeParam;
using MsgType = typename ColType::MsgType;
using TestParamType = typename ColType::ParamType;

Expand All @@ -166,9 +165,8 @@ void test_collection_send_1() {
}
}

template<typename TypeParam>
template<typename ColType>
void test_collection_send_ptm_1(){
using ColType = TypeParam;
using MsgType = typename ColType::MsgType;
using TestParamType = typename ColType::ParamType;

Expand Down

0 comments on commit ab48080

Please sign in to comment.