Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
19bff79d
Commit
19bff79d
authored
May 04, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
May 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/tests: Cleanup strtod tests.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
075f5b73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
59 deletions
+33
-59
string.c
dlls/msvcrt/tests/string.c
+33
-59
No files found.
dlls/msvcrt/tests/string.c
View file @
19bff79d
...
@@ -1934,48 +1934,44 @@ static inline BOOL compare_double(double f, double g, unsigned int ulps)
...
@@ -1934,48 +1934,44 @@ static inline BOOL compare_double(double f, double g, unsigned int ulps)
static
void
test__strtod
(
void
)
static
void
test__strtod
(
void
)
{
{
const
char
double1
[]
=
"12.1"
;
static
const
struct
{
const
char
double2
[]
=
"-13.721"
;
const
char
*
str
;
const
char
double3
[]
=
"INF"
;
int
len
;
const
char
double4
[]
=
".21e12"
;
double
ret
;
const
char
double5
[]
=
"214353e-3"
;
}
tests
[]
=
{
const
char
double6
[]
=
"NAN"
;
{
"12.1"
,
4
,
12
.
1
},
{
"-13.721"
,
7
,
-
13
.
721
},
{
"INF"
,
0
,
0
},
{
".21e12"
,
6
,
210000000000
.
0
},
{
"214353e-3"
,
9
,
214
.
353
},
{
"NAN"
,
0
,
0
},
{
"12.1d2"
,
6
,
12.1e2
},
{
" d10"
,
0
,
0
},
{
"0.1"
,
3
,
0
.
1
},
{
"-0.1"
,
4
,
-
0
.
1
},
{
"0.1281832188491894198128921"
,
27
,
0
.
1281832188491894198128921
},
{
"0.82181281288121"
,
16
,
0
.
82181281288121
},
{
"21921922352523587651128218821"
,
29
,
21921922352523587651128218821
.
0
},
{
"0.1d238"
,
7
,
0.1e238
},
{
"0.1D-4736"
,
9
,
0
},
{
"3.4028234663852887e38"
,
21
,
FLT_MAX
},
{
"1.7976931348623158e+308"
,
23
,
DBL_MAX
},
};
const
char
overflow
[]
=
"1d9999999999999999999"
;
const
char
overflow
[]
=
"1d9999999999999999999"
;
const
char
white_chars
[]
=
" d10"
;
char
*
end
;
char
*
end
;
double
d
;
double
d
;
int
i
;
d
=
strtod
(
double1
,
&
end
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
ok
(
d
==
12
.
1
,
"d = %.16e
\n
"
,
d
);
{
ok
(
end
==
double1
+
4
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double1
));
errno
=
0xdeadbeef
;
d
=
strtod
(
tests
[
i
].
str
,
&
end
);
d
=
strtod
(
double2
,
&
end
);
ok
(
d
==
tests
[
i
].
ret
,
"%d) d = %.16e
\n
"
,
i
,
d
);
ok
(
d
==
-
13
.
721
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
tests
[
i
].
str
+
tests
[
i
].
len
,
"%d) len = %d
\n
"
,
ok
(
end
==
double2
+
7
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double2
));
i
,
(
int
)(
end
-
tests
[
i
].
str
));
ok
(
errno
=
0xdeadbeef
,
"%d) errno = %d
\n
"
,
i
,
errno
);
d
=
strtod
(
double3
,
&
end
);
}
ok
(
d
==
0
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
double3
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double3
));
d
=
strtod
(
double4
,
&
end
);
ok
(
d
==
210000000000
.
0
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
double4
+
6
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double4
));
d
=
strtod
(
double5
,
&
end
);
ok
(
d
==
214
.
353
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
double5
+
9
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double5
));
d
=
strtod
(
double6
,
&
end
);
ok
(
d
==
0
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
double6
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
double6
));
d
=
strtod
(
"12.1d2"
,
NULL
);
ok
(
d
==
12.1e2
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
white_chars
,
&
end
);
ok
(
d
==
0
,
"d = %.16e
\n
"
,
d
);
ok
(
end
==
white_chars
,
"incorrect end (%d)
\n
"
,
(
int
)(
end
-
white_chars
));
if
(
!
p__strtod_l
)
if
(
!
p__strtod_l
)
win_skip
(
"_strtod_l not found
\n
"
);
win_skip
(
"_strtod_l not found
\n
"
);
...
@@ -2013,22 +2009,6 @@ static void test__strtod(void)
...
@@ -2013,22 +2009,6 @@ static void test__strtod(void)
setlocale
(
LC_ALL
,
"C"
);
setlocale
(
LC_ALL
,
"C"
);
/* Precision tests */
d
=
strtod
(
"0.1"
,
NULL
);
ok
(
d
==
0
.
1
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"-0.1"
,
NULL
);
ok
(
d
==
-
0
.
1
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"0.1281832188491894198128921"
,
NULL
);
ok
(
d
==
0
.
1281832188491894198128921
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"0.82181281288121"
,
NULL
);
ok
(
d
==
0
.
82181281288121
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"21921922352523587651128218821"
,
NULL
);
ok
(
d
==
21921922352523587651128218821
.
0
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"0.1d238"
,
NULL
);
ok
(
d
==
0.1e238
,
"d = %.16e
\n
"
,
d
);
d
=
strtod
(
"0.1D-4736"
,
NULL
);
ok
(
d
==
0
.
0
,
"d = %.16e
\n
"
,
d
);
errno
=
0xdeadbeef
;
errno
=
0xdeadbeef
;
strtod
(
overflow
,
&
end
);
strtod
(
overflow
,
&
end
);
ok
(
errno
==
ERANGE
,
"errno = %x
\n
"
,
errno
);
ok
(
errno
==
ERANGE
,
"errno = %x
\n
"
,
errno
);
...
@@ -2037,12 +2017,6 @@ static void test__strtod(void)
...
@@ -2037,12 +2017,6 @@ static void test__strtod(void)
errno
=
0xdeadbeef
;
errno
=
0xdeadbeef
;
strtod
(
"-1d309"
,
NULL
);
strtod
(
"-1d309"
,
NULL
);
ok
(
errno
==
ERANGE
,
"errno = %x
\n
"
,
errno
);
ok
(
errno
==
ERANGE
,
"errno = %x
\n
"
,
errno
);
d
=
strtod
(
"3.4028234663852887e38"
,
NULL
);
ok
(
d
<=
FLT_MAX
,
"d = %e
\n
"
,
d
);
d
=
strtod
(
"1.7976931348623158e+308"
,
NULL
);
ok
(
d
==
DBL_MAX
,
"d = %le
\n
"
,
d
);
}
}
static
void
test_mbstowcs
(
void
)
static
void
test_mbstowcs
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment