(file) Return to wsock32_main.c CVS log (file) (dir) Up to [RizwankCVS] / wine4 / wine / dlls / wsock32 / tests

  1 rizwank 1.1 /*
  2 rizwank 1.3  * Unit tests for 32-bit socket functions in Wine
  3 rizwank 1.1  *
  4 rizwank 1.3  * Copyright (c) 2005 Thomas Kho, Fredy Garcia, Douglas Rosenberg
  5 rizwank 1.1  *
  6              * This library is free software; you can redistribute it and/or
  7              * modify it under the terms of the GNU Lesser General Public
  8              * License as published by the Free Software Foundation; either
  9              * version 2.1 of the License, or (at your option) any later version.
 10              *
 11              * This library is distributed in the hope that it will be useful,
 12              * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13              * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14              * Lesser General Public License for more details.
 15              *
 16              * You should have received a copy of the GNU Lesser General Public
 17              * License along with this library; if not, write to the Free Software
 18              * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 19              */
 20             
 21             #include <assert.h>
 22             #include <stdio.h>
 23             
 24 rizwank 1.3 #include <windows.h>
 25             #include <msvcrt/process.h>
 26             #include <winsock2.h>
 27 rizwank 1.1 
 28             #ifndef STANDALONE
 29             #include "wine/test.h"
 30             #else
 31             #include <assert.h>
 32             #define START_TEST(name) main(int argc, char **argv)
 33             #define ok(condition, msg) \
 34             	do { \
 35             		if(!(condition)) \
 36             		{ \
 37             			fprintf(stderr,"failed at %d\n",__LINE__); \
 38             			exit(0); \
 39             		} \
 40             	} while(0)
 41             
 42             #define todo_wine
 43             #endif
 44             
 45 rizwank 1.3 //#include <wtypes.h>
 46             //#include <winerror.h>
 47 rizwank 1.1 
 48             static void test_NamedPipe_2(void)
 49             {
 50 rizwank 1.2     // something simple
 51 rizwank 1.3     printf("Hello, World\n");
 52                 //while(1)
 53             	    printf("Main Thread\n");
 54 rizwank 1.2     //ok(SetEvent( alarm_event ), "SetEvent\n");
 55                 //CloseHandle( alarm_event );
 56                 //trace("test_NamedPipe_2 returning\n");
 57 rizwank 1.1 }
 58             
 59 rizwank 1.3 static void test_Initialization(void)
 60             {
 61                 // initialize application
 62                 WSADATA mywsadata;
 63                 int wsastartup_result = WSAStartup(MAKEWORD(2,2), &mywsadata);
 64                 ok((wsastartup_result != NO_ERROR), "Error in WSAStartup()");
 65             
 66             }
 67             
 68             void SampleThread1()
 69             {
 70                 while(1)
 71                 {
 72             	printf("Thread 1\n");
 73                 }
 74             }
 75             
 76             void SampleThread2()
 77             {
 78                 while(1)
 79                 {
 80 rizwank 1.3 	printf("Thread 2\n");
 81                 }
 82             }
 83             
 84 rizwank 1.1 START_TEST(wsock32_main)
 85             {
 86 rizwank 1.3     //_beginthread( SampleThread1, 0, NULL );
 87                 //_beginthread( SampleThread2, 0, NULL );
 88 rizwank 1.2     trace("simple test:\n");
 89 rizwank 1.3     test_Initialization();
 90 rizwank 1.2     //test_DisconnectNamedPipe();
 91                 //trace("test 2 of 4:\n");
 92                 //test_CreateNamedPipe_instances_must_match();
 93                 //trace("test 3 of 4:\n");
 94 rizwank 1.1     test_NamedPipe_2();
 95 rizwank 1.2     //trace("test 4 of 4:\n");
 96                 //test_CreateNamedPipe(PIPE_TYPE_BYTE);
 97                 //trace("all tests done\n");
 98                 //test_CreateNamedPipe(PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE);
 99 rizwank 1.1     trace("all tests done\n");
100             }

Rizwan Kassim
Powered by
ViewCVS 0.9.2