ReactOS 0.4.16-dev-91-g764881a
_vsnwprintf.c File Reference
#include <apitest.h>
#include <stdio.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ndk/mmfuncs.h>
#include <ndk/rtlfuncs.h>
Include dependency graph for _vsnwprintf.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 

Functions

static void call_varargs (wchar_t *buf, size_t buf_size, int expected_ret, LPCWSTR formatString,...)
 
 START_TEST (_vsnwprintf)
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 9 of file _vsnwprintf.c.

Function Documentation

◆ call_varargs()

static void call_varargs ( wchar_t buf,
size_t  buf_size,
int  expected_ret,
LPCWSTR  formatString,
  ... 
)
static

Definition at line 16 of file _vsnwprintf.c.

17{
19 int ret;
20 /* Test the basic functionality */
21 va_start(args, formatString);
22 ret = _vsnwprintf(buf, buf_size, formatString, args);
23 va_end(args);
24 ok(expected_ret == ret, "Test failed: expected %i, got %i.\n", expected_ret, ret);
25}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define ok(value,...)
Definition: atltest.h:57
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
#define args
Definition: format.c:66
Definition: match.c:390
int ret

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( _vsnwprintf  )

Definition at line 27 of file _vsnwprintf.c.

28{
29 wchar_t buffer[255];
30
31 /* Test basic functionality */
32 //call_varargs(buffer, 255, 10, L"%s world!", "hello"); // this test is broken
33 call_varargs(buffer, 255, 12, L"%s world!", L"hello");
34 call_varargs(buffer, 255, 11, L"%u cookies", 100);
35 /* This is how WINE implements _vcsprintf, and they are obviously wrong */
36 StartSeh()
37#if defined(TEST_CRTDLL)
38 call_varargs(NULL, INT_MAX, -1, L"%s it really work?", L"does");
39#else
40 call_varargs(NULL, INT_MAX, 20, L"%s it really work?", L"does");
41#endif
42
43#if defined(TEST_USER32)
45#else
47#endif
48
49#if defined(TEST_USER32)/* NTDLL doesn't use/set errno */
50 ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
51#else
52 ok(errno == 0, "Expected 0, got %u\n", errno);
53#endif
54
55 /* This one is no better */
56 StartSeh()
57#if defined(TEST_CRTDLL)
58 call_varargs(NULL, 0, -1, L"%s it really work?", L"does");
59#else
60 call_varargs(NULL, 0, 20, L"%s it really work?", L"does");
61#endif
63 ok(errno == 0, "Expected 0, got %u\n", errno);
64
65
66 /* One more NULL checks */
67 StartSeh()
68 call_varargs(buffer, 255, -1, NULL);
70 ok(errno == 0, "Expected 0, got %u\n", errno);
71}
BOOLEAN Expected
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define EINVAL
Definition: acclib.h:90
#define NULL
Definition: types.h:112
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define INT_MAX
Definition: limits.h:40
static void call_varargs(wchar_t *buf, size_t buf_size, int expected_ret, LPCWSTR formatString,...)
Definition: _vsnwprintf.c:16
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define L(x)
Definition: ntvdm.h:50
#define errno
Definition: errno.h:18
#define STATUS_SUCCESS
Definition: shellext.h:65