1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <streambuf> 10 11 // template <class charT, class traits = char_traits<charT> > 12 // class basic_streambuf; 13 14 // void setp(char_type* pbeg, char_type* pend); 15 16 #include <streambuf> 17 #include <cassert> 18 19 #include "test_macros.h" 20 21 template <class CharT> 22 struct test 23 : public std::basic_streambuf<CharT> 24 { 25 typedef std::basic_streambuf<CharT> base; 26 testtest27 test() {} 28 setptest29 void setp(CharT* pbeg, CharT* pend) 30 { 31 base::setp(pbeg, pend); 32 assert(base::pbase() == pbeg); 33 assert(base::pptr() == pbeg); 34 assert(base::epptr() == pend); 35 } 36 }; 37 main(int,char **)38int main(int, char**) 39 { 40 { 41 test<char> t; 42 char in[] = "ABC"; 43 t.setp(in, in+sizeof(in)/sizeof(in[0])); 44 } 45 { 46 test<wchar_t> t; 47 wchar_t in[] = L"ABC"; 48 t.setp(in, in+sizeof(in)/sizeof(in[0])); 49 } 50 51 return 0; 52 } 53