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
20ac0613
Commit
20ac0613
authored
Jan 25, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jan 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: Add tests for HashData.
parent
005eb0bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
url.c
dlls/shlwapi/tests/url.c
+88
-0
No files found.
dlls/shlwapi/tests/url.c
View file @
20ac0613
...
...
@@ -1082,6 +1082,93 @@ static void test_ParseURL(void)
}
}
static
void
test_HashData
(
void
)
{
HRESULT
res
;
BYTE
input
[
16
]
=
{
0x51
,
0x33
,
0x4F
,
0xA7
,
0x45
,
0x15
,
0xF0
,
0x52
,
0x90
,
0x2B
,
0xE7
,
0xF5
,
0xFD
,
0xE1
,
0xA6
,
0xA7
};
BYTE
output
[
32
];
static
const
BYTE
expected
[]
=
{
0x54
,
0x9C
,
0x92
,
0x55
,
0xCD
,
0x82
,
0xFF
,
0xA1
,
0x8E
,
0x0F
,
0xCF
,
0x93
,
0x14
,
0xAA
,
0xE3
,
0x2D
};
static
const
BYTE
expected2
[]
=
{
0x54
,
0x9C
,
0x92
,
0x55
,
0xCD
,
0x82
,
0xFF
,
0xA1
,
0x8E
,
0x0F
,
0xCF
,
0x93
,
0x14
,
0xAA
,
0xE3
,
0x2D
,
0x47
,
0xFC
,
0x80
,
0xB8
,
0xD0
,
0x49
,
0xE6
,
0x13
,
0x2A
,
0x30
,
0x51
,
0x8D
,
0xF9
,
0x4B
,
0x07
,
0xA6
};
static
const
BYTE
expected3
[]
=
{
0x2B
,
0xDC
,
0x9A
,
0x1B
,
0xF0
,
0x5A
,
0xF9
,
0xC6
,
0xBE
,
0x94
,
0x6D
,
0xF3
,
0x33
,
0xC1
,
0x36
,
0x07
};
int
i
;
/* Test hashing with identically sized input/output buffers. */
res
=
HashData
(
input
,
16
,
output
,
16
);
ok
(
res
==
S_OK
,
"Expected HashData to return S_OK, got 0x%08x
\n
"
,
res
);
if
(
res
==
S_OK
)
ok
(
!
memcmp
(
output
,
expected
,
sizeof
(
expected
)),
"Output buffer did not match expected contents
\n
"
);
/* Test hashing with larger output buffer. */
res
=
HashData
(
input
,
16
,
output
,
32
);
ok
(
res
==
S_OK
,
"Expected HashData to return S_OK, got 0x%08x
\n
"
,
res
);
if
(
res
==
S_OK
)
ok
(
!
memcmp
(
output
,
expected2
,
sizeof
(
expected2
)),
"Output buffer did not match expected contents
\n
"
);
/* Test hashing with smaller input buffer. */
res
=
HashData
(
input
,
8
,
output
,
16
);
ok
(
res
==
S_OK
,
"Expected HashData to return S_OK, got 0x%08x
\n
"
,
res
);
if
(
res
==
S_OK
)
ok
(
!
memcmp
(
output
,
expected3
,
sizeof
(
expected3
)),
"Output buffer did not match expected contents
\n
"
);
/* Test passing NULL pointers for input/output parameters. */
res
=
HashData
(
NULL
,
0
,
NULL
,
0
);
ok
(
res
==
E_INVALIDARG
||
broken
(
res
==
S_OK
),
/* Windows 2000 */
"Expected HashData to return E_INVALIDARG, got 0x%08x
\n
"
,
res
);
res
=
HashData
(
input
,
0
,
NULL
,
0
);
ok
(
res
==
E_INVALIDARG
||
broken
(
res
==
S_OK
),
/* Windows 2000 */
"Expected HashData to return E_INVALIDARG, got 0x%08x
\n
"
,
res
);
res
=
HashData
(
NULL
,
0
,
output
,
0
);
ok
(
res
==
E_INVALIDARG
||
broken
(
res
==
S_OK
),
/* Windows 2000 */
"Expected HashData to return E_INVALIDARG, got 0x%08x
\n
"
,
res
);
/* Test passing valid pointers with sizes of zero. */
for
(
i
=
0
;
i
<
sizeof
(
input
)
/
sizeof
(
BYTE
);
i
++
)
input
[
i
]
=
0x00
;
for
(
i
=
0
;
i
<
sizeof
(
output
)
/
sizeof
(
BYTE
);
i
++
)
output
[
i
]
=
0xFF
;
res
=
HashData
(
input
,
0
,
output
,
0
);
ok
(
res
==
S_OK
,
"Expected HashData to return S_OK, got 0x%08x
\n
"
,
res
);
/* The buffers should be unchanged. */
for
(
i
=
0
;
i
<
sizeof
(
input
)
/
sizeof
(
BYTE
);
i
++
)
{
ok
(
input
[
i
]
==
0x00
,
"Expected the input buffer to be unchanged
\n
"
);
if
(
input
[
i
]
!=
0x00
)
break
;
}
for
(
i
=
0
;
i
<
sizeof
(
output
)
/
sizeof
(
BYTE
);
i
++
)
{
ok
(
output
[
i
]
==
0xFF
,
"Expected the output buffer to be unchanged
\n
"
);
if
(
output
[
i
]
!=
0xFF
)
break
;
}
/* Input/output parameters are not validated. */
res
=
HashData
((
BYTE
*
)
0xdeadbeef
,
0
,
(
BYTE
*
)
0xdeadbeef
,
0
);
ok
(
res
==
S_OK
,
"Expected HashData to return S_OK, got 0x%08x
\n
"
,
res
);
if
(
0
)
{
res
=
HashData
((
BYTE
*
)
0xdeadbeef
,
1
,
(
BYTE
*
)
0xdeadbeef
,
1
);
trace
(
"HashData returned 0x%08x
\n
"
,
res
);
}
}
/* ########################### */
START_TEST
(
url
)
...
...
@@ -1103,4 +1190,5 @@ START_TEST(url)
test_UrlIs
();
test_UrlUnescape
();
test_ParseURL
();
test_HashData
();
}
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