]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/22_locale/collate_byname/named_equivalence.cc
Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 22_locale / collate_byname / named_equivalence.cc
CommitLineData
f63a8495
PC
1// { dg-require-namedlocale "" }
2
bf5fe473
BK
3// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
4
748086b7 5// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
1b716e90 6// Free Software Foundation
bf5fe473
BK
7//
8// This file is part of the GNU ISO C++ Library. This library is free
9// software; you can redistribute it and/or modify it under the
10// terms of the GNU General Public License as published by the
748086b7 11// Free Software Foundation; either version 3, or (at your option)
bf5fe473
BK
12// any later version.
13
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
18
19// You should have received a copy of the GNU General Public License along
748086b7
JJ
20// with this library; see the file COPYING3. If not see
21// <http://www.gnu.org/licenses/>.
bf5fe473
BK
22
23// 22.2.4.2 Template class collate_byname
24
25#include <locale>
1b716e90 26#include <cstring>
bf5fe473
BK
27#include <testsuite_hooks.h>
28
29void test01()
30{
31 using namespace std;
32 typedef std::collate<char>::string_type string_type;
33
34 bool test __attribute__((unused)) = true;
35 string str;
36 locale loc_c = locale::classic();
37
f63a8495 38 locale loc_de = locale("de_DE");
bf5fe473
BK
39 str = loc_de.name();
40
41 locale loc_byname(locale::classic(), new collate_byname<char>("de_DE"));
42 str = loc_byname.name();
43
44 VERIFY( loc_de != loc_byname );
45
46 // cache the collate facets
47 const collate<char>& coll_de = use_facet<collate<char> >(loc_de);
48
49 // Check German "de_DE" locale.
50 int i1;
51 int i2;
52 long l1;
53 long l2;
54