riched32/tests: Use the available ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-06-18 00:09:33 +02:00 committed by Alexandre Julliard
parent 2441e9417c
commit ebfe62fc7f

View file

@ -104,7 +104,7 @@ static void test_WM_SETTEXT(void)
* for line breaking (only \n adds a line break)
*/
for (i = 0; i < sizeof(testitems)/sizeof(testitems[0]); i++) {
for (i = 0; i < ARRAY_SIZE(testitems); i++) {
char buf[1024] = {0};
LRESULT result;
@ -410,7 +410,7 @@ static void test_EM_GETLINE(void)
}
memset(origdest, 0xBB, nBuf);
for (i = 0; i < sizeof(gl)/sizeof(struct getline_s); i++)
for (i = 0; i < ARRAY_SIZE(gl); i++)
{
int nCopied, expected_nCopied, expected_bytes_written;
char gl_text[1024];
@ -504,7 +504,7 @@ static void test_EM_LINELENGTH(void)
}
ok(result == 9, "Incorrect line count of %ld\n", result);
for (i = 0; i < sizeof(offset_test)/sizeof(offset_test[0]); i++) {
for (i = 0; i < ARRAY_SIZE(offset_test); i++) {
result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test[i][0], 0);
ok(result == offset_test[i][1], "Length of line at offset %d is %ld, expected %d\n",
offset_test[i][0], result, offset_test[i][1]);
@ -525,7 +525,7 @@ static void test_EM_LINELENGTH(void)
{16, 4}, /* Line 3: |wine */
};
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1);
for (i = 0; i < sizeof(offset_test1)/sizeof(offset_test1[0]); i++) {
for (i = 0; i < ARRAY_SIZE(offset_test1); i++) {
result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test1[i][0], 0);
todo_wine_if (offset_test1[i][2])
ok(result == offset_test1[i][1], "Length of line at offset %d is %ld, expected %d\n",
@ -781,20 +781,17 @@ static void test_EM_FINDTEXT(void)
HWND hwndRichEdit = new_richedit(NULL);
/* Empty rich edit control */
run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests,
sizeof(find_tests)/sizeof(struct find_s));
run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, ARRAY_SIZE(find_tests));
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack);
/* Haystack text */
run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2,
sizeof(find_tests2)/sizeof(struct find_s));
run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, ARRAY_SIZE(find_tests2));
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack2);
/* Haystack text 2 (with EOL characters) */
run_tests_EM_FINDTEXT(hwndRichEdit, "3", find_tests3,
sizeof(find_tests3)/sizeof(struct find_s));
run_tests_EM_FINDTEXT(hwndRichEdit, "3", find_tests3, ARRAY_SIZE(find_tests3));
DestroyWindow(hwndRichEdit);
}
@ -1178,7 +1175,7 @@ static void test_enter(void)
HWND hwndRichEdit = new_richedit(NULL);
UINT i,j;
for (i = 0; i < sizeof(testenteritems)/sizeof(testenteritems[0]); i++) {
for (i = 0; i < ARRAY_SIZE(testenteritems); i++) {
char buf[1024] = {0};
LRESULT result;
@ -1321,7 +1318,7 @@ static void test_EM_EXSETSEL(void)
{
HWND hwndRichEdit = new_richedit(NULL);
int i;
const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s);
const int num_tests = ARRAY_SIZE(exsetsel_tests);
/* sending some text to the window */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection");
@ -1378,7 +1375,7 @@ static void test_EM_SETSEL(void)
char buffA[32] = {0};
HWND hwndRichEdit = new_richedit(NULL);
int i;
const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s);
const int num_tests = ARRAY_SIZE(exsetsel_tests);
/* sending some text to the window */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection");