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
b36a526f
Commit
b36a526f
authored
Jun 12, 2015
by
Iván Matellanes
Committed by
Alexandre Julliard
Jun 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcirt/tests: Add more streambuf tests.
parent
43dfe763
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
10 deletions
+41
-10
msvcirt.c
dlls/msvcirt/tests/msvcirt.c
+41
-10
No files found.
dlls/msvcirt/tests/msvcirt.c
View file @
b36a526f
...
@@ -196,7 +196,7 @@ static DWORD WINAPI lock_streambuf(void *arg)
...
@@ -196,7 +196,7 @@ static DWORD WINAPI lock_streambuf(void *arg)
static
void
test_streambuf
(
void
)
static
void
test_streambuf
(
void
)
{
{
streambuf
sb
,
sb2
,
*
psb
;
streambuf
sb
,
sb2
,
sb3
,
*
psb
;
struct
streambuf_lock_arg
lock_arg
;
struct
streambuf_lock_arg
lock_arg
;
HANDLE
thread
;
HANDLE
thread
;
char
reserve
[
16
];
char
reserve
[
16
];
...
@@ -205,6 +205,7 @@ static void test_streambuf(void)
...
@@ -205,6 +205,7 @@ static void test_streambuf(void)
memset
(
&
sb
,
0xab
,
sizeof
(
streambuf
));
memset
(
&
sb
,
0xab
,
sizeof
(
streambuf
));
memset
(
&
sb2
,
0xab
,
sizeof
(
streambuf
));
memset
(
&
sb2
,
0xab
,
sizeof
(
streambuf
));
memset
(
&
sb3
,
0xab
,
sizeof
(
streambuf
));
/* constructors */
/* constructors */
call_func1
(
p_streambuf_ctor
,
&
sb
);
call_func1
(
p_streambuf_ctor
,
&
sb
);
...
@@ -219,6 +220,11 @@ static void test_streambuf(void)
...
@@ -219,6 +220,11 @@ static void test_streambuf(void)
ok
(
sb2
.
base
==
reserve
,
"wrong base pointer, expected %p got %p
\n
"
,
reserve
,
sb2
.
base
);
ok
(
sb2
.
base
==
reserve
,
"wrong base pointer, expected %p got %p
\n
"
,
reserve
,
sb2
.
base
);
ok
(
sb2
.
ebuf
==
reserve
+
16
,
"wrong ebuf pointer, expected %p got %p
\n
"
,
reserve
+
16
,
sb2
.
ebuf
);
ok
(
sb2
.
ebuf
==
reserve
+
16
,
"wrong ebuf pointer, expected %p got %p
\n
"
,
reserve
+
16
,
sb2
.
ebuf
);
ok
(
sb
.
lock
.
LockCount
==
-
1
,
"wrong critical section state, expected -1 got %d
\n
"
,
sb
.
lock
.
LockCount
);
ok
(
sb
.
lock
.
LockCount
==
-
1
,
"wrong critical section state, expected -1 got %d
\n
"
,
sb
.
lock
.
LockCount
);
call_func1
(
p_streambuf_ctor
,
&
sb3
);
ok
(
sb3
.
allocated
==
0
,
"wrong allocate value, expected 0 got %d
\n
"
,
sb3
.
allocated
);
ok
(
sb3
.
unbuffered
==
0
,
"wrong unbuffered value, expected 0 got %d
\n
"
,
sb3
.
unbuffered
);
ok
(
sb3
.
base
==
NULL
,
"wrong base pointer, expected %p got %p
\n
"
,
NULL
,
sb3
.
base
);
ok
(
sb3
.
ebuf
==
NULL
,
"wrong ebuf pointer, expected %p got %p
\n
"
,
NULL
,
sb3
.
ebuf
);
/* setlock */
/* setlock */
ok
(
sb
.
do_lock
==
-
1
,
"expected do_lock value -1, got %d
\n
"
,
sb
.
do_lock
);
ok
(
sb
.
do_lock
==
-
1
,
"expected do_lock value -1, got %d
\n
"
,
sb
.
do_lock
);
...
@@ -326,34 +332,58 @@ static void test_streambuf(void)
...
@@ -326,34 +332,58 @@ static void test_streambuf(void)
ok
(
ret
==
1
,
"doallocate failed, got %d
\n
"
,
ret
);
ok
(
ret
==
1
,
"doallocate failed, got %d
\n
"
,
ret
);
ok
(
sb2
.
allocated
==
1
,
"wrong allocate value, expected 1 got %d
\n
"
,
sb2
.
allocated
);
ok
(
sb2
.
allocated
==
1
,
"wrong allocate value, expected 1 got %d
\n
"
,
sb2
.
allocated
);
ok
(
sb2
.
ebuf
-
sb2
.
base
==
512
,
"wrong reserve area size, expected 512 got %p-%p
\n
"
,
sb2
.
ebuf
,
sb2
.
base
);
ok
(
sb2
.
ebuf
-
sb2
.
base
==
512
,
"wrong reserve area size, expected 512 got %p-%p
\n
"
,
sb2
.
ebuf
,
sb2
.
base
);
ret
=
(
int
)
call_func1
(
p_streambuf_doallocate
,
&
sb3
);
ok
(
ret
==
1
,
"doallocate failed, got %d
\n
"
,
ret
);
ok
(
sb3
.
allocated
==
1
,
"wrong allocate value, expected 1 got %d
\n
"
,
sb3
.
allocated
);
ok
(
sb3
.
ebuf
-
sb3
.
base
==
512
,
"wrong reserve area size, expected 512 got %p-%p
\n
"
,
sb3
.
ebuf
,
sb3
.
base
);
/* sb: buffered, space available */
sb
.
eback
=
sb
.
gptr
=
sb
.
base
;
sb
.
egptr
=
sb
.
base
+
256
;
sb
.
pbase
=
sb
.
pptr
=
sb
.
base
+
256
;
sb
.
epptr
=
sb
.
base
+
512
;
/* sb2: buffered, no space available */
sb2
.
eback
=
sb2
.
base
;
sb2
.
gptr
=
sb2
.
egptr
=
sb2
.
base
+
256
;
sb2
.
pbase
=
sb2
.
base
+
256
;
sb2
.
pptr
=
sb2
.
epptr
=
sb2
.
base
+
512
;
/* sb3: unbuffered */
sb3
.
unbuffered
=
1
;
/* gbump */
/* gbump */
sb
.
eback
=
sb
.
base
+
100
;
sb
.
gptr
=
sb
.
base
+
104
;
sb
.
egptr
=
sb
.
base
+
110
;
call_func2
(
p_streambuf_gbump
,
&
sb
,
10
);
call_func2
(
p_streambuf_gbump
,
&
sb
,
10
);
ok
(
sb
.
gptr
==
sb
.
eback
+
1
4
,
"advance get pointer failed, expected %p got %p
\n
"
,
sb
.
eback
+
14
,
sb
.
gptr
);
ok
(
sb
.
gptr
==
sb
.
eback
+
1
0
,
"advance get pointer failed, expected %p got %p
\n
"
,
sb
.
eback
+
10
,
sb
.
gptr
);
call_func2
(
p_streambuf_gbump
,
&
sb
,
-
15
);
call_func2
(
p_streambuf_gbump
,
&
sb
,
-
15
);
ok
(
sb
.
gptr
==
sb
.
eback
-
1
,
"advance get pointer failed, expected %p got %p
\n
"
,
sb
.
eback
-
1
,
sb
.
gptr
);
ok
(
sb
.
gptr
==
sb
.
eback
-
5
,
"advance get pointer failed, expected %p got %p
\n
"
,
sb
.
eback
-
5
,
sb
.
gptr
);
sb
.
gptr
=
sb
.
eback
;
/* pbump */
/* pbump */
sb
.
pbase
=
sb
.
pptr
=
sb
.
base
+
200
;
sb
.
epptr
=
sb
.
base
+
210
;
call_func2
(
p_streambuf_pbump
,
&
sb
,
-
2
);
call_func2
(
p_streambuf_pbump
,
&
sb
,
-
2
);
ok
(
sb
.
pptr
==
sb
.
pbase
-
2
,
"advance put pointer failed, expected %p got %p
\n
"
,
sb
.
pbase
-
2
,
sb
.
pptr
);
ok
(
sb
.
pptr
==
sb
.
pbase
-
2
,
"advance put pointer failed, expected %p got %p
\n
"
,
sb
.
pbase
-
2
,
sb
.
pptr
);
call_func2
(
p_streambuf_pbump
,
&
sb
,
20
);
call_func2
(
p_streambuf_pbump
,
&
sb
,
20
);
ok
(
sb
.
pptr
==
sb
.
pbase
+
18
,
"advance put pointer failed, expected %p got %p
\n
"
,
sb
.
pbase
+
18
,
sb
.
pptr
);
ok
(
sb
.
pptr
==
sb
.
pbase
+
18
,
"advance put pointer failed, expected %p got %p
\n
"
,
sb
.
pbase
+
18
,
sb
.
pptr
);
sb
.
pptr
=
sb
.
pbase
;
/* sync */
/* sync */
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
ok
(
ret
==
EOF
,
"sync failed, expected EOF got %d
\n
"
,
ret
);
ok
(
ret
==
EOF
,
"sync failed, expected EOF got %d
\n
"
,
ret
);
sb
.
gptr
=
sb
.
egptr
;
sb
.
gptr
=
sb
.
egptr
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
ok
(
ret
==
EOF
,
"sync failed, expected EOF
got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"sync failed, expected 0
got %d
\n
"
,
ret
);
sb
.
pptr
=
sb
.
pbase
;
sb
.
gptr
=
sb
.
egptr
+
1
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb
);
todo_wine
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
sb
.
gptr
=
sb
.
eback
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb2
);
ok
(
ret
==
EOF
,
"sync failed, expected EOF got %d
\n
"
,
ret
);
sb2
.
pptr
=
sb2
.
pbase
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb2
);
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
sb2
.
pptr
=
sb2
.
pbase
-
1
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb2
);
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb2
);
todo_wine
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
sb2
.
pptr
=
sb2
.
epptr
;
ret
=
(
int
)
call_func1
(
p_streambuf_sync
,
&
sb3
);
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
ok
(
ret
==
0
,
"sync failed, expected 0 got %d
\n
"
,
ret
);
SetEvent
(
lock_arg
.
test
[
3
]);
SetEvent
(
lock_arg
.
test
[
3
]);
...
@@ -361,6 +391,7 @@ static void test_streambuf(void)
...
@@ -361,6 +391,7 @@ static void test_streambuf(void)
call_func1
(
p_streambuf_dtor
,
&
sb
);
call_func1
(
p_streambuf_dtor
,
&
sb
);
call_func1
(
p_streambuf_dtor
,
&
sb2
);
call_func1
(
p_streambuf_dtor
,
&
sb2
);
call_func1
(
p_streambuf_dtor
,
&
sb3
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
CloseHandle
(
lock_arg
.
lock
[
i
]);
CloseHandle
(
lock_arg
.
lock
[
i
]);
CloseHandle
(
lock_arg
.
test
[
i
]);
CloseHandle
(
lock_arg
.
test
[
i
]);
...
...
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