| 1 | // { dg-require-namedlocale "en_US.ISO8859-1" } |
| 2 | // { dg-require-namedlocale "is_IS.ISO8859-1" } |
| 3 | // { dg-require-namedlocale "de_DE.ISO8859-15" } |
| 4 | |
| 5 | // 2001-01-17 Benjamin Kosnik <[email protected]> |
| 6 | |
| 7 | // Copyright (C) 2001-2025 Free Software Foundation, Inc. |
| 8 | // |
| 9 | // This file is part of the GNU ISO C++ Library. This library is free |
| 10 | // software; you can redistribute it and/or modify it under the |
| 11 | // terms of the GNU General Public License as published by the |
| 12 | // Free Software Foundation; either version 3, or (at your option) |
| 13 | // any later version. |
| 14 | |
| 15 | // This library is distributed in the hope that it will be useful, |
| 16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | // GNU General Public License for more details. |
| 19 | |
| 20 | // You should have received a copy of the GNU General Public License along |
| 21 | // with this library; see the file COPYING3. If not see |
| 22 | // <http://www.gnu.org/licenses/>. |
| 23 | |
| 24 | // 22.2.3.1.1 nunpunct members |
| 25 | |
| 26 | #include <locale> |
| 27 | #include <testsuite_hooks.h> |
| 28 | |
| 29 | void test02() |
| 30 | { |
| 31 | using namespace std; |
| 32 | |
| 33 | // basic construction |
| 34 | locale loc_c = locale::classic(); |
| 35 | locale loc_us = locale(ISO_8859(1,en_US)); |
| 36 | locale loc_is = locale(ISO_8859(1,is_IS)); |
| 37 | locale loc_de = locale(ISO_8859(15,de_DE)); |
| 38 | VERIFY( loc_c != loc_de ); |
| 39 | VERIFY( loc_us != loc_is ); |
| 40 | VERIFY( loc_us != loc_de ); |
| 41 | VERIFY( loc_de != loc_is ); |
| 42 | |
| 43 | // cache the numpunct facets |
| 44 | const numpunct<char>& nump_c = use_facet<numpunct<char> >(loc_c); |
| 45 | const numpunct<char>& nump_us = use_facet<numpunct<char> >(loc_us); |
| 46 | const numpunct<char>& nump_is = use_facet<numpunct<char> >(loc_is); |
| 47 | const numpunct<char>& nump_de = use_facet<numpunct<char> >(loc_de); |
| 48 | |
| 49 | // sanity check the data is correct. |
| 50 | string g1 = nump_c.grouping(); |
| 51 | string t1 = nump_c.truename(); |
| 52 | string f1 = nump_c.falsename(); |
| 53 | |
| 54 | char dp2 = nump_us.decimal_point(); |
| 55 | char th2 = nump_us.thousands_sep(); |
| 56 | string g2 = nump_us.grouping(); |
| 57 | string t2 = nump_us.truename(); |
| 58 | string f2 = nump_us.falsename(); |
| 59 | |
| 60 | char dp3 = nump_is.decimal_point(); |
| 61 | char th3 = nump_is.thousands_sep(); |
| 62 | string g3 = nump_is.grouping(); |
| 63 | string t3 = nump_is.truename(); |
| 64 | string f3 = nump_is.falsename(); |
| 65 | |
| 66 | char dp4 = nump_de.decimal_point(); |
| 67 | char th4 = nump_de.thousands_sep(); |
| 68 | string g4 = nump_de.grouping(); |
| 69 | string t4 = nump_de.truename(); |
| 70 | string f4 = nump_de.falsename(); |
| 71 | |
| 72 | VERIFY( dp2 != dp3 ); |
| 73 | VERIFY( th2 != th3 ); |
| 74 | |
| 75 | VERIFY( dp2 != dp4 ); |
| 76 | VERIFY( th2 != th4 ); |
| 77 | // XXX This isn't actually supported right now. |
| 78 | // VERIFY( t2 != t3 ); |
| 79 | // VERIFY( f2 != f3 ); |
| 80 | } |
| 81 | |
| 82 | int main() |
| 83 | { |
| 84 | test02(); |
| 85 | return 0; |
| 86 | } |