rpcrt4/tests: Add some tests for nesting arrays and pointers.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-10-05 16:57:52 -05:00 committed by Alexandre Julliard
parent 6f97103733
commit 935eed8e98
2 changed files with 17 additions and 0 deletions

View File

@ -861,6 +861,16 @@ void __cdecl s_ip_test(ipu_t *a)
ok(hr == S_OK, "got %#x\n", hr); ok(hr == S_OK, "got %#x\n", hr);
} }
int __cdecl s_sum_ptr_array(int *a[2])
{
return *a[0] + *a[1];
}
int __cdecl s_sum_array_ptr(int (*a)[2])
{
return (*a)[0] + (*a)[1];
}
static void static void
make_cmdline(char buffer[MAX_PATH], const char *test) make_cmdline(char buffer[MAX_PATH], const char *test)
{ {
@ -1388,6 +1398,7 @@ array_tests(void)
pints_t api[5]; pints_t api[5];
numbers_struct_t *ns; numbers_struct_t *ns;
refpint_t rpi[5]; refpint_t rpi[5];
int i0 = 1, i1 = 2, *ptr_array[2] = {&i0, &i1}, array[2] = {3, 4};
if (!old_windows_version) if (!old_windows_version)
{ {
@ -1518,6 +1529,9 @@ array_tests(void)
pi[4] = -4; rpi[4] = &pi[4]; pi[4] = -4; rpi[4] = &pi[4];
ok(sum_complex_array(5, rpi) == 1, "RPC sum_complex_array\n"); ok(sum_complex_array(5, rpi) == 1, "RPC sum_complex_array\n");
HeapFree(GetProcessHeap(), 0, pi); HeapFree(GetProcessHeap(), 0, pi);
ok(sum_ptr_array(ptr_array) == 3, "RPC sum_ptr_array\n");
ok(sum_array_ptr(&array) == 7, "RPC sum_array_ptr\n");
} }
void __cdecl s_authinfo_test(unsigned int protseq, int secure) void __cdecl s_authinfo_test(unsigned int protseq, int secure)

View File

@ -393,4 +393,7 @@ cpp_quote("#endif")
} ipu_t; } ipu_t;
void ip_test([in] ipu_t *a); void ip_test([in] ipu_t *a);
int sum_ptr_array([in] int *a[2]);
int sum_array_ptr([in] int (*a)[2]);
} }