https://git.reactos.org/?p=reactos.git;a=commitdiff;h=55032c31220554d724ec2…
commit 55032c31220554d724ec20b33f29447fff3162ee
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sun Jan 5 02:23:04 2020 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sat Feb 8 22:09:13 2020 +0100
[ROSTESTS] Fix result being evaluated twice,
and in the process fix gcc signed/unsigned errors
---
modules/rostests/apitests/dbghelp/rsym.c | 14 ++------------
sdk/include/reactos/wine/test.h | 22 +++++++++++++---------
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/modules/rostests/apitests/dbghelp/rsym.c
b/modules/rostests/apitests/dbghelp/rsym.c
index 16b759c9418..fa4e3218011 100644
--- a/modules/rostests/apitests/dbghelp/rsym.c
+++ b/modules/rostests/apitests/dbghelp/rsym.c
@@ -20,7 +20,7 @@
do { \
ULONG64 _value = (expression); \
ULONG64 _result = (result); \
- ok(_value == (result), "Wrong value for '%s', expected: "
#result " (%s), got: %s\n", \
+ ok(_value == _result, "Wrong value for '%s', expected: "
#result " (%s), got: %s\n", \
#expression, wine_dbgstr_longlong(_result), wine_dbgstr_longlong(_value)); \
} while (0)
@@ -28,20 +28,10 @@
do { \
ULONG64 _value = (expression); \
ULONG64 _result = (result); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (%s), got: %s\n", \
+ ok_(file, line)(_value == _result, "Wrong value for '%s', expected:
" #result " (%s), got: %s\n", \
#expression, wine_dbgstr_longlong(_result), wine_dbgstr_longlong(_value)); \
} while (0)
-#define ok_hex_(file, line, expression, result) \
- do { \
- int _value = (expression); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (0x%x), got: 0x%x\n", \
- #expression, (int)(result), _value); \
- } while (0)
-
-#define ok_str_(file, line, x, y) \
- ok_(file, line)(strcmp(x, y) == 0, "Wrong string. Expected '%s', got
'%s'\n", y, x)
-
// data.c
void dump_rsym(const char* filename);
diff --git a/sdk/include/reactos/wine/test.h b/sdk/include/reactos/wine/test.h
index d3e0c76d8ff..5eb52d80e36 100644
--- a/sdk/include/reactos/wine/test.h
+++ b/sdk/include/reactos/wine/test.h
@@ -824,32 +824,36 @@ int main( int argc, char **argv )
#define ok_hex_(file, line, expression, result) \
do { \
int _value = (expression); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (0x%x), got: 0x%x\n", \
- #expression, (int)(result), _value); \
+ int _result = (result); \
+ ok_(file, line)(_value == _result, "Wrong value for '%s', expected:
" #result " (0x%x), got: 0x%x\n", \
+ #expression, _result, _value); \
} while (0)
#define ok_hex(expression, result) ok_hex_(__FILE__, __LINE__, expression, result)
#define ok_dec_(file, line, expression, result) \
do { \
int _value = (expression); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (%d), got: %d\n", \
- #expression, (int)(result), _value); \
+ int _result = (result); \
+ ok_(file, line)(_value == _result, "Wrong value for '%s', expected:
" #result " (%d), got: %d\n", \
+ #expression, _result, _value); \
} while (0)
#define ok_dec(expression, result) ok_dec_(__FILE__, __LINE__, expression, result)
#define ok_ptr_(file, line, expression, result) \
do { \
- void *_value = (expression); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (%p), got: %p\n", \
- #expression, (void*)(result), _value); \
+ const void *_value = (expression); \
+ const void *_result = (result); \
+ ok_(file, line)(_value == _result, "Wrong value for '%s', expected:
" #result " (%p), got: %p\n", \
+ #expression, _result, _value); \
} while (0)
#define ok_ptr(expression, result) ok_ptr_(__FILE__, __LINE__, expression, result)
#define ok_size_t_(file, line, expression, result) \
do { \
size_t _value = (expression); \
- ok_(file, line)(_value == (result), "Wrong value for '%s', expected:
" #result " (%Ix), got: %Ix\n", \
- #expression, (size_t)(result), _value); \
+ size_t _result = (result); \
+ ok_(file, line)(_value == _result, "Wrong value for '%s', expected:
" #result " (%Ix), got: %Ix\n", \
+ #expression, _result, _value); \
} while (0)
#define ok_size_t(expression, result) ok_size_t_(__FILE__, __LINE__, expression,
result)