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// <streambuf>
11
12// template <class charT, class traits = char_traits<charT> >
13// class basic_streambuf;
14
15// void pbump(int n);
16
17#include <streambuf>
18#include <cassert>
19
20template <class CharT>
21struct test
22    : public std::basic_streambuf<CharT>
23{
24    typedef std::basic_streambuf<CharT> base;
25
26    test() {}
27
28    void setp(CharT* pbeg, CharT* pend)
29    {
30        base::setp(pbeg, pend);
31    }
32
33    void pbump(int n)
34    {
35        CharT* pbeg = base::pbase();
36        CharT* pnext = base::pptr();
37        CharT* pend = base::epptr();
38        base::pbump(n);
39        assert(base::pbase() == pbeg);
40        assert(base::pptr() == pnext+n);
41        assert(base::epptr() == pend);
42    }
43};
44
45int main()
46{
47    {
48        test<char> t;
49        char in[] = "ABCDE";
50        t.setp(in, in+sizeof(in)/sizeof(in[0]));
51        t.pbump(2);
52        t.pbump(1);
53    }
54    {
55        test<wchar_t> t;
56        wchar_t in[] = L"ABCDE";
57        t.setp(in, in+sizeof(in)/sizeof(in[0]));
58        t.pbump(3);
59        t.pbump(1);
60    }
61}
62