[libcxx][test] Fix a test for the range of file offsets on ARMv7 Linux targets. ...
[llvm-project.git] / libcxx / test / std / strings / string.view / string.view.hash / enabled_hashes.pass.cpp
blob13abb945693682cfcdee8c8abf3f017d221d5996
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
10 // UNSUPPORTED: !stdlib=libc++ && (c++11 || c++14)
12 // <string_view>
14 // Test that <string_view> provides all of the arithmetic, enum, and pointer
15 // hash specializations.
17 #include <string_view>
19 #include "constexpr_char_traits.h"
20 #include "poisoned_hash_helper.h"
21 #include "test_macros.h"
23 struct MyChar {
24 char c;
27 template <>
28 struct std::char_traits<MyChar> {
29 using char_type = MyChar;
30 using int_type = std::char_traits<char>::int_type;
31 using off_type = std::char_traits<char>::off_type;
32 using pos_type = std::char_traits<char>::pos_type;
33 using state_type = std::char_traits<char>::state_type;
35 static void assign(char_type&, const char_type&);
36 static bool eq(char_type, char_type);
37 static bool lt(char_type, char_type);
39 static int compare(const char_type*, const char_type*, std::size_t);
40 static std::size_t length(const char_type*);
41 static const char_type* find(const char_type*, std::size_t, const char_type&);
42 static char_type* move(char_type*, const char_type*, std::size_t);
43 static char_type* copy(char_type*, const char_type*, std::size_t);
44 static char_type* assign(char_type*, std::size_t, char_type);
46 static int_type not_eof(int_type);
47 static char_type to_char_type(int_type);
48 static int_type to_int_type(char_type);
49 static bool eq_int_type(int_type, int_type);
50 static int_type eof();
53 int main(int, char**) {
54 test_library_hash_specializations_available();
56 test_hash_enabled<std::string_view>();
57 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
58 test_hash_enabled<std::wstring_view>();
59 #endif
60 #ifndef TEST_HAS_NO_CHAR8_T
61 test_hash_enabled<std::u8string_view>();
62 #endif
63 test_hash_enabled<std::u16string_view>();
64 test_hash_enabled<std::u32string_view>();
65 test_hash_disabled<std::basic_string_view<MyChar, std::char_traits<MyChar>>>();
66 test_hash_disabled<std::basic_string_view<char, constexpr_char_traits<char>>>();
69 return 0;