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: General test to see if swprintf works correctly
10**
11**
12**==========================================================================*/
13
14
15
16#include <palsuite.h>
17#include "../swprintf.h"
18
19/*
20 * Uses memcmp & wcslen
21 */
22
23int __cdecl main(int argc, char *argv[])
24{
25 WCHAR *checkstr;
26 WCHAR buf[256];
27
28 if (PAL_Initialize(argc, argv) != 0)
29 {
30 return FAIL;
31 }
32
33 checkstr = convert("hello world");
34 swprintf_s(buf, _countof(buf), convert("hello world"));
35
36 if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
37 {
38 Fail("ERROR: Expected \"%s\", got \"%s\".\n", "hello world",
39 convertC(buf));
40 }
41
42 PAL_Terminate();
43 return PASS;
44}
45