]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / containers / unord / unord.set / unord.set.cnstr / size.fail.cpp
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 // <unordered_set>
11
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 //           class Alloc = allocator<Value>>
14 // class unordered_set
15
16 // explicit unordered_set(size_type n);
17
18 #include <unordered_set>
19 #include <cassert>
20
21 #include "test_macros.h"
22 #include "../../../NotConstructible.h"
23 #include "../../../test_compare.h"
24 #include "../../../test_hash.h"
25 #include "test_allocator.h"
26
27 int main()
28 {
29     {
30         typedef std::unordered_set<NotConstructible,
31                                    test_hash<std::hash<NotConstructible> >,
32                                    test_compare<std::equal_to<NotConstructible> >,
33                                    test_allocator<NotConstructible>
34                                    > C;
35         C c = 7;
36         LIBCPP_ASSERT(c.bucket_count() == 7);
37         assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
38         assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
39         assert(c.get_allocator() == (test_allocator<NotConstructible>()));
40         assert(c.size() == 0);
41         assert(c.empty());
42         assert(std::distance(c.begin(), c.end()) == 0);
43         assert(c.load_factor() == 0);
44         assert(c.max_load_factor() == 1);
45     }
46 }