[Utils] Identity map module-level debug info on first use in CloneFunction* (#118627)
[llvm-project.git] / libcxx / test / std / depr / depr.str.strstreams / depr.strstreambuf / depr.strstreambuf.virtuals / overflow.pass.cpp
blob6a932dc00afa2a379f6bb08f5490d6763144e7da
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 //===----------------------------------------------------------------------===//
9 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM
11 // <strstream>
13 // class strstreambuf
15 // int_type overflow(int_type c = EOF);
17 #include <strstream>
18 #include <cassert>
20 #include "test_macros.h"
22 int main(int, char**)
25 char buf[12] = "abc";
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"));
51 return 0;