| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | /*============================================================================ |
| 6 | ** |
| 7 | ** Source: test1.c |
| 8 | ** |
| 9 | ** Purpose: |
| 10 | ** Call the function to copy into an empty buffer. Check that the return value |
| 11 | ** is pointing at the destination buffer. Also compare the string copied to |
| 12 | ** the origional string, to ensure they are the same. |
| 13 | ** |
| 14 | ** |
| 15 | **==========================================================================*/ |
| 16 | |
| 17 | #include <palsuite.h> |
| 18 | |
| 19 | |
| 20 | int __cdecl main(int argc, char *argv[]) |
| 21 | { |
| 22 | char dest[80]; |
| 23 | char *result = "foo" ; |
| 24 | char str[] = {'f','o','o',0,'b','a','r',0}; |
| 25 | char *ret; |
| 26 | |
| 27 | |
| 28 | if (PAL_Initialize(argc, argv)) |
| 29 | { |
| 30 | return FAIL; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | ret = strcpy(dest, str); |
| 35 | |
| 36 | if (ret != dest) |
| 37 | { |
| 38 | Fail("Expected strcpy to return %p, got %p!\n" , dest, ret); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | if (strcmp(dest, result) != 0) |
| 43 | { |
| 44 | Fail("Expected strcpy to give \"%s\", got \"%s\"!\n" , result, dest); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | PAL_Terminate(); |
| 49 | |
| 50 | return PASS; |
| 51 | } |
| 52 | |