summaryrefslogtreecommitdiff
path: root/server/src/tcpsocket.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-17 11:00:14 +0000
committerdeva <deva>2011-02-17 11:00:14 +0000
commitdb144840aba95affb3a6b5b2536059f49f0677ff (patch)
tree1c397a20aa5745c6bbb5dee6a4409f58c4542e87 /server/src/tcpsocket.cc
parentc8651b8c89673300477ab86962640c93216ea306 (diff)
Rewrite of all old tests to new unittest framework. Also some work on testdb; more to come...
Diffstat (limited to 'server/src/tcpsocket.cc')
-rw-r--r--server/src/tcpsocket.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc
index 70722ed..b54b581 100644
--- a/server/src/tcpsocket.cc
+++ b/server/src/tcpsocket.cc
@@ -367,9 +367,19 @@ std::string TCPSocket::dstaddr()
}
#ifdef TEST_TCPSOCKET
+//deps: exception.cc debug.cc log.cc
+//cflags: -I..
+//libs:
+#include <test.h>
-int main()
-{
+#define PORT 12346
+
+TEST_BEGIN;
+
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+/*
char buf[32];
switch(fork()) {
@@ -381,7 +391,7 @@ int main()
try {
TCPSocket client;
sleep(1); // We need to wait for the listen socket to be created.
- client.connect("localhost", 12345);
+ client.connect("localhost", PORT);
sprintf(buf, "hello");
client.write(buf, sizeof(buf));
printf("Sent: [%s]\n", buf);
@@ -394,7 +404,7 @@ int main()
default: // parent
try {
TCPSocket listen_sock;
- listen_sock.listen(12345);
+ listen_sock.listen(PORT);
TCPSocket *sock = listen_sock.accept();
sock->read(buf, sizeof(buf));
printf("Got: [%s]\n", buf);
@@ -406,8 +416,8 @@ int main()
}
break;
}
+*/
- return 0;
-}
+TEST_END;
#endif/*TEST_TCPSOCKET*/