summaryrefslogtreecommitdiff
path: root/src/tests/signals.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
commit4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch)
tree79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/signals.cpp
parentc7636dc954eddfe58f7959392602fbc9072d77e7 (diff)
downloadlibbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to 'src/tests/signals.cpp')
-rw-r--r--src/tests/signals.cpp131
1 files changed, 0 insertions, 131 deletions
diff --git a/src/tests/signals.cpp b/src/tests/signals.cpp
deleted file mode 100644
index 14bbc9c..0000000
--- a/src/tests/signals.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include <bu/signals.h>
9#include <bu/sio.h>
10
11using namespace Bu;
12
13class Thing
14{
15public:
16 Thing() :
17 iState( 82731 )
18 {
19 }
20
21 virtual ~Thing()
22 {
23 }
24
25 void fnc0()
26 {
27 sio << iState << ": void fnc0()" << sio.nl;
28 }
29
30 void fnc1( int a )
31 {
32 sio << iState << ": void fnc1( " << a << " )" << sio.nl;
33 }
34
35 void fnc2( int a, Bu::String b )
36 {
37 sio << iState << ": void fnc2( " << a << ", \"" << b << "\" )" << sio.nl;
38 }
39
40 void fnc3( int a, Bu::String b, double c )
41 {
42 sio << iState << ": void fnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl;
43 }
44
45 void fnc4( int a, Bu::String b, double c, char d )
46 {
47 sio << iState << ": void fnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl;
48 }
49
50 void fnc5( int a, Bu::String b, double c, char d, long e )
51 {
52 sio << iState << ": void fnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl;
53 }
54
55private:
56 int iState;
57};
58
59void pfnc0()
60{
61 sio << ": void pfnc0()" << sio.nl;
62}
63
64void pfnc1( int a )
65{
66 sio << ": void pfnc1( " << a << " )" << sio.nl;
67}
68
69void pfnc2( int a, Bu::String b )
70{
71 sio << ": void pfnc2( " << a << ", \"" << b << "\" )" << sio.nl;
72}
73
74void pfnc3( int a, Bu::String b, double c )
75{
76 sio << ": void pfnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl;
77}
78
79void pfnc4( int a, Bu::String b, double c, char d )
80{
81 sio << ": void pfnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl;
82}
83
84void pfnc5( int a, Bu::String b, double c, char d, long e )
85{
86 sio << ": void pfnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl;
87}
88
89void callit( Signal0<void> sig )
90{
91 sig();
92}
93
94int main()
95{
96 Thing t;
97
98 Signal0<void> cb0( slot( &t, &Thing::fnc0 ) );
99 cb0();
100 cb0 = slot( &pfnc0 );
101 cb0();
102
103 Signal1<void, int> cb1( slot( &t, &Thing::fnc1 ) );
104 cb1( 5 );
105 cb1 = slot( &pfnc1 );
106 cb1( 5 );
107
108 Signal2<void, int, Bu::String> cb2( slot( &t, &Thing::fnc2 ) );
109 cb2( 5, "Hi there" );
110 cb2 = slot( &pfnc2 );
111 cb2( 5, "Hi there" );
112
113 Signal3<void, int, Bu::String, double> cb3( slot( &t, &Thing::fnc3 ) );
114 cb3( 5, "Hi there", 12.85 );
115 cb3 = slot( &pfnc3 );
116 cb3( 5, "Hi there", 12.85 );
117
118 Signal4<void, int, Bu::String, double, char> cb4( slot( &t, &Thing::fnc4 ) );
119 cb4( 5, "Hi there", 12.85, 'z' );
120 cb4 = slot( &pfnc4 );
121 cb4( 5, "Hi there", 12.85, 'z' );
122
123 Signal5<void, int, Bu::String, double, char, long> cb5( slot( &t, &Thing::fnc5 ) );
124 cb5( 5, "Hi there", 12.85, 'z', 849 );
125 cb5 = slot( &pfnc5 );
126 cb5( 5, "Hi there", 12.85, 'z', 849 );
127
128// Signal1<int, int> cb1( slot( &t, &Thing::fnc1 ) );
129// sio << "Result: " << cb1( 5 ) << sio.nl;
130}
131