mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[MSVCRT_APITEST]
- add basic test for _vsnprintf This is mostly to verify if WINE's implementation of _vcsprintf is correct svn path=/trunk/; revision=56924
This commit is contained in:
parent
b8244617b9
commit
7ee4b9f4f0
3 changed files with 35 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
add_definitions(-D_DLL -D__USE_CRTIMP)
|
||||
|
||||
list(APPEND SOURCE
|
||||
_vsnprintf.c
|
||||
ieee.c
|
||||
splitpath.c
|
||||
testlist.c)
|
||||
|
|
32
rostests/apitests/msvcrt/_vsnprintf.c
Normal file
32
rostests/apitests/msvcrt/_vsnprintf.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for _vsnprintf
|
||||
*/
|
||||
|
||||
#include <wine/test.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void call_varargs(char* buf, size_t buf_size, int expected_ret, LPCSTR formatString, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
/* Test the basic functionality */
|
||||
va_start(args, formatString);
|
||||
ret = _vsnprintf(buf, 255, formatString, args);
|
||||
ok(expected_ret == ret, "Test failed: expected %i, got %i.\n", expected_ret, ret);
|
||||
}
|
||||
|
||||
START_TEST(_vsnprintf)
|
||||
{
|
||||
char buffer[255];
|
||||
/* Test basic functionality */
|
||||
call_varargs(buffer, 255, 12, "%s world!", "hello");
|
||||
/* This is how WINE implements _vcsprintf, and they are obviously wrong */
|
||||
call_varargs(NULL, INT_MAX, -1, "%s it really work?", "does");
|
||||
/* This one is no better */
|
||||
call_varargs(NULL, 0, -1, "%s it really work?", "does");
|
||||
}
|
|
@ -5,11 +5,13 @@
|
|||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func__vsnprintf(void);
|
||||
extern void func_ieee(void);
|
||||
extern void func_splitpath(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "_vsnprintf", func__vsnprintf},
|
||||
{ "ieee", func_ieee },
|
||||
{ "splitpath", func_splitpath },
|
||||
|
||||
|
|
Loading…
Reference in a new issue