Commit 4e2f8bcf by Aaron W. LaFramboise Committed by Benjamin Kosnik

locale_facets.tcc (collate::do_hash): Fix.


2002-02-11  Aaron W LaFramboise  <AWLaFramboise@aol.com>

	* include/bits/locale_facets.tcc (collate::do_hash): Fix.
	* testsuite/22_locale/collate_members_char.cc (test03): New test.
	* testsuite/22_locale/collate_members_wchar_t.cc (test03): Same.

From-SVN: r49682
parent df61a3d2
2002-02-11 Aaron W LaFramboise <AWLaFramboise@aol.com>
* include/bits/locale_facets.tcc (collate::do_hash): Fix.
* testsuite/22_locale/collate_members_char.cc (test03): New test.
* testsuite/22_locale/collate_members_wchar_t.cc (test03): Same.
2002-02-10 Phil Edwards <pme@gcc.gnu.org>
* include/bits/stl_algo.h (transform (both signatures), generate_n):
......
......@@ -1855,7 +1855,7 @@ namespace std
unsigned long __val = 0;
for (; __lo < __hi; ++__lo)
__val = *__lo + ((__val << 7) |
(__val >> (numeric_limits<unsigned long>::digits - 1)));
(__val >> (numeric_limits<unsigned long>::digits - 7)));
return static_cast<long>(__val);
}
......
......@@ -147,12 +147,24 @@ void test02()
#endif
}
void test03()
{
bool test = true;
std::string str1("fffff");
std::string str2("ffffffffffff");
const std::locale cloc = std::locale::classic();
const std::collate<char> &col = std::use_facet<std::collate<char> >(cloc);
long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
VERIFY( l1 != l2 );
}
int main()
{
test01();
test02();
test03();
return 0;
}
......@@ -146,6 +146,20 @@ void test02()
}
#endif
}
void test03()
{
bool test = true;
std::wstring str1(L"fffff");
std::wstring str2(L"ffffffffffff");
const std::locale cloc = std::locale::classic();
const std::collate<wchar_t> &col = std::use_facet<std::collate<wchar_t> >(cloc);
long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
VERIFY( l1 != l2 );
}
#endif
int main()
......@@ -153,10 +167,7 @@ int main()
#if _GLIBCPP_USE_WCHAR_T
test01();
test02();
test03();
#endif
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment