ws2_32/tests: Add SO_ERROR [set|get]sockopt tests.

This commit is contained in:
Bruno Jesus 2013-01-17 22:33:05 -02:00 committed by Alexandre Julliard
parent 0d0f705048
commit 02c199beed
1 changed files with 28 additions and 0 deletions

View File

@ -1192,6 +1192,34 @@ static void test_set_getsockopt(void)
"got %d with %d (expected SOCKET_ERROR with WSAEINVAL)\n",
err, WSAGetLastError());
/* Test SO_ERROR set/get */
SetLastError(0xdeadbeef);
i = 1234;
err = setsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, size);
todo_wine
ok( !err && !WSAGetLastError(),
"got %d with %d (expected 0 with 0)\n",
err, WSAGetLastError());
SetLastError(0xdeadbeef);
i = 4321;
err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
todo_wine
ok( !err && !WSAGetLastError(),
"got %d with %d (expected 0 with 0)\n",
err, WSAGetLastError());
todo_wine
ok (i == 1234, "got %d (expected 1234)\n", i);
/* Test invalid optlen */
SetLastError(0xdeadbeef);
size = 1;
err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
todo_wine
ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEFAULT),
"got %d with %d (expected SOCKET_ERROR with WSAEFAULT)\n",
err, WSAGetLastError());
closesocket(s);
}