Commit eb13a49d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add some _mbstok tests.

parent 779c1f80
......@@ -93,6 +93,7 @@ static __msvcrt_ulong* (__cdecl *p_doserrno)(void);
static void (__cdecl *p_srand)(unsigned int);
static char* (__cdecl *p_strtok)(char*, const char*);
static wchar_t* (__cdecl *p_wcstok)(wchar_t*, const wchar_t*);
static unsigned char* (__cdecl *p__mbstok)(unsigned char*, const unsigned char*);
static char* (__cdecl *p_strerror)(int);
static wchar_t* (__cdecl *p_wcserror)(int);
static char* (__cdecl *p_tmpnam)(char*);
......@@ -279,6 +280,7 @@ static BOOL init(void)
SET(p_srand, "srand");
SET(p_strtok, "strtok");
SET(p_wcstok, "wcstok");
SET(p__mbstok, "_mbstok");
SET(p_strerror, "strerror");
SET(p_wcserror, "_wcserror");
SET(p_tmpnam, "tmpnam");
......@@ -1038,6 +1040,7 @@ static void test_getptd(void)
DWORD tid = GetCurrentThreadId();
wchar_t testW[] = {'t','e','s','t',0}, tW[] = {'t',0}, *wp;
char test[] = "test", *p;
unsigned char mbstok_test[] = "test", *up;
struct tm time;
__time64_t secs = 0;
int dec, sign;
......@@ -1053,6 +1056,8 @@ static void test_getptd(void)
ok(ptd->strtok_next == p+3, "ptd->strtok_next is incorrect\n");
wp = p_wcstok(testW, tW);
ok(ptd->wcstok_next == wp+3, "ptd->wcstok_next is incorrect\n");
up = p__mbstok(mbstok_test, (unsigned char*)"t");
ok(ptd->mbstok_next == up+3, "ptd->mbstok_next is incorrect\n");
ok(p_strerror(0) == ptd->strerror_buffer, "ptd->strerror_buffer is incorrect\n");
ok(p_wcserror(0) == ptd->wcserror_buffer, "ptd->wcserror_buffer is incorrect\n");
ok(p_tmpnam(NULL) == ptd->tmpnam_buffer, "ptd->tmpnam_buffer is incorrect\n");
......
......@@ -2193,6 +2193,24 @@ static void test__mbslwr_s(void)
buffer);
}
static void test__mbstok(void)
{
const unsigned char delim[] = "t";
char str[] = "!.!test";
unsigned char *ret;
strtok(str, "!");
ret = _mbstok(NULL, delim);
/* most versions of msvcrt use the same buffer for strtok and _mbstok */
ok(!ret || broken((char*)ret==str+4),
"_mbstok(NULL, \"t\") = %p, expected NULL (%p)\n", ret, str);
ret = _mbstok(NULL, delim);
ok(!ret, "_mbstok(NULL, \"t\") = %p, expected NULL\n", ret);
}
static void test__ultoa_s(void)
{
errno_t ret;
......@@ -2615,6 +2633,7 @@ START_TEST(string)
test_mbctombb();
test_ismbclegal();
test_strtok();
test__mbstok();
test_wcscpy_s();
test__wcsupr_s();
test_strtol();
......
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