1 /* Unit test suite for resources.
3 * Copyright 2004 Ferenc Wagner
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/test.h"
26 test_LoadStringA (void)
28 HINSTANCE hInst
= GetModuleHandle (NULL
);
29 const char str
[] = "String resource"; /* same in resource.rc */
35 struct string_test tests
[] = {{sizeof buf
, sizeof str
- 1},
36 {sizeof str
, sizeof str
- 1},
37 {sizeof str
- 1, sizeof str
- 2}};
40 assert (sizeof str
< sizeof buf
);
41 for (i
= 0; i
< sizeof tests
/ sizeof tests
[0]; i
++) {
42 const int bufsiz
= tests
[i
].bufsiz
;
43 const int expected
= tests
[i
].expected
;
44 const int len
= LoadStringA (hInst
, 0, buf
, bufsiz
);
46 ok (len
== expected
, "bufsiz=%d: got %d, expected %d",
47 bufsiz
, len
, expected
);
48 ok (!memcmp (buf
, str
, len
),
49 "bufsiz=%d: got '%s', expected '%.*s'",
50 bufsiz
, buf
, len
, str
);
51 ok (buf
[len
] == 0, "bufsiz=%d: NUL termination missing",