| 1 | // Copyright (C) 2007 Anthony Williams
|
|---|
| 2 | //
|
|---|
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|---|
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|---|
| 5 | #include <boost/thread/thread.hpp>
|
|---|
| 6 | #include <boost/test/unit_test.hpp>
|
|---|
| 7 |
|
|---|
| 8 | void do_nothing()
|
|---|
| 9 | {}
|
|---|
| 10 |
|
|---|
| 11 | void test_move_on_construction()
|
|---|
| 12 | {
|
|---|
| 13 | boost::thread x=boost::thread(do_nothing);
|
|---|
| 14 | x.join();
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | boost::thread make_thread()
|
|---|
| 18 | {
|
|---|
| 19 | return boost::thread(do_nothing);
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | void test_move_from_function_return()
|
|---|
| 23 | {
|
|---|
| 24 | boost::thread x=make_thread();
|
|---|
| 25 | x.join();
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | boost::thread make_thread1()
|
|---|
| 29 | {
|
|---|
| 30 | boost::thread x=make_thread();
|
|---|
| 31 | return boost::move(x);
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
|
|---|
| 35 | {
|
|---|
| 36 | boost::unit_test_framework::test_suite* test =
|
|---|
| 37 | BOOST_TEST_SUITE("Boost.Threads: thread move test suite");
|
|---|
| 38 |
|
|---|
| 39 | test->add(BOOST_TEST_CASE(test_move_on_construction));
|
|---|
| 40 | test->add(BOOST_TEST_CASE(test_move_from_function_return));
|
|---|
| 41 | return test;
|
|---|
| 42 | }
|
|---|