Update of /cvsroot/sharedaemon/sharedaemon-ui-web/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24435/src
Modified Files:
Main.cpp
Log Message:
26/12/2003 Mikael Barbeaux
* Implemented Socket, ServerSocket and SocketException classes.
* Added simple test program for Sockets.
Index: Main.cpp
===================================================================
RCS file: /cvsroot/sharedaemon/sharedaemon-ui-web/src/Main.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Main.cpp 24 Dec 2003 14:10:32 -0000 1.3
+++ Main.cpp 26 Dec 2003 10:04:51 -0000 1.4
@@ -20,19 +20,51 @@
#include "test/TestException.h"
#include "test/TestThread.h"
#include "test/TestSemaphore.h"
+#include "test/TestSocket.h"
+#include <iostream>
+#include <string>
+using namespace std;
/**
* Main program.
*/
int main() {
- TestException test_excp;
- test_excp.test();
-
- TestThread test_th;
- test_th.test();
+ cout << "Choose a test to run : " << endl;
+ cout << " 1. Exceptions test" << endl;
+ cout << " 2. Threads test" << endl;
+ cout << " 3. Semaphores test" << endl;
+ cout << " 4. Sockets test" << endl;
+ cout << "Enter your choice : ";
+
+ bool cont = true;
+ while(cont) {
+ // Retrieve command
+ string command;
+ char buffer[80];
+ cin.getline(buffer, 79);
+ command = buffer;
- TestSemaphore test_sem;
- test_sem.test();
- return 0;
+ if(command == "1") {
+ TestException test_excp;
+ test_excp.test();
+ cont = false;
+ }
+ else if(command == "2") {
+ TestThread test_th;
+ test_th.test();
+ cont = false;
+ }
+ else if(command == "3") {
+ TestSemaphore test_sem;
+ test_sem.test();
+ cont = false;
+ }
+ else if(command == "4") {
+ TestSocket test_sock;
+ test_sock.test();
+ cont = false;
+ }
+ else cout << "Invalid choice... Enter your choice : ";
+ }
}
|