Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
6a5f27be
Commit
6a5f27be
authored
May 06, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test.
parent
eb09e586
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
test/gtest-extra-test.cc
test/gtest-extra-test.cc
+22
-0
No files found.
test/gtest-extra-test.cc
View file @
6a5f27be
...
@@ -504,6 +504,28 @@ TEST(FileTest, Read) {
...
@@ -504,6 +504,28 @@ TEST(FileTest, Read) {
EXPECT_READ
(
f
,
"language: cpp"
);
EXPECT_READ
(
f
,
"language: cpp"
);
}
}
#ifdef _WIN32
// The count argument to the read function is unsigned on Windows, so check
// if integer overflow is handled properly.
TEST
(
FileTest
,
ReadCountOverflow
)
{
if
(
sizeof
(
std
::
size_t
)
==
sizeof
(
unsigned
))
return
;
File
read_end
,
write_end
;
File
::
pipe
(
read_end
,
write_end
);
Write
(
write_end
,
"test"
);
write_end
.
close
();
char
buffer
[
4
];
std
::
size_t
offset
=
0
;
std
::
size_t
count
=
std
::
numeric_limits
<
unsigned
>::
max
()
+
std
::
size_t
(
1
);
std
::
streamsize
n
=
0
;
do
{
n
=
read_end
.
read
(
buffer
+
offset
,
count
);
offset
+=
n
;
}
while
(
n
!=
0
);
EXPECT_EQ
(
"test"
,
std
::
string
(
buffer
,
offset
));
}
#endif
TEST
(
FileTest
,
ReadError
)
{
TEST
(
FileTest
,
ReadError
)
{
File
read_end
,
write_end
;
File
read_end
,
write_end
;
File
::
pipe
(
read_end
,
write_end
);
File
::
pipe
(
read_end
,
write_end
);
...
...
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