30 static const unsigned __inf_bytes = 0x7f800000;
31 return *(
const float *)&__inf_bytes;
36 #define INFINITY __port_infinity() 40 static const unsigned __nan_bytes = 0x7fc00000;
41 return *(
const float *)&__nan_bytes;
46 #define NAN __port_nan() 49 if(d1-d2>-1
e-30 && d1-d2<1
e-30)
61 static void (
__cdecl *p__invalid_parameter)(
const wchar_t*,
68 static void *(
__cdecl *p_lfind_s)(
const void*,
const void*,
unsigned int*,
69 size_t,
int (
__cdecl *)(
void*,
const void*,
const void*),
void*);
71 static void init(
void)
97 win_skip(
"rand_s is not available\n");
103 ok(
ret ==
EINVAL,
"Expected rand_s to return EINVAL, got %d\n",
ret);
107 ok(
ret == 0,
"Expected rand_s to return 0, got %d\n",
ret);
129 { 0.0, 10, 0, {0,
' ', 1,
"0"}, 1,
"" },
130 { 1.0, 10, 0, {1,
' ', 1,
"1"}, 1,
"000000009" },
131 { -1.0, 10, 0, {1,
'-', 1,
"1"}, 1,
"000000009" },
132 { 1.23, 10, 0, {1,
' ', 3,
"123"}, 1,
"0000009" },
133 { 1e13, 10, 0, {14,
' ', 1,
"1"}, 1,
"000000009" },
134 { 1e30, 30, 0, {31,
' ', 21,
"100000000000000001988"}, 1,
"" },
135 { 1
e-13, 10, 0, {-12,
' ', 1,
"1"}, 1,
"000000000" },
136 { 0.25, 10, 0, {0,
' ', 2,
"25"}, 1,
"00000000" },
137 { 1.0000001, 10, 0, {1,
' ', 8,
"10000001"}, 1,
"00" },
139 { 0.0, 10, 1, {0,
' ', 1,
"0"}, 1,
"" },
140 { 1.0, 10, 1, {1,
' ', 1,
"1"}, 1,
"0000000009" },
141 { -1.0, 10, 1, {1,
'-', 1,
"1"}, 1,
"0000000009" },
142 { 1.23, 10, 1, {1,
' ', 3,
"123"}, 1,
"00000009" },
143 { 1e13, 10, 1, {14,
' ', 1,
"1"}, 1,
"00000000000000000009" },
144 { 1e30, 30, 1, {31,
' ', 21,
"100000000000000001988"}, 1,
"" },
145 { 1
e-13, 10, 1, {0,
' ', 1,
"0"}, 1,
"" },
146 { 1
e-7, 10, 1, {-6,
' ', 1,
"1"}, 1,
"09" },
147 { 0.25, 10, 1, {0,
' ', 2,
"25"}, 1,
"00000000" },
148 { 1.0000001, 10, 1, {1,
' ', 8,
"10000001"}, 1,
"000" },
150 { 0.0, 0, 0, {0,
' ', 1,
"0"}, 1,
"" },
151 { 0.0, 0, 1, {0,
' ', 1,
"0"}, 1,
"" },
152 { 123.0, 2, 0, {3,
' ', 2,
"12"}, 1,
"" },
153 { 123.0, 0, 0, {0,
' ', 1,
"0"}, 1,
"" },
154 { 123.0, 2, 1, {3,
' ', 3,
"123"}, 1,
"09" },
155 { 0.99, 1, 0, {1,
' ', 1,
"1"}, 1,
"" },
156 { 1264567.0, 2, 0, {7,
' ', 2,
"13"}, 1,
"" },
157 { 1264567.0, 2, 1, {7,
' ', 7,
"1264567"}, 1,
"00" },
158 { 1234567891.0, 2, 1, {10,
' ', 10,
"1234567891"}, 1,
"09" }
167 win_skip(
"I10_OUTPUT not available\n");
171 trace(
"sizeof(long double) = %d on this machine\n",
j);
176 if (
sizeof(
long double) == 12)
180 typedef struct {
ULONG x80[3]; } uld;
181 union {
long double ld; uld ld12; } fp80;
195 "%d: &out.str[%d] = %.25s...\n",
i,
out.len+1,
out.str+
out.len+1);
198 if(
out.str[
j] !=
'#')
199 ok(0,
"%d: out.str[%d] = %c (expected \'#\')\n",
i,
j,
out.str[
j]);
210 win_skip(
"strerror_s is not available\n");
216 ok(
ret ==
EINVAL,
"Expected strerror_s to return EINVAL, got %d\n",
ret);
221 ok(
ret ==
EINVAL,
"Expected strerror_s to return EINVAL, got %d\n",
ret);
226 ret = pstrerror_s(
buf, 0, 0);
227 ok(
ret ==
EINVAL,
"Expected strerror_s to return EINVAL, got %d\n",
ret);
229 ok(
buf[0] ==
'X',
"Expected output buffer to be untouched\n");
232 ret = pstrerror_s(
buf, 1, 0);
233 ok(
ret == 0,
"Expected strerror_s to return 0, got %d\n",
ret);
234 ok(
strlen(
buf) == 0,
"Expected output buffer to be null terminated\n");
237 ret = pstrerror_s(
buf, 2, 0);
238 ok(
ret == 0,
"Expected strerror_s to return 0, got %d\n",
ret);
239 ok(
strlen(
buf) == 1,
"Expected output buffer to be truncated\n");
243 ok(
ret == 0,
"Expected strerror_s to return 0, got %d\n",
ret);
247 ok(
ret == 0,
"Expected strerror_s to return 0, got %d\n",
ret);
256 win_skip(
"_get_doserrno is not available\n");
263 ok(
ret ==
EINVAL,
"Expected _get_doserrno to return EINVAL, got %d\n",
ret);
270 ret = p_get_doserrno(&
out);
271 ok(
ret == 0,
"Expected _get_doserrno to return 0, got %d\n",
ret);
281 win_skip(
"_get_errno is not available\n");
287 ok(
ret ==
EINVAL,
"Expected _get_errno to return EINVAL, got %d\n",
ret);
293 ok(
ret == 0,
"Expected _get_errno to return 0, got %d\n",
ret);
294 ok(
out ==
EBADF,
"Expected output variable to be EBADF, got %d\n",
out);
303 win_skip(
"_set_doserrno is not available\n");
309 ok(
ret == 0,
"Expected _set_doserrno to return 0, got %d\n",
ret);
311 "Expected _doserrno to be ERROR_FILE_NOT_FOUND, got %d\n",
_doserrno);
314 ret = p_set_doserrno(-1);
315 ok(
ret == 0,
"Expected _set_doserrno to return 0, got %d\n",
ret);
317 "Expected _doserrno to be -1, got %d\n",
_doserrno);
320 ret = p_set_doserrno(0xdeadbeef);
321 ok(
ret == 0,
"Expected _set_doserrno to return 0, got %d\n",
ret);
323 "Expected _doserrno to be 0xdeadbeef, got %d\n",
_doserrno);
332 win_skip(
"_set_errno is not available\n");
338 ok(
ret == 0,
"Expected _set_errno to return 0, got %d\n",
ret);
342 ret = p_set_errno(-1);
343 ok(
ret == 0,
"Expected _set_errno to return 0, got %d\n",
ret);
344 ok(
errno == -1,
"Expected errno to be -1, got %d\n",
errno);
347 ret = p_set_errno(0xdeadbeef);
348 ok(
ret == 0,
"Expected _set_errno to return 0, got %d\n",
ret);
349 ok(
errno == 0xdeadbeef,
"Expected errno to be 0xdeadbeef, got %d\n",
errno);
368 ok(pipe !=
NULL,
"_popen failed with error: %d\n",
errno);
374 ok(
ret == 0x37,
"_pclose returned %x, expected 0x37\n",
ret);
378 ok(
ret == -1,
"_pclose returned %x, expected -1\n",
ret);
385 if(!p__invalid_parameter) {
386 win_skip(
"_invalid_parameter not available\n");
409 ok(qt->
pos < 64,
"qt->pos = %d\n", qt->
pos);
411 "%d) l on %ld position\n", qt->
pos, (
long)((
int*)
l - qt->
base));
413 "%d) r on %ld position\n", qt->
pos, (
long)((
int*)
r - qt->
base));
417 return *(
int*)
l%1000 - *(
int*)
r%1000;
422 static const int nonstable_test[] = {9000, 8001, 7002, 6003, 1003, 5004, 4005, 3006, 2007};
427 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5}, {7, 6},
428 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 5},
429 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4},
430 {1, 0}, {2, 1}, {3, 2}, {4, 3},
431 {1, 0}, {2, 1}, {3, 2},
437 {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0},
438 {1, 0}, {2, 1}, {3, 1}, {4, 1}, {5, 1}, {6, 1},
439 {1, 0}, {2, 1}, {3, 2}, {4, 2}, {5, 2},
440 {1, 0}, {2, 1}, {3, 2}, {4, 3},
441 {1, 0}, {2, 1}, {3, 2},
447 {0, 4}, {0, 8}, {4, 8},
448 {1, 4}, {2, 4}, {3, 4}, {5, 4}, {6, 4}, {7, 4}, {7, 4}, {6, 4},
451 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 4}, {6, 4},
452 {1, 0}, {2, 1}, {3, 2}, {4, 3}, {5, 3},
453 {1, 0}, {2, 1}, {3, 2}, {4, 2},
454 {1, 0}, {2, 1}, {3, 2},
461 win_skip(
"qsort_s not available\n");
465 for(
i=0;
i<8;
i++) tab[
i] =
i;
466 p_qsort_s(tab, 8,
sizeof(
int),
qsort_comp, &small_sort);
467 ok(small_sort.
pos == 28,
"small_sort.pos = %d\n", small_sort.
pos);
469 ok(tab[
i] ==
i,
"tab[%d] = %d\n",
i, tab[
i]);
471 for(
i=0;
i<8;
i++) tab[
i] = 7-
i;
472 p_qsort_s(tab, 8,
sizeof(
int),
qsort_comp, &small_sort2);
473 ok(small_sort2.pos == 28,
"small_sort2.pos = %d\n", small_sort2.pos);
475 ok(tab[
i] ==
i,
"tab[%d] = %d\n",
i, tab[
i]);
477 for(
i=0;
i<9;
i++) tab[
i] =
i;
480 p_qsort_s(tab, 9,
sizeof(
int),
qsort_comp, &quick_sort);
481 ok(quick_sort.pos == 34,
"quick_sort.pos = %d\n", quick_sort.pos);
484 for(
i=0;
i<9;
i++) tab[
i] = 8-
i + 1000*(
i+1);
488 ok(tab[
i] == nonstable_test[
i],
"tab[%d] = %d, expected %d\n",
i, tab[
i], nonstable_test[
i]);
492 for(
i=0;
i<100;
i++) tab[
i] =
rand()%1000;
495 ok(tab[
i-1] <= tab[
i],
"data sorted incorrectly on position %d: %d <= %d\n",
i, tab[
i-1], tab[
i]);
498 for(
i=0;
i<100;
i++) tab[
i] =
i;
499 for(
i=0;
i<100;
i++) {
510 ok(tab[
i] ==
i,
"data sorted incorrectly on position %d: %d\n",
i, tab[
i]);
551 if (end_thread_type == (
void*)1)
553 else if (end_thread_type == (
void*)2)
555 else if (end_thread_type == (
void*)3)
611 *(
int *)
ctx = 0xdeadc0de;
612 return *(
int *)
l - *(
int *)
r;
617 static const int tests[] = {9000, 8001, 7002, 6003, 1003, 5004, 4005, 3006, 2007};
625 win_skip(
"_lfind_s is not available\n");
635 ok(!found,
"Expected NULL, got %p\n", found);
640 ok(!found,
"Expected NULL, got %p\n", found);
645 ok(!found,
"Expected NULL, got %p\n", found);
650 ok(!found,
"Expected NULL, got %p\n", found);
657 ok(found ==
tests,
"Expected %p, got %p\n",
tests, found);
658 ok(
ctx == 0xdeadc0de,
"Expected 0xdeadc0de, got %x\n",
ctx);
665 ok(found ==
tests+8,
"Expected %p, got %p\n",
tests+8, found);
666 ok(
ctx == 0xdeadc0de,
"Expected 0xdeadc0de, got %x\n",
ctx);
673 ok(!found,
"Expected NULL, got %p\n", found);
674 ok(
ctx == 0xdeadc0de,
"Expected 0xdeadc0de, got %x\n",
ctx);
686 if(!
strcmp(arg_v[2],
"popen"))
689 ok(0,
"invalid argument '%s'\n", arg_v[2]);
static int __cdecl _lfind_s_comp(void *ctx, const void *l, const void *r)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
_CRTIMP void __cdecl _endthread(void)
static void test_strerror_s(void)
ACPI_SIZE strlen(const char *String)
GLdouble GLdouble GLdouble r
static struct test_info tests[]
static void test_qsort_s(void)
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
struct _I10_OUTPUT_test I10_OUTPUT_test
void __cdecl srand(_In_ unsigned int _Seed)
_Check_return_ _CRTIMP FILE *__cdecl _popen(_In_z_ const char *_Command, _In_z_ const char *_Mode)
static void test__lfind_s(void)
#define INVALID_HANDLE_VALUE
VOID WINAPI ExitProcess(IN UINT uExitCode)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
static void test__popen(const char *name)
#define sprintf(buf, format,...)
static void test_I10_OUTPUT(void)
GLenum GLuint GLenum GLsizei const GLchar * buf
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
static void test_math_functions(void)
static float __port_nan(void)
_Check_return_ int __cdecl rand(void)
struct qsort_test::@1635 cmp[64]
_CRTIMP void __cdecl _endthreadex(_In_ unsigned _Retval)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
static unsigned __stdcall test_thread_func_ex(void *arg)
static void test_thread_handle_close(void)
VOID WINAPI ExitThread(IN DWORD uExitCode)
#define ERROR_FILE_NOT_FOUND
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 const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static void test__set_doserrno(void)
static void test__set_errno(void)
#define ERROR_INVALID_CMM
GLboolean GLboolean GLboolean b
static void test__popen_child(void)
static const I10_OUTPUT_test I10_OUTPUT_tests[]
static void test__get_doserrno(void)
#define todo_wine_if(is_todo)
static void *static MSVCRT_size_t
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static BOOL almost_equal(double d1, double d2)
static int __cdecl qsort_comp(void *ctx, const void *l, const void *r)
int winetest_get_mainargs(char ***pargv)
static void test__get_errno(void)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
static void test_rand_s(void)
struct _I10_OUTPUT_data I10_OUTPUT_data
static PEXPLICIT_ACCESSW *static HMODULE hmod
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
static const wchar_t const wchar_t unsigned uintptr_t
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 const GLfloat const GLdouble const GLfloat GLint i
static void __cdecl test_thread_func(void *end_thread_type)
static void test__invalid_parameter(void)
_CRTIMP uintptr_t __cdecl _beginthread(_In_ void(__cdecl *_StartAddress)(void *), _In_ unsigned _StackSize, _In_opt_ void *_ArgList)
int strcmp(const char *String1, const char *String2)
#define GetProcAddress(x, y)
static void(__cdecl *p__invalid_parameter)(const wchar_t *
static float __port_infinity(void)