libt2n: (gerd) basic structure of wrappers done, ignore handler missing, unit tests...
[libt2n] / test / wrapper.cpp
1 /***************************************************************************
2  *   Copyright (C) 2004 by Intra2net AG                                    *
3  *   info@intra2net.com                                                    *
4  *                                                                         *
5  ***************************************************************************/
6
7 #include <sys/types.h>
8 #include <unistd.h>
9 #include <errno.h>
10 #include <signal.h>
11 #include <stdio.h>
12
13 #include <iostream>
14 #include <string>
15 #include <sstream>
16 #include <stdexcept>
17
18 #include <cppunit/extensions/TestFactoryRegistry.h>
19 #include <cppunit/ui/text/TestRunner.h>
20 #include <cppunit/extensions/HelperMacros.h>
21
22 #include <command_client.hxx>
23 #include <client_wrapper.hxx>
24 #include <socket_wrapper.hxx>
25
26 #ifdef HAVE_CONFIG_H
27 #include <config.h>
28 #endif
29
30 using namespace std;
31 using namespace libt2n;
32 using namespace CppUnit;
33
34 class testme : public command_client
35 {
36     public:
37
38     testme(client_connection &x, long long a, long long b)
39         : command_client(x,100000,10000)
40         { }
41
42     void helloworld(const std::string& text)
43     {
44         std::cout << "Hello world, " << text << std::endl;
45     }
46 };
47
48 typedef T2nSingletonWrapper<testme> wraptype;
49
50 template<>
51 std::auto_ptr<wraptype> wraptype::SingletonObject = std::auto_ptr<wraptype>();
52
53 template<>
54 std::auto_ptr<ConnectionWrapper> wraptype::WrappedConnection = std::auto_ptr<ConnectionWrapper>();
55
56 class test_wrapper : public TestFixture
57 {
58     CPPUNIT_TEST_SUITE(test_wrapper);
59
60     CPPUNIT_TEST(simple_wrap);
61
62     CPPUNIT_TEST_SUITE_END();
63
64     public:
65
66     void setUp()
67     { }
68
69     void tearDown()
70     { }
71
72     void simple_wrap()
73     {
74 //        t2n_exec(&testme::helloworld)("gurke");
75
76         CPPUNIT_ASSERT_EQUAL(true,true);
77     }
78
79
80 };
81
82 CPPUNIT_TEST_SUITE_REGISTRATION(test_wrapper);