1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// REQUIRES: locale.en_US.UTF-8
11
12// <locale>
13
14// template <class charT> class collate_byname
15
16// long hash(const charT* low, const charT* high) const;
17
18//   This test is not portable
19
20#include <locale>
21#include <string>
22#include <cassert>
23
24#include "platform_support.h" // locale name macros
25
26int main()
27{
28    std::locale l(LOCALE_en_US_UTF_8);
29    {
30        std::string x1("1234");
31        std::string x2("12345");
32        const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
33        assert(f.hash(x1.data(), x1.data() + x1.size())
34            != f.hash(x2.data(), x2.data() + x2.size()));
35    }
36    {
37        std::wstring x1(L"1234");
38        std::wstring x2(L"12345");
39        const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
40        assert(f.hash(x1.data(), x1.data() + x1.size())
41            != f.hash(x2.data(), x2.data() + x2.size()));
42    }
43}
44