ReactOS 0.4.15-dev-7834-g00c4b3d
__fto64.c File Reference
#include <apitest.h>
Include dependency graph for __fto64.c:

Go to the source code of this file.

Classes

struct  _DTOI64_TEST_DATA
 
struct  _DTOU64_TEST_DATA
 
struct  _STOI64_TEST_DATA
 
struct  _STOU64_TEST_DATA
 

Typedefs

typedef struct _DTOI64_TEST_DATA DTOI64_TEST_DATA
 
typedef struct _DTOU64_TEST_DATA DTOU64_TEST_DATA
 
typedef struct _STOI64_TEST_DATA STOI64_TEST_DATA
 
typedef struct _STOU64_TEST_DATA STOU64_TEST_DATA
 

Functions

 START_TEST (__fto64)
 

Typedef Documentation

◆ DTOI64_TEST_DATA

◆ DTOU64_TEST_DATA

◆ STOI64_TEST_DATA

◆ STOU64_TEST_DATA

Function Documentation

◆ START_TEST()

START_TEST ( __fto64  )

Definition at line 50 of file __fto64.c.

51{
52 DTOI64_TEST_DATA dtoi64[] =
53 {
54 { 1383034209.0, 1383034209LL }, /* test 32bit number */
55 { -1383034209.0, -1383034209LL }, /* test negative 32bit number */
56 { 1383034209.1383034209, 1383034209LL }, /* test rounding 32bit */
57 { -1383034209.1383034209, -1383034209LL }, /* test negative rounding 32bit */
58 { 1383034209.83034209, 1383034209LL }, /* test rounding up 32bit */
59 { -1383034209.83034209, -1383034209LL }, /* test negative rounding up 32bit */
60 { 354056757614.0, 354056757614LL }, /* test 64bit int */
61 { -354056757614.0, -354056757614LL }, /* test negative 64bit int */
62 { 354056757614.83034209, 354056757614LL }, /* test 64bit rounding */
63 { 18445937028656326656.0, 0x8000000000000000LL }, /* test unsigned 64bit */
64 { 1.0000001, 1LL },
65 { 0.0000001, 0LL },
66 { -0.0000001, 0LL },
67
68 /* special values tests */
69
70 { -0.0, 0LL }, /* test -0 */
71 { +0.0, 0LL }, /* test +0 */
72 { .given.raw = 0x7FF0000000000000ULL, 0x8000000000000000LL }, /* test +INFINITY */
73 { .given.raw = 0xFFF0000000000000ULL, 0x8000000000000000LL }, /* test -INFINITY */
74 { .given.raw = 0x7FF0000000000001ULL, 0x8000000000000000LL }, /* test NaN1 */
75 { .given.raw = 0x7FF8000000000001ULL, 0x8000000000000000LL }, /* test NaN2 */
76 { .given.raw = 0x7FFFFFFFFFFFFFFFULL, 0x8000000000000000LL }, /* test NaN3 */
77 { .given.raw = 0x7FF80000000000F1ULL, 0x8000000000000000LL }, /* test NaN4 */
78 };
79 DTOU64_TEST_DATA dtou64[] =
80 {
81 { 1383034209.0, 1383034209ULL }, /* test 32bit number */
82 { -1383034209.0, 18446744072326517407ULL }, /* test negative 32bit number */
83 { 1383034209.1383034209, 1383034209ULL }, /* test rounding 32bit */
84 { -1383034209.1383034209, 18446744072326517407ULL }, /* test negative rounding 32bit */
85 { 1383034209.83034209, 1383034209ULL }, /* test rounding up 32bit */
86 { -1383034209.83034209, 18446744072326517407ULL }, /* test negative rounding up 32bit */
87 { 354056757614.0, 354056757614ULL }, /* test 64bit int */
88 { -354056757614.0, 18446743719652794002ULL }, /* test negative 64bit int */
89 { 354056757614.83034209, 354056757614ULL }, /* test 64bit rounding */
90 { 18445937028656326656.0, 18445937028656326656ULL }, /* test unsigned 64bit */
91 { 1.0000001, 1ULL },
92 { 0.0000001, 0ULL },
93 { -0.0000001, 0ULL },
94
95 /* special values tests */
96
97 { -0.0, 0ULL }, /* test -0 */
98 { +0.0, 0ULL }, /* test +0 */
99 { .given.raw = 0x7FF0000000000000ULL, 0x8000000000000000LL }, /* test +INFINITY */
100 { .given.raw = 0xFFF0000000000000ULL, 0x8000000000000000LL }, /* test -INFINITY */
101 { .given.raw = 0x7FF0000000000001ULL, 0x8000000000000000LL }, /* test NaN1 */
102 { .given.raw = 0x7FF8000000000001ULL, 0x8000000000000000LL }, /* test NaN2 */
103 { .given.raw = 0x7FFFFFFFFFFFFFFFULL, 0x8000000000000000LL }, /* test NaN3 */
104 { .given.raw = 0x7FF80000000000F1ULL, 0x8000000000000000LL }, /* test NaN4 */
105 };
106 STOI64_TEST_DATA stoi64[] =
107 {
108 { 1383034.0f, 1383034LL }, /* test 32bit number */
109 { -1383034.0f, -1383034LL }, /* test negative 32bit number */
110 { 1383034.1383034209f, 1383034LL }, /* test rounding 32bit */
111 { -1383034.1383034209f, -1383034LL }, /* test negative rounding 32bit */
112 { 1383034.83034209f, 1383034LL }, /* test rounding up 32bit */
113 { -1383034.83034209f, -1383034LL }, /* test negative rounding up 32bit */
114 { 354056765440.0f, 354056765440LL }, /* test 64bit int */
115 { -354056765440.0f, -354056765440LL }, /* test negative 64bit int */
116 { 3000000.75f, 3000000LL }, /* test 64bit rounding */
117 { 18445937032174764032.0f, 0x8000000000000000LL }, /* test unsigned 64bit */
118 { 1.0000001f, 1LL },
119 { 0.0000001f, 0LL },
120 { -0.0000001f, 0LL },
121
122 /* special values tests */
123
124 { -0.0f, 0LL }, /* test -0 */
125 { +0.0f, 0LL }, /* test +0 */
126 { .given.raw = 0x7F800000U, 0x8000000000000000LL }, /* test +INFINITY */
127 { .given.raw = 0xFF800000U, 0x8000000000000000LL }, /* test -INFINITY */
128 { .given.raw = 0x7F800001U, 0x8000000000000000LL }, /* test NaN1 */
129 { .given.raw = 0x7FC00001U, 0x8000000000000000LL }, /* test NaN2 */
130 { .given.raw = 0x7F8FFFFFU, 0x8000000000000000LL }, /* test NaN3 */
131 { .given.raw = 0x7F8000F1U, 0x8000000000000000LL }, /* test NaN4 */
132 };
133 STOU64_TEST_DATA stou64[] =
134 {
135 { 1383034.0f, 1383034ULL }, /* test 32bit number */
136 { -1383034.0f, 18446744073708168582ULL }, /* test negative 32bit number */
137 { 1383034.1383034209f, 1383034ULL }, /* test rounding 32bit */
138 { -1383034.1383034209f, 18446744073708168582ULL }, /* test negative rounding 32bit */
139 { 1383034.83034209f, 1383034ULL }, /* test rounding up 32bit */
140 { -1383034.83034209f, 18446744073708168582ULL }, /* test negative rounding up 32bit */
141 { 354056765440.0f, 354056765440ULL }, /* test 64bit int */
142 { -354056765440.0f, 18446743719652786176ULL }, /* test negative 64bit int */
143 { 3000000.75f, 3000000ULL }, /* test 64bit rounding */
144 { 18445937032174764032.0f, 18445937032174764032ULL }, /* test unsigned 64bit */
145 { 1.0000001f, 1ULL },
146 { 0.0000001f, 0ULL },
147 { -0.0000001f, 0ULL },
148
149 /* special values tests */
150
151 { -0.0f, 0LL }, /* test -0 */
152 { +0.0f, 0LL }, /* test +0 */
153 {.given.raw = 0x7F800000U, 0x8000000000000000LL }, /* test +INFINITY */
154 {.given.raw = 0xFF800000U, 0x8000000000000000LL }, /* test -INFINITY */
155 {.given.raw = 0x7F800001U, 0x8000000000000000LL }, /* test NaN1 */
156 {.given.raw = 0x7FC00001U, 0x8000000000000000LL }, /* test NaN2 */
157 {.given.raw = 0x7F8FFFFFU, 0x8000000000000000LL }, /* test NaN3 */
158 {.given.raw = 0x7F8000F1U, 0x8000000000000000LL }, /* test NaN4 */
159 };
160
161 unsigned int i;
162
163 for (i = 0; i < _countof(dtoi64); ++i)
164 {
165 long long actual;
166
167 actual = (long long)dtoi64[i].given.value;
168 ok(actual == dtoi64[i].expected, "(dtoi64) %d: Expected %lld, but %lf -> %lld\n",
169 i, dtoi64[i].expected, dtoi64[i].given.value, actual);
170 }
171
172 for (i = 0; i < _countof(dtou64); ++i)
173 {
174 unsigned long long actual;
175
176 actual = (unsigned long long)dtou64[i].given.value;
177 ok(actual == dtou64[i].expected, "(dtou64) %d: Expected %llu, but %lf -> %llu\n",
178 i, dtou64[i].expected, dtou64[i].given.value, actual);
179 }
180
181 for (i = 0; i < _countof(stoi64); ++i)
182 {
183 long long actual;
184
185 actual = (long long)stoi64[i].given.value;
186 ok(actual == stoi64[i].expected, "(stoi64) %d: Expected %lld, but %f -> %lld\n",
187 i, stoi64[i].expected, stoi64[i].given.value, actual);
188 }
189
190 for (i = 0; i < _countof(stou64); ++i)
191 {
192 unsigned long long actual;
193
194 actual = (unsigned long long)stou64[i].given.value;
195 ok(actual == stou64[i].expected, "(stou64) %d: Expected %llu, but %f -> %llu\n",
196 i, stou64[i].expected, stou64[i].given.value, actual);
197 }
198}
#define ok(value,...)
Definition: atltest.h:57
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
Definition: glfuncs.h:248
BOOL expected
Definition: store.c:2063
#define ULL(a, b)
Definition: format_msg.c:27
#define long
Definition: qsort.c:33
#define _countof(array)
Definition: sndvol32.h:68
char * value
Definition: compiler.c:67
#define LL
Definition: tui.h:167