Add trailing '\n's to ok() calls.
[wine/dcerpc.git] / dlls / user / tests / resource.c
blobef82349e34e764f4f73d2063894534c1fe0a686d
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
20 #include <assert.h>
21 #include <windows.h>
23 #include "wine/test.h"
25 void
26 test_LoadStringA (void)
28 HINSTANCE hInst = GetModuleHandle (NULL);
29 const char str[] = "String resource"; /* same in resource.rc */
30 char buf[128];
31 struct string_test {
32 int bufsiz;
33 int expected;
35 struct string_test tests[] = {{sizeof buf, sizeof str - 1},
36 {sizeof str, sizeof str - 1},
37 {sizeof str - 1, sizeof str - 2}};
38 int i;
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\n",
47 bufsiz, len, expected);
48 ok (!memcmp (buf, str, len),
49 "bufsiz=%d: got '%s', expected '%.*s'\n",
50 bufsiz, buf, len, str);
51 ok (buf[len] == 0, "bufsiz=%d: NUL termination missing\n",
52 bufsiz);
56 START_TEST(resource)
58 test_LoadStringA ();