$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: srajko_at_[hidden]
Date: 2007-07-05 16:43:20
Author: srajko
Date: 2007-07-05 16:43:19 EDT (Thu, 05 Jul 2007)
New Revision: 7369
URL: http://svn.boost.org/trac/boost/changeset/7369
Log:
add new tests for details and connect.
Added:
   sandbox/SOC/2007/signals/libs/signal_network/test/test_bind_object.cpp   (contents, props changed)
   sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp   (contents, props changed)
   sandbox/SOC/2007/signals/libs/signal_network/test/test_result_of_defined.cpp   (contents, props changed)
Added: sandbox/SOC/2007/signals/libs/signal_network/test/test_bind_object.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_bind_object.cpp	2007-07-05 16:43:19 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,35 @@
+// Copyright Stjepan Rajko 2007. 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)
+
+#include <boost/signal_network/connection/detail/bind_object.hpp>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+struct adder
+{
+    adder(int z) : z(z) {}
+    adder() : z(0) {}
+    
+    int add(int x, float y)
+    {
+        return x + y + z;
+    }
+    
+    int z;
+};
+
+int test_main(int, char* [])
+{
+    adder a(10);
+    
+    boost::function<int(int, float)> f;
+    
+    f = boost::signals::detail::bind_object<int(int, float), adder>()(&adder::add, a);
+    
+    BOOST_CHECK_EQUAL(f(4, 2.1), 16);
+    
+    return 0;
+}
+
Added: sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_connect.cpp	2007-07-05 16:43:19 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,36 @@
+// Copyright Stjepan Rajko 2007. 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)
+
+#include <boost/signal_network/connection/signal.hpp>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+struct receiver
+{
+    typedef void result_type;
+    
+    receiver() : stored(0) {}
+    
+    void operator()(int x)
+    {
+        stored = x;
+    }
+    
+    int stored;
+};
+
+int test_main(int, char* [])
+{
+    boost::signal<void(int)> signal;
+    receiver r;
+    
+    connect(signal, r);
+    
+    signal(3);
+    
+    BOOST_CHECK_EQUAL(r.stored, 3);
+    
+    return 0;
+}
\ No newline at end of file
Added: sandbox/SOC/2007/signals/libs/signal_network/test/test_result_of_defined.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/signals/libs/signal_network/test/test_result_of_defined.cpp	2007-07-05 16:43:19 EDT (Thu, 05 Jul 2007)
@@ -0,0 +1,55 @@
+// Copyright Stjepan Rajko 2007. 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)
+
+#include <boost/signal_network/connection/detail/result_of_defined.hpp>
+#include <boost/fusion/sequence/container/map.hpp>
+#include <boost/signal_network/component/junction.hpp>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+
+using namespace boost;
+
+struct nothing
+{
+};
+
+struct has_result_type
+{
+    typedef void result_type;
+};
+
+struct has_result
+{
+    template<typename FArgs>
+    struct result;
+    
+    template<typename T>
+    struct result<has_result(T)>
+    {
+        typedef void type;
+    };
+};
+
+int test_main(int, char* [])
+{
+//    bool value = signals::detail::result_of_defined<fusion::map<>(void)>::value;
+    BOOST_CHECK(!signals::detail::result_of_defined<fusion::map<>(int)>::value);
+    BOOST_CHECK(!signals::detail::result_of_defined<fusion::map<>()>::value);
+    BOOST_CHECK(!signals::detail::result_of_defined<nothing(int)>::value);
+    BOOST_CHECK(!signals::detail::result_of_defined<nothing()>::value);
+    BOOST_CHECK(signals::detail::result_of_defined<has_result_type(int)>::value);
+    BOOST_CHECK(signals::detail::result_of_defined<has_result_type()>::value);
+    BOOST_CHECK(signals::detail::result_of_defined<has_result(int)>::value);
+    BOOST_CHECK(!signals::detail::result_of_defined<has_result()>::value);
+    BOOST_CHECK(!signals::detail::result_of_defined<has_result(float, float)>::value);
+    bool junction_void_value = signals::detail::result_of_defined<
+        signals::junction<void(), signals::unfused> ()>::value;
+    BOOST_CHECK(junction_void_value);
+//    bool junction_int_value = signals::detail::result_of_defined<
+//        signals::junction<void(), signals::unfused> (int)>::value;
+//    BOOST_CHECK(!junction_int_value);
+    
+   return 0;
+} // int test_main(int, char* [])