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
4145a7a8
Commit
4145a7a8
authored
Mar 22, 2002
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 22, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for GetSystemDirectoryA/W and GetWindowsDirectoryA/W.
parent
58ed1f17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
139 additions
and
0 deletions
+139
-0
Makefile.in
dlls/kernel/Makefile.in
+3
-0
.cvsignore
dlls/kernel/tests/.cvsignore
+3
-0
directory.c
dlls/kernel/tests/directory.c
+128
-0
kernel32_test.spec
dlls/kernel/tests/kernel32_test.spec
+5
-0
No files found.
dlls/kernel/Makefile.in
View file @
4145a7a8
...
...
@@ -39,6 +39,9 @@ EXTRASUBDIRS = \
nls
\
tests
CTESTS
=
\
tests/directory.c
PLTESTS
=
\
tests/atom.pl
...
...
dlls/kernel/tests/.cvsignore
View file @
4145a7a8
atom.ok
directory.ok
kernel32_test.spec.c
testlist.c
dlls/kernel/tests/directory.c
0 → 100644
View file @
4145a7a8
/*
* Unit test suite for directory functions.
*
* Copyright 2002 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "winbase.h"
#include "wine/test.h"
/* If you change something in these tests, please do the same
* for GetSystemDirectory tests.
*/
static
void
test_GetWindowsDirectoryA
(
void
)
{
UINT
len
,
len_with_null
;
char
buf
[
MAX_PATH
];
lstrcpyA
(
buf
,
"foo"
);
len_with_null
=
GetWindowsDirectoryA
(
buf
,
1
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
==
0
,
"should not touch the buffer"
);
ok
(
len_with_null
<=
MAX_PATH
,
"should fit into MAX_PATH"
);
lstrcpyA
(
buf
,
"foo"
);
len
=
GetWindowsDirectoryA
(
buf
,
len_with_null
-
1
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
==
0
,
"should not touch the buffer"
);
ok
(
len
==
len_with_null
,
"should return length with terminating 0"
);
lstrcpyA
(
buf
,
"foo"
);
len
=
GetWindowsDirectoryA
(
buf
,
len_with_null
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
!=
0
,
"should touch the buffer"
);
ok
(
len
==
lstrlenA
(
buf
),
"returned length should be equal to the length of string"
);
ok
(
len
==
(
len_with_null
-
1
),
"should return length without terminating 0"
);
}
static
void
test_GetWindowsDirectoryW
(
void
)
{
UINT
len
,
len_with_null
;
WCHAR
buf
[
MAX_PATH
];
static
const
WCHAR
fooW
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
lstrcpyW
(
buf
,
fooW
);
len_with_null
=
GetWindowsDirectoryW
(
buf
,
1
);
ok
(
lstrcmpW
(
buf
,
fooW
)
==
0
,
"should not touch the buffer"
);
ok
(
len_with_null
<=
MAX_PATH
,
"should fit into MAX_PATH"
);
lstrcpyW
(
buf
,
fooW
);
len
=
GetWindowsDirectoryW
(
buf
,
len_with_null
-
1
);
ok
(
lstrcmpW
(
buf
,
fooW
)
==
0
,
"should not touch the buffer"
);
ok
(
len
==
len_with_null
,
"should return length with terminating 0"
);
lstrcpyW
(
buf
,
fooW
);
len
=
GetWindowsDirectoryW
(
buf
,
len_with_null
);
ok
(
lstrcmpW
(
buf
,
fooW
)
!=
0
,
"should touch the buffer"
);
ok
(
len
==
lstrlenW
(
buf
),
"returned length should be equal to the length of string"
);
ok
(
len
==
(
len_with_null
-
1
),
"should return length without terminating 0"
);
}
/* If you change something in these tests, please do the same
* for GetWindowsDirectory tests.
*/
static
void
test_GetSystemDirectoryA
(
void
)
{
UINT
len
,
len_with_null
;
char
buf
[
MAX_PATH
];
lstrcpyA
(
buf
,
"foo"
);
len_with_null
=
GetSystemDirectoryA
(
buf
,
1
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
==
0
,
"should not touch the buffer"
);
ok
(
len_with_null
<=
MAX_PATH
,
"should fit into MAX_PATH"
);
lstrcpyA
(
buf
,
"foo"
);
len
=
GetSystemDirectoryA
(
buf
,
len_with_null
-
1
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
==
0
,
"should not touch the buffer"
);
ok
(
len
==
len_with_null
,
"should return length with terminating 0"
);
lstrcpyA
(
buf
,
"foo"
);
len
=
GetSystemDirectoryA
(
buf
,
len_with_null
);
ok
(
lstrcmpA
(
buf
,
"foo"
)
!=
0
,
"should touch the buffer"
);
ok
(
len
==
lstrlenA
(
buf
),
"returned length should be equal to the length of string"
);
ok
(
len
==
(
len_with_null
-
1
),
"should return length without terminating 0"
);
}
static
void
test_GetSystemDirectoryW
(
void
)
{
UINT
len
,
len_with_null
;
WCHAR
buf
[
MAX_PATH
];
static
const
WCHAR
fooW
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
lstrcpyW
(
buf
,
fooW
);
len_with_null
=
GetSystemDirectoryW
(
buf
,
1
);
ok
(
lstrcmpW
(
buf
,
fooW
)
==
0
,
"should not touch the buffer"
);
ok
(
len_with_null
<=
MAX_PATH
,
"should fit into MAX_PATH"
);
lstrcpyW
(
buf
,
fooW
);
len
=
GetSystemDirectoryW
(
buf
,
len_with_null
-
1
);
ok
(
lstrcmpW
(
buf
,
fooW
)
==
0
,
"should not touch the buffer"
);
ok
(
len
==
len_with_null
,
"should return length with terminating 0"
);
lstrcpyW
(
buf
,
fooW
);
len
=
GetSystemDirectoryW
(
buf
,
len_with_null
);
ok
(
lstrcmpW
(
buf
,
fooW
)
!=
0
,
"should touch the buffer"
);
ok
(
len
==
lstrlenW
(
buf
),
"returned length should be equal to the length of string"
);
ok
(
len
==
(
len_with_null
-
1
),
"should return length without terminating 0"
);
}
START_TEST
(
directory
)
{
test_GetWindowsDirectoryA
();
test_GetWindowsDirectoryW
();
test_GetSystemDirectoryA
();
test_GetSystemDirectoryW
();
}
dlls/kernel/tests/kernel32_test.spec
0 → 100644
View file @
4145a7a8
name kernel32_test
type win32
mode cuiexe
import kernel32.dll
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