blob: e03e8e0cbda3ca88df39d29b804dccf2331cfc1e [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
10// <streambuf>
11
12// template <class charT, class traits = char_traits<charT> >
13// class basic_streambuf;
14
15// streamsize sputn(const char_type* s, streamsize n);
16
17#include <streambuf>
18#include <cassert>
19
20int xsputn_called = 0;
21
22struct test
23 : public std::basic_streambuf<char>
24{
25 test() {}
26
27protected:
Dan Albert1d4a1ed2016-05-25 22:36:09 -070028 std::streamsize xsputn(const char_type* s, std::streamsize n)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000029 {
30 ++xsputn_called;
31 return 5;
32 }
33};
34
35int main()
36{
37 test t;
38 assert(xsputn_called == 0);
39 assert(t.sputn(0, 0) == 5);
40 assert(xsputn_called == 1);
41}