diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-08-01 00:58:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:14 -0500 |
commit | b9cbfe64a7bb3be3ba2705776519d129105de8d3 (patch) | |
tree | 67086fe9154ec2dda6f6a79ba8dd276037b8897f /source4 | |
parent | 5bddfe7a1a094d86dffaa0f8a52c2e35d6453b2d (diff) | |
download | samba-b9cbfe64a7bb3be3ba2705776519d129105de8d3.tar.gz samba-b9cbfe64a7bb3be3ba2705776519d129105de8d3.tar.bz2 samba-b9cbfe64a7bb3be3ba2705776519d129105de8d3.zip |
r8876: check the result of AddOne and test some more values
metze
(This used to be commit 6918e9c5a3e2f9cd69569037bbdfed4e7eed94d5)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/echo.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index 4e0cf90e42..1ce4a20008 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -29,27 +29,43 @@ /* test the AddOne interface */ +#define TEST_ADDONE(value) do { \ + n = i = value; \ + r.in.in_data = n; \ + r.out.out_data = &n; \ + status = dcerpc_echo_AddOne(p, mem_ctx, &r); \ + if (!NT_STATUS_IS_OK(status)) { \ + printf("AddOne(%d) failed - %s\n", i, nt_errstr(status)); \ + return False; \ + } \ + if (n != i+1) { \ + printf("%d + 1 != %u (should be %u)\n", i, n, i+1); \ + ret = False; \ + } else { \ + printf("%d + 1 = %u\n", i, n); \ + } \ +} while(0) + static BOOL test_addone(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { - int i; + BOOL ret = True; + uint32_t i; NTSTATUS status; + uint32_t n; + struct echo_AddOne r; printf("\nTesting AddOne\n"); for (i=0;i<10;i++) { - uint32_t n = i; - struct echo_AddOne r; - r.in.in_data = n; - r.out.out_data = &n; - status = dcerpc_echo_AddOne(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("AddOne(%d) failed - %s\n", i, nt_errstr(status)); - return False; - } - printf("%d + 1 = %u\n", i, n); + TEST_ADDONE(i); } - return True; + TEST_ADDONE(0x7FFFFFFE); + TEST_ADDONE(0xFFFFFFFE); + TEST_ADDONE(0xFFFFFFFF); + TEST_ADDONE(random() & 0xFFFFFFFF); + + return ret; } /* |