summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-06-22 15:21:29 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-06-22 15:21:29 +0000
commit307f81437219827463f265802452ca80f9e306d7 (patch)
tree23064e0d8de2f3413b5a1ec5804d83dfb988fa5d /libcxx/test
parentb9bbaba6b14b7c11554ffe2467e2508402545a39 (diff)
downloadbcm5719-llvm-307f81437219827463f265802452ca80f9e306d7.tar.gz
bcm5719-llvm-307f81437219827463f265802452ca80f9e306d7.zip
Implement full support for non-pointer types in custom allocators. This is for the unordered containers only. This work still needs to be done on the sequence containers.
llvm-svn: 184635
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/containers/unord/unord.map/bucket.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.map/bucket_count.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.map/bucket_size.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.map/count.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.map/eq.pass.cpp71
-rw-r--r--libcxx/test/containers/unord/unord.map/equal_range_const.pass.cpp28
-rw-r--r--libcxx/test/containers/unord/unord.map/equal_range_non_const.pass.cpp28
-rw-r--r--libcxx/test/containers/unord/unord.map/find_const.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.map/find_non_const.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.map/iterators.pass.cpp44
-rw-r--r--libcxx/test/containers/unord/unord.map/load_factor.pass.cpp29
-rw-r--r--libcxx/test/containers/unord/unord.map/local_iterators.pass.cpp200
-rw-r--r--libcxx/test/containers/unord/unord.map/max_bucket_count.pass.cpp12
-rw-r--r--libcxx/test/containers/unord/unord.map/max_load_factor.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.map/max_size.pass.cpp9
-rw-r--r--libcxx/test/containers/unord/unord.map/rehash.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.map/reserve.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.map/swap_member.pass.cpp183
-rw-r--r--libcxx/test/containers/unord/unord.map/types.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp48
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp42
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp42
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp80
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp44
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp41
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.elem/at.pass.cpp56
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.elem/index.pass.cpp47
-rw-r--r--libcxx/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp183
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp21
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp27
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp61
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp59
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp65
-rw-r--r--libcxx/test/containers/unord/unord.multimap/bucket.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.multimap/bucket_size.pass.cpp27
-rw-r--r--libcxx/test/containers/unord/unord.multimap/count.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multimap/eq.pass.cpp80
-rw-r--r--libcxx/test/containers/unord/unord.multimap/equal_range_const.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.multimap/find_const.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multimap/find_non_const.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multimap/iterators.pass.cpp47
-rw-r--r--libcxx/test/containers/unord/unord.multimap/load_factor.pass.cpp29
-rw-r--r--libcxx/test/containers/unord/unord.multimap/local_iterators.pass.cpp264
-rw-r--r--libcxx/test/containers/unord/unord.multimap/max_bucket_count.pass.cpp12
-rw-r--r--libcxx/test/containers/unord/unord.multimap/max_load_factor.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multimap/max_size.pass.cpp9
-rw-r--r--libcxx/test/containers/unord/unord.multimap/rehash.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.multimap/reserve.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.multimap/swap_member.pass.cpp188
-rw-r--r--libcxx/test/containers/unord/unord.multimap/types.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp62
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp59
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp68
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp56
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp56
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp56
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp58
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp59
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp60
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp61
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp102
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp67
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp58
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp60
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp61
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp62
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp63
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp21
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp33
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp166
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp80
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp30
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp59
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp57
-rw-r--r--libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp187
-rw-r--r--libcxx/test/containers/unord/unord.multiset/bucket.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.multiset/bucket_count.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.multiset/bucket_size.pass.cpp27
-rw-r--r--libcxx/test/containers/unord/unord.multiset/clear.pass.cpp21
-rw-r--r--libcxx/test/containers/unord/unord.multiset/count.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multiset/emplace.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp21
-rw-r--r--libcxx/test/containers/unord/unord.multiset/eq.pass.cpp80
-rw-r--r--libcxx/test/containers/unord/unord.multiset/equal_range_const.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.multiset/equal_range_non_const.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.multiset/erase_const_iter.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multiset/erase_key.pass.cpp61
-rw-r--r--libcxx/test/containers/unord/unord.multiset/erase_range.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.multiset/find_const.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.multiset/find_non_const.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp27
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp51
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_init.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_range.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.multiset/insert_rvalue.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multiset/iterators.pass.cpp44
-rw-r--r--libcxx/test/containers/unord/unord.multiset/load_factor.pass.cpp29
-rw-r--r--libcxx/test/containers/unord/unord.multiset/local_iterators.pass.cpp240
-rw-r--r--libcxx/test/containers/unord/unord.multiset/max_bucket_count.pass.cpp10
-rw-r--r--libcxx/test/containers/unord/unord.multiset/max_load_factor.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/max_size.pass.cpp9
-rw-r--r--libcxx/test/containers/unord/unord.multiset/rehash.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.multiset/reserve.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.multiset/swap_member.pass.cpp183
-rw-r--r--libcxx/test/containers/unord/unord.multiset/types.pass.cpp19
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp56
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp101
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp49
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp33
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp78
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp93
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp183
-rw-r--r--libcxx/test/containers/unord/unord.set/bucket.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.set/bucket_count.pass.cpp29
-rw-r--r--libcxx/test/containers/unord/unord.set/bucket_size.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/clear.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.set/count.pass.cpp25
-rw-r--r--libcxx/test/containers/unord/unord.set/emplace.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp21
-rw-r--r--libcxx/test/containers/unord/unord.set/eq.pass.cpp68
-rw-r--r--libcxx/test/containers/unord/unord.set/equal_range_const.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.set/equal_range_non_const.pass.cpp31
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_const_iter.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_key.pass.cpp60
-rw-r--r--libcxx/test/containers/unord/unord.set/erase_range.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.set/find_const.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/find_non_const.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_const_lvalue.pass.cpp30
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp27
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp51
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_init.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_range.pass.cpp24
-rw-r--r--libcxx/test/containers/unord/unord.set/insert_rvalue.pass.cpp57
-rw-r--r--libcxx/test/containers/unord/unord.set/iterators.pass.cpp44
-rw-r--r--libcxx/test/containers/unord/unord.set/load_factor.pass.cpp29
-rw-r--r--libcxx/test/containers/unord/unord.set/local_iterators.pass.cpp184
-rw-r--r--libcxx/test/containers/unord/unord.set/max_bucket_count.pass.cpp10
-rw-r--r--libcxx/test/containers/unord/unord.set/max_load_factor.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.set/max_size.pass.cpp9
-rw-r--r--libcxx/test/containers/unord/unord.set/rehash.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.set/reserve.pass.cpp34
-rw-r--r--libcxx/test/containers/unord/unord.set/swap_member.pass.cpp183
-rw-r--r--libcxx/test/containers/unord/unord.set/types.pass.cpp19
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp48
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp48
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp41
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp41
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp33
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp36
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp78
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp44
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp35
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp37
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp38
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp39
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp40
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp20
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp22
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp23
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp26
-rw-r--r--libcxx/test/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp183
-rwxr-xr-xlibcxx/test/testit2
225 files changed, 10211 insertions, 13 deletions
diff --git a/libcxx/test/containers/unord/unord.map/bucket.pass.cpp b/libcxx/test/containers/unord/unord.map/bucket.pass.cpp
index 6cb6fbb0891..f7ff18eca78 100644
--- a/libcxx/test/containers/unord/unord.map/bucket.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/bucket.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -39,4 +41,25 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (size_t i = 0; i < 13; ++i)
+ assert(c.bucket(i) == i % bc);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.map/bucket_count.pass.cpp
index 478f9ade386..dbc24eed737 100644
--- a/libcxx/test/containers/unord/unord.map/bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/bucket_count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,33 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 11);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/bucket_size.pass.cpp b/libcxx/test/containers/unord/unord.map/bucket_size.pass.cpp
index ab1f68493e9..967bb8d9f95 100644
--- a/libcxx/test/containers/unord/unord.map/bucket_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/bucket_size.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,27 @@ int main()
assert(c.bucket_size(3) == 1);
assert(c.bucket_size(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ assert(c.bucket_size(0) == 0);
+ assert(c.bucket_size(1) == 1);
+ assert(c.bucket_size(2) == 1);
+ assert(c.bucket_size(3) == 1);
+ assert(c.bucket_size(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/count.pass.cpp b/libcxx/test/containers/unord/unord.map/count.pass.cpp
index fa40d0a1e6c..04d16991260 100644
--- a/libcxx/test/containers/unord/unord.map/count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -39,4 +41,25 @@ int main()
assert(c.count(30) == 1);
assert(c.count(5) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(5) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/eq.pass.cpp b/libcxx/test/containers/unord/unord.map/eq.pass.cpp
index 8e7ed99ba7e..ec1378577a0 100644
--- a/libcxx/test/containers/unord/unord.map/eq.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/eq.pass.cpp
@@ -23,6 +23,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -89,4 +91,73 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90, "ninety"));
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ c1.insert(P(90, "ninety"));
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/equal_range_const.pass.cpp b/libcxx/test/containers/unord/unord.map/equal_range_const.pass.cpp
index 766d740a43a..8f9c58e44f2 100644
--- a/libcxx/test/containers/unord/unord.map/equal_range_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/equal_range_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -44,4 +46,30 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/equal_range_non_const.pass.cpp b/libcxx/test/containers/unord/unord.map/equal_range_non_const.pass.cpp
index ddc930fbb2a..9291eb4fda7 100644
--- a/libcxx/test/containers/unord/unord.map/equal_range_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/equal_range_non_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -44,4 +46,30 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/find_const.pass.cpp b/libcxx/test/containers/unord/unord.map/find_const.pass.cpp
index 5d4eefb89fb..c049d2392c8 100644
--- a/libcxx/test/containers/unord/unord.map/find_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/find_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,28 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/find_non_const.pass.cpp b/libcxx/test/containers/unord/unord.map/find_non_const.pass.cpp
index c6ebe63b29a..04126938815 100644
--- a/libcxx/test/containers/unord/unord.map/find_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/find_non_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,28 @@ int main()
i = c.find(5);
assert(i == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/iterators.pass.cpp b/libcxx/test/containers/unord/unord.map/iterators.pass.cpp
index c8a52660539..7d99fdf9d29 100644
--- a/libcxx/test/containers/unord/unord.map/iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/iterators.pass.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -64,4 +66,46 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::const_iterator i;
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/load_factor.pass.cpp b/libcxx/test/containers/unord/unord.map/load_factor.pass.cpp
index fcb2b9b32ee..70e6048c59a 100644
--- a/libcxx/test/containers/unord/unord.map/load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/load_factor.pass.cpp
@@ -20,6 +20,8 @@
#include <cassert>
#include <cfloat>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,31 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/local_iterators.pass.cpp b/libcxx/test/containers/unord/unord.map/local_iterators.pass.cpp
index c9812d042e1..ec10f50b8b1 100644
--- a/libcxx/test/containers/unord/unord.map/local_iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/local_iterators.pass.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -218,4 +220,202 @@ int main()
assert(i->first == 4);
assert(i->second == "four");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 1);
+ assert(i->second == "one");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 2);
+ assert(i->second == "two");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/max_bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.map/max_bucket_count.pass.cpp
index 2a89f5c0eed..a1f1c3c3faa 100644
--- a/libcxx/test/containers/unord/unord.map/max_bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/max_bucket_count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -28,4 +30,14 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/max_load_factor.pass.cpp b/libcxx/test/containers/unord/unord.map/max_load_factor.pass.cpp
index 57b64b29faf..a644e7bf473 100644
--- a/libcxx/test/containers/unord/unord.map/max_load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/max_load_factor.pass.cpp
@@ -20,6 +20,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -36,4 +38,22 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/max_size.pass.cpp b/libcxx/test/containers/unord/unord.map/max_size.pass.cpp
index bde1e2da37e..1993741d0dc 100644
--- a/libcxx/test/containers/unord/unord.map/max_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/max_size.pass.cpp
@@ -18,10 +18,19 @@
#include <unordered_map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
std::unordered_map<int, int> u;
assert(u.max_size() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, int>>> u;
+ assert(u.max_size() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/rehash.pass.cpp b/libcxx/test/containers/unord/unord.map/rehash.pass.cpp
index 61cd4f57d25..c516872c617 100644
--- a/libcxx/test/containers/unord/unord.map/rehash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/rehash.pass.cpp
@@ -19,7 +19,10 @@
#include <string>
#include <cassert>
-void test(const std::unordered_map<int, std::string>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 4);
assert(c.at(1) == "one");
@@ -56,4 +59,33 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ assert(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ assert(c.bucket_count() == 31);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/reserve.pass.cpp b/libcxx/test/containers/unord/unord.map/reserve.pass.cpp
index 9a8eb8bcc0a..753316f7f0c 100644
--- a/libcxx/test/containers/unord/unord.map/reserve.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/reserve.pass.cpp
@@ -19,7 +19,10 @@
#include <string>
#include <cassert>
-void test(const std::unordered_map<int, std::string>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 4);
assert(c.at(1) == "one");
@@ -56,4 +59,33 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ assert(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/swap_member.pass.cpp b/libcxx/test/containers/unord/unord.map/swap_member.pass.cpp
index 871815b273f..311a9a541e4 100644
--- a/libcxx/test/containers/unord/unord.map/swap_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/swap_member.pass.cpp
@@ -22,6 +22,7 @@
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "../../test_allocator.h"
+#include "../../min_allocator.h"
int main()
{
@@ -386,4 +387,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "fourty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "fourty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/types.pass.cpp b/libcxx/test/containers/unord/unord.map/types.pass.cpp
index da7d5696599..4bf459169d1 100644
--- a/libcxx/test/containers/unord/unord.map/types.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/types.pass.cpp
@@ -31,6 +31,8 @@
#include <unordered_map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -48,4 +50,22 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<char, short, std::hash<char>, std::equal_to<char>,
+ min_allocator<std::pair<const char, short>>> C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
index 7bb7355292d..0f9e4cefb59 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index dda88e3be7f..8e8f97d9586 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -116,4 +117,51 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
index 54e41e43aac..86d44f20642 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
index 826ccb477a8..97924edbf35 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -164,5 +165,53 @@ int main()
assert(c.max_load_factor() == 1);
assert(c0.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c0.size() == 0);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
index 7bb294c8f23..398f2fd822b 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -106,4 +107,45 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
index 87dc2493fe6..c7d5396e77a 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -65,4 +66,45 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c(c0, min_allocator<std::pair<const int, std::string> >());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
index 762d5282d63..b32c260e820 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
index 5b3fe7e87dc..be5a70fcbf5 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,38 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
index 4aa1ea62c22..fd28845f243 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -60,5 +61,40 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
index d499adc28fa..bcc97b67dce 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -61,5 +62,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
index 25c212e6dea..5e21873796d 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -63,5 +64,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
index d33efeec6d9..0f5e7b58729 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -64,5 +65,43 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
index b094330ce98..5c5c53a4d59 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -104,5 +105,84 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
index a1434a52b78..0f7348087f9 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -109,5 +110,48 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<int, std::string> P;
+ typedef min_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
index 0c4ccec7f39..25e1d8d641d 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -62,4 +63,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
index 0d8b1a7e4ce..42822bc6e8f 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -64,4 +65,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 10
+ );
+ assert(c.bucket_count() == 11);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
index 0d55b26c1af..f6f294fded9 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
@@ -27,6 +27,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -66,4 +67,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
index 0c81503e17f..16b7f8bf34e 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
@@ -27,6 +27,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -67,4 +68,43 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
index c8371ce006e..82825ce5f85 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -28,6 +28,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -69,4 +70,44 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
index ce19c1776d8..71303660cc3 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c = 7;
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
index ab2b1866b0d..81cb07ddb7e 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
index 0d4d7a156fb..783189c7aa4 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -46,4 +47,27 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
index 44fcc30ca99..9c7f2b57359 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -47,4 +48,28 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
index be0897829f7..139ffad1295 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -48,4 +49,29 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.elem/at.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.elem/at.pass.cpp
index 720a7c599fb..c8eade2fba1 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.elem/at.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.elem/at.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -75,4 +76,59 @@ int main()
}
assert(c.size() == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.size() == 4);
+ c.at(1) = "ONE";
+ assert(c.at(1) == "ONE");
+ try
+ {
+ c.at(11) = "eleven";
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(c.size() == 4);
+ }
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ try
+ {
+ c.at(11);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ }
+ assert(c.size() == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.elem/index.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.elem/index.pass.cpp
index 071e059b8af..bbee80d938c 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.elem/index.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.elem/index.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -65,4 +66,50 @@ int main()
assert(c.at(11) == "eleven");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_map<MoveOnly, std::string, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.size() == 4);
+ c[1] = "ONE";
+ assert(c.at(1) == "ONE");
+ c[11] = "eleven";
+ assert(c.size() == 5);
+ assert(c.at(11) == "eleven");
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
index 450fed38e91..224286ab964 100644
--- a/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -386,4 +387,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "fourty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.at(10) == "ten");
+ assert(c1.at(20) == "twenty");
+ assert(c1.at(30) == "thirty");
+ assert(c1.at(40) == "fourty");
+ assert(c1.at(50) == "fifty");
+ assert(c1.at(60) == "sixty");
+ assert(c1.at(70) == "seventy");
+ assert(c1.at(80) == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.at(1) == "one");
+ assert(c2.at(2) == "two");
+ assert(c2.at(3) == "three");
+ assert(c2.at(4) == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp
index c51e3d095ed..0e0f188be78 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,23 @@ int main()
c.clear();
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ c.clear();
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp
index 488d2ba0053..515b32925ca 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -47,5 +48,31 @@ int main()
assert(r.first->first == 5);
assert(r.first->second == Emplaceable(6, 7));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace(3);
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == Emplaceable());
+
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == Emplaceable(5, 6));
+
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
+ std::forward_as_tuple(6, 7));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == Emplaceable(6, 7));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp
index 463fc3b53a6..6c2a75a2913 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -45,5 +46,29 @@ int main()
assert(r->first == 5);
assert(r->second == Emplaceable(6, 7));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, Emplaceable, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, 3);
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
+
+ r = c.emplace_hint(e, std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
+
+ r = c.emplace_hint(e, std::piecewise_construct, std::forward_as_tuple(5),
+ std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp
index f7127d51e36..977581cdf1c 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,27 @@ int main()
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::iterator j = c.erase(i);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp
index cc59bb90630..c2a8666b1dc 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -77,4 +79,63 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.at(3) == "three");
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp
index b5c438374e1..ad915fd63c9 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -56,4 +58,42 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = next(i, 1);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(k == j);
+ assert(c.at(1) == "one");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+
+ k = c.erase(c.cbegin(), c.cend());
+ assert(k == c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp
index d9ab4156d4a..8bf66caf806 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -49,4 +51,36 @@ int main()
assert(r.first->first == 5.5);
assert(r.first->second == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef C::value_type P;
+ C c;
+ R r = c.insert(P(3.5, 3));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3.5, 4));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4.5, 4));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5.5, 4));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp
index 0d2ffe3911e..788105e7459 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,33 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(3.5, 4));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(4.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp
index 6fc6e8ed762..3fef2701b63 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -78,4 +79,62 @@ int main()
assert(r->second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(3.5, 4));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(4.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(3, 4));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(4, 4));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp
index 532c7cb22cc..b667c7e4533 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,5 +45,28 @@ int main()
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ }
+ );
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp
index eda189a7a1a..68cb25c8e87 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,27 @@ int main()
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.at(1) == "one");
+ assert(c.at(2) == "two");
+ assert(c.at(3) == "three");
+ assert(c.at(4) == "four");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp
index 3b156ff67f3..3e050e94301 100644
--- a/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -84,4 +85,68 @@ int main()
assert(r.first->second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_map<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, 3));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3.5, 4));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3.5);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4.5, 4));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4.5);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5.5, 4));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5.5);
+ assert(r.first->second == 4);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(!r.second);
+ assert(c.size() == 1);
+ assert(r.first->first == 3);
+ assert(r.first->second == 3);
+
+ r = c.insert(P(4, 4));
+ assert(r.second);
+ assert(c.size() == 2);
+ assert(r.first->first == 4);
+ assert(r.first->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(r.second);
+ assert(c.size() == 3);
+ assert(r.first->first == 5);
+ assert(r.first->second == 4);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/bucket.pass.cpp b/libcxx/test/containers/unord/unord.multimap/bucket.pass.cpp
index b1f9d36cd50..e53b492bbcc 100644
--- a/libcxx/test/containers/unord/unord.multimap/bucket.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/bucket.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -39,4 +41,25 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (size_t i = 0; i < 13; ++i)
+ assert(c.bucket(i) == i % bc);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/bucket_size.pass.cpp b/libcxx/test/containers/unord/unord.multimap/bucket_size.pass.cpp
index d8f784a2630..79e53d2e92a 100644
--- a/libcxx/test/containers/unord/unord.multimap/bucket_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/bucket_size.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -43,4 +45,29 @@ int main()
assert(c.bucket_size(5) == 0);
assert(c.bucket_size(6) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ assert(c.bucket_size(0) == 0);
+ assert(c.bucket_size(1) == 2);
+ assert(c.bucket_size(2) == 2);
+ assert(c.bucket_size(3) == 1);
+ assert(c.bucket_size(4) == 1);
+ assert(c.bucket_size(5) == 0);
+ assert(c.bucket_size(6) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/count.pass.cpp b/libcxx/test/containers/unord/unord.multimap/count.pass.cpp
index 3bfac4da07c..a1d0432b3c5 100644
--- a/libcxx/test/containers/unord/unord.multimap/count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,28 @@ int main()
assert(c.count(50) == 3);
assert(c.count(5) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/eq.pass.cpp b/libcxx/test/containers/unord/unord.multimap/eq.pass.cpp
index 6461cae1490..b069ded55af 100644
--- a/libcxx/test/containers/unord/unord.multimap/eq.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/eq.pass.cpp
@@ -23,6 +23,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -98,4 +100,82 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(20, "twenty 2"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fifty 2"),
+ P(50, "fifty 3"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90, "ninety"));
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ c1.insert(P(90, "ninety"));
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/equal_range_const.pass.cpp b/libcxx/test/containers/unord/unord.multimap/equal_range_const.pass.cpp
index 394ebb8b1f2..bc0c703bf81 100644
--- a/libcxx/test/containers/unord/unord.multimap/equal_range_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/equal_range_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -55,4 +57,41 @@ int main()
assert(r.first->first == 50);
assert(r.first->second == "fiftyB");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(r.first->first == 50);
+ assert(r.first->second == "fifty");
+ ++r.first;
+ assert(r.first->first == 50);
+ assert(r.first->second == "fiftyA");
+ ++r.first;
+ assert(r.first->first == 50);
+ assert(r.first->second == "fiftyB");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp b/libcxx/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
index 3fe83faac3c..8b78f70b515 100644
--- a/libcxx/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -55,4 +57,41 @@ int main()
assert(r.first->first == 50);
assert(r.first->second == "fiftyB");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::iterator I;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(50, "fiftyA"),
+ P(50, "fiftyB"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(r.first->first == 30);
+ assert(r.first->second == "thirty");
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(r.first->first == 50);
+ assert(r.first->second == "fifty");
+ ++r.first;
+ assert(r.first->first == 50);
+ assert(r.first->second == "fiftyA");
+ ++r.first;
+ assert(r.first->first == 50);
+ assert(r.first->second == "fiftyB");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/find_const.pass.cpp b/libcxx/test/containers/unord/unord.multimap/find_const.pass.cpp
index 8700dcf3996..b967a5132f4 100644
--- a/libcxx/test/containers/unord/unord.multimap/find_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/find_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,28 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/find_non_const.pass.cpp b/libcxx/test/containers/unord/unord.multimap/find_non_const.pass.cpp
index cb3aab9d9b6..8da85ba9aa5 100644
--- a/libcxx/test/containers/unord/unord.multimap/find_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/find_non_const.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,28 @@ int main()
i = c.find(5);
assert(i == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(i->first == 30);
+ assert(i->second == "thirty");
+ i = c.find(5);
+ assert(i == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/iterators.pass.cpp b/libcxx/test/containers/unord/unord.multimap/iterators.pass.cpp
index 573fc63058d..c2fc44bcbb6 100644
--- a/libcxx/test/containers/unord/unord.multimap/iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/iterators.pass.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -67,4 +69,49 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i;
+ i = c.begin();
+ i->second = "ONE";
+ assert(i->second == "ONE");
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::const_iterator i;
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/load_factor.pass.cpp b/libcxx/test/containers/unord/unord.multimap/load_factor.pass.cpp
index 250509d2d28..29cf689e001 100644
--- a/libcxx/test/containers/unord/unord.multimap/load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/load_factor.pass.cpp
@@ -20,6 +20,8 @@
#include <cassert>
#include <cfloat>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,31 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/local_iterators.pass.cpp b/libcxx/test/containers/unord/unord.multimap/local_iterators.pass.cpp
index 7a292f90a5d..695953d0012 100644
--- a/libcxx/test/containers/unord/unord.multimap/local_iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/local_iterators.pass.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -282,4 +284,266 @@ int main()
j = c.cend(b);
assert(std::distance(i, j) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 3);
+ assert(i->second == "three");
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(i->first == 4);
+ assert(i->second == "four");
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/max_bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.multimap/max_bucket_count.pass.cpp
index e512eb88861..0504db0666e 100644
--- a/libcxx/test/containers/unord/unord.multimap/max_bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/max_bucket_count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -28,4 +30,14 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef C::const_iterator I;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/max_load_factor.pass.cpp b/libcxx/test/containers/unord/unord.multimap/max_load_factor.pass.cpp
index 1d30084fdd5..5fcca6b13fe 100644
--- a/libcxx/test/containers/unord/unord.multimap/max_load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/max_load_factor.pass.cpp
@@ -20,6 +20,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -36,4 +38,22 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/max_size.pass.cpp b/libcxx/test/containers/unord/unord.multimap/max_size.pass.cpp
index b9e72a82958..ac247d7674c 100644
--- a/libcxx/test/containers/unord/unord.multimap/max_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/max_size.pass.cpp
@@ -18,10 +18,19 @@
#include <unordered_map>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
std::unordered_multimap<int, int> u;
assert(u.max_size() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, int>>> u;
+ assert(u.max_size() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/rehash.pass.cpp b/libcxx/test/containers/unord/unord.multimap/rehash.pass.cpp
index 42764360abd..e722c04ac9e 100644
--- a/libcxx/test/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/rehash.pass.cpp
@@ -20,14 +20,16 @@
#include <cassert>
#include <cfloat>
-void test(const std::unordered_multimap<int, std::string>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
- typedef std::unordered_multimap<int, std::string> C;
assert(c.size() == 6);
- typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ typedef std::pair<typename C::const_iterator, typename C::const_iterator> Eq;
Eq eq = c.equal_range(1);
assert(std::distance(eq.first, eq.second) == 2);
- C::const_iterator i = eq.first;
+ typename C::const_iterator i = eq.first;
assert(i->first == 1);
assert(i->second == "one");
++i;
@@ -85,4 +87,33 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ assert(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ assert(c.bucket_count() == 31);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/reserve.pass.cpp b/libcxx/test/containers/unord/unord.multimap/reserve.pass.cpp
index 3f652ad4688..f13ae73b0bd 100644
--- a/libcxx/test/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/reserve.pass.cpp
@@ -19,7 +19,10 @@
#include <string>
#include <cassert>
-void test(const std::unordered_multimap<int, std::string>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 6);
assert(c.find(1)->second == "one");
@@ -58,4 +61,33 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ assert(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/swap_member.pass.cpp b/libcxx/test/containers/unord/unord.multimap/swap_member.pass.cpp
index 2388e5266a8..41b34ddae75 100644
--- a/libcxx/test/containers/unord/unord.multimap/swap_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/swap_member.pass.cpp
@@ -23,6 +23,8 @@
#include "../../test_hash.h"
#include "../../test_allocator.h"
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -394,4 +396,190 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "fourty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.find(1)->second == "one");
+ assert(next(c2.find(1))->second == "four");
+ assert(c2.find(2)->second == "two");
+ assert(next(c2.find(2))->second == "four");
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "fourty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.find(1)->second == "one");
+ assert(next(c2.find(1))->second == "four");
+ assert(c2.find(2)->second == "two");
+ assert(next(c2.find(2))->second == "four");
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/types.pass.cpp b/libcxx/test/containers/unord/unord.multimap/types.pass.cpp
index 13cd3d7610b..369063cffd4 100644
--- a/libcxx/test/containers/unord/unord.multimap/types.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/types.pass.cpp
@@ -31,6 +31,8 @@
#include <unordered_map>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -48,4 +50,22 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<char, short, std::hash<char>, std::equal_to<char>,
+ min_allocator<std::pair<const char, short>>> C;
+ static_assert((std::is_same<C::key_type, char>::value), "");
+ static_assert((std::is_same<C::mapped_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
index bc3a2feb68a..1f7f4034057 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index 54d42dceeab..5c074ec4ed4 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -144,4 +145,65 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ ++i;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
index a80870865f1..a48f2ea05e5 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -83,5 +84,63 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
index f01b6fda6c3..721743aeef2 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -222,5 +223,72 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<std::pair<const int, std::string> > A;
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
index 9dc901485e5..d46ba1c05be 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -134,4 +135,59 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ ++i;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
index 4160a9f9778..0e0d864d7a5 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -79,4 +80,59 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c(c0, min_allocator<std::pair<const int, std::string> >());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+ ++i;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ ++i;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
index b40d43df455..f450455d97a 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
index a8c9e6bd71d..b4b2ac58f1c 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -80,5 +81,60 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c = {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
index a4a265a5ff1..7cb292744c5 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -82,5 +83,62 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
index 21155e69232..7a2faaa66f4 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -83,5 +84,63 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
index 79936ff4d24..73c0ec2851e 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -85,5 +86,64 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
index 53c7090fbc8..bc59d64b0e8 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -86,5 +87,65 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ C c({
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
index 5ebb217baa8..3d4e5920876 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -126,5 +127,106 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const int, std::string> >()));
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
index e40dc8b3d34..6f0cba8fb68 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -157,5 +158,71 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::pair<int, std::string> P;
+ typedef min_allocator<std::pair<const int, std::string>> A;
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
index 5894e63792c..74171c71f70 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -84,4 +85,61 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
index c02aa5336d6..53a50de4018 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -86,4 +87,63 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 10
+ );
+ assert(c.bucket_count() == 11);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
index c3ce6189dce..02cfb2fa52d 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
@@ -27,6 +27,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -88,4 +89,64 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
index a13eba0e9c3..e4fdfd3d912 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
@@ -27,6 +27,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -89,4 +90,65 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >()));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
index 402ef6bef92..640de3556e8 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -28,6 +28,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -91,4 +92,66 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >(10)));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<std::pair<const int, std::string> >
+ > C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<std::pair<const int, std::string> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator i = eq.first;
+ assert(i->first == 1);
+ assert(i->second == "one");
+ ++i;
+ assert(i->first == 1);
+ assert(i->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ i = eq.first;
+ assert(i->first == 2);
+ assert(i->second == "two");
+ ++i;
+ assert(i->first == 2);
+ assert(i->second == "four");
+
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 3);
+ assert(i->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ i = eq.first;
+ assert(i->first == 4);
+ assert(i->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >()));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
index f9b7eb7f076..95ba70bbea7 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c = 7;
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
index d16957c94ee..d9fac2ff3f1 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
index afa25517501..d691dd9cd65 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -46,4 +47,27 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
index 5a3c2628e12..9f902751820 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -47,4 +48,28 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
index 6394ad460e0..23fae577503 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -48,4 +49,29 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<NotConstructible, NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<std::pair<const NotConstructible,
+ NotConstructible> >
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() ==
+ (min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
index e2071fb6685..a731f5b04c4 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -37,4 +39,23 @@ int main()
c.clear();
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ c.clear();
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
index f05edd88f25..244419dc221 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,5 +45,28 @@ int main()
assert(r->first == 5);
assert(r->second == Emplaceable(6, 7));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace(3);
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
+
+ r = c.emplace(std::pair<const int, Emplaceable>(4, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 4);
+ assert(r->second == Emplaceable(5, 6));
+
+ r = c.emplace(std::piecewise_construct, std::forward_as_tuple(5),
+ std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 5);
+ assert(r->second == Emplaceable(6, 7));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
index 302451f1d68..576be4e37aa 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../../Emplaceable.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -53,5 +54,37 @@ int main()
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, Emplaceable, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, Emplaceable>>> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e, 3);
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
+
+ r = c.emplace_hint(e, std::pair<const int, Emplaceable>(3, Emplaceable(5, 6)));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(5, 6));
+ assert(r == next(c.begin()));
+
+ r = c.emplace_hint(r, std::piecewise_construct, std::forward_as_tuple(3),
+ std::forward_as_tuple(6, 7));
+ assert(c.size() == 3);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(6, 7));
+ assert(r == next(c.begin()));
+ r = c.begin();
+ assert(r->first == 3);
+ assert(r->second == Emplaceable());
+ r = next(r, 2);
+ assert(r->first == 3);
+ assert(r->second == Emplaceable(5, 6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
index b1df0f56d51..2b1d4d20667 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -65,4 +67,51 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::iterator j = c.erase(i);
+
+ assert(c.size() == 5);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
index 07f423b7495..d59609a20a8 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -182,4 +184,168 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ typedef std::pair<C::const_iterator, C::const_iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::const_iterator k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == "two");
+ ++k;
+ assert(k->first == 2);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 0);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
index 08e77266749..3ca3a3610fd 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -96,4 +98,82 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == "two");
+ ++k;
+ assert(k->first == 2);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
index 39bcefee224..0528714d79e 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,32 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ R r = c.insert(P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(P(3.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(4.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(5.5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
index 038a2f3a7f4..9e3f1280be3 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_map>
#include <cassert>
+#include "../../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,33 @@ int main()
assert(r->first == 5.5);
assert(r->second == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(e, P(3.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(4.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5.5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
index fbcaa03a08c..c8dd38d56ad 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -78,4 +79,62 @@ int main()
assert(r->second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(4.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5.5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(r, P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(e, P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
index cab85081d87..0a7d8ea55ac 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -69,5 +70,53 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ C c;
+ c.insert(
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ }
+ );
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::iterator k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == "two");
+ ++k;
+ assert(k->first == 2);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
index fa445472774..bda1958c251 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -69,4 +70,52 @@ int main()
assert(std::distance(c.begin(), c.end()) == c.size());
assert(std::distance(c.cbegin(), c.cend()) == c.size());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>> C;
+ typedef std::pair<int, std::string> P;
+ P a[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c;
+ c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.size() == 6);
+ typedef std::pair<C::iterator, C::iterator> Eq;
+ Eq eq = c.equal_range(1);
+ assert(std::distance(eq.first, eq.second) == 2);
+ C::iterator k = eq.first;
+ assert(k->first == 1);
+ assert(k->second == "one");
+ ++k;
+ assert(k->first == 1);
+ assert(k->second == "four");
+ eq = c.equal_range(2);
+ assert(std::distance(eq.first, eq.second) == 2);
+ k = eq.first;
+ assert(k->first == 2);
+ assert(k->second == "two");
+ ++k;
+ assert(k->first == 2);
+ assert(k->second == "four");
+ eq = c.equal_range(3);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 3);
+ assert(k->second == "three");
+ eq = c.equal_range(4);
+ assert(std::distance(eq.first, eq.second) == 1);
+ k = eq.first;
+ assert(k->first == 4);
+ assert(k->second == "four");
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
index dceada2e103..c8bd1284ab4 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
@@ -21,6 +21,7 @@
#include <cassert>
#include "../../../MoveOnly.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -76,4 +77,60 @@ int main()
assert(r->second == 4);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multimap<double, int, std::hash<double>, std::equal_to<double>,
+ min_allocator<std::pair<const double, int>>> C;
+ typedef C::iterator R;
+ typedef std::pair<double, short> P;
+ C c;
+ R r = c.insert(P(3.5, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3.5);
+ assert(r->second == 3);
+
+ r = c.insert(P(3.5, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(4.5, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4.5);
+ assert(r->second == 4);
+
+ r = c.insert(P(5.5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5.5);
+ assert(r->second == 4);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
+ min_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
+ typedef C::iterator R;
+ typedef std::pair<MoveOnly, MoveOnly> P;
+ C c;
+ R r = c.insert(P(3, 3));
+ assert(c.size() == 1);
+ assert(r->first == 3);
+ assert(r->second == 3);
+
+ r = c.insert(P(3, 4));
+ assert(c.size() == 2);
+ assert(r->first == 3);
+ assert(r->second == 4);
+
+ r = c.insert(P(4, 4));
+ assert(c.size() == 3);
+ assert(r->first == 4);
+ assert(r->second == 4);
+
+ r = c.insert(P(5, 4));
+ assert(c.size() == 4);
+ assert(r->first == 5);
+ assert(r->second == 4);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
index d7f25700afa..0b5c5c3cd9f 100644
--- a/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -394,4 +395,190 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "fourty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.find(1)->second == "one");
+ assert(next(c2.find(1))->second == "four");
+ assert(c2.find(2)->second == "two");
+ assert(next(c2.find(2))->second == "four");
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<std::pair<const int, std::string> > Alloc;
+ typedef std::unordered_multimap<int, std::string, Hash, Compare, Alloc> C;
+ typedef std::pair<int, std::string> P;
+ P a1[] =
+ {
+ P(1, "one"),
+ P(2, "two"),
+ P(3, "three"),
+ P(4, "four"),
+ P(1, "four"),
+ P(2, "four"),
+ };
+ P a2[] =
+ {
+ P(10, "ten"),
+ P(20, "twenty"),
+ P(30, "thirty"),
+ P(40, "fourty"),
+ P(50, "fifty"),
+ P(60, "sixty"),
+ P(70, "seventy"),
+ P(80, "eighty"),
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(c1.find(10)->second == "ten");
+ assert(c1.find(20)->second == "twenty");
+ assert(c1.find(30)->second == "thirty");
+ assert(c1.find(40)->second == "fourty");
+ assert(c1.find(50)->second == "fifty");
+ assert(c1.find(60)->second == "sixty");
+ assert(c1.find(70)->second == "seventy");
+ assert(c1.find(80)->second == "eighty");
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.find(1)->second == "one");
+ assert(next(c2.find(1))->second == "four");
+ assert(c2.find(2)->second == "two");
+ assert(next(c2.find(2))->second == "four");
+ assert(c2.find(3)->second == "three");
+ assert(c2.find(4)->second == "four");
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/bucket.pass.cpp b/libcxx/test/containers/unord/unord.multiset/bucket.pass.cpp
index cab661be19c..99a72ab8498 100644
--- a/libcxx/test/containers/unord/unord.multiset/bucket.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/bucket.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -38,4 +40,25 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(std::begin(a), std::end(a));
+ size_t bc = c.bucket_count();
+ assert(bc >= 7);
+ for (size_t i = 0; i < 13; ++i)
+ assert(c.bucket(i) == i % bc);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.multiset/bucket_count.pass.cpp
index d2469b62b8d..36c45b0554b 100644
--- a/libcxx/test/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,33 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ const C c;
+ assert(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 11);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/bucket_size.pass.cpp b/libcxx/test/containers/unord/unord.multiset/bucket_size.pass.cpp
index 6e04ccf874b..0f2977ded8d 100644
--- a/libcxx/test/containers/unord/unord.multiset/bucket_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/bucket_size.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,29 @@ int main()
assert(c.bucket_size(5) == 0);
assert(c.bucket_size(6) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 7);
+ assert(c.bucket_size(0) == 0);
+ assert(c.bucket_size(1) == 2);
+ assert(c.bucket_size(2) == 2);
+ assert(c.bucket_size(3) == 1);
+ assert(c.bucket_size(4) == 1);
+ assert(c.bucket_size(5) == 0);
+ assert(c.bucket_size(6) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/clear.pass.cpp b/libcxx/test/containers/unord/unord.multiset/clear.pass.cpp
index 21c9a90b969..73916312d6e 100644
--- a/libcxx/test/containers/unord/unord.multiset/clear.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/clear.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -36,4 +38,23 @@ int main()
c.clear();
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ c.clear();
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/count.pass.cpp b/libcxx/test/containers/unord/unord.multiset/count.pass.cpp
index 74447ef2fbd..426b5f88b56 100644
--- a/libcxx/test/containers/unord/unord.multiset/count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,28 @@ int main()
assert(c.count(50) == 3);
assert(c.count(5) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 3);
+ assert(c.count(5) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/emplace.pass.cpp b/libcxx/test/containers/unord/unord.multiset/emplace.pass.cpp
index b1513054b37..78478831bd2 100644
--- a/libcxx/test/containers/unord/unord.multiset/emplace.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/emplace.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../Emplaceable.h"
+#include "../../min_allocator.h"
int main()
{
@@ -40,5 +41,24 @@ int main()
assert(c.size() == 3);
assert(*r == Emplaceable(5, 6));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
+ std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
+ typedef C::iterator R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
+
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+
+ r = c.emplace(5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
index 1e529b0cb24..25a3b7591cd 100644
--- a/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/emplace_hint.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../Emplaceable.h"
+#include "../../min_allocator.h"
int main()
{
@@ -41,5 +42,25 @@ int main()
assert(c.size() == 3);
assert(*r == Emplaceable(5, 6));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
+ std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e);
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
+
+ r = c.emplace_hint(e, Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 3);
+ assert(*r == Emplaceable(5, 6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multiset/eq.pass.cpp b/libcxx/test/containers/unord/unord.multiset/eq.pass.cpp
index 6ac9ac8e26a..7350e4444ae 100644
--- a/libcxx/test/containers/unord/unord.multiset/eq.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/eq.pass.cpp
@@ -22,6 +22,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -97,4 +99,82 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ c1.insert(P(90));
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/equal_range_const.pass.cpp b/libcxx/test/containers/unord/unord.multiset/equal_range_const.pass.cpp
index 91df1276794..3fe242f58eb 100644
--- a/libcxx/test/containers/unord/unord.multiset/equal_range_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/equal_range_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -51,4 +53,38 @@ int main()
++r.first;
assert(*r.first == 50);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/equal_range_non_const.pass.cpp b/libcxx/test/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
index c0f974ae473..ebda719bdcb 100644
--- a/libcxx/test/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/equal_range_non_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -51,4 +53,38 @@ int main()
++r.first;
assert(*r.first == 50);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 3);
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ ++r.first;
+ assert(*r.first == 50);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/erase_const_iter.pass.cpp b/libcxx/test/containers/unord/unord.multiset/erase_const_iter.pass.cpp
index 658f50fba60..6cb2c72cccd 100644
--- a/libcxx/test/containers/unord/unord.multiset/erase_const_iter.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/erase_const_iter.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,28 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::iterator j = c.erase(i);
+ assert(c.size() == 5);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/erase_key.pass.cpp b/libcxx/test/containers/unord/unord.multiset/erase_key.pass.cpp
index ecb974ea9ac..b0b68158666 100644
--- a/libcxx/test/containers/unord/unord.multiset/erase_key.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/erase_key.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -77,4 +79,63 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 2);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 2);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/erase_range.pass.cpp b/libcxx/test/containers/unord/unord.multiset/erase_range.pass.cpp
index cf2777517d1..601c4b3be1e 100644
--- a/libcxx/test/containers/unord/unord.multiset/erase_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/erase_range.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -53,4 +55,40 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = next(i, 2);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ k = c.erase(i, j);
+ assert(c.size() == 4);
+ assert(c.count(1) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/find_const.pass.cpp b/libcxx/test/containers/unord/unord.multiset/find_const.pass.cpp
index b39e46f4267..dbe4eae54f2 100644
--- a/libcxx/test/containers/unord/unord.multiset/find_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/find_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,27 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/find_non_const.pass.cpp b/libcxx/test/containers/unord/unord.multiset/find_non_const.pass.cpp
index e6ac8551cbc..af630180741 100644
--- a/libcxx/test/containers/unord/unord.multiset/find_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/find_non_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,27 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
index 6e4b9a10ef2..ce469976c82 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,28 @@ int main()
assert(c.size() == 4);
assert(*r == 5.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
index 4d949e49fd6..02b8375f7fe 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_hint_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,29 @@ int main()
assert(c.size() == 4);
assert(*r == 5.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(e, P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
index 8239b3432d4..590baa05782 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -68,4 +69,54 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(e, P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(e, P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(e, P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_init.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_init.pass.cpp
index db82f65ac5a..7a9d3f7cfbd 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_init.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -43,5 +44,28 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ c.insert(
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ }
+ );
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_range.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_range.pass.cpp
index 93d5e837735..28637f5f47c 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_range.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -43,4 +44,27 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c;
+ c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.multiset/insert_rvalue.pass.cpp
index dd33e4b0611..7cddb0d9094 100644
--- a/libcxx/test/containers/unord/unord.multiset/insert_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/insert_rvalue.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -66,4 +67,52 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 2);
+ assert(*r == 3.5);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 3);
+ assert(*r == 4.5);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 4);
+ assert(*r == 5.5);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(P(3));
+ assert(c.size() == 2);
+ assert(*r == 3);
+
+ r = c.insert(P(4));
+ assert(c.size() == 3);
+ assert(*r == 4);
+
+ r = c.insert(P(5));
+ assert(c.size() == 4);
+ assert(*r == 5);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/iterators.pass.cpp b/libcxx/test/containers/unord/unord.multiset/iterators.pass.cpp
index 1da86067662..ddfc3742f5c 100644
--- a/libcxx/test/containers/unord/unord.multiset/iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/iterators.pass.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -63,4 +65,46 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::const_iterator i;
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/load_factor.pass.cpp b/libcxx/test/containers/unord/unord.multiset/load_factor.pass.cpp
index 664a2a790e6..c6e4825fcba 100644
--- a/libcxx/test/containers/unord/unord.multiset/load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/load_factor.pass.cpp
@@ -19,6 +19,8 @@
#include <cassert>
#include <cfloat>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -44,4 +46,31 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/local_iterators.pass.cpp b/libcxx/test/containers/unord/unord.multiset/local_iterators.pass.cpp
index 51481ac483f..6cc07b600d8 100644
--- a/libcxx/test/containers/unord/unord.multiset/local_iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/local_iterators.pass.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -257,4 +259,242 @@ int main()
j = c.cend(b);
assert(std::distance(i, j) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 7);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 2);
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+
+ b = c.bucket(5);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(6);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/max_bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.multiset/max_bucket_count.pass.cpp
index db6d98874be..fa55a1f8ef2 100644
--- a/libcxx/test/containers/unord/unord.multiset/max_bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/max_bucket_count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -25,4 +27,12 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/max_load_factor.pass.cpp b/libcxx/test/containers/unord/unord.multiset/max_load_factor.pass.cpp
index d1212d8a885..f2beb8fe576 100644
--- a/libcxx/test/containers/unord/unord.multiset/max_load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/max_load_factor.pass.cpp
@@ -19,6 +19,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -35,4 +37,22 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/max_size.pass.cpp b/libcxx/test/containers/unord/unord.multiset/max_size.pass.cpp
index fa2938ea9d7..23171294d71 100644
--- a/libcxx/test/containers/unord/unord.multiset/max_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/max_size.pass.cpp
@@ -18,10 +18,19 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
std::unordered_multiset<int> u;
assert(u.max_size() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> u;
+ assert(u.max_size() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/rehash.pass.cpp b/libcxx/test/containers/unord/unord.multiset/rehash.pass.cpp
index e82664bf4f3..9358c327c57 100644
--- a/libcxx/test/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/rehash.pass.cpp
@@ -18,7 +18,10 @@
#include <unordered_set>
#include <cassert>
-void test(const std::unordered_multiset<int>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 6);
assert(c.count(1) == 2);
@@ -55,4 +58,33 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.rehash(3);
+ assert(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ assert(c.bucket_count() == 31);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/reserve.pass.cpp b/libcxx/test/containers/unord/unord.multiset/reserve.pass.cpp
index bce82132ef8..e1c9e0a0f38 100644
--- a/libcxx/test/containers/unord/unord.multiset/reserve.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/reserve.pass.cpp
@@ -18,7 +18,10 @@
#include <unordered_set>
#include <cassert>
-void test(const std::unordered_multiset<int>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 6);
assert(c.count(1) == 2);
@@ -55,4 +58,33 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 7);
+ c.reserve(3);
+ assert(c.bucket_count() == 7);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/swap_member.pass.cpp b/libcxx/test/containers/unord/unord.multiset/swap_member.pass.cpp
index 3392eccbfde..3a7c506f56a 100644
--- a/libcxx/test/containers/unord/unord.multiset/swap_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/swap_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "../../test_allocator.h"
+#include "../../min_allocator.h"
int main()
{
@@ -385,4 +386,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/types.pass.cpp b/libcxx/test/containers/unord/unord.multiset/types.pass.cpp
index 67a8eb6fc6d..5d7fa3aa6af 100644
--- a/libcxx/test/containers/unord/unord.multiset/types.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/types.pass.cpp
@@ -30,6 +30,8 @@
#include <unordered_set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,21 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<short, std::hash<short>,
+ std::equal_to<short>, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
index 2299b5e7980..db8ba0e79bd 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(min_allocator<NotConstructible>{});
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == min_allocator<NotConstructible>());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index dbeda949df7..5f5cac2ffe8 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -131,4 +132,59 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 4);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
index d1c3cb1711a..23ca1fc4b78 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ C c = {
+ P(4),
+ P(1),
+ P(2)
+ };
+ c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
index 881a0d777f2..292f50ffd84 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -169,5 +170,105 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
index 20f5644eb77..300a4db8bba 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -119,4 +120,52 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 4);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
index b3357a80944..636f644944d 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -71,4 +72,52 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c(c0, min_allocator<int>());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 4);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
index d2761b18238..4546d597139 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
index ce16ebf5cd5..29729b5a4b0 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -56,5 +57,37 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
index b473d2616d0..f16c2321211 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
index 4b474fc5b96..53bf1953345 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -60,5 +61,40 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
index ca8fde42e68..bd2c3188d80 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -61,5 +62,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
index ba1ec05b3da..d7c69359527 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -62,5 +63,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
index 969d35d7903..e24d8f387cf 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -101,5 +102,82 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
index 77d6d81b3ea..e5283168ac7 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -116,5 +117,97 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ C::const_iterator i = c.cbegin();
+ assert(*i == 4);
+ ++i;
+ assert(*i == 3);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 2);
+ ++i;
+ assert(*i == 1);
+ ++i;
+ assert(*i == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
index 92a5e98d0e4..8c0828ae417 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -59,4 +60,38 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
index 6d2aff60601..5fa494b91fb 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -61,4 +62,40 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
index fbec983692c..bace36a8538 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -63,4 +64,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
index c70187566ab..a97750eb567 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -64,4 +65,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
index ba94ac43e4c..41f2e27797e 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -66,4 +67,43 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 6);
+ assert(c.count(1) == 2);
+ assert(c.count(2) == 2);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
index 11010e4a40d..1916b6b8072 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c = 7;
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
index afeedb4a281..4e9903745c0 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
index bc5b49a6441..19f4440a8f6 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
index 106775ff5f9..59eba5321a0 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -45,4 +46,26 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
index b90044da225..ca71ab3709b 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -46,4 +47,27 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_multiset<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ min_allocator<std::pair<const NotConstructible, NotConstructible> >()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/libcxx/test/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
index f56e247478d..b75816a9ab4 100644
--- a/libcxx/test/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -385,4 +386,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 7);
+ assert(c2.size() == 6);
+ assert(c2.count(1) == 2);
+ assert(c2.count(2) == 2);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/bucket.pass.cpp b/libcxx/test/containers/unord/unord.set/bucket.pass.cpp
index bdbd523a6f8..25f65815a92 100644
--- a/libcxx/test/containers/unord/unord.set/bucket.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/bucket.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -38,4 +40,24 @@ int main()
for (size_t i = 0; i < 13; ++i)
assert(c.bucket(i) == i % bc);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(std::begin(a), std::end(a));
+ size_t bc = c.bucket_count();
+ assert(bc >= 5);
+ for (size_t i = 0; i < 13; ++i)
+ assert(c.bucket(i) == i % bc);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.set/bucket_count.pass.cpp
index 5cfc71d591c..649aaa150e6 100644
--- a/libcxx/test/containers/unord/unord.set/bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/bucket_count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,31 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ const C c;
+ assert(c.bucket_count() == 0);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 11);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/bucket_size.pass.cpp b/libcxx/test/containers/unord/unord.set/bucket_size.pass.cpp
index 3c0f120e1ee..aecb2585196 100644
--- a/libcxx/test/containers/unord/unord.set/bucket_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/bucket_size.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,26 @@ int main()
assert(c.bucket_size(3) == 1);
assert(c.bucket_size(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.bucket_count() >= 5);
+ assert(c.bucket_size(0) == 0);
+ assert(c.bucket_size(1) == 1);
+ assert(c.bucket_size(2) == 1);
+ assert(c.bucket_size(3) == 1);
+ assert(c.bucket_size(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/clear.pass.cpp b/libcxx/test/containers/unord/unord.set/clear.pass.cpp
index 3052087eae1..1f97ab75b13 100644
--- a/libcxx/test/containers/unord/unord.set/clear.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/clear.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -36,4 +38,22 @@ int main()
c.clear();
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ c.clear();
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/count.pass.cpp b/libcxx/test/containers/unord/unord.set/count.pass.cpp
index bbd02d63bbe..d850a7e5754 100644
--- a/libcxx/test/containers/unord/unord.set/count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -41,4 +43,27 @@ int main()
assert(c.count(50) == 1);
assert(c.count(5) == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(c.count(30) == 1);
+ assert(c.count(50) == 1);
+ assert(c.count(5) == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/emplace.pass.cpp b/libcxx/test/containers/unord/unord.set/emplace.pass.cpp
index 70ffeb9b66f..a6faecb3a75 100644
--- a/libcxx/test/containers/unord/unord.set/emplace.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/emplace.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../Emplaceable.h"
+#include "../../min_allocator.h"
int main()
{
@@ -43,5 +44,27 @@ int main()
assert(*r.first == Emplaceable(5, 6));
assert(!r.second);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
+ std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
+ typedef std::pair<C::iterator, bool> R;
+ C c;
+ R r = c.emplace();
+ assert(c.size() == 1);
+ assert(*r.first == Emplaceable());
+ assert(r.second);
+
+ r = c.emplace(Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(r.second);
+
+ r = c.emplace(5, 6);
+ assert(c.size() == 2);
+ assert(*r.first == Emplaceable(5, 6));
+ assert(!r.second);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp b/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
index 59cf44559c2..de00ebeea0f 100644
--- a/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/emplace_hint.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "../../Emplaceable.h"
+#include "../../min_allocator.h"
int main()
{
@@ -41,5 +42,25 @@ int main()
assert(c.size() == 2);
assert(*r == Emplaceable(5, 6));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<Emplaceable, std::hash<Emplaceable>,
+ std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
+ typedef C::iterator R;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.emplace_hint(e);
+ assert(c.size() == 1);
+ assert(*r == Emplaceable());
+
+ r = c.emplace_hint(e, Emplaceable(5, 6));
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+
+ r = c.emplace_hint(r, 5, 6);
+ assert(c.size() == 2);
+ assert(*r == Emplaceable(5, 6));
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/eq.pass.cpp b/libcxx/test/containers/unord/unord.set/eq.pass.cpp
index 52d8304be31..7b5569e24bb 100644
--- a/libcxx/test/containers/unord/unord.set/eq.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/eq.pass.cpp
@@ -22,6 +22,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -88,4 +90,70 @@ int main()
assert( (c1 == c2));
assert(!(c1 != c2));
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2;
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c1(std::begin(a), std::end(a));
+ const C c2 = c1;
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a), std::end(a));
+ C c2 = c1;
+ c2.rehash(30);
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ c2.insert(P(90));
+ assert(!(c1 == c2));
+ assert( (c1 != c2));
+ c1.insert(P(90));
+ assert( (c1 == c2));
+ assert(!(c1 != c2));
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/equal_range_const.pass.cpp b/libcxx/test/containers/unord/unord.set/equal_range_const.pass.cpp
index 98e4885c68c..c64e0af34bf 100644
--- a/libcxx/test/containers/unord/unord.set/equal_range_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/equal_range_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -47,4 +49,33 @@ int main()
assert(std::distance(r.first, r.second) == 1);
assert(*r.first == 50);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::const_iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/equal_range_non_const.pass.cpp b/libcxx/test/containers/unord/unord.set/equal_range_non_const.pass.cpp
index ba7ba0d1b0f..6d7e044b5f5 100644
--- a/libcxx/test/containers/unord/unord.set/equal_range_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/equal_range_non_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -47,4 +49,33 @@ int main()
assert(std::distance(r.first, r.second) == 1);
assert(*r.first == 50);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef C::iterator I;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(50),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c(std::begin(a), std::end(a));
+ std::pair<I, I> r = c.equal_range(30);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 30);
+ r = c.equal_range(5);
+ assert(std::distance(r.first, r.second) == 0);
+ r = c.equal_range(50);
+ assert(std::distance(r.first, r.second) == 1);
+ assert(*r.first == 50);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/erase_const_iter.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_const_iter.pass.cpp
index a6038a4f667..ff746016a97 100644
--- a/libcxx/test/containers/unord/unord.set/erase_const_iter.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/erase_const_iter.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,26 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::iterator j = c.erase(i);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/erase_key.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_key.pass.cpp
index c4483ec7c1b..187f11826f3 100644
--- a/libcxx/test/containers/unord/unord.set/erase_key.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/erase_key.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -77,4 +79,62 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.erase(5) == 0);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 1);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(2) == 0);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ assert(c.erase(4) == 1);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(4) == 0);
+ assert(c.size() == 2);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 1);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(1) == 0);
+ assert(c.size() == 1);
+ assert(c.count(3) == 1);
+
+ assert(c.erase(3) == 1);
+ assert(c.size() == 0);
+
+ assert(c.erase(3) == 0);
+ assert(c.size() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/erase_range.pass.cpp b/libcxx/test/containers/unord/unord.set/erase_range.pass.cpp
index ba51efaf006..98b7d4d4297 100644
--- a/libcxx/test/containers/unord/unord.set/erase_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/erase_range.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -53,4 +55,39 @@ int main()
assert(c.size() == 0);
assert(k == c.end());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ C::const_iterator i = c.find(2);
+ C::const_iterator j = next(i);
+ C::iterator k = c.erase(i, i);
+ assert(k == i);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ k = c.erase(i, j);
+ assert(c.size() == 3);
+ assert(c.count(1) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+
+ k = c.erase(c.cbegin(), c.cend());
+ assert(c.size() == 0);
+ assert(k == c.end());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/find_const.pass.cpp b/libcxx/test/containers/unord/unord.set/find_const.pass.cpp
index 80dca545bfc..ca8b9e6a032 100644
--- a/libcxx/test/containers/unord/unord.set/find_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/find_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,26 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ C::const_iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/find_non_const.pass.cpp b/libcxx/test/containers/unord/unord.set/find_non_const.pass.cpp
index 8ff0fe4b08d..a2ab80425fc 100644
--- a/libcxx/test/containers/unord/unord.set/find_non_const.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/find_non_const.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -40,4 +42,26 @@ int main()
i = c.find(5);
assert(i == c.cend());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c(std::begin(a), std::end(a));
+ C::iterator i = c.find(30);
+ assert(*i == 30);
+ i = c.find(5);
+ assert(i == c.cend());
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_const_lvalue.pass.cpp
index 36ee2cfbb65..b5d2733e122 100644
--- a/libcxx/test/containers/unord/unord.set/insert_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -45,4 +47,32 @@ int main()
assert(*r.first == 5.5);
assert(r.second);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef C::value_type P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(r.second);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(!r.second);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 2);
+ assert(*r.first == 4.5);
+ assert(r.second);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 3);
+ assert(*r.first == 5.5);
+ assert(r.second);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
index 88b317aa5cc..cbc212aacad 100644
--- a/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_hint_const_lvalue.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -42,4 +44,29 @@ int main()
assert(c.size() == 3);
assert(*r == 5.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef C::value_type P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(4.5));
+ assert(c.size() == 2);
+ assert(*r == 4.5);
+
+ r = c.insert(e, P(5.5));
+ assert(c.size() == 3);
+ assert(*r == 5.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
index 3d79fbcc299..8d7e5ba7a03 100644
--- a/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_hint_rvalue.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -68,4 +69,54 @@ int main()
assert(*r == 5);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef C::iterator R;
+ typedef double P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(r, P(3.5));
+ assert(c.size() == 1);
+ assert(*r == 3.5);
+
+ r = c.insert(e, P(4.5));
+ assert(c.size() == 2);
+ assert(*r == 4.5);
+
+ r = c.insert(e, P(5.5));
+ assert(c.size() == 3);
+ assert(*r == 5.5);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef C::iterator R;
+ typedef MoveOnly P;
+ C c;
+ C::const_iterator e = c.end();
+ R r = c.insert(e, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(r, P(3));
+ assert(c.size() == 1);
+ assert(*r == 3);
+
+ r = c.insert(e, P(4));
+ assert(c.size() == 2);
+ assert(*r == 4);
+
+ r = c.insert(e, P(5));
+ assert(c.size() == 3);
+ assert(*r == 5);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_init.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_init.pass.cpp
index 3b1abdf4896..18a97a15314 100644
--- a/libcxx/test/containers/unord/unord.set/insert_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_init.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -43,5 +44,28 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ c.insert(
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ }
+ );
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_range.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_range.pass.cpp
index b0b8fc62874..aa3b38bbe2a 100644
--- a/libcxx/test/containers/unord/unord.set/insert_range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_range.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "test_iterators.h"
+#include "../../min_allocator.h"
int main()
{
@@ -43,4 +44,27 @@ int main()
assert(c.count(3) == 1);
assert(c.count(4) == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c;
+ c.insert(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/insert_rvalue.pass.cpp b/libcxx/test/containers/unord/unord.set/insert_rvalue.pass.cpp
index e3268f0ad6a..9ed2cda9905 100644
--- a/libcxx/test/containers/unord/unord.set/insert_rvalue.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/insert_rvalue.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include "../../MoveOnly.h"
+#include "../../min_allocator.h"
int main()
{
@@ -74,4 +75,60 @@ int main()
assert(r.second);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<double, std::hash<double>,
+ std::equal_to<double>, min_allocator<double>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef double P;
+ C c;
+ R r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(r.second);
+
+ r = c.insert(P(3.5));
+ assert(c.size() == 1);
+ assert(*r.first == 3.5);
+ assert(!r.second);
+
+ r = c.insert(P(4.5));
+ assert(c.size() == 2);
+ assert(*r.first == 4.5);
+ assert(r.second);
+
+ r = c.insert(P(5.5));
+ assert(c.size() == 3);
+ assert(*r.first == 5.5);
+ assert(r.second);
+ }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
+ std::equal_to<MoveOnly>, min_allocator<MoveOnly>> C;
+ typedef std::pair<C::iterator, bool> R;
+ typedef MoveOnly P;
+ C c;
+ R r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(r.second);
+
+ r = c.insert(P(3));
+ assert(c.size() == 1);
+ assert(*r.first == 3);
+ assert(!r.second);
+
+ r = c.insert(P(4));
+ assert(c.size() == 2);
+ assert(*r.first == 4);
+ assert(r.second);
+
+ r = c.insert(P(5));
+ assert(c.size() == 3);
+ assert(*r.first == 5);
+ assert(r.second);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/iterators.pass.cpp b/libcxx/test/containers/unord/unord.set/iterators.pass.cpp
index ef1ecb9ebc9..7815b9b381e 100644
--- a/libcxx/test/containers/unord/unord.set/iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/iterators.pass.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -63,4 +65,46 @@ int main()
assert(std::distance(c.cbegin(), c.cend()) == c.size());
C::const_iterator i;
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::iterator i;
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ C::const_iterator i;
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/load_factor.pass.cpp b/libcxx/test/containers/unord/unord.set/load_factor.pass.cpp
index 60b0f91e534..959f384cc37 100644
--- a/libcxx/test/containers/unord/unord.set/load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/load_factor.pass.cpp
@@ -19,6 +19,8 @@
#include <cassert>
#include <cfloat>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -44,4 +46,31 @@ int main()
const C c;
assert(c.load_factor() == 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ const C c(std::begin(a), std::end(a));
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ const C c;
+ assert(c.load_factor() == 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/local_iterators.pass.cpp b/libcxx/test/containers/unord/unord.set/local_iterators.pass.cpp
index 93d7ea89fd6..5b82228a3b1 100644
--- a/libcxx/test/containers/unord/unord.set/local_iterators.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/local_iterators.pass.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -201,4 +203,186 @@ int main()
assert(std::distance(i, j) == 1);
assert(*i == 4);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.begin(b);
+ I j = c.end(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.begin(b);
+ j = c.end(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ typedef C::const_local_iterator I;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ const C c(a, a + sizeof(a)/sizeof(a[0]));
+ assert(c.bucket_count() >= 5);
+ C::size_type b = c.bucket(0);
+ I i = c.cbegin(b);
+ I j = c.cend(b);
+ assert(std::distance(i, j) == 0);
+
+ b = c.bucket(1);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 1);
+
+ b = c.bucket(2);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 2);
+
+ b = c.bucket(3);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 3);
+
+ b = c.bucket(4);
+ i = c.cbegin(b);
+ j = c.cend(b);
+ assert(std::distance(i, j) == 1);
+ assert(*i == 4);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/max_bucket_count.pass.cpp b/libcxx/test/containers/unord/unord.set/max_bucket_count.pass.cpp
index ee36c56988a..80398b8f8bd 100644
--- a/libcxx/test/containers/unord/unord.set/max_bucket_count.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/max_bucket_count.pass.cpp
@@ -18,6 +18,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -25,4 +27,12 @@ int main()
const C c;
assert(c.max_bucket_count() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ const C c;
+ assert(c.max_bucket_count() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/max_load_factor.pass.cpp b/libcxx/test/containers/unord/unord.set/max_load_factor.pass.cpp
index 66470373f53..db7e78437b4 100644
--- a/libcxx/test/containers/unord/unord.set/max_load_factor.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/max_load_factor.pass.cpp
@@ -19,6 +19,8 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -35,4 +37,22 @@ int main()
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ const C c;
+ assert(c.max_load_factor() == 1);
+ }
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ C c;
+ assert(c.max_load_factor() == 1);
+ c.max_load_factor(2.5);
+ assert(c.max_load_factor() == 2.5);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/max_size.pass.cpp b/libcxx/test/containers/unord/unord.set/max_size.pass.cpp
index 2c5d3be88ff..43d66bb6d80 100644
--- a/libcxx/test/containers/unord/unord.set/max_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/max_size.pass.cpp
@@ -18,10 +18,19 @@
#include <unordered_set>
#include <cassert>
+#include "../../min_allocator.h"
+
int main()
{
{
std::unordered_set<int> u;
assert(u.max_size() > 0);
}
+#if __cplusplus >= 201103L
+ {
+ std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> u;
+ assert(u.max_size() > 0);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/rehash.pass.cpp b/libcxx/test/containers/unord/unord.set/rehash.pass.cpp
index ae962c99f05..bf4d3175938 100644
--- a/libcxx/test/containers/unord/unord.set/rehash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/rehash.pass.cpp
@@ -18,7 +18,10 @@
#include <unordered_set>
#include <cassert>
-void test(const std::unordered_set<int>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 4);
assert(c.count(1) == 1);
@@ -55,4 +58,33 @@ int main()
assert(c.bucket_count() == 31);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.rehash(3);
+ assert(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.rehash(3);
+ assert(c.bucket_count() == 3);
+ test(c);
+ c.rehash(31);
+ assert(c.bucket_count() == 31);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/reserve.pass.cpp b/libcxx/test/containers/unord/unord.set/reserve.pass.cpp
index 79507743590..525f9438412 100644
--- a/libcxx/test/containers/unord/unord.set/reserve.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/reserve.pass.cpp
@@ -18,7 +18,10 @@
#include <unordered_set>
#include <cassert>
-void test(const std::unordered_set<int>& c)
+#include "../../min_allocator.h"
+
+template <class C>
+void test(const C& c)
{
assert(c.size() == 4);
assert(c.count(1) == 1);
@@ -55,4 +58,33 @@ int main()
assert(c.bucket_count() >= 16);
test(c);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int, std::hash<int>,
+ std::equal_to<int>, min_allocator<int>> C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(a, a + sizeof(a)/sizeof(a[0]));
+ test(c);
+ assert(c.bucket_count() >= 5);
+ c.reserve(3);
+ assert(c.bucket_count() == 5);
+ test(c);
+ c.max_load_factor(2);
+ c.reserve(3);
+ assert(c.bucket_count() >= 2);
+ test(c);
+ c.reserve(31);
+ assert(c.bucket_count() >= 16);
+ test(c);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/swap_member.pass.cpp b/libcxx/test/containers/unord/unord.set/swap_member.pass.cpp
index 3d9036265f3..9a972b725eb 100644
--- a/libcxx/test/containers/unord/unord.set/swap_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/swap_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "../../test_allocator.h"
+#include "../../min_allocator.h"
int main()
{
@@ -385,4 +386,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ c1.swap(c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/types.pass.cpp b/libcxx/test/containers/unord/unord.set/types.pass.cpp
index a69eb0a09b2..11d992f9fa0 100644
--- a/libcxx/test/containers/unord/unord.set/types.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/types.pass.cpp
@@ -30,6 +30,8 @@
#include <unordered_set>
#include <type_traits>
+#include "../../min_allocator.h"
+
int main()
{
{
@@ -46,4 +48,21 @@ int main()
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<short, std::hash<short>,
+ std::equal_to<short>, min_allocator<short>> C;
+ static_assert((std::is_same<C::value_type, short>::value), "");
+ static_assert((std::is_same<C::key_type, short>::value), "");
+ static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), "");
+ static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<C::value_type> >::value), "");
+ static_assert((std::is_same<C::reference, C::value_type&>::value), "");
+ static_assert((std::is_same<C::const_reference, const C::value_type&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<C::value_type>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const C::value_type>>::value), "");
+ static_assert((std::is_same<C::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
index a5e2368d390..31878362f1e 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(min_allocator<NotConstructible>{});
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == min_allocator<NotConstructible>());
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index eaf2e8036fd..e7fa903636e 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -115,4 +116,51 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
index 10fff26cfd1..256f4447c92 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ C c = {
+ P(4),
+ P(1),
+ P(2)
+ };
+ c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index 945c8ef8add..8dab47b861d 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -161,5 +162,52 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(a, a + 2,
+ 7,
+ test_hash<std::hash<int> >(2),
+ test_compare<std::equal_to<int> >(3),
+ A()
+ );
+ c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
index d1ee1fb74e3..7fe0e15df7c 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -103,4 +104,44 @@ int main()
assert(c.max_load_factor() == 1);
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = c0;
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
index 23924f076e7..67995b3abdc 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -63,4 +64,44 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c(c0, min_allocator<int>());
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
index 2e73140ae89..e53264fc570 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c;
+ assert(c.bucket_count() == 0);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
index 0d3320e345e..8dc37e30465 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -56,5 +57,37 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c = {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
index 3ec3bbe981d..3cc3cf0ab8c 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -58,5 +59,39 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
index f953c1ef4ea..9dc61fbb082 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -60,5 +61,40 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
index 3b982510779..a191c7c2f0b 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -61,5 +62,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
index 2dc76902215..4a1fc6cd8a8 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -23,6 +23,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -62,5 +63,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ C c({
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ },
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
index 7077690f04d..5c75a3e8aca 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -101,5 +102,82 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 0);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ C c = std::move(c0);
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
index 0b1336a8255..1e58dbd7a26 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -108,5 +109,48 @@ int main()
assert(c0.empty());
}
+#if __cplusplus >= 201103L
+ {
+ typedef int P;
+ typedef min_allocator<int> A;
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ A
+ > C;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c0(a, a + sizeof(a)/sizeof(a[0]),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ A()
+ );
+ C c(std::move(c0), A());
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == A());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+
+ assert(c0.empty());
+ }
+#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
index 1515a0c2df7..322fa3ff5a3 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -59,4 +60,38 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])));
+ assert(c.bucket_count() >= 5);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
index 33d8f3a1149..87e62a005d1 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
@@ -24,6 +24,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -61,4 +62,40 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >());
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
index deabebdbeab..6f6f1782f98 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -63,4 +64,41 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >());
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
index a0fafaddee3..ac2aafd7350 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -64,4 +65,42 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
index c6153df62be..5a051e82712 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -26,6 +26,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -66,4 +67,43 @@ int main()
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<int,
+ test_hash<std::hash<int> >,
+ test_compare<std::equal_to<int> >,
+ min_allocator<int>
+ > C;
+ typedef int P;
+ P a[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
+ 7,
+ test_hash<std::hash<int> >(8),
+ test_compare<std::equal_to<int> >(9),
+ min_allocator<int>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.size() == 4);
+ assert(c.count(1) == 1);
+ assert(c.count(2) == 1);
+ assert(c.count(3) == 1);
+ assert(c.count(4) == 1);
+ assert(c.hash_function() == test_hash<std::hash<int> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
+ assert(c.get_allocator() == min_allocator<int>());
+ assert(!c.empty());
+ assert(std::distance(c.begin(), c.end()) == c.size());
+ assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
index b5d970d290f..fe019669b2e 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -42,4 +43,23 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7);
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >());
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
index 575236f0fdf..2bda6cc2fd2 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -44,4 +45,25 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
index 380082cd733..bd5e7545d36 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -45,4 +46,26 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9)
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
index b5666878ecb..e3378ce856b 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
@@ -22,6 +22,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -34,7 +35,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9),
- test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
+ test_allocator<NotConstructible>(10)
);
assert(c.bucket_count() == 7);
assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
@@ -46,4 +47,27 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef std::unordered_set<NotConstructible,
+ test_hash<std::hash<NotConstructible> >,
+ test_compare<std::equal_to<NotConstructible> >,
+ min_allocator<NotConstructible>
+ > C;
+ C c(7,
+ test_hash<std::hash<NotConstructible> >(8),
+ test_compare<std::equal_to<NotConstructible> >(9),
+ min_allocator<NotConstructible>()
+ );
+ assert(c.bucket_count() == 7);
+ assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
+ assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >(9));
+ assert(c.get_allocator() == (min_allocator<NotConstructible>()));
+ assert(c.size() == 0);
+ assert(c.empty());
+ assert(std::distance(c.begin(), c.end()) == 0);
+ assert(c.load_factor() == 0);
+ assert(c.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/libcxx/test/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
index ffe102d2b56..57899aeffbd 100644
--- a/libcxx/test/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
+++ b/libcxx/test/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "../../../test_allocator.h"
+#include "../../../min_allocator.h"
int main()
{
@@ -385,4 +386,186 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
+#if __cplusplus >= 201103L
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() == 0);
+ assert(c2.size() == 0);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() == 0);
+ assert(c1.size() == 0);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+ {
+ typedef test_hash<std::hash<int> > Hash;
+ typedef test_compare<std::equal_to<int> > Compare;
+ typedef min_allocator<int> Alloc;
+ typedef std::unordered_set<int, Hash, Compare, Alloc> C;
+ typedef int P;
+ P a1[] =
+ {
+ P(1),
+ P(2),
+ P(3),
+ P(4),
+ P(1),
+ P(2)
+ };
+ P a2[] =
+ {
+ P(10),
+ P(20),
+ P(30),
+ P(40),
+ P(50),
+ P(60),
+ P(70),
+ P(80)
+ };
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
+ c2.max_load_factor(2);
+ swap(c1, c2);
+
+ assert(c1.bucket_count() >= 11);
+ assert(c1.size() == 8);
+ assert(*c1.find(10) == 10);
+ assert(*c1.find(20) == 20);
+ assert(*c1.find(30) == 30);
+ assert(*c1.find(40) == 40);
+ assert(*c1.find(50) == 50);
+ assert(*c1.find(60) == 60);
+ assert(*c1.find(70) == 70);
+ assert(*c1.find(80) == 80);
+ assert(c1.hash_function() == Hash(2));
+ assert(c1.key_eq() == Compare(2));
+ assert(c1.get_allocator() == Alloc());
+ assert(std::distance(c1.begin(), c1.end()) == c1.size());
+ assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.max_load_factor() == 2);
+
+ assert(c2.bucket_count() >= 5);
+ assert(c2.size() == 4);
+ assert(c2.count(1) == 1);
+ assert(c2.count(2) == 1);
+ assert(c2.count(3) == 1);
+ assert(c2.count(4) == 1);
+ assert(c2.hash_function() == Hash(1));
+ assert(c2.key_eq() == Compare(1));
+ assert(c2.get_allocator() == Alloc());
+ assert(std::distance(c2.begin(), c2.end()) == c2.size());
+ assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.max_load_factor() == 1);
+ }
+#endif
}
diff --git a/libcxx/test/testit b/libcxx/test/testit
index f137745d1fa..a7423645d5a 100755
--- a/libcxx/test/testit
+++ b/libcxx/test/testit
@@ -38,7 +38,7 @@ fi
if [ -z "$OPTIONS" ]
then
- OPTIONS="-std=c++0x -stdlib=libc++"
+ OPTIONS="-std=c++11 -stdlib=libc++"
fi
OPTIONS="$OPTIONS -I$LIBCXX_ROOT/test/support"
OpenPOWER on IntegriCloud