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
22a6c60e
Commit
22a6c60e
authored
Jun 21, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add tests for profile struct functions.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
81406047
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
profile.c
dlls/kernel32/tests/profile.c
+72
-0
No files found.
dlls/kernel32/tests/profile.c
View file @
22a6c60e
...
...
@@ -1092,6 +1092,77 @@ static void test_WritePrivateProfileString(void)
DeleteFileA
(
path
);
}
static
void
test_profile_struct
(
void
)
{
static
const
char
expect_data
[]
=
"[s]
\r\n
key=616261637573006F
\r\n
"
;
char
buffer
[
20
];
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
sizeof
(
buffer
),
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStructA
(
"s"
,
"key"
,
(
void
*
)
"abacus"
,
sizeof
(
"abacus"
),
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
check_file_data
(
"./winetest.ini"
,
expect_data
),
"file doesn't match
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
6
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
8
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"abacus"
),
"data didn't match
\n
"
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileStringA
(
"s"
,
"key"
,
"default"
,
buffer
,
sizeof
(
buffer
),
"./winetest.ini"
);
ok
(
ret
==
16
,
"got size %u
\n
"
,
ret
);
ok
(
!
strcmp
(
buffer
,
"616261637573006F"
),
"got %s
\n
"
,
debugstr_a
(
buffer
));
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"636163747573006F"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"6361637475730083"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
!
strcmp
(
buffer
,
"cactus"
),
"data didn't match
\n
"
);
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"636163747573008Q"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"got error %u
\n
"
,
GetLastError
());
ret
=
WritePrivateProfileStringA
(
"s"
,
"key"
,
"16361637475730083"
,
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetPrivateProfileStructA
(
"s"
,
"key"
,
buffer
,
7
,
"./winetest.ini"
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_BAD_LENGTH
,
"got error %u
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
"./winetest.ini"
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
}
START_TEST
(
profile
)
{
test_profile_int
();
...
...
@@ -1119,4 +1190,5 @@ START_TEST(profile)
"[section2]
\r
"
,
"CR only"
);
test_WritePrivateProfileString
();
test_profile_struct
();
}
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