59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
|
/*
|
||
|
* Unit tests for miscellaneous msvcrt functions
|
||
|
*
|
||
|
* Copyright 2010 Andrew Nguyen
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2.1 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||
|
*/
|
||
|
|
||
|
#include "wine/test.h"
|
||
|
#include <errno.h>
|
||
|
|
||
|
static int (__cdecl *prand_s)(unsigned int *);
|
||
|
|
||
|
static void init(void)
|
||
|
{
|
||
|
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
|
||
|
|
||
|
prand_s = (void *)GetProcAddress(hmod, "rand_s");
|
||
|
}
|
||
|
|
||
|
static void test_rand_s(void)
|
||
|
{
|
||
|
int ret;
|
||
|
unsigned int rand;
|
||
|
|
||
|
if (!prand_s)
|
||
|
{
|
||
|
win_skip("rand_s is not available\n");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
errno = EBADF;
|
||
|
ret = prand_s(NULL);
|
||
|
ok(ret == EINVAL, "Expected rand_s to return EINVAL, got %d\n", ret);
|
||
|
ok(errno == EINVAL, "Expected errno to return EINVAL, got %d\n", errno);
|
||
|
|
||
|
ret = prand_s(&rand);
|
||
|
ok(ret == 0, "Expected rand_s to return 0, got %d\n", ret);
|
||
|
}
|
||
|
|
||
|
START_TEST(misc)
|
||
|
{
|
||
|
init();
|
||
|
|
||
|
test_rand_s();
|
||
|
}
|