2
0
mirror of https://github.com/boostorg/context.git synced 2026-01-24 05:42:16 +00:00

add unit-test for passing pointers between execution_context

This commit is contained in:
Oliver Kowalke
2016-02-09 16:55:04 +01:00
parent 0f2cde5e1d
commit 31a196f12c

View File

@@ -41,6 +41,9 @@ struct Y {
value1 = 3;
}
Y( Y const&) = delete;
Y & operator=( Y const&) = delete;
~Y() {
value1 = 7;
}
@@ -183,6 +186,11 @@ ctx::execution_context< variant_t > fn14( ctx::execution_context< variant_t > ct
return ctx;
}
ctx::execution_context< Y * > fn15( ctx::execution_context< Y * > ctx, Y * py) {
ctx( py);
return ctx;
}
void test_move() {
value1 = 0;
@@ -343,6 +351,13 @@ void test_one_arg() {
std::tie( ctx, k) = ctx( i);
BOOST_CHECK( & i != & k);
}
{
Y y;
Y * py = nullptr;
ctx::execution_context< Y * > ctx( fn15);
std::tie( ctx, py) = ctx( & y);
BOOST_CHECK( py == & y);
}
{
moveable m1( 7), m2;
BOOST_CHECK( 7 == m1.value);