rpcrt4/tests: Add a test about unmarshalling of an out-only structure.

This commit is contained in:
Alexandre Julliard 2011-07-27 11:51:24 +02:00
parent 093547e158
commit 9d4e79e382
2 changed files with 27 additions and 0 deletions

View File

@ -340,6 +340,19 @@ int __cdecl s_sum_cpsc(cpsc_t *cpsc)
return sum;
}
int __cdecl s_get_cpsc(int n, cpsc_t *cpsc)
{
static int array[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int i, ret;
cpsc->ca = array;
cpsc->a = min( 10, 2 * n );
cpsc->b = 2;
cpsc->c = 1;
for (i = ret = 0; i < cpsc->a; i++) ret += cpsc->ca[i];
return ret;
}
int __cdecl s_square_puint(puint_t p)
{
int n = atoi(p);
@ -1226,6 +1239,7 @@ array_tests(void)
cs_t *cs;
int n;
int ca[5] = {1, -2, 3, -4, 5};
int tmp[10];
doub_carr_t *dc;
int *pi;
pints_t api[5];
@ -1293,6 +1307,18 @@ array_tests(void)
cpsc.ca = c;
ok(sum_cpsc(&cpsc) == 10, "RPC sum_cpsc\n");
cpsc.ca = NULL;
ok(get_cpsc(5, &cpsc) == 45, "RPC sum_cpsc\n");
ok( cpsc.a == 10, "RPC get_cpsc %u\n", cpsc.a );
for (n = 0; n < 10; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
memset( tmp, 0x33, sizeof(tmp) );
cpsc.ca = tmp;
ok(get_cpsc(4, &cpsc) == 28, "RPC sum_cpsc\n");
ok( cpsc.a == 8, "RPC get_cpsc %u\n", cpsc.a );
ok( cpsc.ca == tmp, "RPC get_cpsc %p/%p\n", cpsc.ca, tmp );
for (n = 0; n < 8; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
ok(sum_toplev_conf_2n(c, 3) == 15, "RPC sum_toplev_conf_2n\n");
ok(sum_toplev_conf_cond(c, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n");
ok(sum_toplev_conf_cond(c, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n");

View File

@ -162,6 +162,7 @@ cpp_quote("#endif")
int sum_cs(cs_t *cs);
int sum_cps(cps_t *cps);
int sum_cpsc(cpsc_t *cpsc);
int get_cpsc(int n, [out] cpsc_t *cpsc );
int sum_complex_array(int n, [size_is(n)] refpint_t pi[]);
typedef [wire_marshal(int)] void *puint_t;