| 1 | // { dg-require-namedlocale "de_DE.ISO8859-15" } |
| 2 | |
| 3 | // 1999-09-20 bkoz |
| 4 | |
| 5 | // Copyright (C) 1999-2025 Free Software Foundation, Inc. |
| 6 | // |
| 7 | // This file is part of the GNU ISO C++ Library. This library is free |
| 8 | // software; you can redistribute it and/or modify it under the |
| 9 | // terms of the GNU General Public License as published by the |
| 10 | // Free Software Foundation; either version 3, or (at your option) |
| 11 | // any later version. |
| 12 | |
| 13 | // This library is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | |
| 18 | // You should have received a copy of the GNU General Public License along |
| 19 | // with this library; see the file COPYING3. If not see |
| 20 | // <http://www.gnu.org/licenses/>. |
| 21 | |
| 22 | |
| 23 | // 27.4.4.2 basic_ios member functions |
| 24 | |
| 25 | // NB: Don't include any other headers in this file. |
| 26 | #include <ios> |
| 27 | #include <testsuite_hooks.h> |
| 28 | |
| 29 | // copyfmt and locales. |
| 30 | void test03() |
| 31 | { |
| 32 | using namespace std; |
| 33 | |
| 34 | typedef std::ios_base::fmtflags fmtflags; |
| 35 | typedef std::ios_base::iostate iostate; |
| 36 | locale loc_c = locale::classic(); |
| 37 | locale loc_de = locale(ISO_8859(15,de_DE)); |
| 38 | std::ios ios_01(0); |
| 39 | std::ios ios_02(0); |
| 40 | ios_01.imbue(loc_c); |
| 41 | ios_02.imbue(loc_de); |
| 42 | ios_02.setstate(ios_base::badbit); |
| 43 | VERIFY( loc_c == ios_01.getloc() ); |
| 44 | VERIFY( loc_de == ios_02.getloc() ); |
| 45 | |
| 46 | iostate ios1 = ios_01.rdstate(); |
| 47 | iostate ios2 = ios_02.rdstate(); |
| 48 | streambuf* sb1 = ios_01.rdbuf(); |
| 49 | streambuf* sb2 = ios_02.rdbuf(); |
| 50 | ios_01.copyfmt(ios_02); |
| 51 | |
| 52 | VERIFY( loc_de == ios_01.getloc() ); |
| 53 | VERIFY( ios_01.getloc() == ios_02.getloc() ); |
| 54 | VERIFY( ios1 == ios_01.rdstate() ); |
| 55 | VERIFY( ios2 == ios_02.rdstate() ); |
| 56 | VERIFY( sb1 == ios_01.rdbuf() ); |
| 57 | VERIFY( sb2 == ios_02.rdbuf() ); |
| 58 | } |
| 59 | |
| 60 | int main() |
| 61 | { |
| 62 | test03(); |
| 63 | return 0; |
| 64 | } |