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
78553db0
Commit
78553db0
authored
Dec 17, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Dec 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added _atodbl tests.
parent
3b5ab1b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
string.c
dlls/msvcrt/tests/string.c
+64
-0
stdlib.h
include/msvcrt/stdlib.h
+1
-0
No files found.
dlls/msvcrt/tests/string.c
View file @
78553db0
...
...
@@ -30,6 +30,7 @@
#include <locale.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
static
char
*
buf_to_string
(
const
unsigned
char
*
bin
,
int
len
,
int
nr
)
{
...
...
@@ -89,6 +90,7 @@ static size_t (__cdecl *p_wcrtomb)(char*, wchar_t, mbstate_t*);
static
int
(
__cdecl
*
p_tolower
)(
int
);
static
size_t
(
__cdecl
*
p_mbrlen
)(
const
char
*
,
size_t
,
mbstate_t
*
);
static
size_t
(
__cdecl
*
p_mbrtowc
)(
wchar_t
*
,
const
char
*
,
size_t
,
mbstate_t
*
);
static
int
(
__cdecl
*
p__atodbl_l
)(
_CRT_DOUBLE
*
,
char
*
,
_locale_t
);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
...
...
@@ -2376,6 +2378,66 @@ static void test_tolower(void)
setlocale
(
LC_ALL
,
"C"
);
}
static
void
test__atodbl
(
void
)
{
_CRT_DOUBLE
d
;
char
num
[
32
];
int
ret
;
if
(
!
p__atodbl_l
)
{
/* Old versions of msvcrt use different values for _OVERFLOW and _UNDERFLOW
* Because of this lets skip _atodbl tests when _atodbl_l is not available */
win_skip
(
"_atodbl_l is not available
\n
"
);
return
;
}
num
[
0
]
=
0
;
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
0
,
"_atodbl_l(&d,
\"\"
, NULL) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
0
,
"_atodbl(&d,
\"\"
) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
strcpy
(
num
,
"t"
);
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
0
,
"_atodbl_l(&d,
\"
t
\"
, NULL) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
0
,
"_atodbl(&d,
\"
t
\"
) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
strcpy
(
num
,
"0"
);
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
0
,
"_atodbl_l(&d,
\"
0
\"
, NULL) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
0
,
"_atodbl(&d,
\"
0
\"
) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
0
,
"d.x = %lf, expected 0
\n
"
,
d
.
x
);
strcpy
(
num
,
"123"
);
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
0
,
"_atodbl_l(&d,
\"
123
\"
, NULL) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
123
,
"d.x = %lf, expected 123
\n
"
,
d
.
x
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
0
,
"_atodbl(&d,
\"
123
\"
) returned %d, expected 0
\n
"
,
ret
);
ok
(
d
.
x
==
123
,
"d.x = %lf, expected 123
\n
"
,
d
.
x
);
strcpy
(
num
,
"1e-309"
);
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
_UNDERFLOW
,
"_atodbl_l(&d,
\"
1e-309
\"
, NULL) returned %d, expected _UNDERFLOW
\n
"
,
ret
);
ok
(
d
.
x
!=
0
&&
almost_equal
(
d
.
x
,
0
),
"d.x = %le, expected 0
\n
"
,
d
.
x
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
_UNDERFLOW
,
"_atodbl(&d,
\"
1e-309
\"
) returned %d, expected _UNDERFLOW
\n
"
,
ret
);
ok
(
d
.
x
!=
0
&&
almost_equal
(
d
.
x
,
0
),
"d.x = %le, expected 0
\n
"
,
d
.
x
);
strcpy
(
num
,
"1e309"
);
ret
=
p__atodbl_l
(
&
d
,
num
,
NULL
);
ok
(
ret
==
_OVERFLOW
,
"_atodbl_l(&d,
\"
1e309
\"
, NULL) returned %d, expected _OVERFLOW
\n
"
,
ret
);
ret
=
_atodbl
(
&
d
,
num
);
ok
(
ret
==
_OVERFLOW
,
"_atodbl(&d,
\"
1e309
\"
) returned %d, expected _OVERFLOW
\n
"
,
ret
);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -2420,6 +2482,7 @@ START_TEST(string)
p_mbrlen
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbrlen"
);
p_mbrtowc
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbrtowc"
);
p_mbsrtowcs
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbsrtowcs"
);
p__atodbl_l
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_atodbl_l"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -2469,4 +2532,5 @@ START_TEST(string)
test_wctob
();
test_wctomb
();
test_tolower
();
test__atodbl
();
}
include/msvcrt/stdlib.h
View file @
78553db0
...
...
@@ -140,6 +140,7 @@ typedef int (__cdecl *_onexit_t)(void);
int
__cdecl
_atodbl
(
_CRT_DOUBLE
*
,
char
*
);
int
__cdecl
_atodbl_l
(
_CRT_DOUBLE
*
,
char
*
,
_locale_t
);
int
__cdecl
_atoflt
(
_CRT_FLOAT
*
,
char
*
);
int
__cdecl
_atoflt_l
(
_CRT_FLOAT
*
,
char
*
,
_locale_t
);
__int64
__cdecl
_atoi64
(
const
char
*
);
...
...
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