d3d9: Add a test testing two texbem instructions in one shader.
[wine] / dlls / rpcrt4 / tests / rpc_async.c
1 /*
2  * Unit test suite for rpc functions
3  *
4  * Copyright 2008 Robert Shearman (for CodeWeavers)
5  *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22
23 #include "wine/test.h"
24
25 #include <rpc.h>
26 #include <rpcasync.h>
27
28 RPC_STATUS (RPC_ENTRY *pRpcAsyncInitializeHandle)(PRPC_ASYNC_STATE,unsigned int);
29 RPC_STATUS (RPC_ENTRY *pRpcAsyncGetCallStatus)(PRPC_ASYNC_STATE);
30
31 static void test_RpcAsyncInitializeHandle(void)
32 {
33     char buffer[256];
34     RPC_ASYNC_STATE async;
35     RPC_STATUS status;
36     int i;
37
38     status = pRpcAsyncInitializeHandle((PRPC_ASYNC_STATE)buffer, sizeof(buffer));
39     ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with large Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
40
41     status = pRpcAsyncInitializeHandle(&async, sizeof(async) - 1);
42     ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with small Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
43
44     memset(&async, 0xcc, sizeof(async));
45     status = pRpcAsyncInitializeHandle(&async, sizeof(async));
46     ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
47
48     ok(async.Size == sizeof(async), "async.Size wrong: %d\n", async.Size);
49     ok(async.Signature == 0x43595341, "async.Signature should be 0x43595341, but is 0x%x instead\n", async.Signature);
50     ok(async.Lock == 0, "async.Lock should be 0, but is %d instead\n", async.Lock);
51     ok(async.Flags == 0, "async.Flags should be 0, but is %d instead\n", async.Flags);
52     ok(async.StubInfo == NULL, "async.StubInfo should be NULL, not %p\n", async.StubInfo);
53     ok(async.UserInfo == (void *)0xcccccccc, "async.UserInfo should be unset, not %p\n", async.UserInfo);
54     ok(async.RuntimeInfo == NULL, "async.RuntimeInfo should be NULL, not %p\n", async.RuntimeInfo);
55     ok(async.Event == 0xcccccccc, "async.Event should be unset, not %d\n", async.Event);
56     ok(async.NotificationType == 0xcccccccc, "async.NotificationType should be unset, not %d\n", async.NotificationType);
57     for (i = 0; i < 4; i++)
58         ok(async.Reserved[i] == 0x0, "async.Reserved[%d] should be 0x0, not 0x%lx\n", i, async.Reserved[i]);
59 }
60
61 static void test_RpcAsyncGetCallStatus(void)
62 {
63     RPC_ASYNC_STATE async;
64     RPC_STATUS status;
65
66     status = pRpcAsyncInitializeHandle(&async, sizeof(async));
67     ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
68
69     status = pRpcAsyncGetCallStatus(&async);
70     todo_wine
71     ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
72
73     memset(&async, 0, sizeof(async));
74     status = pRpcAsyncGetCallStatus(&async);
75     todo_wine
76     ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
77 }
78
79 START_TEST( rpc_async )
80 {
81     HMODULE hRpcRt4 = GetModuleHandle("rpcrt4.dll");
82     pRpcAsyncInitializeHandle = (void *)GetProcAddress(hRpcRt4, "RpcAsyncInitializeHandle");
83     pRpcAsyncGetCallStatus = (void *)GetProcAddress(hRpcRt4, "RpcAsyncGetCallStatus");
84     if (!pRpcAsyncInitializeHandle || !pRpcAsyncGetCallStatus)
85     {
86         skip("asynchronous functions not available\n");
87         return;
88     }
89     test_RpcAsyncInitializeHandle();
90     test_RpcAsyncGetCallStatus();
91 }