b939afcd8a26d37e0a592781574149f603b65658
[senf.git] / senf / Socket / ProtocolClientSocketHandle.test.cc
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief ProtocolClientSocketHandle unit tests */
25
26 //#include "ProtocolClientSocketHandle.test.hh"
27 //#include "ProtocolClientSocketHandle.test.ih"
28
29 // Custom includes
30 #include "ProtocolClientSocketHandle.hh"
31 #include "SocketProtocol.test.hh"
32
33 #include <senf/Utils/auto_unit_test.hh>
34 #include <boost/test/test_tools.hpp>
35
36 #define prefix_
37 //-/////////////////////////////////////////////////////////////////////////////////////////////////
38
39 namespace {
40     struct MySocketProtocol : public senf::test::SomeSocketProtocol
41     {
42         using senf::test::SomeSocketProtocol::init_client;
43         void init_client(char const *,unsigned) const {}
44     };
45 }
46
47 SENF_AUTO_UNIT_TEST(protocolClientSocketHandle)
48 {
49     typedef senf::ProtocolClientSocketHandle<MySocketProtocol> MySocketHandle;
50
51     {
52         typedef senf::MakeSocketPolicy<
53             senf::test::SomeFramingPolicy,
54             senf::test::SomeReadPolicy,
55             senf::test::SomeWritePolicy
56             >::policy OtherSocketPolicy;
57         typedef senf::SocketHandle<OtherSocketPolicy> OtherSocketHandle;
58
59         MySocketHandle h;
60         h.protocol();
61
62         OtherSocketHandle osh (h);
63         h = senf::static_socket_cast<MySocketHandle>(osh);
64     }
65
66     {
67         MySocketHandle hh("foo.bar.c",1234);
68     }
69     BOOST_CHECK( true );
70 }
71
72 //-/////////////////////////////////////////////////////////////////////////////////////////////////
73 #undef prefix_
74
75 \f
76 // Local Variables:
77 // mode: c++
78 // fill-column: 100
79 // c-file-style: "senf"
80 // indent-tabs-mode: nil
81 // ispell-local-dictionary: "american"
82 // compile-command: "scons -u test"
83 // comment-column: 40
84 // End: