diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-06-26 19:23:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:32 -0500 |
commit | 3fc105b106c1ebf0ab097b9cf150dc211be01d92 (patch) | |
tree | ed629744afffbca39216db25b0a428d5f998be57 /source4/torture/ui.h | |
parent | b22ddfd61d5a3e477ea4401b3800d44709d56f82 (diff) | |
download | samba-3fc105b106c1ebf0ab097b9cf150dc211be01d92.tar.gz |
r16524: Fix double evaluation.
(This used to be commit 93f7adfb140d9e77120dd197d05a8fdd50e768bd)
Diffstat (limited to 'source4/torture/ui.h')
-rw-r--r-- | source4/torture/ui.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/source4/torture/ui.h b/source4/torture/ui.h index 96dccbd5a05..0cf7f3fa221 100644 --- a/source4/torture/ui.h +++ b/source4/torture/ui.h @@ -125,32 +125,41 @@ BOOL torture_run_test(struct torture_context *context, } #define torture_assert_werr_equal(ctx,got,expected,string) \ - if (!W_ERROR_EQUAL(got, expected)) { \ + do { WERROR __got = got, __expected = expected; \ + if (!W_ERROR_EQUAL(__got, __expected)) { \ torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \ - __LINE__, string, win_errstr(got), win_errstr(expected)); \ + __LINE__, string, win_errstr(__got), win_errstr(__expected)); \ return False; \ - } + } \ + } while (0) #define torture_assert_ntstatus_equal(ctx,got,expected,string) \ - if (!NT_STATUS_EQUAL(got, expected)) { \ + do { NTSTATUS __got = got, __expected = expected; \ + if (!NT_STATUS_EQUAL(__got, __expected)) { \ torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \ - __LINE__, string, nt_errstr(got), nt_errstr(expected)); \ + __LINE__, string, nt_errstr(__got), nt_errstr(__expected)); \ return False; \ - } + }\ + } while(0) + #define torture_assert_casestr_equal(ctx,got,expected,string) \ - if (strcasecmp(got, expected) != 0) { \ + do { const char *__got = got, __expected = expected; \ + if (strcasecmp(__got, __expected) != 0) { \ torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \ __LINE__, string, got, expected); \ return False; \ - } + } \ + } while(0) #define torture_assert_str_equal(ctx,got,expected,string) \ - if (strcmp(got, expected) != 0) { \ + do { const char *__got = got, __expected = expected; \ + if (strcmp(__got, __expected) != 0) { \ torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \ - __LINE__, string, got, expected); \ + __LINE__, string, __got, __expected); \ return False; \ - } + } \ + } while(0) /* Convenience macros */ |