1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
15 // int_type overflow(int_type c = EOF);
20 #include "test_macros.h"
26 std::strstreambuf
sb(buf
, sizeof(buf
), buf
);
27 assert(sb
.sputc('1') == '1');
28 assert(sb
.str() == std::string("1bc"));
29 assert(sb
.sputc('2') == '2');
30 assert(sb
.str() == std::string("12c"));
31 assert(sb
.sputc('3') == '3');
32 assert(sb
.str() == std::string("123"));
33 assert(sb
.sputc('4') == '4');
34 assert(sb
.str() == std::string("1234"));
35 assert(sb
.sputc('5') == '5');
36 assert(sb
.str() == std::string("12345"));
37 assert(sb
.sputc('6') == '6');
38 assert(sb
.str() == std::string("123456"));
39 assert(sb
.sputc('7') == '7');
40 assert(sb
.str() == std::string("1234567"));
41 assert(sb
.sputc('8') == '8');
42 assert(sb
.str() == std::string("12345678"));
43 assert(sb
.sputc('9') == '9');
44 assert(sb
.str() == std::string("123456789"));
45 assert(sb
.sputc('0') == '0');
46 assert(sb
.str() == std::string("1234567890"));
47 assert(sb
.sputc('1') == '1');
48 assert(sb
.str() == std::string("12345678901"));