198944Sobrien// { dg-require-namedlocale "" } 298944Sobrien 398944Sobrien// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> 498944Sobrien 598944Sobrien// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation 698944Sobrien// 798944Sobrien// This file is part of the GNU ISO C++ Library. This library is free 898944Sobrien// software; you can redistribute it and/or modify it under the 998944Sobrien// terms of the GNU General Public License as published by the 1098944Sobrien// Free Software Foundation; either version 2, or (at your option) 1198944Sobrien// any later version. 1298944Sobrien 1398944Sobrien// This library is distributed in the hope that it will be useful, 1498944Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1598944Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1698944Sobrien// GNU General Public License for more details. 1798944Sobrien 1898944Sobrien// You should have received a copy of the GNU General Public License along 1998944Sobrien// with this library; see the file COPYING. If not, write to the Free 2098944Sobrien// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 2198944Sobrien// USA. 2298944Sobrien 2398944Sobrien// 22.2.4.1.1 collate members 2498944Sobrien 2598944Sobrien#include <locale> 2698944Sobrien#include <testsuite_hooks.h> 2798944Sobrien 2898944Sobrien// Check German "de_DE" locale. 2998944Sobrienvoid test02() 3098944Sobrien{ 3198944Sobrien using namespace std; 3298944Sobrien typedef std::collate<char>::string_type string_type; 3398944Sobrien 3498944Sobrien bool test __attribute__((unused)) = true; 3598944Sobrien 3698944Sobrien // basic construction 3798944Sobrien locale loc_c = locale::classic(); 3898944Sobrien locale loc_us = locale("en_US"); 3998944Sobrien locale loc_fr = locale("fr_FR"); 4098944Sobrien locale loc_de = locale("de_DE"); 4198944Sobrien VERIFY( loc_c != loc_de ); 4298944Sobrien VERIFY( loc_us != loc_fr ); 4398944Sobrien VERIFY( loc_us != loc_de ); 4498944Sobrien VERIFY( loc_de != loc_fr ); 4598944Sobrien 4698944Sobrien // cache the collate facets 4798944Sobrien const collate<char>& coll_de = use_facet<collate<char> >(loc_de); 4898944Sobrien 4998944Sobrien // long hash(const charT*, const charT*) cosnt 5098944Sobrien const char* strlit3 = "�uglein Augment"; // "C" == "Augment �uglein" 5198944Sobrien const char* strlit4 = "Base ba� Ba� Bast"; // "C" == "Base ba� Ba� Bast" 5298944Sobrien 5398944Sobrien long l1; 5498944Sobrien long l2; 5598944Sobrien int size3 = char_traits<char>::length(strlit4) - 1; 5698944Sobrien int size4 = char_traits<char>::length(strlit3) - 1; 5798944Sobrien 5898944Sobrien l1 = coll_de.hash(strlit3, strlit3 + size3); 5998944Sobrien l2 = coll_de.hash(strlit3, strlit3 + size3 - 1); 6098944Sobrien VERIFY ( l1 != l2 ); 6198944Sobrien l1 = coll_de.hash(strlit3, strlit3 + size3); 6298944Sobrien l2 = coll_de.hash(strlit4, strlit4 + size4); 6398944Sobrien VERIFY ( l1 != l2 ); 6498944Sobrien} 6598944Sobrien 6698944Sobrienint main() 6798944Sobrien{ 6898944Sobrien test02(); 6998944Sobrien return 0; 7098944Sobrien} 7198944Sobrien