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
a504a79d
Commit
a504a79d
authored
Oct 13, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Oct 14, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Add tests for UuidCreate.
parent
a9b2ee2a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
rpc.c
dlls/rpcrt4/tests/rpc.c
+69
-0
No files found.
dlls/rpcrt4/tests/rpc.c
View file @
a504a79d
...
...
@@ -761,6 +761,74 @@ static void test_RpcStringBindingFromBinding(void)
ok
(
status
==
RPC_S_OK
,
"RpcBindingFree failed with error %lu
\n
"
,
status
);
}
static
char
*
printGuid
(
char
*
buf
,
const
UUID
*
guid
)
{
sprintf
(
buf
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}
\n
"
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]);
return
buf
;
}
static
void
test_UuidCreate
(
void
)
{
UUID
guid
;
BYTE
version
;
UuidCreate
(
&
guid
);
version
=
(
guid
.
Data3
&
0xf000
)
>>
12
;
todo_wine
ok
(
version
==
4
||
broken
(
version
==
1
),
"unexpected version %d
\n
"
,
version
);
if
(
version
==
4
)
{
static
UUID
v4and
=
{
0
,
0
,
0x4000
,
{
0x80
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
};
static
UUID
v4or
=
{
0xffffffff
,
0xffff
,
0x4fff
,
{
0xbf
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
}
};
UUID
and
,
or
;
RPC_STATUS
rslt
;
int
i
;
char
buf
[
39
];
memcpy
(
&
and
,
&
guid
,
sizeof
(
guid
));
memcpy
(
&
or
,
&
guid
,
sizeof
(
guid
));
/* Generate a bunch of UUIDs and mask them. By the end, we expect
* every randomly generated bit to have been zero at least once,
* resulting in no bits set in the and mask except those which are not
* randomly generated: the version number and the topmost bits of the
* Data4 field (treated as big-endian.) Similarly, we expect only
* the bits which are not randomly set to be cleared in the or mask.
*/
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
LPBYTE
src
,
dst
;
UuidCreate
(
&
guid
);
for
(
src
=
(
LPBYTE
)
&
guid
,
dst
=
(
LPBYTE
)
&
and
;
src
-
(
LPBYTE
)
&
guid
<
sizeof
(
guid
);
src
++
,
dst
++
)
*
dst
&=
*
src
;
for
(
src
=
(
LPBYTE
)
&
guid
,
dst
=
(
LPBYTE
)
&
or
;
src
-
(
LPBYTE
)
&
guid
<
sizeof
(
guid
);
src
++
,
dst
++
)
*
dst
|=
*
src
;
}
ok
(
UuidEqual
(
&
and
,
&
v4and
,
&
rslt
),
"unexpected bits set in V4 UUID: %s
\n
"
,
printGuid
(
buf
,
&
and
));
ok
(
UuidEqual
(
&
or
,
&
v4or
,
&
rslt
),
"unexpected bits set in V4 UUID: %s
\n
"
,
printGuid
(
buf
,
&
or
));
}
else
{
/* Older versions of Windows generate V1 UUIDs. For these, there are
* many stable bits, including at least the MAC address if one is
* present. Just check that Data4[0]'s most significant bits are
* set as expected.
*/
todo_wine
ok
((
guid
.
Data4
[
0
]
&
0xc0
)
==
0x80
,
"unexpected value in Data4[0]: %02x
\n
"
,
guid
.
Data4
[
0
]
&
0xc0
);
}
}
START_TEST
(
rpc
)
{
static
unsigned
char
ncacn_np
[]
=
"ncacn_np"
;
...
...
@@ -779,4 +847,5 @@ START_TEST( rpc )
test_endpoint_mapper
(
ncacn_np
,
np_address
,
np_endpoint
);
test_endpoint_mapper
(
ncalrpc
,
NULL
,
lrpc_endpoint
);
test_RpcStringBindingFromBinding
();
test_UuidCreate
();
}
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