Reverse the order for deleting the items in resetcontent to correctly
[wine] / dlls / msvcrt / tests / string.c
1 /*
2  * Unit test suite for string functions.
3  *
4  * Copyright 2004 Uwe Bonnes
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "wine/test.h"
22 #include "winbase.h"
23 #include <string.h>
24 #include <stdlib.h>
25
26 static void* (*pmemcpy)(void *, const void *, size_t n);
27 static int* (*pmemcmp)(void *, const void *, size_t n);
28
29 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
30 #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
31
32
33 START_TEST(string)
34 {
35     void *mem;
36     static const char xilstring[]="c:/xilinx";
37     int nLen=strlen(xilstring);
38     HMODULE hMsvcrt = LoadLibraryA("msvcrt.dll");
39     ok(hMsvcrt != 0, "LoadLibraryA failed\n");
40     SET(pmemcpy,"memcpy");
41     SET(pmemcmp,"memcmp");
42
43     /* MSVCRT memcpy behaves like memmove for overlapping moves,
44        MFC42 CString::Insert seems to rely on that behaviour */
45     mem = malloc(100);
46     ok(mem != NULL, "memory not allocated for size 0\n");
47     strcpy((char*)mem,xilstring);
48     pmemcpy((char*)mem+5, mem,nLen+1);
49     ok(pmemcmp((char*)mem+5,xilstring, nLen) == 0, 
50        "Got result %s\n",(char*)mem+5);
51 }