| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // <unordered_set> |
| 10 | |
| 11 | // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, |
| 12 | // class Alloc = allocator<Value>> |
| 13 | // class unordered_set |
| 14 | |
| 15 | // explicit unordered_set(size_type n); |
| 16 | |
| 17 | #include <unordered_set> |
| 18 | #include <cassert> |
| 19 | |
| 20 | #include "test_macros.h" |
| 21 | #include "../../../NotConstructible.h" |
| 22 | #include "../../../test_compare.h" |
| 23 | #include "../../../test_hash.h" |
| 24 | #include "test_allocator.h" |
| 25 | |
| 26 | int main(int, char**) { |
| 27 | { |
| 28 | typedef std::unordered_set<NotConstructible, |
| 29 | test_hash<NotConstructible>, |
| 30 | test_equal_to<NotConstructible>, |
| 31 | test_allocator<NotConstructible> > |
| 32 | C; |
| 33 | C c = 7; |
| 34 | LIBCPP_ASSERT(c.bucket_count() == 7); |
| 35 | assert(c.hash_function() == test_hash<NotConstructible>()); |
| 36 | assert(c.key_eq() == test_equal_to<NotConstructible>()); |
| 37 | assert(c.get_allocator() == (test_allocator<NotConstructible>())); |
| 38 | assert(c.size() == 0); |
| 39 | assert(c.empty()); |
| 40 | assert(std::distance(c.begin(), c.end()) == 0); |
| 41 | assert(c.load_factor() == 0); |
| 42 | assert(c.max_load_factor() == 1); |
| 43 | } |
| 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | |