Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e30b853e
Commit
e30b853e
authored
Jun 08, 2020
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucrtbase: Add printf %a format tests.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
111e4221
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
printf.c
dlls/ucrtbase/tests/printf.c
+62
-0
No files found.
dlls/ucrtbase/tests/printf.c
View file @
e30b853e
...
...
@@ -648,6 +648,67 @@ static void test_printf_natural_string(void)
ok
(
!
lstrcmpW
(
wbuffer
,
wide_out
),
"buffer wrong, got=%s
\n
"
,
wine_dbgstr_w
(
wbuffer
));
}
static
void
test_printf_fp
(
void
)
{
static
const
int
flags
[]
=
{
0
,
_CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY
,
_CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS
,
_CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY
|
_CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS
};
static
const
struct
{
const
char
*
fmt
;
double
d
;
const
char
*
res
[
ARRAY_SIZE
(
flags
)];
}
tests
[]
=
{
{
"%a"
,
0
,
{
"0x0.0000000000000p+0"
}},
{
"%A"
,
0
,
{
"0X0.0000000000000P+0"
}},
{
"%a"
,
0
.
5
,
{
"0x1.0000000000000p-1"
}},
{
"%a"
,
1
,
{
"0x1.0000000000000p+0"
}},
{
"%a"
,
20
,
{
"0x1.4000000000000p+4"
}},
{
"%a"
,
-
1
,
{
"-0x1.0000000000000p+0"
}},
{
"%a"
,
0
.
1
,
{
"0x1.999999999999ap-4"
}},
{
"%24a"
,
0
.
1
,
{
" 0x1.999999999999ap-4"
}},
{
"%024a"
,
0
.
1
,
{
"0x00001.999999999999ap-4"
}},
{
"%.2a"
,
0
.
1
,
{
"0x1.9ap-4"
}},
{
"%.20a"
,
0
.
1
,
{
"0x1.999999999999a0000000p-4"
}},
{
"%.a"
,
0.1e-20
,
{
"0x1p-70"
}},
{
"%a"
,
0.1e-20
,
{
"0x1.2e3b40a0e9b4fp-70"
}},
{
"%a"
,
4.9406564584124654e-324
,
{
"0x0.0000000000001p-1022"
}},
{
"%.0a"
,
-
1
.
5
,
{
"-0x1p+0"
}},
{
"%.0a"
,
-
0
.
5
,
{
"-0x1p-1"
}},
{
"%.0a"
,
0
.
5
,
{
"0x1p-1"
}},
{
"%.0a"
,
1
.
5
,
{
"0x1p+0"
}},
{
"%.0a"
,
1
.
99
,
{
"0x2p+0"
}},
{
"%.0a"
,
2
,
{
"0x1p+1"
}},
{
"%.0a"
,
9
.
5
,
{
"0x1p+3"
}},
{
"%.0a"
,
10
.
5
,
{
"0x1p+3"
}},
{
"%#.0a"
,
-
1
.
5
,
{
"-0x1.p+0"
}},
{
"%#.0a"
,
-
0
.
5
,
{
"-0x1.p-1"
}},
{
"%#.0a"
,
0
.
5
,
{
"0x1.p-1"
}},
{
"%#.0a"
,
1
.
5
,
{
"0x1.p+0"
}},
};
const
char
*
res
=
NULL
;
char
buf
[
100
];
int
i
,
j
,
r
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
tests
);
i
++
)
{
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
flags
);
j
++
)
{
if
(
tests
[
i
].
res
[
j
])
res
=
tests
[
i
].
res
[
j
];
r
=
vsprintf_wrapper
(
flags
[
j
],
buf
,
sizeof
(
buf
),
tests
[
i
].
fmt
,
tests
[
i
].
d
);
ok
(
r
==
strlen
(
res
),
"%d,%d) r = %d, expected %d
\n
"
,
i
,
j
,
r
,
strlen
(
res
));
ok
(
!
strcmp
(
buf
,
res
),
"%d,%d) buf = %s, expected %s
\n
"
,
i
,
j
,
buf
,
res
);
}
}
}
START_TEST
(
printf
)
{
ok
(
_set_invalid_parameter_handler
(
test_invalid_parameter_handler
)
==
NULL
,
...
...
@@ -664,4 +725,5 @@ START_TEST(printf)
test_printf_legacy_three_digit_exp
();
test_printf_c99
();
test_printf_natural_string
();
test_printf_fp
();
}
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