a6255afb6c36725500a502ad441f12d66005b0f9
1 // 2003-02-24 Petur Runolfsson <peturr02@ru.is>
3 // Copyright (C) 2003 Free Software Foundation
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // 22.2.4.1.1 collate members
24 #include <testsuite_hooks.h>
29 typedef std::collate
<char>::string_type string_type
;
34 locale loc_c
= locale::classic();
35 locale
loc_de("de_DE");
36 VERIFY( loc_c
!= loc_de
);
38 // cache the collate facets
39 const collate
<char>& coll_c
= use_facet
<collate
<char> >(loc_c
);
40 const collate
<char>& coll_de
= use_facet
<collate
<char> >(loc_de
);
42 const char* strlit1
= "a\0a\0";
43 const char* strlit2
= "a\0b\0";
44 const char* strlit3
= "a\0\xc4\0";
45 const char* strlit4
= "a\0B\0";
46 const char* strlit5
= "aa\0";
47 const char* strlit6
= "b\0a\0";
53 str1
= coll_c
.transform(strlit1
, strlit1
+ 3);
54 str2
= coll_c
.transform(strlit2
, strlit2
+ 3);
55 i
= str1
.compare(str2
);
58 str1
= coll_de
.transform(strlit1
, strlit1
+ 3);
59 str2
= coll_de
.transform(strlit2
, strlit2
+ 3);
60 i
= str1
.compare(str2
);
63 str1
= coll_c
.transform(strlit3
, strlit3
+ 3);
64 str2
= coll_c
.transform(strlit4
, strlit4
+ 3);
65 i
= str1
.compare(str2
);
68 str1
= coll_de
.transform(strlit3
, strlit3
+ 3);
69 str2
= coll_de
.transform(strlit4
, strlit4
+ 3);
70 i
= str1
.compare(str2
);
73 str1
= coll_c
.transform(strlit1
, strlit1
+ 1);
74 str2
= coll_c
.transform(strlit5
, strlit5
+ 1);
75 i
= str1
.compare(str2
);
78 str1
= coll_de
.transform(strlit6
, strlit6
+ 3);
79 str2
= coll_de
.transform(strlit1
, strlit1
+ 3);
80 i
= str1
.compare(str2
);
83 str1
= coll_c
.transform(strlit1
, strlit1
+ 3);
84 str2
= coll_c
.transform(strlit5
, strlit5
+ 3);
85 i
= str1
.compare(str2
);