Author: spetreolle Date: Fri Oct 3 09:00:15 2014 New Revision: 64480
URL: http://svn.reactos.org/svn/reactos?rev=64480&view=rev Log: [WS2_32_APITEST] Add WSAStartup-dependent tests.
Added: trunk/rostests/apitests/ws2_32/nostartup.c (with props) Modified: trunk/rostests/apitests/ws2_32/CMakeLists.txt trunk/rostests/apitests/ws2_32/testlist.c
Modified: trunk/rostests/apitests/ws2_32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/CMakeLists... ============================================================================== --- trunk/rostests/apitests/ws2_32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/ws2_32/CMakeLists.txt [iso-8859-1] Fri Oct 3 09:00:15 2014 @@ -3,6 +3,7 @@ getaddrinfo.c helpers.c ioctlsocket.c + nostartup.c recv.c WSAStartup.c testlist.c)
Added: trunk/rostests/apitests/ws2_32/nostartup.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/nostartup.... ============================================================================== --- trunk/rostests/apitests/ws2_32/nostartup.c (added) +++ trunk/rostests/apitests/ws2_32/nostartup.c [iso-8859-1] Fri Oct 3 09:00:15 2014 @@ -0,0 +1,40 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for WSAStartup + * PROGRAMMER: Sylvain Petreolle sylvain.petreolle@reactos.org + */ + +#include <apitest.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include <windef.h> +#include <winsock2.h> +#include <ndk/rtlfuncs.h> +#include <ndk/mmfuncs.h> + +// This test depends on WSAStartup not having been called +START_TEST(nostartup) +{ + int Error=0; + ok(WSASocketA(0, 0, 0, NULL, 0, 0) == INVALID_SOCKET, "WSASocketA should have failed\n"); + + WSASetLastError(0xdeadbeef); + getservbyname(NULL,NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + WSASetLastError(0xdeadbeef); + getservbyport(0,NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + WSASetLastError(0xdeadbeef); + gethostbyname(NULL); + Error = WSAGetLastError(); + ok_dec(Error, WSANOTINITIALISED); + + ok_dec(inet_addr("127.0.0.1"), 0x100007f); +}
Propchange: trunk/rostests/apitests/ws2_32/nostartup.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/ws2_32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/testlist.c... ============================================================================== --- trunk/rostests/apitests/ws2_32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ws2_32/testlist.c [iso-8859-1] Fri Oct 3 09:00:15 2014 @@ -7,14 +7,15 @@ extern void func_ioctlsocket(void); extern void func_recv(void); extern void func_WSAStartup(void); +extern void func_nostartup(void);
const struct test winetest_testlist[] = { { "getaddrinfo", func_getaddrinfo }, { "ioctlsocket", func_ioctlsocket }, + { "nostartup", func_nostartup }, { "recv", func_recv }, { "WSAStartup", func_WSAStartup }, - { 0, 0 } };