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
c7fb64db
Commit
c7fb64db
authored
Mar 08, 2017
by
Bruno Jesus
Committed by
Alexandre Julliard
Mar 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add 64bit number tests for FormatMessage[A|W].
Signed-off-by:
Bruno Jesus
<
bjesus@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c54b667e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
format_msg.c
dlls/kernel32/tests/format_msg.c
+77
-0
No files found.
dlls/kernel32/tests/format_msg.c
View file @
c7fb64db
...
...
@@ -24,6 +24,8 @@
#include "winbase.h"
#include "winnls.h"
#define ULL(a,b) (((ULONG64)(a) << 32) | (b))
static
DWORD
__cdecl
doit
(
DWORD
flags
,
LPCVOID
src
,
DWORD
msg_id
,
DWORD
lang_id
,
LPSTR
out
,
DWORD
outsize
,
...
)
{
...
...
@@ -1781,6 +1783,80 @@ static void test_message_invalid_flags_wide(void)
"Expected the output buffer to be untouched
\n
"
);
}
static
void
test_message_from_64bit_number
(
void
)
{
static
const
WCHAR
I64d
[]
=
{
'%'
,
'1'
,
'!'
,
'I'
,
'6'
,
'4'
,
'd'
,
'!'
,
0
};
static
const
WCHAR
I64u
[]
=
{
'%'
,
'1'
,
'!'
,
'I'
,
'6'
,
'4'
,
'u'
,
'!'
,
0
};
WCHAR
outW
[
0x100
],
expW
[
0x100
];
char
outA
[
0x100
];
DWORD
r
;
static
const
struct
{
UINT64
number
;
const
char
expected
[
32
];
int
len
;
}
unsigned_tests
[]
=
{
{
0
,
"0"
,
1
},
{
1234567890
,
"1234567890"
,
10
},
{
ULL
(
0xFFFFFFFF
,
0xFFFFFFFF
),
"18446744073709551615"
,
20
},
{
ULL
(
0x7FFFFFFF
,
0xFFFFFFFF
),
"9223372036854775807"
,
19
},
};
static
const
struct
{
INT64
number
;
const
char
expected
[
32
];
int
len
;
}
signed_tests
[]
=
{
{
0
,
"0"
,
1
},
{
1234567890
,
"1234567890"
,
10
},
{
-
1
,
"-1"
,
2
},
{
ULL
(
0xFFFFFFFF
,
0xFFFFFFFF
),
"-1"
,
2
},
{
ULL
(
0x7FFFFFFF
,
0xFFFFFFFF
),
"9223372036854775807"
,
19
},
{
-
ULL
(
0x7FFFFFFF
,
0xFFFFFFFF
),
"-9223372036854775807"
,
20
},
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
unsigned_tests
)
/
sizeof
(
unsigned_tests
[
0
]);
i
++
)
{
r
=
doitW
(
FORMAT_MESSAGE_FROM_STRING
,
I64u
,
0
,
0
,
outW
,
sizeof
(
outW
)
/
sizeof
(
WCHAR
),
unsigned_tests
[
i
].
number
);
MultiByteToWideChar
(
CP_ACP
,
0
,
unsigned_tests
[
i
].
expected
,
-
1
,
expW
,
sizeof
(
expW
));
todo_wine
{
ok
(
!
lstrcmpW
(
outW
,
expW
),
"[%d] failed, expected %s, got %s
\n
"
,
i
,
unsigned_tests
[
i
].
expected
,
wine_dbgstr_w
(
outW
));
ok
(
r
==
unsigned_tests
[
i
].
len
,
"[%d] failed: r=%d
\n
"
,
i
,
r
);
}
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!I64u!"
,
0
,
0
,
outA
,
sizeof
(
outA
),
unsigned_tests
[
i
].
number
);
todo_wine
{
ok
(
!
strcmp
(
outA
,
unsigned_tests
[
i
].
expected
),
"[%d] failed, expected %s, got %s
\n
"
,
i
,
unsigned_tests
[
i
].
expected
,
outA
);
ok
(
r
==
unsigned_tests
[
i
].
len
,
"[%d] failed: r=%d
\n
"
,
i
,
r
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
signed_tests
)
/
sizeof
(
signed_tests
[
0
]);
i
++
)
{
r
=
doitW
(
FORMAT_MESSAGE_FROM_STRING
,
I64d
,
0
,
0
,
outW
,
sizeof
(
outW
)
/
sizeof
(
WCHAR
),
signed_tests
[
i
].
number
);
MultiByteToWideChar
(
CP_ACP
,
0
,
signed_tests
[
i
].
expected
,
-
1
,
expW
,
sizeof
(
expW
));
todo_wine
{
ok
(
!
lstrcmpW
(
outW
,
expW
),
"[%d] failed, expected %s, got %s
\n
"
,
i
,
signed_tests
[
i
].
expected
,
wine_dbgstr_w
(
outW
));
ok
(
r
==
signed_tests
[
i
].
len
,
"[%d] failed: r=%d
\n
"
,
i
,
r
);
}
r
=
doit
(
FORMAT_MESSAGE_FROM_STRING
,
"%1!I64d!"
,
0
,
0
,
outA
,
sizeof
(
outA
),
signed_tests
[
i
].
number
);
todo_wine
{
ok
(
!
strcmp
(
outA
,
signed_tests
[
i
].
expected
),
"[%d] failed, expected %s, got %s
\n
"
,
i
,
signed_tests
[
i
].
expected
,
outA
);
ok
(
r
==
signed_tests
[
i
].
len
,
"[%d] failed: r=%d
\n
"
,
i
,
r
);
}
}
}
START_TEST
(
format_msg
)
{
DWORD
ret
;
...
...
@@ -1808,4 +1884,5 @@ START_TEST(format_msg)
test_message_null_buffer_wide
();
test_message_allocate_buffer_wide
();
test_message_invalid_flags_wide
();
test_message_from_64bit_number
();
}
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