size_hash_equal.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===//
2//
3// ��������������������The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. 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// unordered_set(size_type n, const hasher& hf, const key_equal& eql);
17
18#include <unordered_set>
19#include <cassert>
20
21#include "../../../NotConstructible.h"
22#include "../../../test_compare.h"
23#include "../../../test_hash.h"
24#include "../../../test_allocator.h"
25
26int main()
27{
28    {
29        typedef std::unordered_set<NotConstructible,
30                                   test_hash<std::hash<NotConstructible> >,
31                                   test_compare<std::equal_to<NotConstructible> >,
32                                   test_allocator<NotConstructible>
33                                   > C;
34        C c(7,
35            test_hash<std::hash<NotConstructible> >(8),
36            test_compare<std::equal_to<NotConstructible> >(9)
37           );
38        assert(c.bucket_count() == 7);
39        assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
40        assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
41        assert(c.get_allocator() == (test_allocator<NotConstructible>()));
42        assert(c.size() == 0);
43        assert(c.empty());
44        assert(std::distance(c.begin(), c.end()) == 0);
45        assert(c.load_factor() == 0);
46        assert(c.max_load_factor() == 1);
47    }
48}
49