|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53310 - trunk/libs/signals2/test
From: fmhess_at_[hidden]
Date: 2009-05-27 13:26:20
Author: fmhess
Date: 2009-05-27 13:26:19 EDT (Wed, 27 May 2009)
New Revision: 53310
URL: http://svn.boost.org/trac/boost/changeset/53310
Log:
Added a little test of a signal taking a reference argument.
Text files modified:
trunk/libs/signals2/test/signal_test.cpp | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
Modified: trunk/libs/signals2/test/signal_test.cpp
==============================================================================
--- trunk/libs/signals2/test/signal_test.cpp (original)
+++ trunk/libs/signals2/test/signal_test.cpp 2009-05-27 13:26:19 EDT (Wed, 27 May 2009)
@@ -1,6 +1,9 @@
// Boost.Signals library
-// Copyright Douglas Gregor 2001-2003. Use, modification and
+// Copyright Frank Mori Hess 2008-2009.
+// Copyright Douglas Gregor 2001-2003.
+//
+// Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -215,6 +218,23 @@
}
}
+void increment_arg(int &value)
+{
+ ++value;
+}
+
+static void
+test_reference_args()
+{
+ typedef boost::signals2::signal<void (int &value)> signal_type;
+ signal_type s1;
+
+ s1.connect(&increment_arg);
+ int value = 0;
+ s1(value);
+ BOOST_CHECK(value == 1);
+}
+
int
test_main(int, char* [])
{
@@ -223,6 +243,7 @@
test_signal_signal_connect();
test_extended_slot<void>();
test_extended_slot<int>();
+ test_reference_args();
return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk