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
f8e4d4cc
Commit
f8e4d4cc
authored
Jul 17, 2006
by
Duane Clark
Committed by
Alexandre Julliard
Jul 18, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add tests of file operations in ASCII mode.
parent
d85110a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
file.c
dlls/msvcrt/tests/file.c
+52
-0
No files found.
dlls/msvcrt/tests/file.c
View file @
f8e4d4cc
...
...
@@ -132,6 +132,57 @@ static void test_fileops( void )
unlink
(
"fdopen.tst"
);
}
static
void
test_asciifileops
(
void
)
{
static
const
char
outbuffer
[]
=
"0,1,2,3,4,5,6,7,8,9
\r\n\r\n
A,B,C,D,E
\r\n
X,Y,Z"
;
char
buffer
[
256
];
int
fd
;
FILE
*
file
;
int
i
;
long
l
;
fd
=
open
(
"fdopen.tst"
,
O_WRONLY
|
O_CREAT
|
O_BINARY
,
_S_IREAD
|
_S_IWRITE
);
write
(
fd
,
outbuffer
,
sizeof
(
outbuffer
));
close
(
fd
);
/* Open file in ascii mode */
fd
=
open
(
"fdopen.tst"
,
O_RDONLY
);
file
=
fdopen
(
fd
,
"rb"
);
ok
(
strlen
(
outbuffer
)
==
(
sizeof
(
outbuffer
)
-
1
),
"strlen/sizeof error
\n
"
);
ok
(
ftell
(
file
)
==
0
,
"Did not start at beginning of file
\n
"
);
ok
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
)
!=
0
,
"line 1 fgets failed unexpected
\n
"
);
ok
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
)
!=
0
,
"line 2 fgets failed unexpected
\n
"
);
ok
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
)
!=
0
,
"line 3 fgets failed unexpected
\n
"
);
ok
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
)
!=
0
,
"line 4 fgets failed unexpected
\n
"
);
ok
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
)
==
0
,
"fgets didn't signal EOF
\n
"
);
ok
(
feof
(
file
)
!=
0
,
"feof doesn't signal EOF
\n
"
);
rewind
(
file
);
ok
(
ftell
(
file
)
==
0
,
"Did not rewind to beginning of file
\n
"
);
for
(
i
=
0
;
i
<
strlen
(
outbuffer
);
i
++
)
if
(
outbuffer
[
i
]
==
'\n'
)
break
;
i
++
;
ok
(
fgets
(
buffer
,
strlen
(
outbuffer
),
file
)
!=
0
,
"line 1 fgets failed unexpected
\n
"
);
l
=
ftell
(
file
);
todo_wine
ok
(
l
==
i
,
"line 1 ftell got %ld should be %d
\n
"
,
l
,
i
);
ok
(
lstrlenA
(
buffer
)
==
i
-
1
,
"line 1 fgets got size %d should be %d
\n
"
,
lstrlenA
(
buffer
),
i
-
1
);
ok
(
fgets
(
buffer
,
sizeof
(
outbuffer
),
file
)
!=
0
,
"line 2 fgets failed unexpected
\n
"
);
i
+=
2
;
l
=
ftell
(
file
);
todo_wine
ok
(
l
==
i
,
"line 2 ftell got %ld should be %d
\n
"
,
l
,
i
);
ok
(
lstrlenA
(
buffer
)
==
1
,
"line 2 fgets got size %d should be %d
\n
"
,
lstrlenA
(
buffer
),
1
);
ok
(
fgets
(
buffer
,
sizeof
(
outbuffer
),
file
)
!=
0
,
"line 3 fgets failed unexpected
\n
"
);
for
(;
i
<
strlen
(
outbuffer
);
i
++
)
if
(
outbuffer
[
i
]
==
'\n'
)
break
;
i
++
;
l
=
ftell
(
file
);
ok
(
l
==
i
,
"line 3 ftell got %ld should be %d
\n
"
,
l
,
i
);
fclose
(
file
);
unlink
(
"fdopen.tst"
);
}
static
WCHAR
*
AtoW
(
char
*
p
)
{
WCHAR
*
buffer
;
...
...
@@ -505,6 +556,7 @@ START_TEST(file)
test_fdopen
();
test_fopen_fclose_fcloseall
();
test_fileops
();
test_asciifileops
();
test_fgetwc
();
test_file_put_get
();
test_tmpnam
();
...
...
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