[MSVCRT_WINETEST]

sync msvcrt_winetest to wine 1.1.40

svn path=/trunk/; revision=45933
This commit is contained in:
Christoph von Wittich
2010-03-06 13:20:39 +00:00
parent 8fc089778a
commit 3bdf74f576

View File

@@ -345,6 +345,29 @@ static void test_mbcp(void)
else
skip("Current locale has double-byte charset - could leave to false positives\n");
_setmbcp(1361);
expect_eq(_ismbblead(0x80), 0, int, "%d");
todo_wine {
expect_eq(_ismbblead(0x81), 1, int, "%d");
expect_eq(_ismbblead(0x83), 1, int, "%d");
}
expect_eq(_ismbblead(0x84), 1, int, "%d");
expect_eq(_ismbblead(0xd3), 1, int, "%d");
expect_eq(_ismbblead(0xd7), 0, int, "%d");
todo_wine {
expect_eq(_ismbblead(0xd8), 1, int, "%d");
}
expect_eq(_ismbblead(0xd9), 1, int, "%d");
expect_eq(_ismbbtrail(0x30), 0, int, "%d");
expect_eq(_ismbbtrail(0x31), 1, int, "%d");
expect_eq(_ismbbtrail(0x7e), 1, int, "%d");
expect_eq(_ismbbtrail(0x7f), 0, int, "%d");
expect_eq(_ismbbtrail(0x80), 0, int, "%d");
expect_eq(_ismbbtrail(0x81), 1, int, "%d");
expect_eq(_ismbbtrail(0xfe), 1, int, "%d");
expect_eq(_ismbbtrail(0xff), 0, int, "%d");
_setmbcp(curr_mbcp);
}
@@ -707,6 +730,103 @@ static void test_mbcjisjms(void)
} while(jisjms[i++][0] != 0);
}
static void test_mbctombb(void)
{
static const unsigned int mbcmbb_932[][2] = {
{0x829e, 0x829e}, {0x829f, 0xa7}, {0x82f1, 0xdd}, {0x82f2, 0x82f2},
{0x833f, 0x833f}, {0x8340, 0xa7}, {0x837e, 0xd0}, {0x837f, 0x837f},
{0x8380, 0xd1}, {0x8396, 0xb9}, {0x8397, 0x8397}, {0x813f, 0x813f},
{0x8140, 0x20}, {0x814c, 0x814c}, {0x814f, 0x5e}, {0x8197, 0x40},
{0x8198, 0x8198}, {0x8258, 0x39}, {0x8259, 0x8259}, {0x825f, 0x825f},
{0x8260, 0x41}, {0x82f1, 0xdd}, {0x82f2, 0x82f2}, {0,0}};
unsigned int exp, ret, i;
unsigned int prev_cp = _getmbcp();
_setmbcp(932);
for (i = 0; mbcmbb_932[i][0] != 0; i++)
{
ret = _mbctombb(mbcmbb_932[i][0]);
exp = mbcmbb_932[i][1];
ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret);
}
_setmbcp(prev_cp);
}
static void test_ismbclegal(void) {
unsigned int prev_cp = _getmbcp();
int ret, exp, err;
unsigned int i;
_setmbcp(932); /* Japanese */
err = 0;
for(i = 0; i < 0x10000; i++) {
ret = _ismbclegal(i);
exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0x9F) ||
(HIBYTE(i) >= 0xE0 && HIBYTE(i) <= 0xFC)) &&
((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) ||
(LOBYTE(i) >= 0x80 && LOBYTE(i) <= 0xFC));
if(ret != exp) {
err = 1;
break;
}
}
ok(!err, "_ismbclegal (932) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
_setmbcp(936); /* Chinese (GBK) */
err = 0;
for(i = 0; i < 0x10000; i++) {
ret = _ismbclegal(i);
exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0xFE;
if(ret != exp) {
err = 1;
break;
}
}
ok(!err, "_ismbclegal (936) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
_setmbcp(949); /* Korean */
err = 0;
for(i = 0; i < 0x10000; i++) {
ret = _ismbclegal(i);
exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
LOBYTE(i) >= 0x41 && LOBYTE(i) <= 0xFE;
if(ret != exp) {
err = 1;
break;
}
}
ok(!err, "_ismbclegal (949) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
_setmbcp(950); /* Chinese (Big5) */
err = 0;
for(i = 0; i < 0x10000; i++) {
ret = _ismbclegal(i);
exp = HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xFE &&
((LOBYTE(i) >= 0x40 && LOBYTE(i) <= 0x7E) ||
(LOBYTE(i) >= 0xA1 && LOBYTE(i) <= 0xFE));
if(ret != exp) {
err = 1;
break;
}
}
ok(!err, "_ismbclegal (950) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
_setmbcp(1361); /* Korean (Johab) */
err = 0;
for(i = 0; i < 0x10000; i++) {
ret = _ismbclegal(i);
exp = ((HIBYTE(i) >= 0x81 && HIBYTE(i) <= 0xD3) ||
(HIBYTE(i) >= 0xD8 && HIBYTE(i) <= 0xF9)) &&
((LOBYTE(i) >= 0x31 && LOBYTE(i) <= 0x7E) ||
(LOBYTE(i) >= 0x81 && LOBYTE(i) <= 0xFE)) &&
HIBYTE(i) != 0xDF;
if(ret != exp) {
err = 1;
break;
}
}
todo_wine ok(!err, "_ismbclegal (1361) : Expected 0x%x, got 0x%x (0x%x)\n", exp, ret, i);
_setmbcp(prev_cp);
}
static const struct {
const char* string;
const char* delimiter;
@@ -833,6 +953,8 @@ START_TEST(string)
test_strcat_s();
test__mbsnbcpy_s();
test_mbcjisjms();
test_mbctombb();
test_ismbclegal();
test_strtok();
test_wcscpy_s();
test__wcsupr_s();