Commit 18f7f637 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

kernel32/tests: Fix IdnToNameprepUnicode tests.

parent 66677e61
...@@ -3107,6 +3107,7 @@ static void test_IdnToNameprepUnicode(void) ...@@ -3107,6 +3107,7 @@ static void test_IdnToNameprepUnicode(void)
DWORD in_len; DWORD in_len;
const WCHAR in[64]; const WCHAR in[64];
DWORD ret; DWORD ret;
DWORD broken_ret;
const WCHAR out[64]; const WCHAR out[64];
DWORD flags; DWORD flags;
DWORD err; DWORD err;
...@@ -3114,77 +3115,77 @@ static void test_IdnToNameprepUnicode(void) ...@@ -3114,77 +3115,77 @@ static void test_IdnToNameprepUnicode(void)
} test_data[] = { } test_data[] = {
{ {
5, {'t','e','s','t',0}, 5, {'t','e','s','t',0},
5, {'t','e','s','t',0}, 5, 5, {'t','e','s','t',0},
0, 0xdeadbeef 0, 0xdeadbeef
}, },
{ {
3, {'a',0xe111,'b'}, 3, {'a',0xe111,'b'},
0, {0}, 0, 0, {0},
0, ERROR_INVALID_NAME 0, ERROR_INVALID_NAME
}, },
{ {
4, {'t',0,'e',0}, 4, {'t',0,'e',0},
0, {0}, 0, 0, {0},
0, ERROR_INVALID_NAME 0, ERROR_INVALID_NAME
}, },
{ {
1, {'T',0}, 1, {'T',0},
1, {'T',0}, 1, 1, {'T',0},
0, 0xdeadbeef 0, 0xdeadbeef
}, },
{ {
1, {0}, 1, {0},
0, {0}, 0, 0, {0},
0, ERROR_INVALID_NAME 0, ERROR_INVALID_NAME
}, },
{ {
6, {' ','-','/','[',']',0}, 6, {' ','-','/','[',']',0},
6, {' ','-','/','[',']',0}, 6, 6, {' ','-','/','[',']',0},
0, 0xdeadbeef 0, 0xdeadbeef
}, },
{ {
3, {'a','-','a'}, 3, {'a','-','a'},
3, {'a','-','a'}, 3, 3, {'a','-','a'},
IDN_USE_STD3_ASCII_RULES, 0xdeadbeef IDN_USE_STD3_ASCII_RULES, 0xdeadbeef
}, },
{ {
3, {'a','a','-'}, 3, {'a','a','-'},
0, {0}, 0, 0, {0},
IDN_USE_STD3_ASCII_RULES, ERROR_INVALID_NAME IDN_USE_STD3_ASCII_RULES, ERROR_INVALID_NAME
}, },
{ /* FoldString is not working as expected when MAP_FOLDCZONE is specified (composition+compatibility) */ { /* FoldString is not working as expected when MAP_FOLDCZONE is specified (composition+compatibility) */
10, {'T',0xdf,0x130,0x143,0x37a,0x6a,0x30c,' ',0xaa,0}, 10, {'T',0xdf,0x130,0x143,0x37a,0x6a,0x30c,' ',0xaa,0},
12, {'t','s','s','i',0x307,0x144,' ',0x3b9,0x1f0,' ','a',0}, 12, 12, {'t','s','s','i',0x307,0x144,' ',0x3b9,0x1f0,' ','a',0},
0, 0xdeadbeef, TRUE 0, 0xdeadbeef, TRUE
}, },
{ {
11, {'t',0xad,0x34f,0x1806,0x180b,0x180c,0x180d,0x200b,0x200c,0x200d,0}, 11, {'t',0xad,0x34f,0x1806,0x180b,0x180c,0x180d,0x200b,0x200c,0x200d,0},
2, {'t',0}, 2, 0, {'t',0},
0, 0xdeadbeef 0, 0xdeadbeef
}, },
{ /* Another example of incorrectly working FoldString (composition) */ { /* Another example of incorrectly working FoldString (composition) */
2, {0x3b0, 0}, 2, {0x3b0, 0},
2, {0x3b0, 0}, 2, 2, {0x3b0, 0},
0, 0xdeadbeef, TRUE 0, 0xdeadbeef, TRUE
}, },
{ {
2, {0x221, 0}, 2, {0x221, 0},
0, {0}, 0, 2, {0},
0, ERROR_NO_UNICODE_TRANSLATION 0, ERROR_NO_UNICODE_TRANSLATION
}, },
{ {
2, {0x221, 0}, 2, {0x221, 0},
2, {0x221, 0}, 2, 2, {0x221, 0},
IDN_ALLOW_UNASSIGNED, 0xdeadbeef IDN_ALLOW_UNASSIGNED, 0xdeadbeef
}, },
{ {
5, {'a','.','.','a',0}, 5, {'a','.','.','a',0},
0, {0}, 0, 0, {0},
0, ERROR_INVALID_NAME 0, ERROR_INVALID_NAME
}, },
{ {
3, {'a','.',0}, 3, {'a','.',0},
3, {'a','.',0}, 3, 3, {'a','.',0},
0, 0xdeadbeef 0, 0xdeadbeef
}, },
}; };
...@@ -3253,15 +3254,23 @@ static void test_IdnToNameprepUnicode(void) ...@@ -3253,15 +3254,23 @@ static void test_IdnToNameprepUnicode(void)
ret = pIdnToNameprepUnicode(test_data[i].flags, test_data[i].in, ret = pIdnToNameprepUnicode(test_data[i].flags, test_data[i].in,
test_data[i].in_len, buf, sizeof(buf)/sizeof(WCHAR)); test_data[i].in_len, buf, sizeof(buf)/sizeof(WCHAR));
err = GetLastError(); err = GetLastError();
if(!test_data[i].todo) {
ok(ret == test_data[i].ret, "%d) ret = %d\n", i, ret); if (!test_data[i].todo)
ok(err == test_data[i].err, "%d) err = %d\n", i, err); {
ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)), ok(ret == test_data[i].ret ||
"%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret)); broken(ret == test_data[i].broken_ret), "%d) ret = %d\n", i, ret);
}else {
todo_wine ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)),
"%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret));
} }
else
{
todo_wine ok(ret == test_data[i].ret ||
broken(ret == test_data[i].broken_ret), "%d) ret = %d\n", i, ret);
}
if(ret != test_data[i].ret)
continue;
ok(err == test_data[i].err, "%d) err = %d\n", i, err);
ok(!memcmp(test_data[i].out, buf, ret*sizeof(WCHAR)),
"%d) buf = %s\n", i, wine_dbgstr_wn(buf, ret));
} }
} }
......
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