widl: Add tests for arrays of pointers.

This commit is contained in:
Dan Hipschman 2007-06-20 16:50:44 -07:00 committed by Alexandre Julliard
parent c60bdca5b0
commit 4e8c8d03e5
3 changed files with 31 additions and 1 deletions

View File

@ -257,6 +257,21 @@ s_square_encu(encu_t *eu)
}
}
int
s_sum_parr(int *a[3])
{
return s_sum_pcarr(a, 3);
}
int
s_sum_pcarr(int *a[], int n)
{
int i, s = 0;
for (i = 0; i < n; ++i)
s += *a[i];
return s;
}
void
s_stop(void)
{
@ -494,14 +509,27 @@ us_t_UserFree(ULONG *flags, us_t *pus)
static void
pointer_tests(void)
{
static int a[] = {1, 2, 3, 4};
static char p1[] = "11";
test_list_t *list = make_list(make_list(make_list(null_list())));
static test_us_t tus = {{p1}};
int *pa[4];
ok(test_list_length(list) == 3, "RPC test_list_length\n");
ok(square_puint(p1) == 121, "RPC square_puint\n");
ok(square_test_us(&tus) == 121, "RPC square_test_us\n");
pa[0] = &a[0];
pa[1] = &a[1];
pa[2] = &a[2];
ok(sum_parr(pa) == 6, "RPC sum_parr\n");
pa[0] = &a[0];
pa[1] = &a[1];
pa[2] = &a[2];
pa[3] = &a[3];
ok(sum_pcarr(pa, 4) == 10, "RPC sum_pcarr\n");
free_list(list);
}

View File

@ -158,5 +158,7 @@ interface IServer
} encu_t;
double square_encu(encu_t *eu);
int sum_parr(int *a[3]);
int sum_pcarr([size_is(n)] int *a[], int n);
void stop(void);
}

View File

@ -1518,7 +1518,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type
print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP);
print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD);
*typestring_offset += 2;
write_pointer_description(file, type->ref, 0, 0, typestring_offset);
write_pointer_description(file, type, 0, 0, typestring_offset);
print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END);
*typestring_offset += 1;
}