aboutsummaryrefslogtreecommitdiffstats
path: root/test/std/input.output
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/input.output')
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
index 6d20db13189a..8ec69cb24b60 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/seekoff.pass.cpp
@@ -21,6 +21,30 @@
int main()
{
{
+ std::stringbuf sb(std::ios_base::in);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(0, std::ios_base::beg, std::ios_base::in) == 0);
+ assert(sb.pubseekoff(0, std::ios_base::cur, std::ios_base::in) == 0);
+ assert(sb.pubseekoff(0, std::ios_base::end, std::ios_base::in) == 0);
+ }
+ {
+ std::stringbuf sb(std::ios_base::out);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(-3, std::ios_base::end, std::ios_base::in | std::ios_base::out) == -1);
+ assert(sb.pubseekoff(0, std::ios_base::beg, std::ios_base::out) == 0);
+ assert(sb.pubseekoff(0, std::ios_base::cur, std::ios_base::out) == 0);
+ assert(sb.pubseekoff(0, std::ios_base::end, std::ios_base::out) == 0);
+ }
+ {
std::stringbuf sb("0123456789", std::ios_base::in);
assert(sb.pubseekoff(3, std::ios_base::beg, std::ios_base::out) == -1);
assert(sb.pubseekoff(3, std::ios_base::cur, std::ios_base::out) == -1);