From 39f9afcdb1c41bb3527971e5b91826bca11388c3 Mon Sep 17 00:00:00 2001 From: molpopgen Date: Thu, 11 Mar 2021 03:13:52 -0800 Subject: [PATCH] Add test for move construction into a named_type. See #336 --- testsuite/Makefile.am | 1 + testsuite/unit/test_named_type.cc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 testsuite/unit/test_named_type.cc diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 7a83cb9f1..8c042897d 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -18,6 +18,7 @@ unit_fwdpp_unit_tests_SOURCES=unit/fwdpp_unit_tests.cc unit/mutateTest.cc unit/g unit/test_enum_bitflags.cc \ unit/test_nested_forward_lists.cc \ unit/test_validators.cc \ + unit/test_named_type.cc \ fixtures/sugar_fixtures.cc \ fixtures/fwdpp_fixtures.hpp \ fixtures/sugar_fixtures.hpp \ diff --git a/testsuite/unit/test_named_type.cc b/testsuite/unit/test_named_type.cc new file mode 100644 index 000000000..cadd84e50 --- /dev/null +++ b/testsuite/unit/test_named_type.cc @@ -0,0 +1,16 @@ +#include +#include +#include + +BOOST_AUTO_TEST_SUITE(test_named_type) + +BOOST_AUTO_TEST_CASE(test_move_construction) +{ + struct nt_tag{}; + using vec = fwdpp::strong_types::named_type, nt_tag>; + std::vector x{1,2,3,4,5,6}; + vec v{std::move(x)}; + BOOST_CHECK(x.empty()); +} + +BOOST_AUTO_TEST_SUITE_END()