2 * Unit tests for code page to/from unicode translations
4 * Copyright (c) 2002 Dmitry Timoshkov
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "wine/test.h"
25 static void test_negative_source_length(void)
30 static const WCHAR foobarW
[] = {'f','o','o','b','a','r',0};
32 /* Test, whether any negative source length works as strlen() + 1 */
33 SetLastError( 0xdeadbeef );
34 len
= WideCharToMultiByte(CP_ACP
, 0, foobarW
, -2002, buf
, 10, NULL
, NULL
);
35 ok(len
== 7 && !lstrcmpA(buf
, "foobar") && GetLastError() == 0xdeadbeef,
36 "any negative value should work as strlen() + 1");
38 SetLastError( 0xdeadbeef );
39 len
= MultiByteToWideChar(CP_ACP
, 0, "foobar", -2002, bufW
, 10);
40 ok(len
== 7 && !lstrcmpW(bufW
, foobarW
) && GetLastError() == 0xdeadbeef,
41 "any negative value should work as strlen() + 1");
46 test_negative_source_length();