17{
18 {
21
22 char const str1[] = "abcdef1";
23 char const str2[] = "abcdef2";
24 const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
25 const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
26
27 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
28 CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
29
30
31 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
32 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
33 }
34
35# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
36 try {
38 {
41
42 char const str1[] = "abcdef1";
43 char const str2[] = "abcdef2";
44 const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
45 const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
46
47 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
48 CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
49
50
51 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
52 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
53 }
54 {
57
58 string strs[] = {"abdd", "abçd", "abbd", "abcd"};
59
60 string transformed[4];
61 for (
size_t i = 0;
i < 4; ++
i) {
62 transformed[
i] = col.transform(strs[
i].
data(), strs[
i].data() + strs[
i].size());
63 }
64
65 sort(strs, strs + 4, loc);
70
71 sort(transformed, transformed + 4);
72
73 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] );
74 CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] );
75 CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] );
76 CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] );
77
78
79 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() );
80
81
82 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) );
83 }
84# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
85 {
88
89 wchar_t const str1[] =
L"abcdef1";
90 wchar_t const str2[] =
L"abcdef2";
91 const size_t size1 = sizeof(str1) / sizeof(str1[0]) - 1;
92 const size_t size2 = sizeof(str2) / sizeof(str2[0]) - 1;
93
94 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 1) == 0 );
95 CPPUNIT_ASSERT( col.compare(str1, str1 + size1, str2, str2 + size2) == -1 );
96
97
98 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 2, str2, str2 + size2 - 1) == -1 );
99 CPPUNIT_ASSERT( col.compare(str1, str1 + size1 - 1, str2, str2 + size2 - 2) == 1 );
100 }
101 {
105
106
107
108
109 wstring strs[] = {
L"abdd",
L"abcd",
L"abbd",
L"abcd"};
110
111 wstring transformed[4];
112 for (
i = 0;
i < 4; ++
i) {
113 transformed[
i] = col.transform(strs[
i].
data(), strs[
i].data() + strs[
i].size());
114 }
115
116 sort(strs, strs + 4, loc);
121
122 sort(transformed, transformed + 4);
123
124 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + strs[0].size()) == transformed[0] );
125 CPPUNIT_ASSERT( col.transform(strs[1].data(), strs[1].data() + strs[1].size()) == transformed[1] );
126 CPPUNIT_ASSERT( col.transform(strs[2].data(), strs[2].data() + strs[2].size()) == transformed[2] );
127 CPPUNIT_ASSERT( col.transform(strs[3].data(), strs[3].data() + strs[3].size()) == transformed[3] );
128
129 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data()).empty() );
130
131 CPPUNIT_ASSERT( col.transform(strs[0].data(), strs[0].data() + 2) == col.transform(strs[1].data(), strs[1].data() + 2) );
132 }
133# endif
134 }
137 }
138# endif
139}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data