Commit 2596bd57 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

comctl32/tests: Use inline function in expect*() macros to handle integral conversion.

depending on the files, these macros can be called with: - UINT/UINT, DWORD/DWORD pairs, but also UINT/DWORD or DWORD/UINT pairs... - wrapping inside an inline function allows the compiler to take care of the integral conversions Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 330261b9
...@@ -32,7 +32,11 @@ ...@@ -32,7 +32,11 @@
#include "wine/test.h" #include "wine/test.h"
#include "v6util.h" #include "v6util.h"
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
typedef struct _STREAMDATA typedef struct _STREAMDATA
{ {
......
...@@ -2032,8 +2032,11 @@ static void test_margins_font_change(void) ...@@ -2032,8 +2032,11 @@ static void test_margins_font_change(void)
} }
#define edit_pos_ok(exp, got, txt) \ #define edit_pos_ok(expected, got, txt) edit_pos_ok_(__LINE__, expected, got, #txt)
ok(exp == got, "wrong " #txt " expected %d got %d\n", exp, got); static inline void edit_pos_ok_(unsigned line, DWORD expected, DWORD got, const char* txt)
{
ok_(__FILE__, line)(expected == got, "wrong %s expected %d got %d\n", txt, expected, got);
}
#define check_pos(hwEdit, set_height, test_top, test_height, test_left) \ #define check_pos(hwEdit, set_height, test_top, test_height, test_left) \
do { \ do { \
......
...@@ -56,7 +56,11 @@ static HWND hWndHeader; ...@@ -56,7 +56,11 @@ static HWND hWndHeader;
#define compare(val, exp, fmt) ok((val) == (exp), #val " value: " fmt ", expected: " fmt "\n", (val), (exp)) #define compare(val, exp, fmt) ok((val) == (exp), #val " value: " fmt ", expected: " fmt "\n", (val), (exp))
#define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCES 2 #define NUM_MSG_SEQUENCES 2
#define PARENT_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 0
......
...@@ -46,9 +46,19 @@ enum seq_index { ...@@ -46,9 +46,19 @@ enum seq_index {
#define LISTVIEW_ID 0 #define LISTVIEW_ID 0
#define HEADER_ID 1 #define HEADER_ID 1
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) #define expect(expected,got) expect_(__LINE__, expected, got)
#define expect2(expected1, expected2, got1, got2) ok(expected1 == got1 && expected2 == got2, \ static inline void expect_(unsigned line, DWORD expected, DWORD got)
"expected (%d,%d), got (%d,%d)\n", expected1, expected2, got1, got2) {
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect2(expected1, expected2, got1, got2) expect2_(__LINE__, expected1, expected2, got1, got2)
static inline void expect2_(unsigned line, DWORD expected1, DWORD expected2, DWORD got1, DWORD got2)
{
ok_(__FILE__, line)(expected1 == got1 && expected2 == got2,
"expected (%d,%d), got (%d,%d)\n",
expected1, expected2, got1, got2);
}
static HWND hwndparent, hwndparentW; static HWND hwndparent, hwndparentW;
/* prevents edit box creation, LVN_BEGINLABELEDIT return value */ /* prevents edit box creation, LVN_BEGINLABELEDIT return value */
......
...@@ -32,8 +32,17 @@ ...@@ -32,8 +32,17 @@
#include <windows.h> #include <windows.h>
#include "msg.h" #include "msg.h"
#define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got); #define expect(expected,got) expect_(__LINE__, expected, got)
#define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got); static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect_hex(expected,got) expect_hex_(__LINE__, expected, got)
static inline void expect_hex_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %x, got %x\n", expected, got);
}
#define expect_d(expected, got) ok(abs((expected) - (got)) <= 2, "Expected %d, got %d\n", expected, got); #define expect_d(expected, got) ok(abs((expected) - (got)) <= 2, "Expected %d, got %d\n", expected, got);
#define NUM_MSG_SEQUENCES 2 #define NUM_MSG_SEQUENCES 2
......
...@@ -34,7 +34,12 @@ ...@@ -34,7 +34,12 @@
#define PARENT_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 0
#define TAB_SEQ_INDEX 1 #define TAB_SEQ_INDEX 1
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define expect_str(expected, got)\ #define expect_str(expected, got)\
ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got) ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)
......
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
#include "msg.h" #include "msg.h"
#include "v6util.h" #include "v6util.h"
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCE 2 #define NUM_MSG_SEQUENCE 2
#define PARENT_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 0
#define TRACKBAR_SEQ_INDEX 1 #define TRACKBAR_SEQ_INDEX 1
......
...@@ -57,7 +57,11 @@ static BOOL g_v6; ...@@ -57,7 +57,11 @@ static BOOL g_v6;
#define PARENT_SEQ_INDEX 1 #define PARENT_SEQ_INDEX 1
#define PARENT_CD_SEQ_INDEX 2 #define PARENT_CD_SEQ_INDEX 2
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
static struct msg_sequence *item_sequence[1]; static struct msg_sequence *item_sequence[1];
......
...@@ -50,7 +50,11 @@ ...@@ -50,7 +50,11 @@
#include "wine/test.h" #include "wine/test.h"
#include "msg.h" #include "msg.h"
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT)) #define expect(expected,got) expect_(__LINE__, expected, got)
static inline void expect_(unsigned line, DWORD expected, DWORD got)
{
ok_(__FILE__, line)(expected == got, "Expected %d, got %d\n", expected, got);
}
#define NUM_MSG_SEQUENCES 3 #define NUM_MSG_SEQUENCES 3
#define PARENT_SEQ_INDEX 0 #define PARENT_SEQ_INDEX 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment