]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / std / input.output / iostream.format / input.streams / istream.unformatted / ignore_0xff.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // XFAIL: with_system_cxx_lib=macosx10.7
11 // XFAIL: with_system_cxx_lib=macosx10.8
12
13 // <istream>
14
15 // basic_istream<charT,traits>&
16 //    ignore(streamsize n = 1, int_type delim = traits::eof());
17
18 // https://bugs.llvm.org/show_bug.cgi?id=16427
19
20 #include <sstream>
21 #include <cassert>
22
23 int main()
24 {
25     int bad=-1;
26     std::ostringstream os;
27     os << "aaaabbbb" << static_cast<char>(bad)
28        << "ccccdddd" << std::endl;
29     std::string s=os.str();
30
31     std::istringstream is(s);
32     const unsigned int ignoreLen=10;
33     std::istringstream::pos_type a=is.tellg();
34     is.ignore(ignoreLen);
35     std::istringstream::pos_type b=is.tellg();
36     assert((b-a)==ignoreLen);
37 }