Akihiro Sagawa : msvcrt/tests: Rewrite test_mbcjisjms to test in various codepages.
Alexandre Julliard
julliard at winehq.org
Mon Mar 26 12:29:32 CDT 2012
Module: wine
Branch: master
Commit: 9085a2e54cf81cab6bb7e7cc581e4e7e8981c030
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9085a2e54cf81cab6bb7e7cc581e4e7e8981c030
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Wed Mar 21 23:02:12 2012 +0900
msvcrt/tests: Rewrite test_mbcjisjms to test in various codepages.
---
dlls/msvcrt/tests/string.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index f3fb243..5edd86c 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -864,20 +864,23 @@ static void test_mbcjisjms(void)
unsigned int jisjms[][2] = { {0x2020, 0}, {0x2021, 0}, {0x2120, 0}, {0x2121, 0x8140},
{0x7f7f, 0}, {0x7f7e, 0}, {0x7e7f, 0}, {0x7e7e, 0xeffc},
{0x2121FFFF, 0}, {0x2223, 0x81a1}, {0x237e, 0x829e}, {0, 0}};
- unsigned int ret, exp, i;
+ int cp[] = { 932, 936, 939, 950, 1361, _MB_CP_SBCS };
+ unsigned int i, j;
+ int prev_cp = _getmbcp();
- i = 0;
- do
+ for (i = 0; i < sizeof(cp)/sizeof(cp[0]); i++)
{
- ret = _mbcjistojms(jisjms[i][0]);
-
- if(_getmbcp() == 932) /* Japanese codepage? */
- exp = jisjms[i][1];
- else
- exp = jisjms[i][0]; /* If not, no conversion */
-
- ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret);
- } while(jisjms[i++][0] != 0);
+ _setmbcp(cp[i]);
+ for (j = 0; jisjms[j][0] != 0; j++)
+ {
+ unsigned int ret, exp;
+ ret = _mbcjistojms(jisjms[j][0]);
+ exp = (cp[i] == 932) ? jisjms[j][1] : jisjms[j][0];
+ ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage=%d)\n",
+ exp, ret, jisjms[j][0], cp[i]);
+ }
+ }
+ _setmbcp(prev_cp);
}
static void test_mbcjmsjis(void)
More information about the wine-cvs
mailing list