[CRT_APITEST]
[reactos.git] / rostests / apitests / crt / mbstowcs.c
index 012fc7b..2c5f9fd 100644 (file)
 #include <specstrings.h>
 
 #define StrROS "ReactOS"
-
+#define LStrROS L"ReactOS"
 
 START_TEST(mbstowcs)
 {
     size_t len;
+    wchar_t out[ARRAYSIZE(LStrROS)];
 
-    len = mbstowcs(NULL, StrROS, sizeof(StrROS) / sizeof(StrROS[0]));
+    len = mbstowcs(NULL, StrROS, 0);
+    ok(len == 7, "Got len = %u, excepting 7\n", len);
+    len = mbstowcs(NULL, StrROS, 0);
+    ok(len == 7, "Got len = %u, excepting 7\n", len);
+    len = mbstowcs(NULL, StrROS, ARRAYSIZE(out));
+    ok(len == 7, "Got len = %u, excepting 7\n", len);
+    len = mbstowcs(NULL, StrROS, ARRAYSIZE(out));
+    ok(len == 7, "Got len = %u, excepting 7\n", len);
+    len = mbstowcs(out, StrROS, ARRAYSIZE(out));
     ok(len == 7, "Got len = %u, excepting 7\n", len);
-    len = mbstowcs(NULL, StrROS, sizeof(StrROS) / sizeof(StrROS[0]) - 1);
+    ok_wstr(out, LStrROS);
+    memset(out, 0, sizeof(out));
+    len = mbstowcs(out, StrROS, ARRAYSIZE(out));
     ok(len == 7, "Got len = %u, excepting 7\n", len);
+    ok_wstr(out, LStrROS);
 }