Added some regression tests from patch #2321830
[fw/sdcc] / support / regression / tests / strcpy.c
1 /** tests for strcpy
2 */
3 #include <testfwk.h>
4 #include <string.h>
5
6 static void 
7 teststrcpy(void)
8 {
9   static char empty[] = "";
10   static char string[] = "\1\2\0\3";
11   char buf[40] = "abcdefghijklmnopqrstuvwxyz";
12
13   char * result = strcpy(buf, empty);
14   ASSERT( strlen(buf) == 0);
15   ASSERT( result == buf);
16
17   result = strcpy(buf, string);
18   ASSERT( result == buf);
19   ASSERT( strlen(buf) == 2);
20   ASSERT( buf[0] == '\1');
21   ASSERT( buf[1] == '\2');
22   ASSERT( buf[3] == 'd');
23 }