aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers')
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp10
-rw-r--r--test/std/containers/associative/map/map.access/iterator.pass.cpp36
-rw-r--r--test/std/containers/associative/map/map.access/max_size.pass.cpp38
-rw-r--r--test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/associative/map/map.cons/copy.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/copy_assign.pass.cpp13
-rw-r--r--test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/associative/map/map.ops/count.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/count1.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/count2.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/count3.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range1.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range2.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range3.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/find.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/find1.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/find2.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/find3.fail.cpp5
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp3
-rw-r--r--test/std/containers/associative/map/map.special/non_member_swap.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp28
-rw-r--r--test/std/containers/associative/multimap/iterator.pass.cpp28
-rw-r--r--test/std/containers/associative/multimap/max_size.pass.cpp38
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp3
-rw-r--r--test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp8
-rw-r--r--test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp30
-rw-r--r--test/std/containers/associative/multiset/count.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/equal_range.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/find.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/insert_initializer_list.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/iterator.pass.cpp28
-rw-r--r--test/std/containers/associative/multiset/lower_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/max_size.pass.cpp35
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp8
-rw-r--r--test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp28
-rw-r--r--test/std/containers/associative/multiset/upper_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/set/count.pass.cpp23
-rw-r--r--test/std/containers/associative/set/equal_range.pass.cpp3
-rw-r--r--test/std/containers/associative/set/find.pass.cpp3
-rw-r--r--test/std/containers/associative/set/insert_initializer_list.pass.cpp5
-rw-r--r--test/std/containers/associative/set/iterator.pass.cpp36
-rw-r--r--test/std/containers/associative/set/lower_bound.pass.cpp3
-rw-r--r--test/std/containers/associative/set/max_size.pass.cpp35
-rw-r--r--test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/associative/set/set.cons/copy.pass.cpp5
-rw-r--r--test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp3
-rw-r--r--test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp3
-rw-r--r--test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/associative/set/set.special/non_member_swap.pass.cpp8
-rw-r--r--test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp28
-rw-r--r--test/std/containers/associative/set/upper_bound.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp18
-rw-r--r--test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp4
-rw-r--r--test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp3
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp16
-rw-r--r--test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.tuple/get.fail.cpp5
-rw-r--r--test/std/containers/sequences/array/at.pass.cpp17
-rw-r--r--test/std/containers/sequences/array/iterators.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/access.pass.cpp16
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp47
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp9
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.cons/copy.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.cons/default.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp13
-rw-r--r--test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size.pass.cpp31
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp3
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp3
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp21
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp20
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp29
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp7
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp5
-rw-r--r--test/std/containers/sequences/deque/deque.special/swap.pass.cpp8
-rw-r--r--test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp18
-rw-r--r--test/std/containers/sequences/deque/iterators.pass.cpp3
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp11
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp6
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp6
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp21
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp3
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp20
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp2
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp17
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp5
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp5
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp32
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp32
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp18
-rw-r--r--test/std/containers/sequences/forwardlist/max_size.pass.cpp37
-rw-r--r--test/std/containers/sequences/list/iterators.pass.cpp7
-rw-r--r--test/std/containers/sequences/list/list.capacity/max_size.pass.cpp47
-rw-r--r--test/std/containers/sequences/list/list.cons/copy.pass.cpp6
-rw-r--r--test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp5
-rw-r--r--test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/sequences/list/list.cons/size_type.pass.cpp22
-rw-r--r--test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp5
-rw-r--r--test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp20
-rw-r--r--test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp20
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp2
-rw-r--r--test/std/containers/sequences/list/list.ops/remove.pass.cpp80
-rw-r--r--test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp18
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/construct_size.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/emplace_back.pass.cpp29
-rw-r--r--test/std/containers/sequences/vector.bool/find.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp25
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/iterators.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp9
-rw-r--r--test/std/containers/sequences/vector.bool/push_back.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector.bool/swap.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp18
-rw-r--r--test/std/containers/sequences/vector/contiguous.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/iterators.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp48
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp16
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector/vector.cons/copy.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp3
-rw-r--r--test/std/containers/sequences/vector/vector.data/data.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.data/data_const.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp38
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp34
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp51
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp53
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp51
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp51
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp51
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp49
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp55
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp34
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp33
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp35
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp22
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp38
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp38
-rw-r--r--test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp56
-rw-r--r--test/std/containers/sequences/vector/vector.special/swap.pass.cpp14
-rw-r--r--test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp18
-rw-r--r--test/std/containers/stack_allocator.h66
-rw-r--r--test/std/containers/unord/unord.map/bucket.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/bucket_count.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.map/bucket_size.pass.cpp21
-rw-r--r--test/std/containers/unord/unord.map/iterators.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.map/max_size.pass.cpp41
-rw-r--r--test/std/containers/unord/unord.map/rehash.pass.cpp13
-rw-r--r--test/std/containers/unord/unord.map/reserve.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/swap_member.pass.cpp177
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp26
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp24
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp26
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp22
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp10
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp43
-rw-r--r--test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp177
-rw-r--r--test/std/containers/unord/unord.multimap/bucket.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/bucket_count.pass.cpp6
-rw-r--r--test/std/containers/unord/unord.multimap/bucket_size.pass.cpp29
-rw-r--r--test/std/containers/unord/unord.multimap/iterators.fail.cpp6
-rw-r--r--test/std/containers/unord/unord.multimap/iterators.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multimap/local_iterators.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.multimap/max_size.pass.cpp43
-rw-r--r--test/std/containers/unord/unord.multimap/rehash.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.multimap/reserve.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multimap/scary.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multimap/swap_member.pass.cpp178
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp11
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp26
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp24
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp53
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp22
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp17
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp15
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp73
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp17
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp43
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp178
-rw-r--r--test/std/containers/unord/unord.multiset/bucket.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/bucket_count.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multiset/bucket_size.pass.cpp29
-rw-r--r--test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.multiset/iterators.fail.cpp6
-rw-r--r--test/std/containers/unord/unord.multiset/iterators.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multiset/local_iterators.fail.cpp10
-rw-r--r--test/std/containers/unord/unord.multiset/max_size.pass.cpp40
-rw-r--r--test/std/containers/unord/unord.multiset/rehash.pass.cpp13
-rw-r--r--test/std/containers/unord/unord.multiset/reserve.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multiset/scary.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multiset/swap_member.pass.cpp178
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp11
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp48
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp24
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp52
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp38
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp43
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp178
-rw-r--r--test/std/containers/unord/unord.set/bucket.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/bucket_count.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.set/bucket_size.pass.cpp21
-rw-r--r--test/std/containers/unord/unord.set/erase_const_iter.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.set/iterators.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.set/max_size.pass.cpp36
-rw-r--r--test/std/containers/unord/unord.set/rehash.pass.cpp13
-rw-r--r--test/std/containers/unord/unord.set/reserve.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/swap_member.pass.cpp178
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp11
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp18
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp26
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp24
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp52
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp13
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp3
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp20
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp14
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp3
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp43
-rw-r--r--test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp178
418 files changed, 3344 insertions, 3310 deletions
diff --git a/test/std/containers/associative/map/map.access/at.pass.cpp b/test/std/containers/associative/map/map.access/at.pass.cpp
index c5f77bf5f0fb..6d3e98e9e78b 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <map>
// class map
@@ -19,6 +18,7 @@
#include <cassert>
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -43,6 +43,7 @@ int main()
assert(m.at(3) == 3.5);
assert(m.at(4) == 4.5);
assert(m.at(5) == 5.5);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
m.at(6);
@@ -51,6 +52,7 @@ int main()
catch (std::out_of_range&)
{
}
+#endif
assert(m.at(7) == 7.5);
assert(m.at(8) == 8.5);
assert(m.size() == 7);
@@ -74,6 +76,7 @@ int main()
assert(m.at(3) == 3.5);
assert(m.at(4) == 4.5);
assert(m.at(5) == 5.5);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
m.at(6);
@@ -82,6 +85,7 @@ int main()
catch (std::out_of_range&)
{
}
+#endif
assert(m.at(7) == 7.5);
assert(m.at(8) == 8.5);
assert(m.size() == 7);
@@ -108,6 +112,7 @@ int main()
assert(m.at(3) == 3.5);
assert(m.at(4) == 4.5);
assert(m.at(5) == 5.5);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
m.at(6);
@@ -116,6 +121,7 @@ int main()
catch (std::out_of_range&)
{
}
+#endif
assert(m.at(7) == 7.5);
assert(m.at(8) == 8.5);
assert(m.size() == 7);
@@ -139,6 +145,7 @@ int main()
assert(m.at(3) == 3.5);
assert(m.at(4) == 4.5);
assert(m.at(5) == 5.5);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
m.at(6);
@@ -147,6 +154,7 @@ int main()
catch (std::out_of_range&)
{
}
+#endif
assert(m.at(7) == 7.5);
assert(m.at(8) == 8.5);
assert(m.size() == 7);
diff --git a/test/std/containers/associative/map/map.access/iterator.pass.cpp b/test/std/containers/associative/map/map.access/iterator.pass.cpp
index 4f66eb6a8e31..27fe3511c474 100644
--- a/test/std/containers/associative/map/map.access/iterator.pass.cpp
+++ b/test/std/containers/associative/map/map.access/iterator.pass.cpp
@@ -28,7 +28,9 @@
#include <map>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -63,13 +65,13 @@ int main()
V(8, 2)
};
std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::map<int, double>::iterator i;
i = m.begin();
std::map<int, double>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -107,13 +109,13 @@ int main()
V(8, 2)
};
const std::map<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::map<int, double>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -150,13 +152,13 @@ int main()
V(8, 2)
};
std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::map<int, double, std::less<int>, min_allocator<V>>::iterator i;
i = m.begin();
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
@@ -194,20 +196,20 @@ int main()
V(8, 2)
};
const std::map<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::map<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
{
assert(i->first == j);
assert(i->second == 1);
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::map<int, double> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/associative/map/map.access/max_size.pass.cpp b/test/std/containers/associative/map/map.access/max_size.pass.cpp
index c67d8b1f674d..82a817a1f4ae 100644
--- a/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -13,23 +13,39 @@
// size_type max_size() const;
-#include <map>
#include <cassert>
+#include <limits>
+#include <map>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
- {
- typedef std::map<int, double> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::pair<const int, int> KV;
+ {
+ typedef limited_allocator<KV, 10> A;
+ typedef std::map<int, int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<KV, (size_t)-1> A;
+ typedef std::map<int, int, std::less<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::map<char, int> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
index 81ccba3bbc96..210c27050a60 100644
--- a/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/associative/map/map.cons/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <map>
-// Check that std::map fails to instantiate if the comparison predicate is
+// Check that std::map fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <map>
diff --git a/test/std/containers/associative/map/map.cons/copy.pass.cpp b/test/std/containers/associative/map/map.cons/copy.pass.cpp
index a1de1b13aed2..081c8f7c0a82 100644
--- a/test/std/containers/associative/map/map.cons/copy.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -56,7 +57,7 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
@@ -91,8 +92,6 @@ int main()
assert(*next(mo.begin()) == V(2, 1));
assert(*next(mo.begin(), 2) == V(3, 1));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
index cc5d0d5d2f8b..0a4f70e59d95 100644
--- a/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp
@@ -17,6 +17,7 @@
#include <cassert>
#include <vector>
#include <algorithm>
+#include <iterator>
#include <iostream>
@@ -35,7 +36,7 @@ public:
int foo{0};
counting_allocatorT(int f) noexcept : foo(f) {}
- using propagate_on_container_copy_assignment = std::true_type;
+ using propagate_on_container_copy_assignment = std::true_type;
template <class U> counting_allocatorT(const counting_allocatorT<U>& other) noexcept {foo = other.foo;}
template <class U> bool operator==(const counting_allocatorT<U>& other) const noexcept { return foo == other.foo; }
template <class U> bool operator!=(const counting_allocatorT<U>& other) const noexcept { return foo != other.foo; }
@@ -58,7 +59,7 @@ public:
int foo{0};
counting_allocatorF(int f) noexcept : foo(f) {}
- using propagate_on_container_copy_assignment = std::false_type;
+ using propagate_on_container_copy_assignment = std::false_type;
template <class U> counting_allocatorF(const counting_allocatorF<U>& other) noexcept {foo = other.foo;}
template <class U> bool operator==(const counting_allocatorF<U>& other) const noexcept { return foo == other.foo; }
template <class U> bool operator!=(const counting_allocatorF<U>& other) const noexcept { return foo != other.foo; }
@@ -76,7 +77,7 @@ public:
bool balanced_allocs() {
std::vector<int> temp1, temp2;
-
+
std::cout << "Allocations = " << ca_allocs.size() << ", deallocatons = " << ca_deallocs.size() << std::endl;
if (ca_allocs.size() != ca_deallocs.size())
return false;
@@ -86,13 +87,13 @@ bool balanced_allocs() {
temp2.clear();
std::unique_copy(temp1.begin(), temp1.end(), std::back_inserter<std::vector<int>>(temp2));
std::cout << "There were " << temp2.size() << " different allocators\n";
-
+
for (std::vector<int>::const_iterator it = temp2.begin(); it != temp2.end(); ++it ) {
std::cout << *it << ": " << std::count(ca_allocs.begin(), ca_allocs.end(), *it) << " vs " << std::count(ca_deallocs.begin(), ca_deallocs.end(), *it) << std::endl;
if ( std::count(ca_allocs.begin(), ca_allocs.end(), *it) != std::count(ca_deallocs.begin(), ca_deallocs.end(), *it))
return false;
}
-
+
temp1 = ca_allocs;
std::sort(temp1.begin(), temp1.end());
temp2.clear();
@@ -103,7 +104,7 @@ bool balanced_allocs() {
if ( std::count(ca_allocs.begin(), ca_allocs.end(), *it) != std::count(ca_deallocs.begin(), ca_deallocs.end(), *it))
return false;
}
-
+
return true;
}
#endif
diff --git a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
index efdf5a2ed184..a0cf689ed909 100644
--- a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -44,6 +45,6 @@ int main()
}
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
index 6bad75d66f1d..705fb580487b 100644
--- a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp
@@ -18,6 +18,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -75,7 +76,7 @@ int main()
assert(*next(m.begin()) == V(2, 1));
assert(*next(m.begin(), 2) == V(3, 1));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
index 95ddf6dcb82f..84f115f1958e 100644
--- a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -46,7 +47,7 @@ int main()
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
index 1c2a242edf43..b5301418e85a 100644
--- a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -36,15 +37,15 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/map/map.ops/count.pass.cpp b/test/std/containers/associative/map/map.ops/count.pass.cpp
index f3df31951c79..c35ad3f0a00e 100644
--- a/test/std/containers/associative/map/map.ops/count.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -98,7 +99,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less <>> M;
diff --git a/test/std/containers/associative/map/map.ops/count1.fail.cpp b/test/std/containers/associative/map/map.ops/count1.fail.cpp
index 075a5ba2e0ab..bd0bf2ec4a04 100644
--- a/test/std/containers/associative/map/map.ops/count1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().count(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/count2.fail.cpp b/test/std/containers/associative/map/map.ops/count2.fail.cpp
index de1899021805..ff4bed8cb60c 100644
--- a/test/std/containers/associative/map/map.ops/count2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().count(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/count3.fail.cpp b/test/std/containers/associative/map/map.ops/count3.fail.cpp
index b139689fec74..55a463ed38a6 100644
--- a/test/std/containers/associative/map/map.ops/count3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/count3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().count(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
index 8beeb8b30f58..28747063a306 100644
--- a/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -297,7 +298,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
index c66c2c512142..a92ad96921c1 100644
--- a/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().equal_range(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
index 85083d4f4796..23357e26897a 100644
--- a/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().equal_range(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
index c9f1126e5baf..3ffa3f22a619 100644
--- a/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().equal_range(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/find.pass.cpp b/test/std/containers/associative/map/map.ops/find.pass.cpp
index 225f0f406042..b23d303df55a 100644
--- a/test/std/containers/associative/map/map.ops/find.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -165,7 +166,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/find1.fail.cpp b/test/std/containers/associative/map/map.ops/find1.fail.cpp
index 4fe61117613c..5346821b42af 100644
--- a/test/std/containers/associative/map/map.ops/find1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/find2.fail.cpp b/test/std/containers/associative/map/map.ops/find2.fail.cpp
index 3532dc8765b3..1dfb7fa44b06 100644
--- a/test/std/containers/associative/map/map.ops/find2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/find3.fail.cpp b/test/std/containers/associative/map/map.ops/find3.fail.cpp
index be77330a29c8..f5e92b8264b7 100644
--- a/test/std/containers/associative/map/map.ops/find3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/find3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
index e4359fa548b9..9c63dc7ab3ac 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -229,7 +230,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less <>> M;
diff --git a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
index 97bbf553205f..6a3ed96a4fc5 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
index eeae8e657387..87fffe7afcce 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
index ba27ae3c5172..fbccd3ab221b 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
index 8c721947a2c3..7276b74b1931 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -228,7 +229,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::map<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
index 6568e04bfad4..cb23588e2b97 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
index bbb857e6f25a..1fa4cbc70012 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
index ed9a41e4f03f..0f3cea238295 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
index 103a57b17e07..7e36797d092b 100644
--- a/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
@@ -121,17 +121,17 @@ int main()
V(11, 11),
V(12, 12)
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1); // not swapped
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
diff --git a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
index cbbf4577ce62..84907945a90e 100644
--- a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <map>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -96,51 +97,42 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for comp
typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
diff --git a/test/std/containers/associative/multimap/iterator.pass.cpp b/test/std/containers/associative/multimap/iterator.pass.cpp
index ef7c5ef18af1..d79dae9e77dc 100644
--- a/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -28,7 +28,9 @@
#include <map>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -63,8 +65,8 @@ int main()
V(8, 2)
};
std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multimap<int, double>::iterator i;
i = m.begin();
std::multimap<int, double>::const_iterator k = i;
@@ -108,10 +110,10 @@ int main()
V(8, 2)
};
const std::multimap<int, double> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multimap<int, double>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
@@ -152,8 +154,8 @@ int main()
V(8, 2)
};
std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multimap<int, double, std::less<int>, min_allocator<V>>::iterator i;
i = m.begin();
std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator k = i;
@@ -197,10 +199,10 @@ int main()
V(8, 2)
};
const std::multimap<int, double, std::less<int>, min_allocator<V>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multimap<int, double, std::less<int>, min_allocator<V>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
@@ -211,7 +213,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::multimap<int, double> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/associative/multimap/max_size.pass.cpp b/test/std/containers/associative/multimap/max_size.pass.cpp
index b7cf226d8f13..8d5ec1148a22 100644
--- a/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -13,23 +13,39 @@
// size_type max_size() const;
-#include <map>
#include <cassert>
+#include <limits>
+#include <map>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
- {
- typedef std::multimap<int, double> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::pair<const int, int> KV;
+ {
+ typedef limited_allocator<KV, 10> A;
+ typedef std::multimap<int, int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<KV, (size_t)-1> A;
+ typedef std::multimap<int, int, std::less<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::multimap<char, int> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
index e6f6c3efee5b..3d33f721a56d 100644
--- a/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <map>
-// Check that std::multimap fails to instantiate if the comparison predicate is
+// Check that std::multimap fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <map>
diff --git a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
index 97dcf39e10c9..b7f5c66ad93d 100644
--- a/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -47,7 +48,7 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
@@ -73,8 +74,6 @@ int main()
assert(mo.get_allocator() == A(7));
assert(mo.key_comp() == C(5));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index 3a240cd48af3..669d23db57cd 100644
--- a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -44,6 +45,6 @@ int main()
}
{
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index 46c56aa0b3ff..de6d97dbc728 100644
--- a/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -76,7 +77,7 @@ int main()
assert(*next(m.begin(), 7) == V(3, 1.5));
assert(*next(m.begin(), 8) == V(3, 2));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
V ar[] =
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
index 890cac867f9e..7637885c81e1 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -46,7 +47,7 @@ int main()
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index 8932b4f83d48..e42251527eb3 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -36,15 +37,15 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
index 92f90f551d44..7fb2a90a5f9f 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -16,6 +16,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -92,7 +93,7 @@ int main()
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::multimap<int, double, std::less<>> M;
typedef M::size_type R;
diff --git a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
index d0f3f1c0fdb7..70464b12c741 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -34,4 +35,4 @@ int main()
M().count(C2Int{5});
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
index 86d492f7f5e0..ad15ff441d74 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -34,4 +35,4 @@ int main()
M().count(C2Int{5});
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
index 55095efb3d6a..5e6c9ab6f967 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -34,4 +35,4 @@ int main()
M().count(C2Int{5});
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index 31eac26816ac..df46d376e028 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -180,7 +181,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::multimap<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
index f793bf8859ba..a339467f7390 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -34,4 +35,4 @@ int main()
M().equal_range(C2Int{5});
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
index d099a8c81a1b..633e0615bef0 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().equal_range(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
index e53fff942793..34b1b4b77fbe 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().equal_range(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
index 2fd8c05b5f5e..f5295e52d192 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -144,7 +145,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::multimap<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
index 2759af46be14..bc3593292be2 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
index c67f3b39dabd..254f524afd5b 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
index e53fc4d55887..2805f47598f6 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
@@ -36,4 +37,4 @@ int main()
M().find(C2Int{5});
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index 5c0315f956a8..8a650fa55975 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -152,7 +153,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::multimap<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
index 9b39573a5f42..4b0db47872af 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
index 68710bd1bc38..300364cffa25 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
index f254ef4785a1..09963096fdfa 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 012354cef7bb..05760dc0e751 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
@@ -152,7 +153,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<const int, double> V;
typedef std::multimap<int, double, std::less<>> M;
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
index d47d7bfc89f4..10e59c5e580e 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
index a3da9d82c95c..81ebbb832c06 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
index 6ffdb206cc30..fe41315247ea 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
@@ -22,9 +22,10 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "is_transparent.h"
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
diff --git a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index a075919bba9a..cef658bab549 100644
--- a/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -121,17 +121,17 @@ int main()
V(11, 11),
V(12, 12)
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
diff --git a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index ffc71b0eeb92..ecc9c7ef5fd4 100644
--- a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <map>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -96,51 +97,42 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for comp
typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/associative/multiset/count.pass.cpp b/test/std/containers/associative/multiset/count.pass.cpp
index 997a949388cf..863da792a2f0 100644
--- a/test/std/containers/associative/multiset/count.pass.cpp
+++ b/test/std/containers/associative/multiset/count.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -91,7 +92,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::multiset<int, std::less<>> M;
diff --git a/test/std/containers/associative/multiset/equal_range.pass.cpp b/test/std/containers/associative/multiset/equal_range.pass.cpp
index 7ab95cfb8f67..1a3beebcf66b 100644
--- a/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -180,7 +181,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::multiset<V, std::less<>> M;
diff --git a/test/std/containers/associative/multiset/find.pass.cpp b/test/std/containers/associative/multiset/find.pass.cpp
index 3b7d96fe9110..e20f4f8cedf9 100644
--- a/test/std/containers/associative/multiset/find.pass.cpp
+++ b/test/std/containers/associative/multiset/find.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -164,7 +165,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::multiset<V, std::less<>> M;
diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
index 7b82cea5fbea..590c66801f99 100644
--- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -15,6 +15,7 @@
#include <set>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8);
- assert(distance(m.begin(), m.end()) == m.size());
+ assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin();
assert(*i == V(1));
assert(*++i == V(2));
@@ -46,7 +47,7 @@ int main()
C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8);
- assert(distance(m.begin(), m.end()) == m.size());
+ assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin();
assert(*i == V(1));
assert(*++i == V(2));
diff --git a/test/std/containers/associative/multiset/iterator.pass.cpp b/test/std/containers/associative/multiset/iterator.pass.cpp
index c152a4398196..ec17689f29b4 100644
--- a/test/std/containers/associative/multiset/iterator.pass.cpp
+++ b/test/std/containers/associative/multiset/iterator.pass.cpp
@@ -28,7 +28,9 @@
#include <set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -63,8 +65,8 @@ int main()
8
};
std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multiset<int>::iterator i;
i = m.begin();
std::multiset<int>::const_iterator k = i;
@@ -103,10 +105,10 @@ int main()
8
};
const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multiset<int>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
@@ -144,8 +146,8 @@ int main()
8
};
std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::multiset<int, std::less<int>, min_allocator<int>>::iterator i;
i = m.begin();
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
@@ -184,10 +186,10 @@ int main()
8
};
const std::multiset<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::multiset<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
for (int j = 1; j <= 8; ++j)
@@ -195,7 +197,7 @@ int main()
assert(*i == j);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::multiset<int> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/associative/multiset/lower_bound.pass.cpp b/test/std/containers/associative/multiset/lower_bound.pass.cpp
index ae8cfe6eff4d..f5ce8e533f17 100644
--- a/test/std/containers/associative/multiset/lower_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/lower_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -152,7 +153,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::multiset<V, std::less<>> M;
diff --git a/test/std/containers/associative/multiset/max_size.pass.cpp b/test/std/containers/associative/multiset/max_size.pass.cpp
index 79492c9b1c40..8ca34ba82739 100644
--- a/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -13,23 +13,38 @@
// size_type max_size() const;
-#include <set>
#include <cassert>
+#include <limits>
+#include <set>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
{
- typedef std::multiset<int> M;
- M m;
- assert(m.max_size() != 0);
+ typedef limited_allocator<int, 10> A;
+ typedef std::multiset<int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::multiset<int, std::less<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::multiset<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
index 2eade5299d6f..9287a035becb 100644
--- a/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <set>
-// Check that std::multiset fails to instantiate if the comparison predicate is
+// Check that std::multiset fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <set>
diff --git a/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
index dde362872109..6349dde1e81a 100644
--- a/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
@@ -67,7 +68,7 @@ int main()
assert(*next(mo.begin(), 7) == 3);
assert(*next(mo.begin(), 8) == 3);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
@@ -114,5 +115,5 @@ int main()
assert(*next(mo.begin(), 7) == 3);
assert(*next(mo.begin(), 8) == 3);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
index f4e868ebbc8f..b4b9d067704b 100644
--- a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index 7327bf62646b..b3d6066ebeb3 100644
--- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -51,7 +52,7 @@ int main()
assert(*++i == V(5));
assert(*++i == V(6));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::multiset<int, std::less<int>, min_allocator<int>> C;
typedef C::value_type V;
diff --git a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
index 4313f46a03d7..8a6cf4541e2e 100644
--- a/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -18,6 +18,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
@@ -57,7 +58,7 @@ int main()
assert(*next(m.begin(), 7) == 3);
assert(*next(m.begin(), 8) == 3);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
index 57388637e97a..bae97cf4e48a 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -45,7 +46,7 @@ int main()
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
index e3a7beedb92b..69759e03a28a 100644
--- a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -35,15 +36,15 @@ int main()
{
{
typedef std::multiset<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
index 91ec4ce93a27..faa0818cfb0e 100644
--- a/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
@@ -118,17 +118,17 @@ int main()
11,
12
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
diff --git a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
index 87639943a0b5..89fabef0a3a0 100644
--- a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <set>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -95,51 +96,42 @@ int main()
{
{
typedef std::multiset<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multiset<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::multiset<MoveOnly, some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for comp
typedef std::multiset<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for comp
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for comp
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for comp
typedef std::multiset<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/associative/multiset/upper_bound.pass.cpp b/test/std/containers/associative/multiset/upper_bound.pass.cpp
index 7bb0c3cb41f3..8bd00e2f3705 100644
--- a/test/std/containers/associative/multiset/upper_bound.pass.cpp
+++ b/test/std/containers/associative/multiset/upper_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -152,7 +153,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::multiset<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/count.pass.cpp b/test/std/containers/associative/set/count.pass.cpp
index ddc913910b5e..115b4fbc27fd 100644
--- a/test/std/containers/associative/set/count.pass.cpp
+++ b/test/std/containers/associative/set/count.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -93,7 +94,7 @@ int main()
assert(r == 0);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::set<int, std::less<>> M;
@@ -144,23 +145,25 @@ int main()
m.insert ( V::make ( 11 ));
m.insert ( V::make ( 12 ));
- R r = m.count(5);
+ const M& mc = m;
+
+ R r = mc.count(5);
assert(r == 1);
- r = m.count(6);
+ r = mc.count(6);
assert(r == 1);
- r = m.count(7);
+ r = mc.count(7);
assert(r == 1);
- r = m.count(8);
+ r = mc.count(8);
assert(r == 1);
- r = m.count(9);
+ r = mc.count(9);
assert(r == 1);
- r = m.count(10);
+ r = mc.count(10);
assert(r == 1);
- r = m.count(11);
+ r = mc.count(11);
assert(r == 1);
- r = m.count(12);
+ r = mc.count(12);
assert(r == 1);
- r = m.count(4);
+ r = mc.count(4);
assert(r == 0);
}
#endif
diff --git a/test/std/containers/associative/set/equal_range.pass.cpp b/test/std/containers/associative/set/equal_range.pass.cpp
index ed41f691a459..53fe895bdc73 100644
--- a/test/std/containers/associative/set/equal_range.pass.cpp
+++ b/test/std/containers/associative/set/equal_range.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -228,7 +229,7 @@ int main()
assert(r.second == next(m.begin(), 8));
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/find.pass.cpp b/test/std/containers/associative/set/find.pass.cpp
index 60f16fcd65d4..fa1e547404bc 100644
--- a/test/std/containers/associative/set/find.pass.cpp
+++ b/test/std/containers/associative/set/find.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -164,7 +165,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
index 60a6e754e17e..490d75905adc 100644
--- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp
+++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp
@@ -15,6 +15,7 @@
#include <set>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8);
- assert(distance(m.begin(), m.end()) == m.size());
+ assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin();
assert(*i == V(1));
assert(*++i == V(2));
@@ -45,7 +46,7 @@ int main()
C m = {10, 8};
m.insert({1, 2, 3, 4, 5, 6});
assert(m.size() == 8);
- assert(distance(m.begin(), m.end()) == m.size());
+ assert(static_cast<std::size_t>(distance(m.begin(), m.end())) == m.size());
C::const_iterator i = m.cbegin();
assert(*i == V(1));
assert(*++i == V(2));
diff --git a/test/std/containers/associative/set/iterator.pass.cpp b/test/std/containers/associative/set/iterator.pass.cpp
index c318341ce859..be0a1578d2c5 100644
--- a/test/std/containers/associative/set/iterator.pass.cpp
+++ b/test/std/containers/associative/set/iterator.pass.cpp
@@ -28,7 +28,9 @@
#include <set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -63,13 +65,13 @@ int main()
8
};
std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::set<int>::iterator i;
i = m.begin();
std::set<int>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
{
@@ -102,13 +104,13 @@ int main()
8
};
const std::set<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::set<int>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
#if TEST_STD_VER >= 11
@@ -142,13 +144,13 @@ int main()
8
};
std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
std::set<int, std::less<int>, min_allocator<int>>::iterator i;
i = m.begin();
std::set<int, std::less<int>, min_allocator<int>>::const_iterator k = i;
assert(i == k);
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
{
@@ -181,17 +183,17 @@ int main()
8
};
const std::set<int, std::less<int>, min_allocator<int>> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
- assert(std::distance(m.begin(), m.end()) == m.size());
- assert(std::distance(m.cbegin(), m.cend()) == m.size());
- assert(std::distance(m.rbegin(), m.rend()) == m.size());
- assert(std::distance(m.crbegin(), m.crend()) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.begin(), m.end())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.cbegin(), m.cend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.rbegin(), m.rend())) == m.size());
+ assert(static_cast<std::size_t>(std::distance(m.crbegin(), m.crend())) == m.size());
std::set<int, std::less<int>, min_allocator<int>>::const_iterator i;
i = m.begin();
- for (int j = 1; j <= m.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) <= m.size(); ++j, ++i)
assert(*i == j);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::set<int> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/associative/set/lower_bound.pass.cpp b/test/std/containers/associative/set/lower_bound.pass.cpp
index 55d49a097ef6..8dfe537b2f70 100644
--- a/test/std/containers/associative/set/lower_bound.pass.cpp
+++ b/test/std/containers/associative/set/lower_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -228,7 +229,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/associative/set/max_size.pass.cpp b/test/std/containers/associative/set/max_size.pass.cpp
index 9df6a4157e11..c894eb51b1ee 100644
--- a/test/std/containers/associative/set/max_size.pass.cpp
+++ b/test/std/containers/associative/set/max_size.pass.cpp
@@ -13,23 +13,38 @@
// size_type max_size() const;
-#include <set>
#include <cassert>
+#include <limits>
+#include <set>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
{
- typedef std::set<int> M;
- M m;
- assert(m.max_size() != 0);
+ typedef limited_allocator<int, 10> A;
+ typedef std::set<int, std::less<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::set<int, std::less<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef std::set<int, std::less<int>, min_allocator<int>> M;
- M m;
- assert(m.max_size() != 0);
+ typedef std::set<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
index dcf23effc443..858ee4161f03 100644
--- a/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/associative/set/set.cons/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <set>
-// Check that std::set fails to instantiate if the comparison predicate is
+// Check that std::set fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <set>
diff --git a/test/std/containers/associative/set/set.cons/copy.pass.cpp b/test/std/containers/associative/set/set.cons/copy.pass.cpp
index a0e34e48de43..7bd6342fcc6c 100644
--- a/test/std/containers/associative/set/set.cons/copy.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/copy.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
@@ -55,7 +56,7 @@ int main()
assert(*next(mo.begin()) == 2);
assert(*next(mo.begin(), 2) == 3);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef int V;
V ar[] =
@@ -90,5 +91,5 @@ int main()
assert(*next(mo.begin()) == 2);
assert(*next(mo.begin(), 2) == 3);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
}
diff --git a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
index 60d1d42c3d9c..041f599c1f76 100644
--- a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
index 821820a1e0ce..80d41b0b5df7 100644
--- a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
@@ -40,7 +41,7 @@ int main()
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef test_compare<std::less<int> > Cmp;
typedef test_allocator<int> A;
diff --git a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
index 077a749caaca..13eccbe2a1c3 100644
--- a/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -22,6 +22,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "test_allocator.h"
@@ -55,7 +56,7 @@ int main()
assert(*next(m.begin()) == 2);
assert(*next(m.begin(), 2) == 3);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
V ar[] =
diff --git a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
index 3f7d783b7630..ce44b69fe336 100644
--- a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -45,7 +46,7 @@ int main()
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
index 72c2f7530a9e..9a7538ca31bd 100644
--- a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -35,15 +36,15 @@ int main()
{
{
typedef std::set<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
diff --git a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
index 3d2d7d7d3bbc..0af481870503 100644
--- a/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
+++ b/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
@@ -118,17 +118,17 @@ int main()
11,
12
};
- M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1));
- M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(2));
+ M m1(ar1, ar1+sizeof(ar1)/sizeof(ar1[0]), C(1), A(1, 1));
+ M m2(ar2, ar2+sizeof(ar2)/sizeof(ar2[0]), C(2), A(1, 2));
M m1_save = m1;
M m2_save = m2;
swap(m1, m2);
assert(m1 == m2_save);
assert(m2 == m1_save);
assert(m1.key_comp() == C(2));
- assert(m1.get_allocator() == A(1));
+ assert(m1.get_allocator().get_id() == 1);
assert(m2.key_comp() == C(1));
- assert(m2.get_allocator() == A(2));
+ assert(m2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<V> A;
diff --git a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
index 0eb7d871b8b4..b3edd31f749b 100644
--- a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <set>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -95,51 +96,42 @@ int main()
{
{
typedef std::set<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::set<MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::set<MoveOnly, some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for comp
typedef std::set<MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for comp
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for comp
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for comp
typedef std::set<MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
diff --git a/test/std/containers/associative/set/upper_bound.pass.cpp b/test/std/containers/associative/set/upper_bound.pass.cpp
index 9d4ab2805d0d..bafb4377f714 100644
--- a/test/std/containers/associative/set/upper_bound.pass.cpp
+++ b/test/std/containers/associative/set/upper_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
@@ -228,7 +229,7 @@ int main()
}
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int V;
typedef std::set<V, std::less<>> M;
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
index f543b6379f15..f435ac3066f4 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
@@ -14,11 +14,11 @@
#include <queue>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
int main()
{
- std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q((std::less<int>()));
+ std::priority_queue<int, std::vector<int, limited_allocator<int, 10> > > q((std::less<int>()));
assert(q.size() == 0);
q.push(1);
q.push(2);
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
index 2bffe80ae11b..5125a433652c 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
@@ -14,11 +14,11 @@
#include <queue>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
int main()
{
- std::priority_queue<int, std::vector<int, stack_allocator<int, 10> > > q;
+ std::priority_queue<int, std::vector<int, limited_allocator<int, 10> > > q;
assert(q.size() == 0);
q.push(1);
q.push(2);
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
index 1aaa8a3c6593..b3cd33549d7a 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
@@ -14,12 +14,13 @@
#include <queue>
#include <cassert>
+#include <cstddef>
int main()
{
int a[] = {3, 5, 2, 0, 6, 8, 1};
int* an = a + sizeof(a)/sizeof(a[0]);
std::priority_queue<int> q(a, an);
- assert(q.size() == an - a);
+ assert(q.size() == static_cast<std::size_t>(an - a));
assert(q.top() == 8);
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
index 17a698c15dff..360f66393e89 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
@@ -15,6 +15,7 @@
#include <queue>
#include <cassert>
#include <functional>
+#include <cstddef>
int main()
{
@@ -22,6 +23,6 @@ int main()
int* an = a + sizeof(a)/sizeof(a[0]);
std::priority_queue<int, std::vector<int>, std::greater<int> >
q(a, an, std::greater<int>());
- assert(q.size() == an - a);
+ assert(q.size() == static_cast<std::size_t>(an - a));
assert(q.top() == 0);
}
diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
index bfff607590fe..845ca758769d 100644
--- a/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap_noexcept.pass.cpp
@@ -18,6 +18,7 @@
// UNSUPPORTED: c++98, c++03
#include <queue>
+#include <utility>
#include <cassert>
#include "MoveOnly.h"
@@ -26,7 +27,6 @@ int main()
{
{
typedef std::priority_queue<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
}
diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
index 16ba1747dd8a..e4fff91f07c7 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp
@@ -14,6 +14,7 @@
#include <queue>
#include <cassert>
+#include <cstddef>
#include "test_allocator.h"
@@ -49,7 +50,7 @@ int main()
test q(d, test_allocator<int>(4));
assert(q.get_allocator() == test_allocator<int>(4));
assert(q.size() == 5);
- for (int i = 0; i < d.size(); ++i)
+ for (C::size_type i = 0; i < d.size(); ++i)
{
assert(q.front() == d[i]);
q.pop();
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
index c4ab955c311b..6832a5f8b84a 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_container.pass.cpp
@@ -13,6 +13,7 @@
#include <queue>
#include <cassert>
+#include <cstddef>
template <class C>
C
@@ -29,7 +30,7 @@ int main()
std::deque<int> d = make<std::deque<int> >(5);
std::queue<int> q(d);
assert(q.size() == 5);
- for (int i = 0; i < d.size(); ++i)
+ for (std::size_t i = 0; i < d.size(); ++i)
{
assert(q.front() == d[i]);
q.pop();
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
index e6aadd39dd9b..f4b69223695e 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_default.pass.cpp
@@ -14,11 +14,11 @@
#include <queue>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
int main()
{
- std::queue<int, std::vector<int, stack_allocator<int, 10> > > q;
+ std::queue<int, std::vector<int, limited_allocator<int, 10> > > q;
assert(q.size() == 0);
q.push(1);
q.push(2);
diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
index 1c13b622c0a5..c8becb3ca98a 100644
--- a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp
@@ -19,12 +19,13 @@
#include <queue>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
{
{
typedef std::queue<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
}
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
index 1d9c08b156b7..77d822a0794d 100644
--- a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
@@ -7,9 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <queue>
-// template <class... Args> void emplace(Args&&... args);
+// template <class... Args> reference emplace(Args&&... args);
#include <queue>
#include <cassert>
@@ -18,13 +20,17 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ typedef Emplaceable T;
std::queue<Emplaceable> q;
- q.emplace(1, 2.5);
- q.emplace(2, 3.5);
- q.emplace(3, 4.5);
+ T& r1 = q.emplace(1, 2.5);
+ assert(&r1 == &q.back());
+ T& r2 = q.emplace(2, 3.5);
+ assert(&r2 == &q.back());
+ T& r3 = q.emplace(3, 4.5);
+ assert(&r3 == &q.back());
assert(q.size() == 3);
assert(q.front() == Emplaceable(1, 2.5));
assert(q.back() == Emplaceable(3, 4.5));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(&r3 == &q.back());
+ assert(&r1 == &q.front());
}
diff --git a/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
index e18f80a91198..542b4901173c 100644
--- a/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.special/swap_noexcept.pass.cpp
@@ -17,6 +17,7 @@
// UNSUPPORTED: c++98, c++03
#include <queue>
+#include <utility>
#include <cassert>
#include "MoveOnly.h"
@@ -25,7 +26,6 @@ int main()
{
{
typedef std::queue<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
}
diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
index fe8622751c95..b3cf39207203 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp
@@ -14,6 +14,7 @@
#include <stack>
#include <cassert>
+#include <cstddef>
#include "test_allocator.h"
@@ -49,7 +50,7 @@ int main()
test q(d, test_allocator<int>(4));
assert(q.get_allocator() == test_allocator<int>(4));
assert(q.size() == 5);
- for (int i = 0; i < d.size(); ++i)
+ for (C::size_type i = 0; i < d.size(); ++i)
{
assert(q.top() == d[d.size() - i - 1]);
q.pop();
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
index 9dc05013e3dd..7ae12dd709d9 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_container.pass.cpp
@@ -13,6 +13,7 @@
#include <stack>
#include <cassert>
+#include <cstddef>
template <class C>
C
@@ -29,7 +30,7 @@ int main()
std::deque<int> d = make<std::deque<int> >(5);
std::stack<int> q(d);
assert(q.size() == 5);
- for (int i = 0; i < d.size(); ++i)
+ for (std::size_t i = 0; i < d.size(); ++i)
{
assert(q.top() == d[d.size() - i - 1]);
q.pop();
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
index 523cd6811893..82e459a4bc84 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_default.pass.cpp
@@ -15,11 +15,11 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
int main()
{
- std::stack<int, std::vector<int, stack_allocator<int, 10> > > q;
+ std::stack<int, std::vector<int, limited_allocator<int, 10> > > q;
assert(q.size() == 0);
q.push(1);
q.push(2);
diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
index 7eb563c76835..c34b7e07000e 100644
--- a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp
@@ -19,12 +19,13 @@
#include <stack>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
{
{
typedef std::stack<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
}
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
index 3573c220ece9..71fe903b74a8 100644
--- a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
@@ -7,9 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <stack>
-// template <class... Args> void emplace(Args&&... args);
+// template <class... Args> reference emplace(Args&&... args);
#include <stack>
#include <cassert>
@@ -18,12 +20,14 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ typedef Emplaceable T;
std::stack<Emplaceable> q;
- q.emplace(1, 2.5);
- q.emplace(2, 3.5);
- q.emplace(3, 4.5);
+ T& r1 = q.emplace(1, 2.5);
+ assert(&r1 == &q.top());
+ T& r2 = q.emplace(2, 3.5);
+ assert(&r2 == &q.top());
+ T& r3 = q.emplace(3, 4.5);
+ assert(&r3 == &q.top());
assert(q.size() == 3);
assert(q.top() == Emplaceable(3, 4.5));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
index 976e362a0483..12150055394e 100644
--- a/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.special/swap_noexcept.pass.cpp
@@ -17,6 +17,7 @@
// UNSUPPORTED: c++98, c++03
#include <stack>
+#include <utility>
#include <cassert>
#include "MoveOnly.h"
@@ -25,7 +26,6 @@ int main()
{
{
typedef std::stack<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
}
diff --git a/test/std/containers/sequences/array/array.tuple/get.fail.cpp b/test/std/containers/sequences/array/array.tuple/get.fail.cpp
index 13323dd8e519..45e1d2b46b0f 100644
--- a/test/std/containers/sequences/array/array.tuple/get.fail.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get.fail.cpp
@@ -19,7 +19,6 @@
#include <array>
#include <cassert>
-#include "test_macros.h"
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
@@ -32,10 +31,6 @@ int main()
typedef std::array<T, 3> C;
C c = {1, 2, 3.5};
std::get<3>(c) = 5.5; // expected-note {{requested here}}
-#if TEST_STD_VER >= 11
// expected-error@array:* {{static_assert failed "Index out of bounds in std::get<> (std::array)"}}
-#else
- // expected-error@array:* {{implicit instantiation of undefined template '__static_assert_test<false>'}}
-#endif
}
}
diff --git a/test/std/containers/sequences/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp
index 9707beeb3946..29483153d4ab 100644
--- a/test/std/containers/sequences/array/at.pass.cpp
+++ b/test/std/containers/sequences/array/at.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <array>
// reference operator[] (size_type)
@@ -40,8 +39,14 @@ int main()
r2 = 7.5;
assert(c.back() == 7.5);
- try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ (void) c.at(3);
+ assert(false);
+ }
catch (const std::out_of_range &) {}
+#endif
}
{
typedef double T;
@@ -53,8 +58,14 @@ int main()
C::const_reference r2 = c.at(2);
assert(r2 == 3.5);
- try { (void) c.at(3); }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ (void) c.at(3);
+ assert(false);
+ }
catch (const std::out_of_range &) {}
+#endif
}
#if TEST_STD_VER > 11
diff --git a/test/std/containers/sequences/array/iterators.pass.cpp b/test/std/containers/sequences/array/iterators.pass.cpp
index 233e9328c4ed..1f9904e1fa71 100644
--- a/test/std/containers/sequences/array/iterators.pass.cpp
+++ b/test/std/containers/sequences/array/iterators.pass.cpp
@@ -15,6 +15,8 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -36,7 +38,7 @@ int main()
assert(i == j);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
{
typedef std::array<int, 5> C;
diff --git a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
index a6a8e7424b25..6f3458a63d19 100644
--- a/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
@@ -52,18 +52,18 @@ int main()
{
{
std::deque<int> c = make<std::deque<int> >(10);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c[i] == i);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
{
const std::deque<int> c = make<std::deque<int> >(10);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c[i] == i);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
@@ -71,18 +71,18 @@ int main()
#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c[i] == i);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
{
const std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c[i] == i);
- for (unsigned i = 0; i < 10; ++i)
+ for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
diff --git a/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
new file mode 100644
index 000000000000..11ce9d2f6899
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// size_type max_size() const;
+
+#include <cassert>
+#include <deque>
+#include <limits>
+#include <type_traits>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+
+int main() {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::deque<int, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::deque<int, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::deque<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index 53c6bd3380a2..330fd40b7229 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -15,6 +15,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -48,12 +49,12 @@ test(C& c1, int size)
typedef typename C::const_iterator CI;
typename C::size_type c1_osize = c1.size();
c1.resize(size);
- assert(c1.size() == size);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
CI i = c1.begin();
- for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j);
- for (int j = c1_osize; j < c1.size(); ++j, ++i)
+ for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
assert(*i == 0);
}
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index 12af64386bd8..3737e727c7b7 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -15,6 +15,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -48,12 +49,12 @@ test(C& c1, int size, int x)
typedef typename C::const_iterator CI;
typename C::size_type c1_osize = c1.size();
c1.resize(size, x);
- assert(c1.size() == size);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
CI i = c1.begin();
- for (int j = 0; j < std::min(c1_osize, c1.size()); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < std::min(c1_osize, c1.size()); ++j, ++i)
assert(*i == j);
- for (int j = c1_osize; j < c1.size(); ++j, ++i)
+ for (std::size_t j = c1_osize; j < c1.size(); ++j, ++i)
assert(*i == x);
}
diff --git a/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
index 6507f58e1194..f06067786cfd 100644
--- a/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -46,7 +47,7 @@ void
test(C& c1, const C& c2)
{
c1.assign(c2.begin(), c2.end());
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(c1 == c2);
}
@@ -66,7 +67,7 @@ testI(C& c1, const C& c2)
typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
c1.assign(ICI(c2.begin()), ICI(c2.end()));
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(c1 == c2);
}
diff --git a/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
index e00e0442d22e..08325b73008c 100644
--- a/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -46,8 +47,8 @@ test(C& c1, int size, int v)
{
typedef typename C::const_iterator CI;
c1.assign(size, v);
- assert(c1.size() == size);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(c1.size() == static_cast<std::size_t>(size));
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
for (CI i = c1.begin(); i != c1.end(); ++i)
assert(*i == v);
}
diff --git a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
index ec73555b9c4f..1840545680d1 100644
--- a/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/copy.pass.cpp
@@ -13,6 +13,8 @@
#include <deque>
#include <cassert>
+
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -37,15 +39,13 @@ int main()
assert(v2 == v);
assert(v2.get_allocator() == v.get_allocator());
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5));
std::deque<int, other_allocator<int> > v2 = v;
assert(v2 == v);
assert(v2.get_allocator() == other_allocator<int>(-2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
int* an = ab + sizeof(ab)/sizeof(ab[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
index 7c42d9e7786e..127b08609464 100644
--- a/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/default.pass.cpp
@@ -14,7 +14,7 @@
#include <deque>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "../../../NotConstructible.h"
#include "min_allocator.h"
@@ -33,7 +33,7 @@ test()
int main()
{
test<int, std::allocator<int> >();
- test<NotConstructible, stack_allocator<NotConstructible, 1> >();
+ test<NotConstructible, limited_allocator<NotConstructible, 1> >();
#if TEST_STD_VER >= 11
test<int, min_allocator<int> >();
test<NotConstructible, min_allocator<NotConstructible> >();
diff --git a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
index 503e1237e9eb..59955157421d 100644
--- a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
index 12a7faf686db..87445c5b2b67 100644
--- a/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp
@@ -13,8 +13,9 @@
#include <deque>
#include <cassert>
+#include <cstddef>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -27,8 +28,8 @@ test(InputIterator f, InputIterator l)
typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator;
C d(f, l);
- assert(d.size() == std::distance(f, l));
- assert(distance(d.begin(), d.end()) == d.size());
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f);
}
@@ -41,8 +42,8 @@ test(InputIterator f, InputIterator l)
typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator;
C d(f, l);
- assert(d.size() == std::distance(f, l));
- assert(distance(d.begin(), d.end()) == d.size());
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f);
}
@@ -55,7 +56,7 @@ int main()
test(forward_iterator<const int*>(ab), forward_iterator<const int*>(an));
test(bidirectional_iterator<const int*>(ab), bidirectional_iterator<const int*>(an));
test(random_access_iterator<const int*>(ab), random_access_iterator<const int*>(an));
- test<stack_allocator<int, 4096> >(ab, an);
+ test<limited_allocator<int, 4096> >(ab, an);
#if TEST_STD_VER >= 11
test<min_allocator<int> >(ab, an);
#endif
diff --git a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
index c8f7759a19d6..54227ebc12d8 100644
--- a/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
#include "test_allocator.h"
@@ -28,8 +29,8 @@ test(InputIterator f, InputIterator l, const Allocator& a)
typedef typename C::const_iterator const_iterator;
C d(f, l, a);
assert(d.get_allocator() == a);
- assert(d.size() == std::distance(f, l));
- assert(distance(d.begin(), d.end()) == d.size());
+ assert(d.size() == static_cast<std::size_t>(std::distance(f, l)));
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i, ++f)
assert(*i == *f);
}
diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
index cebf76a15a4a..9b813ce342a3 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp
@@ -21,6 +21,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,10 +44,10 @@ int main()
}
{
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
index f53e1ba6c807..e0669dc70ca9 100644
--- a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
@@ -19,6 +19,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,15 +34,15 @@ int main()
{
{
typedef std::deque<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
diff --git a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
index b3fccf6671c9..64b3d811fdc9 100644
--- a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp
@@ -13,8 +13,10 @@
#include <deque>
#include <cassert>
+#include <cstddef>
-#include "../../../stack_allocator.h"
+#include "test_macros.h"
+#include "test_allocator.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
@@ -22,21 +24,21 @@ template <class T, class Allocator>
void
test2(unsigned n)
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator;
assert(DefaultOnly::count == 0);
{
C d(n, Allocator());
- assert(DefaultOnly::count == n);
+ assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n);
- assert(distance(d.begin(), d.end()) == d.size());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
assert(DefaultOnly::count == 0);
+#else
+ ((void)n);
#endif
}
@@ -49,13 +51,13 @@ test1(unsigned n)
assert(DefaultOnly::count == 0);
{
C d(n);
- assert(DefaultOnly::count == n);
+ assert(static_cast<unsigned>(DefaultOnly::count) == n);
assert(d.size() == n);
- assert(distance(d.begin(), d.end()) == d.size());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
+#if TEST_STD_VER >= 11
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == T());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
assert(DefaultOnly::count == 0);
}
@@ -64,7 +66,7 @@ template <class T, class Allocator>
void
test3(unsigned n, Allocator const &alloc = Allocator())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::deque<T, Allocator> C;
typedef typename C::const_iterator const_iterator;
{
@@ -72,6 +74,9 @@ test3(unsigned n, Allocator const &alloc = Allocator())
assert(d.size() == n);
assert(d.get_allocator() == alloc);
}
+#else
+ ((void)n);
+ ((void)alloc);
#endif
}
@@ -98,13 +103,13 @@ int main()
test<DefaultOnly, std::allocator<DefaultOnly> >(4096);
test<DefaultOnly, std::allocator<DefaultOnly> >(4097);
- test1<DefaultOnly, stack_allocator<DefaultOnly, 4096> >(4095);
+ LIBCPP_ONLY(test1<DefaultOnly, limited_allocator<DefaultOnly, 4096> >(4095));
#if TEST_STD_VER >= 11
test<DefaultOnly, min_allocator<DefaultOnly> >(4095);
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
test3<DefaultOnly, std::allocator<DefaultOnly>> (1023);
test3<int, std::allocator<int>>(1);
test3<int, min_allocator<int>> (3);
diff --git a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
index aeda168d19d4..2c8eee7cbe5f 100644
--- a/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
@@ -13,8 +13,9 @@
#include <deque>
#include <cassert>
+#include <cstddef>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
template <class T, class Allocator>
@@ -25,7 +26,7 @@ test(unsigned n, const T& x)
typedef typename C::const_iterator const_iterator;
C d(n, x);
assert(d.size() == n);
- assert(distance(d.begin(), d.end()) == d.size());
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == x);
}
@@ -44,7 +45,7 @@ int main()
test<int, std::allocator<int> >(4095, 78);
test<int, std::allocator<int> >(4096, 1165);
test<int, std::allocator<int> >(4097, 157);
- test<int, stack_allocator<int, 4096> >(4095, 90);
+ LIBCPP_ONLY(test<int, limited_allocator<int, 4096> >(4095, 90));
#if TEST_STD_VER >= 11
test<int, min_allocator<int> >(4095, 90);
#endif
diff --git a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
index ed8a7e13baa5..6706411c2537 100644
--- a/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/size_value_alloc.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -25,7 +26,7 @@ test(unsigned n, const T& x, const Allocator& a)
C d(n, x, a);
assert(d.get_allocator() == a);
assert(d.size() == n);
- assert(distance(d.begin(), d.end()) == d.size());
+ assert(static_cast<std::size_t>(distance(d.begin(), d.end())) == d.size());
for (const_iterator i = d.begin(), e = d.end(); i != e; ++i)
assert(*i == x);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
index 713f2159e598..33a0b6df364d 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "../../../Emplaceable.h"
#include "min_allocator.h"
@@ -51,7 +52,7 @@ test(int P, C& c1)
CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
assert(*i == Emplaceable(1, 2.5));
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
index 784b3a38553a..e3a35362b186 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_back.pass.cpp
@@ -7,19 +7,21 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <deque>
-// template <class... Args> void emplace_back(Args&&... args);
+// template <class... Args> reference emplace_back(Args&&... args);
#include <deque>
+#include <cstddef>
#include <cassert>
+#include "test_macros.h"
#include "../../../Emplaceable.h"
#include "min_allocator.h"
#include "test_allocator.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class C>
C
make(int size, int start = 0 )
@@ -47,12 +49,15 @@ void
test(C& c1)
{
typedef typename C::iterator I;
+ typedef typename C::reference Ref;
std::size_t c1_osize = c1.size();
- c1.emplace_back(Emplaceable(1, 2.5));
+ Ref ref = c1.emplace_back(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(distance(c1.begin(), c1.end())
+ == static_cast<std::ptrdiff_t>(c1.size()));
I i = c1.end();
assert(*--i == Emplaceable(1, 2.5));
+ assert(&(*i) == &ref);
}
template <class C>
@@ -63,11 +68,8 @@ testN(int start, int N)
test(c1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -75,7 +77,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
-#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -94,6 +95,4 @@ int main()
c.emplace_front(1, 2, 3);
assert(c.size() == 4);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
index afc0e4972e38..26c700de7253 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace_front.pass.cpp
@@ -7,18 +7,20 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <deque>
-// template <class... Args> void emplace_front(Args&&... args);
+// template <class... Args> reference emplace_front(Args&&... args);
#include <deque>
+#include <cstddef>
#include <cassert>
+#include "test_macros.h"
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class C>
C
make(int size, int start = 0 )
@@ -46,12 +48,15 @@ void
test(C& c1)
{
typedef typename C::iterator I;
+ typedef typename C::reference Ref;
std::size_t c1_osize = c1.size();
- c1.emplace_front(Emplaceable(1, 2.5));
+ Ref res_ref = c1.emplace_front(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(distance(c1.begin(), c1.end())
+ == static_cast<std::ptrdiff_t>(c1.size()));
I i = c1.begin();
assert(*i == Emplaceable(1, 2.5));
+ assert(&res_ref == &(*i));
}
template <class C>
@@ -62,11 +67,9 @@ testN(int start, int N)
test(c1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -74,7 +77,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
-#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -82,6 +84,4 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index 116ed9aa4b5a..def032c2705a 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -15,6 +15,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -45,17 +46,17 @@ void
test(int P, C& c1)
{
typedef typename C::iterator I;
- assert(P < c1.size());
+ assert(static_cast<std::size_t>(P) < c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P);
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize - 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
int j = 0;
for (; j < P; ++j, ++i)
assert(*i == j);
- for (++j; j < c1_osize; ++j, ++i)
+ for (++j; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index a53abaf85d33..338c66d81f97 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -47,17 +48,17 @@ void
test(int P, C& c1, int size)
{
typedef typename C::iterator I;
- assert(P + size <= c1.size());
+ assert(static_cast<std::size_t>(P + size) <= c1.size());
std::size_t c1_osize = c1.size();
I i = c1.erase(c1.cbegin() + P, c1.cbegin() + (P + size));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize - size);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
int j = 0;
for (; j < P; ++j, ++i)
assert(*i == j);
- for (j += size; j < c1_osize; ++j, ++i)
+ for (j += size; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
index fbe3cb69ccdd..f843ff3a5da4 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
@@ -16,11 +16,12 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
#include "MoveOnly.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
template <class C>
@@ -57,13 +58,13 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
{
@@ -74,13 +75,13 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
{
@@ -91,13 +92,13 @@ test(int P, const C& c0, const C& c2)
CI i = c1.insert(c1.begin() + P, BCI(c2.begin()), BCI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
}
@@ -172,13 +173,13 @@ testI(int P, C& c1, const C& c2)
CI i = c1.insert(c1.begin() + P, ICI(c2.begin()), ICI(c2.end()));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + c2.size());
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
- for (int j = 0; j < c2.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c2.size(); ++j, ++i)
assert(*i == j);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
@@ -270,7 +271,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
#if TEST_STD_VER >= 11
- test_move<std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > >();
+ test_move<std::deque<MoveOnly, limited_allocator<MoveOnly, 2000> > >();
#endif
}
#if TEST_STD_VER >= 11
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
index 3c7b0fef28b4..4ce8bbdd57d3 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
#include "min_allocator.h"
@@ -51,13 +52,13 @@ test(int P, C& c1, int x)
CI i = c1.insert(c1.begin() + P, MoveOnly(x));
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == MoveOnly(j));
assert(*i == MoveOnly(x));
++i;
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == MoveOnly(j));
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
index 0efe3b44c604..779b9464e07a 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -50,13 +51,13 @@ test(int P, C& c1, int size, int x)
CI i = c1.insert(c1.begin() + P, size, x);
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + size);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
for (int j = 0; j < size; ++j, ++i)
assert(*i == x);
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
@@ -120,7 +121,7 @@ self_reference_test()
CI jt = c.cbegin() + j;
c.insert(it, 5, *jt);
assert(c.size() == 25);
- assert(distance(c.begin(), c.end()) == c.size());
+ assert(static_cast<std::size_t>(distance(c.begin(), c.end())) == c.size());
it = c.cbegin();
for (int k = 0; k < i; ++k, ++it)
assert(*it == k);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
index 04c4ca4f7b26..e0c2d0129ef0 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -48,13 +49,13 @@ test(int P, C& c1, int x)
CI i = c1.insert(c1.begin() + P, x);
assert(i == c1.begin() + P);
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
i = c1.begin();
for (int j = 0; j < P; ++j, ++i)
assert(*i == j);
assert(*i == x);
++i;
- for (int j = P; j < c1_osize; ++j, ++i)
+ for (int j = P; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
@@ -102,7 +103,7 @@ self_reference_test()
CI jt = c.cbegin() + j;
c.insert(it, *jt);
assert(c.size() == 21);
- assert(distance(c.begin(), c.end()) == c.size());
+ assert(static_cast<std::size_t>(distance(c.begin(), c.end())) == c.size());
it = c.cbegin();
for (int k = 0; k < i; ++k, ++it)
assert(*it == k);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
index aeb62c9d996a..2336b81d4fcd 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_back.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -46,9 +47,9 @@ test(C& c1)
std::size_t c1_osize = c1.size();
c1.pop_back();
assert(c1.size() == c1_osize - 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin();
- for (int j = 0; j < c1.size(); ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
index c7a3a625eab6..3de5586ab920 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/pop_front.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -46,9 +47,9 @@ test(C& c1)
std::size_t c1_osize = c1.size();
c1.pop_front();
assert(c1.size() == c1_osize - 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin();
- for (int j = 1; j < c1.size(); ++j, ++i)
+ for (int j = 1; static_cast<std::size_t>(j) < c1.size(); ++j, ++i)
assert(*i == j);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
index 1fe1da102f37..db22086fd4c9 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <deque>
// void push_back(const value_type& x);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
index ee4f3d7f9ed7..ef9839721a2e 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -46,11 +47,11 @@ test(C& c1, int x)
std::size_t c1_osize = c1.size();
c1.push_front(x);
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin();
assert(*i == x);
++i;
- for (int j = 0; j < c1_osize; ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == j);
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
index 7464870f07e1..7a90c8a75962 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <deque>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
index ab15ca3326bf..8e734a639344 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp
@@ -13,6 +13,7 @@
#include <deque>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
#include "min_allocator.h"
@@ -49,11 +50,11 @@ test(C& c1, int x)
std::size_t c1_osize = c1.size();
c1.push_front(MoveOnly(x));
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(static_cast<std::size_t>(distance(c1.begin(), c1.end())) == c1.size());
I i = c1.begin();
assert(*i == MoveOnly(x));
++i;
- for (int j = 0; j < c1_osize; ++j, ++i)
+ for (int j = 0; static_cast<std::size_t>(j) < c1_osize; ++j, ++i)
assert(*i == MoveOnly(j));
}
diff --git a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
index ab21f434937e..05bbf878ae0d 100644
--- a/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/swap.pass.cpp
@@ -65,13 +65,13 @@ int main()
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
- std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::deque<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
+ std::deque<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
swap(c1, c2);
assert((c1 == std::deque<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert((c2 == std::deque<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
int a1[] = {1, 3, 7, 9, 10};
diff --git a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
index 2f999e9a7a5d..c0af762fb277 100644
--- a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp
@@ -21,6 +21,7 @@
// This tests a conforming extension
#include <deque>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,35 +57,30 @@ int main()
{
{
typedef std::deque<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::deque<MoveOnly, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::deque<MoveOnly, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::deque<MoveOnly, some_alloc<MoveOnly>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::deque<MoveOnly, some_alloc2<MoveOnly>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
diff --git a/test/std/containers/sequences/deque/iterators.pass.cpp b/test/std/containers/sequences/deque/iterators.pass.cpp
index 19d7996f824f..5c7ae01e60e9 100644
--- a/test/std/containers/sequences/deque/iterators.pass.cpp
+++ b/test/std/containers/sequences/deque/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -44,7 +45,7 @@ int main()
assert(i == j);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
std::deque<int>::iterator ii1{}, ii2{};
std::deque<int>::iterator ii4 = ii1;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
index 5240afa82b80..65ab7abe23ba 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -27,14 +28,14 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A(10));
C c = c0;
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
assert(c == c0);
assert(c.get_allocator() == A(10));
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef other_allocator<int> A;
@@ -42,15 +43,13 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A(10));
C c = c0;
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
assert(c == c0);
assert(c.get_allocator() == A(-2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef int T;
typedef min_allocator<int> A;
@@ -58,7 +57,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A());
C c = c0;
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
index e4b73bb54e9b..744bba419f37 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/copy_alloc.pass.cpp
@@ -27,7 +27,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A(10));
C c(c0, A(9));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -41,7 +41,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A(10));
C c(c0, A(9));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -56,7 +56,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c0(std::begin(t), std::end(t), A());
C c(c0, A());
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
index 85d929b4e32e..f70119e3c2af 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
index c783f60ff4c9..ac73d142a67e 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp
@@ -23,7 +23,7 @@ int main()
typedef int T;
typedef std::forward_list<T> C;
C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == 10);
@@ -33,7 +33,7 @@ int main()
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
C c = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == 10);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
index ba9984f969b5..844be20015dd 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp
@@ -25,7 +25,7 @@ int main()
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A(14));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == 10);
@@ -37,7 +37,7 @@ int main()
typedef min_allocator<T> A;
typedef std::forward_list<T, A> C;
C c({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A());
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == 10);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
index a3e204ec28da..a5948b9ef799 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
@@ -30,7 +30,7 @@ int main()
typedef std::move_iterator<T*> I;
C c0(I(std::begin(t)), I(std::end(t)), A(10));
C c = std::move(c0);
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -45,7 +45,7 @@ int main()
typedef std::move_iterator<T*> I;
C c0(I(std::begin(t)), I(std::end(t)), A(10));
C c = std::move(c0);
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -61,7 +61,7 @@ int main()
typedef std::move_iterator<T*> I;
C c0(I(std::begin(t)), I(std::end(t)), A());
C c = std::move(c0);
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
index b9a6ef7ab8a8..5f278e31c0de 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp
@@ -21,6 +21,7 @@
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,10 +44,10 @@ int main()
}
{
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
index 0359133afc9b..089f6d6807cb 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp
@@ -19,6 +19,7 @@
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,15 +34,15 @@ int main()
{
{
typedef std::forward_list<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
index 3c0f2b8403ca..5a7137463caf 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/range.pass.cpp
@@ -27,7 +27,7 @@ int main()
typedef input_iterator<const T*> I;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(I(std::begin(t)), I(std::end(t)));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -39,7 +39,7 @@ int main()
typedef input_iterator<const T*> I;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(I(std::begin(t)), I(std::end(t)));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
index 96a29d24e89c..03d1c4530c53 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/range_alloc.pass.cpp
@@ -30,7 +30,7 @@ int main()
typedef input_iterator<const T*> I;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(I(std::begin(t)), I(std::end(t)), A(13));
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
@@ -44,7 +44,7 @@ int main()
typedef input_iterator<const T*> I;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(I(std::begin(t)), I(std::end(t)), A());
- unsigned n = 0;
+ int n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
assert(*i == n);
assert(n == std::end(t) - std::begin(t));
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
index 736d59936aa3..b536ccf4910e 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp
@@ -14,18 +14,23 @@
#include <forward_list>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "DefaultOnly.h"
#include "min_allocator.h"
template <class T, class Allocator>
void check_allocator(unsigned n, Allocator const &alloc = Allocator())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::forward_list<T, Allocator> C;
C d(n, alloc);
assert(d.get_allocator() == alloc);
- assert(std::distance(d.begin(), d.end()) == n);
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
+#else
+ ((void)n);
+ ((void)alloc);
#endif
}
@@ -37,12 +42,14 @@ int main()
unsigned N = 10;
C c(N);
unsigned n = 0;
- for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) {
+#if TEST_STD_VER >= 11
assert(*i == T());
#else
- ;
+ ((void)0);
#endif
+ }
assert(n == N);
}
#if TEST_STD_VER >= 11
@@ -53,11 +60,7 @@ int main()
C c(N);
unsigned n = 0;
for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
assert(*i == T());
-#else
- ;
-#endif
assert(n == N);
check_allocator<T, min_allocator<T>> ( 0 );
check_allocator<T, min_allocator<T>> ( 3 );
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
index 925cca4d5e8d..d9daf87fb1a6 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.iter/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -120,7 +121,7 @@ int main()
C::const_iterator j;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
std::forward_list<int>::iterator ii1{}, ii2{};
std::forward_list<int>::iterator ii4 = ii1;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
index 18ed69d33f0b..589e71894b8c 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_front.pass.cpp
@@ -7,9 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <forward_list>
-// template <class... Args> void emplace_front(Args&&... args);
+// template <class... Args> reference emplace_front(Args&&... args);
#include <forward_list>
#include <cassert>
@@ -19,32 +21,32 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef Emplaceable T;
typedef std::forward_list<T> C;
C c;
- c.emplace_front();
+ T& r1 = c.emplace_front();
assert(c.front() == Emplaceable());
+ assert(&r1 == &c.front());
assert(distance(c.begin(), c.end()) == 1);
- c.emplace_front(1, 2.5);
+ T& r2 = c.emplace_front(1, 2.5);
assert(c.front() == Emplaceable(1, 2.5));
+ assert(&r2 == &c.front());
assert(*next(c.begin()) == Emplaceable());
assert(distance(c.begin(), c.end()) == 2);
}
-#if TEST_STD_VER >= 11
{
typedef Emplaceable T;
typedef std::forward_list<T, min_allocator<T>> C;
C c;
- c.emplace_front();
+ T& r1 = c.emplace_front();
assert(c.front() == Emplaceable());
+ assert(&r1 == &c.front());
assert(distance(c.begin(), c.end()) == 1);
- c.emplace_front(1, 2.5);
+ T& r2 = c.emplace_front(1, 2.5);
assert(c.front() == Emplaceable(1, 2.5));
+ assert(&r2 == &c.front());
assert(*next(c.begin()) == Emplaceable());
assert(distance(c.begin(), c.end()) == 2);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
index b501347e7893..bff550a0e07c 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <forward_list>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
index ef6f6a0f1887..4c41f53fa94c 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp
@@ -14,6 +14,7 @@
#include <forward_list>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
#include "counting_predicates.hpp"
@@ -37,7 +38,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -49,7 +50,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -62,7 +63,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -86,7 +87,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
#if TEST_STD_VER >= 11
{
@@ -100,7 +101,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -112,7 +113,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -125,7 +126,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
{
typedef int T;
@@ -149,7 +150,7 @@ int main()
Predicate cp(g);
c1.remove_if(std::ref(cp));
assert(c1 == c2);
- assert(cp.count() == std::distance(std::begin(t1), std::end(t1)));
+ assert(cp.count() == static_cast<std::size_t>(std::distance(std::begin(t1), std::end(t1))));
}
#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
index c8d4e2d34f1e..eec9e42636a2 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
@@ -14,14 +14,15 @@
#include <forward_list>
#include <cassert>
#include <iterator>
+#include <cstddef>
#include "min_allocator.h"
typedef int T;
const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
const T t2[] = {10, 11, 12, 13, 14, 15};
-const int size_t1 = std::end(t1) - std::begin(t1);
-const int size_t2 = std::end(t2) - std::begin(t2);
+const std::ptrdiff_t size_t1 = std::end(t1) - std::begin(t1);
+const std::ptrdiff_t size_t2 = std::end(t2) - std::begin(t2);
template <class C>
void
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
index 349a3872d754..cc86c9625671 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
@@ -14,6 +14,7 @@
#include <forward_list>
#include <cassert>
#include <iterator>
+#include <cstddef>
#include "test_macros.h"
#include "min_allocator.h"
@@ -21,8 +22,8 @@
typedef int T;
const T t1[] = {0, 1, 2, 3, 4, 5, 6, 7};
const T t2[] = {10, 11, 12};
-const int size_t1 = std::end(t1) - std::begin(t1);
-const int size_t2 = std::end(t2) - std::begin(t2);
+const std::ptrdiff_t size_t1 = std::end(t1) - std::begin(t1);
+const std::ptrdiff_t size_t2 = std::end(t2) - std::begin(t2);
template <class C>
void
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
index e7a8d048f6f6..242a00bd8608 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/member_swap.pass.cpp
@@ -24,16 +24,16 @@ int main()
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -42,19 +42,19 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -63,39 +63,39 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
+ C c1(A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
+ C c1(A(1, 1));
+ C c2(A(1, 2));
c1.swap(c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
index 983d8140571b..44820d9d304e 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/non_member_swap.pass.cpp
@@ -25,16 +25,16 @@ int main()
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -43,19 +43,19 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
const T t1[] = {0, 1, 2, 3, 4, 5};
- C c1(std::begin(t1), std::end(t1), A(1));
- C c2(A(2));
+ C c1(std::begin(t1), std::end(t1), A(1, 1));
+ C c2(A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 6);
assert(*next(c2.begin(), 0) == 0);
@@ -64,39 +64,39 @@ int main()
assert(*next(c2.begin(), 3) == 3);
assert(*next(c2.begin(), 4) == 4);
assert(*next(c2.begin(), 5) == 5);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
+ C c1(A(1, 1));
const T t2[] = {10, 11, 12};
- C c2(std::begin(t2), std::end(t2), A(2));
+ C c2(std::begin(t2), std::end(t2), A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 3);
assert(*next(c1.begin(), 0) == 10);
assert(*next(c1.begin(), 1) == 11);
assert(*next(c1.begin(), 2) == 12);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
typedef int T;
typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
- C c1(A(1));
- C c2(A(2));
+ C c1(A(1, 1));
+ C c2(A(1, 2));
swap(c1, c2);
assert(distance(c1.begin(), c1.end()) == 0);
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert(distance(c2.begin(), c2.end()) == 0);
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
{
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
index 5f8cf95aa737..c63194f7ee64 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp
@@ -21,6 +21,7 @@
// This tests a conforming extension
#include <forward_list>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,35 +57,30 @@ int main()
{
{
typedef std::forward_list<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::forward_list<MoveOnly, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::forward_list<MoveOnly, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::forward_list<MoveOnly, some_alloc<MoveOnly>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::forward_list<MoveOnly, some_alloc2<MoveOnly>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/sequences/forwardlist/max_size.pass.cpp b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
index a7f39bf90fb8..916d12a9f67c 100644
--- a/test/std/containers/sequences/forwardlist/max_size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
@@ -11,25 +11,38 @@
// size_type max_size() const;
-#include <forward_list>
#include <cassert>
+#include <forward_list>
+#include <limits>
+#include <type_traits>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
{
- typedef int T;
- typedef std::forward_list<T> C;
- C c;
- assert(c.max_size() > 0);
+ typedef limited_allocator<int, 10> A;
+ typedef std::forward_list<int, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::forward_list<int, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- typedef int T;
- typedef std::forward_list<T, min_allocator<T>> C;
- C c;
- assert(c.max_size() > 0);
+ typedef std::forward_list<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/sequences/list/iterators.pass.cpp b/test/std/containers/sequences/list/iterators.pass.cpp
index fe0ac0799687..8103b2435462 100644
--- a/test/std/containers/sequences/list/iterators.pass.cpp
+++ b/test/std/containers/sequences/list/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
struct A
@@ -135,9 +136,8 @@ int main()
assert(j->first == 3);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
- std::list<int> c;
std::list<int>::iterator ii1{}, ii2{};
std::list<int>::iterator ii4 = ii1;
std::list<int>::const_iterator cii{};
@@ -150,9 +150,6 @@ int main()
assert ( (cii == ii1 ));
assert (!(ii1 != cii ));
assert (!(cii != ii1 ));
-
- assert ( ii1 != c.cbegin());
- assert ( cii != c.begin());
}
#endif
diff --git a/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp b/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
new file mode 100644
index 000000000000..bd1b65e63d70
--- /dev/null
+++ b/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// size_type max_size() const noexcept
+
+#include <cassert>
+#include <limits>
+#include <list>
+#include <type_traits>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+
+int main() {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::list<int, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::list<int, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::list<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
+}
diff --git a/test/std/containers/sequences/list/list.cons/copy.pass.cpp b/test/std/containers/sequences/list/list.cons/copy.pass.cpp
index a6abd1f3c30b..fb583a5dd85d 100644
--- a/test/std/containers/sequences/list/list.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/copy.pass.cpp
@@ -13,6 +13,8 @@
#include <list>
#include <cassert>
+
+#include "test_macros.h"
#include "DefaultOnly.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -30,15 +32,13 @@ int main()
assert(l2 == l);
assert(l2.get_allocator() == l.get_allocator());
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5));
std::list<int, other_allocator<int> > l2 = l;
assert(l2 == l);
assert(l2.get_allocator() == other_allocator<int>(-2));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(3, 2);
std::list<int, min_allocator<int>> l2 = l;
diff --git a/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
index 4b88580e12ca..a5ff2b0c215b 100644
--- a/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/default_stack_alloc.pass.cpp
@@ -13,7 +13,7 @@
#include <list>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
int main()
@@ -29,7 +29,7 @@ int main()
assert(std::distance(l.begin(), l.end()) == 0);
}
{
- std::list<int, stack_allocator<int, 4> > l;
+ std::list<int, limited_allocator<int, 4> > l;
assert(l.size() == 0);
assert(std::distance(l.begin(), l.end()) == 0);
}
diff --git a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
index 3d11f13358b5..66e40a30d1f1 100644
--- a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
index 72add79f6670..6040c648e547 100644
--- a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp
@@ -24,7 +24,7 @@ int main()
std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
assert(d.get_allocator() == test_allocator<int>(3));
assert(d.size() == 4);
- std::list<int>::iterator i = d.begin();
+ std::list<int, test_allocator<int>>::iterator i = d.begin();
assert(*i++ == 3);
assert(*i++ == 4);
assert(*i++ == 5);
diff --git a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
index 0dd71d70f85b..3b3c2f7ef1ab 100644
--- a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
@@ -15,7 +15,7 @@
#include <list>
#include <cassert>
#include "test_iterators.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
int main()
@@ -43,7 +43,8 @@ int main()
}
{
int a[] = {0, 1, 2, 3};
- std::list<int, stack_allocator<int, sizeof(a)/sizeof(a[0])> > l(input_iterator<const int*>(a),
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, sizeof(a)/sizeof(a[0]) + 2> > l(input_iterator<const int*>(a),
input_iterator<const int*>(a + sizeof(a)/sizeof(a[0])));
assert(l.size() == sizeof(a)/sizeof(a[0]));
assert(std::distance(l.begin(), l.end()) == sizeof(a)/sizeof(a[0]));
diff --git a/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
index d4f8fde2c8ff..81f78116af2e 100644
--- a/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp
@@ -21,6 +21,7 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,10 +44,10 @@ int main()
}
{
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
index da2b6a36cef5..b40cb718a3f1 100644
--- a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp
@@ -19,6 +19,7 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -33,15 +34,15 @@ int main()
{
{
typedef std::list<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
diff --git a/test/std/containers/sequences/list/list.cons/size_type.pass.cpp b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
index 07b4f14dc3a2..95cdeb0c8539 100644
--- a/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp
@@ -13,23 +13,28 @@
#include <list>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "DefaultOnly.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
template <class T, class Allocator>
void
test3(unsigned n, Allocator const &alloc = Allocator())
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::list<T, Allocator> C;
typedef typename C::const_iterator const_iterator;
{
C d(n, alloc);
assert(d.size() == n);
- assert(std::distance(d.begin(), d.end()) == n);
+ assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);
assert(d.get_allocator() == alloc);
}
+#else
+ ((void)n);
+ ((void)alloc);
#endif
}
@@ -48,7 +53,8 @@ int main()
assert(*i == 0);
}
{
- std::list<int, stack_allocator<int, 3> > l(3);
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, 3 + 2> > l(3);
assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3);
std::list<int>::const_iterator i = l.begin();
@@ -58,7 +64,7 @@ int main()
++i;
assert(*i == 0);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::list<int, min_allocator<int> > C;
C l(3, min_allocator<int> ());
@@ -73,14 +79,12 @@ int main()
test3<int, min_allocator<int>> (3);
}
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
std::list<DefaultOnly> l(3);
assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if TEST_STD_VER >= 11
{
std::list<int, min_allocator<int>> l(3);
assert(l.size() == 3);
@@ -92,12 +96,10 @@ int main()
++i;
assert(*i == 0);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<DefaultOnly, min_allocator<DefaultOnly>> l(3);
assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
}
diff --git a/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
index ac7b18ea4990..d590626d50f9 100644
--- a/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
@@ -14,7 +14,7 @@
#include <list>
#include <cassert>
#include "DefaultOnly.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
int main()
@@ -42,7 +42,8 @@ int main()
assert(*i == 2);
}
{
- std::list<int, stack_allocator<int, 3> > l(3, 2);
+ // Add 2 for implementations that dynamically allocate a sentinel node and container proxy.
+ std::list<int, limited_allocator<int, 3 + 2> > l(3, 2);
assert(l.size() == 3);
assert(std::distance(l.begin(), l.end()) == 3);
std::list<int>::const_iterator i = l.begin();
diff --git a/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
index 2ff01f1676f2..2aae2b9b09eb 100644
--- a/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/emplace_back.pass.cpp
@@ -7,9 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
-// template <class... Args> void emplace_back(Args&&... args);
+// template <class... Args> reference emplace_back(Args&&... args);
#include <list>
#include <cassert>
@@ -33,34 +35,34 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<A> c;
- c.emplace_back(2, 3.5);
+ A& r1 = c.emplace_back(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- c.emplace_back(3, 4.5);
+ A& r2 = c.emplace_back(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#if TEST_STD_VER >= 11
{
std::list<A, min_allocator<A>> c;
- c.emplace_back(2, 3.5);
+ A& r1 = c.emplace_back(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- c.emplace_back(3, 4.5);
+ A& r2 = c.emplace_back(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp b/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
index 8a3df46a31e2..994dac258f8c 100644
--- a/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/emplace_front.pass.cpp
@@ -7,9 +7,11 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <list>
-// template <class... Args> void emplace_front(Args&&... args);
+// template <class... Args> reference emplace_front(Args&&... args);
#include <list>
#include <cassert>
@@ -33,34 +35,34 @@ public:
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::list<A> c;
- c.emplace_front(2, 3.5);
+ A& r1 = c.emplace_front(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.front());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- c.emplace_front(3, 4.5);
+ A& r2 = c.emplace_front(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.front());
assert(c.front().geti() == 3);
assert(c.front().getd() == 4.5);
assert(c.back().geti() == 2);
assert(c.back().getd() == 3.5);
}
-#if TEST_STD_VER >= 11
{
std::list<A, min_allocator<A>> c;
- c.emplace_front(2, 3.5);
+ A& r1 = c.emplace_front(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.front());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
- c.emplace_front(3, 4.5);
+ A& r2 = c.emplace_front(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.front());
assert(c.front().geti() == 3);
assert(c.front().getd() == 4.5);
assert(c.back().geti() == 2);
assert(c.back().getd() == 3.5);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
index d85c1f4b9987..9b923696592f 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <list>
// iterator insert(const_iterator position, size_type n, const value_type& x);
@@ -20,6 +19,7 @@
#include "min_allocator.h"
#include "count_new.hpp"
+#include "test_macros.h"
template <class List>
void test() {
@@ -29,6 +29,7 @@ void test() {
typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
assert(i == next(l1.begin()));
assert(l1 == List(a2, a2+8));
+#ifndef TEST_HAS_NO_EXCEPTIONS
globalMemCounter.throw_after = 4;
int save_count = globalMemCounter.outstanding_new;
try
@@ -41,6 +42,7 @@ void test() {
}
assert(globalMemCounter.checkOutstandingNewEq(save_count));
assert(l1 == List(a2, a2+8));
+#endif
}
int main()
diff --git a/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
index 8d16142defc0..a644955c8236 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <list>
// void push_back(const value_type& x);
diff --git a/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
index aafcceecd471..14379b66913f 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <list>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/list/list.ops/remove.pass.cpp b/test/std/containers/sequences/list/list.ops/remove.pass.cpp
index fed28e442e12..425070ce29d6 100644
--- a/test/std/containers/sequences/list/list.ops/remove.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/remove.pass.cpp
@@ -14,56 +14,70 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
struct S {
- S(int i) : i_(new int(i)) {}
- S(const S &rhs) : i_(new int(*rhs.i_)) {}
- S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
- ~S () { delete i_; i_ = NULL; }
- bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
- int get () const { return *i_; }
- int *i_;
- };
+ S(int i) : i_(new int(i)) {}
+ S(const S &rhs) : i_(new int(*rhs.i_)) {}
+ S &operator=(const S &rhs) {
+ *i_ = *rhs.i_;
+ return *this;
+ }
+ ~S() {
+ delete i_;
+ i_ = NULL;
+ }
+ bool operator==(const S &rhs) const { return *i_ == *rhs.i_; }
+ int get() const { return *i_; }
+ int *i_;
+};
-
-int main()
-{
- {
+int main() {
+ {
int a1[] = {1, 2, 3, 4};
int a2[] = {1, 2, 4};
- std::list<int> c(a1, a1+4);
+ std::list<int> c(a1, a1 + 4);
c.remove(3);
- assert(c == std::list<int>(a2, a2+3));
- }
- { // LWG issue #526
+ assert(c == std::list<int>(a2, a2 + 3));
+ }
+ { // LWG issue #526
int a1[] = {1, 2, 1, 3, 5, 8, 11};
- int a2[] = { 2, 3, 5, 8, 11};
- std::list<int> c(a1, a1+7);
+ int a2[] = {2, 3, 5, 8, 11};
+ std::list<int> c(a1, a1 + 7);
c.remove(c.front());
- assert(c == std::list<int>(a2, a2+5));
- }
- {
+ assert(c == std::list<int>(a2, a2 + 5));
+ }
+ {
int a1[] = {1, 2, 1, 3, 5, 8, 11, 1};
- int a2[] = { 2, 3, 5, 8, 11 };
+ int a2[] = {2, 3, 5, 8, 11};
std::list<S> c;
- for(int *ip = a1; ip < a1+8; ++ip)
- c.push_back(S(*ip));
+ for (int *ip = a1; ip < a1 + 8; ++ip)
+ c.push_back(S(*ip));
c.remove(c.front());
std::list<S>::const_iterator it = c.begin();
- for(int *ip = a2; ip < a2+5; ++ip, ++it) {
- assert ( it != c.end());
- assert ( *ip == it->get());
- }
- assert ( it == c.end ());
+ for (int *ip = a2; ip < a2 + 5; ++ip, ++it) {
+ assert(it != c.end());
+ assert(*ip == it->get());
}
+ assert(it == c.end());
+ }
+ {
+ typedef no_default_allocator<int> Alloc;
+ typedef std::list<int, Alloc> List;
+ int a1[] = {1, 2, 3, 4};
+ int a2[] = {1, 2, 4};
+ List c(a1, a1 + 4, Alloc::create());
+ c.remove(3);
+ assert(c == List(a2, a2 + 3, Alloc::create()));
+ }
#if TEST_STD_VER >= 11
- {
+ {
int a1[] = {1, 2, 3, 4};
int a2[] = {1, 2, 4};
- std::list<int, min_allocator<int>> c(a1, a1+4);
+ std::list<int, min_allocator<int>> c(a1, a1 + 4);
c.remove(3);
- assert((c == std::list<int, min_allocator<int>>(a2, a2+3)));
- }
+ assert((c == std::list<int, min_allocator<int>>(a2, a2 + 3)));
+ }
#endif
}
diff --git a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
index 820da4c78f81..512635359c5d 100644
--- a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp
@@ -21,6 +21,7 @@
// This tests a conforming extension
#include <list>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,35 +57,30 @@ int main()
{
{
typedef std::list<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::list<MoveOnly, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::list<MoveOnly, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::list<MoveOnly, some_alloc<MoveOnly>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::list<MoveOnly, some_alloc2<MoveOnly>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
index 3d11239702c9..bad80c279d4d 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -25,7 +26,7 @@ test(Iterator first, Iterator last)
{
C c(first, last);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
diff --git a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
index 196694d73998..dd4a5c757cb5 100644
--- a/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_iter_iter_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
@@ -26,7 +27,7 @@ test(Iterator first, Iterator last, const typename C::allocator_type& a)
{
C c(first, last, a);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
}
diff --git a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
index 271e4ee33aa4..1fb86a24ab57 100644
--- a/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_size.pass.cpp
@@ -31,6 +31,9 @@ test2(typename C::size_type n,
assert(c.get_allocator() == a);
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
+#else
+ ((void)n);
+ ((void)a);
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/copy.pass.cpp b/test/std/containers/sequences/vector.bool/copy.pass.cpp
index b3cf9b551f96..7e2efad51894 100644
--- a/test/std/containers/sequences/vector.bool/copy.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy.pass.cpp
@@ -23,7 +23,7 @@ template <class C>
void
test(const C& x)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
index aa8646a9b819..56ffb7d52dd7 100644
--- a/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
@@ -22,7 +22,7 @@ template <class C>
void
test(const C& x, const typename C::allocator_type& a)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x, a);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
index bd2534ad3de7..b8ff33c5d2e8 100644
--- a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -42,6 +43,6 @@ int main()
}
{
typedef std::vector<bool, some_alloc<bool>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
index 2950ee3882f1..24005bec82df 100644
--- a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp
@@ -11,42 +11,57 @@
// <vector>
// vector.bool
-// template <class... Args> void emplace_back(Args&&... args);
+// template <class... Args> reference emplace_back(Args&&... args);
#include <vector>
#include <cassert>
#include "min_allocator.h"
-
int main()
{
{
typedef std::vector<bool> C;
+ typedef C::reference Ref;
C c;
- c.emplace_back();
+ Ref r1 = c.emplace_back();
assert(c.size() == 1);
assert(c.front() == false);
- c.emplace_back(true);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
assert(c.size() == 2);
assert(c.front() == false);
assert(c.back() == true);
- c.emplace_back(1 == 1);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
+ Ref r3 = c.emplace_back(1 == 1);
assert(c.size() == 3);
assert(c.front() == false);
assert(c[1] == true);
assert(c.back() == true);
+ r3 = false;
+ assert(c.back() == false);
}
{
typedef std::vector<bool, min_allocator<bool>> C;
+ typedef C::reference Ref;
C c;
- c.emplace_back();
+ Ref r1 = c.emplace_back();
assert(c.size() == 1);
assert(c.front() == false);
- c.emplace_back(true);
+ r1 = true;
+ assert(c.front() == true);
+ r1 = false;
+ Ref r2 = c.emplace_back(true);
assert(c.size() == 2);
assert(c.front() == false);
assert(c.back() == true);
+ r2 = false;
+ assert(c.back() == false);
+ r2 = true;
c.emplace_back(1 == 1);
assert(c.size() == 3);
assert(c.front() == false);
diff --git a/test/std/containers/sequences/vector.bool/find.pass.cpp b/test/std/containers/sequences/vector.bool/find.pass.cpp
index a4b5537d2949..ffe844e0079c 100644
--- a/test/std/containers/sequences/vector.bool/find.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/find.pass.cpp
@@ -17,6 +17,7 @@
#include <vector>
#include <algorithm>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
{
std::vector<bool> b(i,true);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
- assert(j-b.begin() == i);
+ assert(static_cast<std::size_t>(j-b.begin()) == i);
assert(b.end() == j);
}
}
@@ -34,7 +35,7 @@ int main()
{
std::vector<bool> b(i,false);
std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
- assert(j-b.begin() == i);
+ assert(static_cast<std::size_t>(j-b.begin()) == i);
assert(b.end() == j);
}
}
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
index 89fe7a76d409..dc4fe44d5a39 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
@@ -15,6 +15,9 @@
#include <vector>
#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -28,10 +31,10 @@ int main()
input_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -47,7 +50,7 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
@@ -62,10 +65,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -81,10 +84,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -98,10 +101,10 @@ int main()
input_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -114,10 +117,10 @@ int main()
forward_iterator<const bool*>(a+N));
assert(v.size() == 100 + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
index 35c57cbd8e42..3ec8952ff150 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -24,7 +25,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -39,7 +40,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -55,7 +56,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == sz + 5);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -69,7 +70,7 @@ int main()
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
diff --git a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
index 78ffe7ba73cd..6a4a6d4bcb70 100644
--- a/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/insert_iter_value.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -24,7 +25,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -38,7 +39,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -53,7 +54,7 @@ int main()
std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == sz + 1);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -66,7 +67,7 @@ int main()
std::vector<bool, min_allocator<bool>>::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
diff --git a/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
index 882ac9be4a5d..10b96480a51b 100644
--- a/test/std/containers/sequences/vector.bool/iterators.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -94,7 +95,7 @@ int main()
C::const_iterator j;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
std::vector<bool>::iterator ii1{}, ii2{};
std::vector<bool>::iterator ii4 = ii1;
diff --git a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
index fe53fbfc17e0..dd4bf9e01ea9 100644
--- a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
@@ -21,6 +21,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -60,7 +61,7 @@ int main()
{
{
typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
@@ -68,12 +69,12 @@ int main()
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, "");
#else
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
#endif
@@ -81,7 +82,7 @@ int main()
#if TEST_STD_VER > 14
{ // POCMA false, is_always_equal true
typedef std::vector<bool, some_alloc2<bool>> C;
- static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable<C>::value, "");
}
{ // POCMA false, is_always_equal false
typedef std::vector<bool, some_alloc3<bool>> C;
diff --git a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
index 2153c7956bfc..3305d95e1ab8 100644
--- a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp
@@ -19,6 +19,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -32,21 +33,21 @@ int main()
{
{
typedef std::vector<bool> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
// In C++17, move constructors for allocators are not allowed to throw
#if TEST_STD_VER > 14
- static_assert( std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT( std::is_nothrow_move_constructible<C>::value, "");
#else
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
#endif
diff --git a/test/std/containers/sequences/vector.bool/push_back.pass.cpp b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
index 3897a438b445..c482f49454be 100644
--- a/test/std/containers/sequences/vector.bool/push_back.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/push_back.pass.cpp
@@ -14,6 +14,7 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -27,7 +28,7 @@ int main()
{
c.push_back(a[i]);
assert(c.size() == i+1);
- for (int j = 0; j < c.size(); ++j)
+ for (std::size_t j = 0; j < c.size(); ++j)
assert(c[j] == a[j]);
}
}
@@ -40,7 +41,7 @@ int main()
{
c.push_back(a[i]);
assert(c.size() == i+1);
- for (int j = 0; j < c.size(); ++j)
+ for (std::size_t j = 0; j < c.size(); ++j)
assert(c[j] == a[j]);
}
}
diff --git a/test/std/containers/sequences/vector.bool/swap.pass.cpp b/test/std/containers/sequences/vector.bool/swap.pass.cpp
index 81af528f2a9a..60b612ae4f90 100644
--- a/test/std/containers/sequences/vector.bool/swap.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap.pass.cpp
@@ -30,15 +30,15 @@ int main()
}
{
typedef test_allocator<bool> A;
- std::vector<bool, A> v1(100, true, A(1));
- std::vector<bool, A> v2(200, false, A(2));
+ std::vector<bool, A> v1(100, true, A(1, 1));
+ std::vector<bool, A> v2(200, false, A(1, 2));
swap(v1, v2);
assert(v1.size() == 200);
assert(v1.capacity() >= 200);
assert(v2.size() == 100);
assert(v2.capacity() >= 100);
- assert(v1.get_allocator() == A(1));
- assert(v2.get_allocator() == A(2));
+ assert(v1.get_allocator().get_id() == 1);
+ assert(v2.get_allocator().get_id() == 2);
}
{
typedef other_allocator<bool> A;
diff --git a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
index 7ba44453b371..1b68eda2757b 100644
--- a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <vector>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,35 +57,30 @@ int main()
{
{
typedef std::vector<bool> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, test_allocator<bool>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, other_allocator<bool>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<bool, some_alloc<bool>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::vector<bool, some_alloc2<bool>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/sequences/vector/contiguous.pass.cpp b/test/std/containers/sequences/vector/contiguous.pass.cpp
index 70084246eae9..9dfcf7a63e49 100644
--- a/test/std/containers/sequences/vector/contiguous.pass.cpp
+++ b/test/std/containers/sequences/vector/contiguous.pass.cpp
@@ -21,7 +21,7 @@ template <class C>
void test_contiguous ( const C &c )
{
for ( size_t i = 0; i < c.size(); ++i )
- assert ( *(c.begin() + i) == *(std::addressof(*c.begin()) + i));
+ assert ( *(c.begin() + static_cast<typename C::difference_type>(i)) == *(std::addressof(*c.begin()) + i));
}
int main()
diff --git a/test/std/containers/sequences/vector/iterators.pass.cpp b/test/std/containers/sequences/vector/iterators.pass.cpp
index 8dc14977f282..a1ce2be32718 100644
--- a/test/std/containers/sequences/vector/iterators.pass.cpp
+++ b/test/std/containers/sequences/vector/iterators.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
struct A
@@ -135,7 +136,7 @@ int main()
assert(j->first == 3);
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::vector<int> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
new file mode 100644
index 000000000000..5f7a6268d55c
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// size_type max_size() const;
+
+#include <cassert>
+#include <limits>
+#include <type_traits>
+#include <vector>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+
+
+int main() {
+ {
+ typedef limited_allocator<int, 10> A;
+ typedef std::vector<int, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::vector<int, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
+ }
+ {
+ typedef std::vector<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
+}
diff --git a/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
index d04e43db508d..abaa709d4ea2 100644
--- a/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
@@ -13,7 +13,7 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -37,7 +37,8 @@ int main()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<int, stack_allocator<int, 250> > v(100);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<int, limited_allocator<int, 250 + 1> > v(100);
assert(v.capacity() == 100);
v.reserve(50);
assert(v.size() == 100);
diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
index ce74cf9b7c23..6409acaf65c1 100644
--- a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
@@ -13,7 +13,7 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "MoveOnly.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -33,7 +33,8 @@ int main()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<MoveOnly, stack_allocator<MoveOnly, 300> > v(100);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300 + 1> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
@@ -56,7 +57,8 @@ int main()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<int, stack_allocator<int, 300> > v(100);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<int, limited_allocator<int, 300 + 1> > v(100);
v.resize(50);
assert(v.size() == 50);
assert(v.capacity() == 100);
diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
index 3e7df312731f..0bb909710bc9 100644
--- a/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
@@ -13,7 +13,7 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -35,7 +35,8 @@ int main()
assert(v[i] == 1);
}
{
- std::vector<int, stack_allocator<int, 300> > v(100);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ std::vector<int, limited_allocator<int, 300 + 1> > v(100);
v.resize(50, 1);
assert(v.size() == 50);
assert(v.capacity() == 100);
diff --git a/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
index 10ce33f43bd2..daf9b092f493 100644
--- a/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp
@@ -13,7 +13,7 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -29,7 +29,7 @@ int main()
assert(is_contiguous_container_asan_correct(v));
}
{
- std::vector<int, stack_allocator<int, 401> > v(100);
+ std::vector<int, limited_allocator<int, 401> > v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
@@ -39,7 +39,7 @@ int main()
}
#ifndef _LIBCPP_NO_EXCEPTIONS
{
- std::vector<int, stack_allocator<int, 400> > v(100);
+ std::vector<int, limited_allocator<int, 400> > v(100);
v.push_back(1);
assert(is_contiguous_container_asan_correct(v));
v.shrink_to_fit();
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
index 4e6eb00cebb8..edeae04d7bd7 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_default.pass.cpp
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "test_allocator.h"
#include "../../../NotConstructible.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -71,7 +71,7 @@ int main()
(test_allocator<NotConstructible>(5));
}
{
- std::vector<int, stack_allocator<int, 10> > v;
+ std::vector<int, limited_allocator<int, 10> > v;
assert(v.empty());
}
#if TEST_STD_VER >= 11
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
index 5542e91059d6..ec4944d1ad1c 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -13,10 +13,11 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -26,7 +27,7 @@ test(Iterator first, Iterator last)
{
C c(first, last);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
@@ -42,11 +43,12 @@ int main()
test<std::vector<int> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
test<std::vector<int> >(a, an);
- test<std::vector<int, stack_allocator<int, 63> > >(input_iterator<const int*>(a), input_iterator<const int*>(an));
- test<std::vector<int, stack_allocator<int, 18> > >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
- test<std::vector<int, stack_allocator<int, 18> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
- test<std::vector<int, stack_allocator<int, 18> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
- test<std::vector<int, stack_allocator<int, 18> > >(a, an);
+ test<std::vector<int, limited_allocator<int, 63> > >(input_iterator<const int*>(a), input_iterator<const int*>(an));
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ test<std::vector<int, limited_allocator<int, 18 + 1> > >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
+ test<std::vector<int, limited_allocator<int, 18 + 1> > >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an));
+ test<std::vector<int, limited_allocator<int, 18 + 1> > >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an));
+ test<std::vector<int, limited_allocator<int, 18 + 1> > >(a, an);
#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(input_iterator<const int*>(a), input_iterator<const int*>(an));
test<std::vector<int, min_allocator<int>> >(forward_iterator<const int*>(a), forward_iterator<const int*>(an));
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
index f40088ea3e86..b4482ddb2727 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -14,10 +14,11 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -27,7 +28,7 @@ test(Iterator first, Iterator last, const A& a)
{
C c(first, last, a);
LIBCPP_ASSERT(c.__invariants());
- assert(c.size() == std::distance(first, last));
+ assert(c.size() == static_cast<std::size_t>(std::distance(first, last)));
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first)
assert(*i == *first);
@@ -40,6 +41,9 @@ struct implicit_conv_allocator : min_allocator<T>
{
implicit_conv_allocator(void*) {}
implicit_conv_allocator(const implicit_conv_allocator&) = default;
+
+ template <class U>
+ implicit_conv_allocator(implicit_conv_allocator<U>) {}
};
#endif
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
index 46e5ecdc9a56..7416a6ac9d7b 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_size.pass.cpp
@@ -32,6 +32,9 @@ test2(typename C::size_type n, typename C::allocator_type const& a = typename C:
LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
assert(*i == typename C::value_type());
+#else
+ ((void)n);
+ ((void)a);
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
index d3774d1a6595..dcaaa2cd4a30 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
@@ -15,7 +15,7 @@
#include <cassert>
#include "test_macros.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -34,7 +34,8 @@ test(typename C::size_type n, const typename C::value_type& x)
int main()
{
test<std::vector<int> >(50, 3);
- test<std::vector<int, stack_allocator<int, 50> > >(50, 5);
+ // Add 1 for implementations that dynamically allocate a container proxy.
+ test<std::vector<int, limited_allocator<int, 50 + 1> > >(50, 5);
#if TEST_STD_VER >= 11
test<std::vector<int, min_allocator<int>> >(50, 3);
#endif
diff --git a/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp b/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
index 105217bbf15c..887444c81959 100644
--- a/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
@@ -23,7 +23,7 @@ template <class C>
void
test(const C& x)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
index 47259c747332..bf910df05c2a 100644
--- a/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
@@ -23,7 +23,7 @@ template <class C>
void
test(const C& x, const typename C::allocator_type& a)
{
- unsigned s = x.size();
+ typename C::size_type s = x.size();
C c(x, a);
LIBCPP_ASSERT(c.__invariants());
assert(c.size() == s);
diff --git a/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
index bd538120442d..10a381f9c8cc 100644
--- a/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,6 +44,6 @@ int main()
}
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/sequences/vector/vector.data/data.pass.cpp b/test/std/containers/sequences/vector/vector.data/data.pass.cpp
index f6c0575d958c..b7ea3a286f32 100644
--- a/test/std/containers/sequences/vector/vector.data/data.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.data/data.pass.cpp
@@ -21,7 +21,7 @@ struct Nasty {
Nasty() : i_(0) {}
Nasty(int i) : i_(i) {}
~Nasty() {}
-
+
Nasty * operator&() const { assert(false); return nullptr; }
int i_;
};
diff --git a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
index c97ad29708b8..3c013c1ae8af 100644
--- a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp
@@ -21,7 +21,7 @@ struct Nasty {
Nasty() : i_(0) {}
Nasty(int i) : i_(i) {}
~Nasty() {}
-
+
Nasty * operator&() const { assert(false); return nullptr; }
int i_;
};
diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
index 8bcc23979668..d08f4e3c4e23 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/emplace.pass.cpp
@@ -7,22 +7,20 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+
+#include "test_macros.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
class A
{
int i_;
@@ -55,11 +53,8 @@ public:
double getd() const {return d_;}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<A> c;
std::vector<A>::iterator i = c.emplace(c.cbegin(), 2, 3.5);
@@ -88,8 +83,8 @@ int main()
assert(is_contiguous_container_asan_correct(c));
}
{
- std::vector<A, stack_allocator<A, 7> > c;
- std::vector<A, stack_allocator<A, 7> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
+ std::vector<A, limited_allocator<A, 7> > c;
+ std::vector<A, limited_allocator<A, 7> >::iterator i = c.emplace(c.cbegin(), 2, 3.5);
assert(i == c.begin());
assert(c.size() == 1);
assert(c.front().geti() == 2);
@@ -114,15 +109,6 @@ int main()
assert(c.back().getd() == 4.5);
assert(is_contiguous_container_asan_correct(c));
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<A> c1;
- std::vector<A> c2;
- std::vector<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
- assert(false);
- }
-#endif
-#if TEST_STD_VER >= 11
{
std::vector<A, min_allocator<A>> c;
std::vector<A, min_allocator<A>>::iterator i = c.emplace(c.cbegin(), 2, 3.5);
@@ -147,14 +133,4 @@ int main()
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<A, min_allocator<A>> c1;
- std::vector<A, min_allocator<A>> c2;
- std::vector<A, min_allocator<A>>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5);
- assert(false);
- }
-#endif
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
index 61ccade76b02..2fece8c78c78 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp
@@ -7,19 +7,19 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
-// template <class... Args> void emplace_back(Args&&... args);
+// template <class... Args> reference emplace_back(Args&&... args);
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "test_allocator.h"
#include "asan_testing.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
class A
{
int i_;
@@ -52,20 +52,19 @@ public:
double getd() const {return d_;}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<A> c;
- c.emplace_back(2, 3.5);
+ A& r1 = c.emplace_back(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
+ A& r2 = c.emplace_back(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
@@ -73,30 +72,33 @@ int main()
assert(is_contiguous_container_asan_correct(c));
}
{
- std::vector<A, stack_allocator<A, 4> > c;
- c.emplace_back(2, 3.5);
+ std::vector<A, limited_allocator<A, 4> > c;
+ A& r1 = c.emplace_back(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
+ A& r2 = c.emplace_back(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
assert(c.back().getd() == 4.5);
assert(is_contiguous_container_asan_correct(c));
}
-#if TEST_STD_VER >= 11
{
std::vector<A, min_allocator<A>> c;
- c.emplace_back(2, 3.5);
+ A& r1 = c.emplace_back(2, 3.5);
assert(c.size() == 1);
+ assert(&r1 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(is_contiguous_container_asan_correct(c));
- c.emplace_back(3, 4.5);
+ A& r2 = c.emplace_back(3, 4.5);
assert(c.size() == 2);
+ assert(&r2 == &c.back());
assert(c.front().geti() == 2);
assert(c.front().getd() == 3.5);
assert(c.back().geti() == 3);
@@ -111,6 +113,4 @@ int main()
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp
deleted file mode 100644
index b2c22d6ae696..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db1.pass.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator position) with end()
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <cstdlib>
-#include <exception>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>>::const_iterator i = l1.end();
- l1.erase(i);
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp
deleted file mode 100644
index da0b6d4a059b..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_db2.pass.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator position) with iterator from another container
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <cstdlib>
-#include <exception>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int> l2(a1, a1+3);
- std::vector<int>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>> l2(a1, a1+3);
- std::vector<int, min_allocator<int>>::const_iterator i = l2.begin();
- l1.erase(i);
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp
deleted file mode 100644
index 14d3ca803ca3..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db1.pass.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator first, const_iterator last); with first iterator from another container
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int> l2(a1, a1+3);
- std::vector<int>::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>> l2(a1, a1+3);
- std::vector<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp
deleted file mode 100644
index 04c040a8f797..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db2.pass.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator first, const_iterator last); with second iterator from another container
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int> l2(a1, a1+3);
- std::vector<int>::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>> l2(a1, a1+3);
- std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp
deleted file mode 100644
index ba183a83f0b1..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db3.pass.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator first, const_iterator last); with both iterators from another container
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int> l2(a1, a1+3);
- std::vector<int>::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>> l2(a1, a1+3);
- std::vector<int, min_allocator<int>>::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp
deleted file mode 100644
index 0fb8071fc679..000000000000
--- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter_db4.pass.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// Call erase(const_iterator first, const_iterator last); with a bad range
-
-#if _LIBCPP_DEBUG >= 1
-
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <vector>
-#include <cassert>
-#include <exception>
-#include <cstdlib>
-
-#include "min_allocator.h"
-
-int main()
-{
- {
- int a1[] = {1, 2, 3};
- std::vector<int> l1(a1, a1+3);
- std::vector<int>::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 2, 3};
- std::vector<int, min_allocator<int>> l1(a1, a1+3);
- std::vector<int, min_allocator<int>>::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
- assert(false);
- }
-#endif
-}
-
-#else
-
-int main()
-{
-}
-
-#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
index b8953021187f..258b9d9f7517 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -12,13 +12,12 @@
// template <class Iter>
// iterator insert(const_iterator position, Iter first, Iter last);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include <cstddef>
+
+#include "test_macros.h"
+#include "test_allocator.h"
#include "test_iterators.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -37,7 +36,7 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
@@ -54,7 +53,7 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
@@ -69,10 +68,10 @@ int main()
forward_iterator<const int*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
@@ -87,16 +86,16 @@ int main()
forward_iterator<const int*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
}
{
- std::vector<int, stack_allocator<int, 308> > v(100);
+ std::vector<int, limited_allocator<int, 308> > v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
@@ -107,13 +106,13 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
}
{
- std::vector<int, stack_allocator<int, 300> > v(100);
+ std::vector<int, limited_allocator<int, 300> > v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
@@ -124,22 +123,11 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int> v(100);
- std::vector<int> v2(100);
- int a[] = {1, 2, 3, 4, 5};
- const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v2.cbegin() + 10, input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
- assert(false);
- }
-#endif
#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
@@ -153,7 +141,7 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
@@ -170,21 +158,10 @@ int main()
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int, min_allocator<int>> v(100);
- std::vector<int, min_allocator<int>> v2(100);
- int a[] = {1, 2, 3, 4, 5};
- const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int, min_allocator<int>>::iterator i = v.insert(v2.cbegin() + 10, input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
index e1ad6be054e5..8794d924588b 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp
@@ -7,24 +7,23 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <vector>
// iterator insert(const_iterator position, value_type&& x);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+
+#include "test_macros.h"
+#include "test_allocator.h"
#include "MoveOnly.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<MoveOnly> v(100);
std::vector<MoveOnly>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
@@ -39,8 +38,8 @@ int main()
assert(v[j] == MoveOnly());
}
{
- std::vector<MoveOnly, stack_allocator<MoveOnly, 300> > v(100);
- std::vector<MoveOnly, stack_allocator<MoveOnly, 300> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300> > v(100);
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 300> >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -51,15 +50,6 @@ int main()
for (++j; j < 101; ++j)
assert(v[j] == MoveOnly());
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int> v1(3);
- std::vector<int> v2(3);
- v1.insert(v2.begin(), 4);
- assert(false);
- }
-#endif
-#if TEST_STD_VER >= 11
{
std::vector<MoveOnly, min_allocator<MoveOnly>> v(100);
std::vector<MoveOnly, min_allocator<MoveOnly>>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3));
@@ -73,14 +63,4 @@ int main()
for (++j; j < 101; ++j)
assert(v[j] == MoveOnly());
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int, min_allocator<int>> v1(3);
- std::vector<int, min_allocator<int>> v2(3);
- v1.insert(v2.begin(), 4);
- assert(false);
- }
-#endif
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
index ed4d6c976e9c..b6fc9ac73ea1 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
@@ -11,13 +11,12 @@
// iterator insert(const_iterator position, size_type n, const value_type& x);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include <cstddef>
+
+#include "test_macros.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -45,7 +44,7 @@ int main()
assert(v.size() == sz + 5);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -61,7 +60,7 @@ int main()
assert(v.size() == sz + 5);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
for (; j < 15; ++j)
@@ -70,8 +69,8 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int, stack_allocator<int, 300> > v(100);
- std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+ std::vector<int, limited_allocator<int, 300> > v(100);
+ std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
assert(v.size() == 105);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -83,14 +82,6 @@ int main()
for (++j; j < 105; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int> c1(100);
- std::vector<int> c2;
- std::vector<int>::iterator i = c1.insert(c2.cbegin() + 10, 5, 1);
- assert(false);
- }
-#endif
#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
@@ -120,13 +111,5 @@ int main()
for (++j; j < 105; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int, min_allocator<int>> c1(100);
- std::vector<int, min_allocator<int>> c2;
- std::vector<int, min_allocator<int>>::iterator i = c1.insert(c2.cbegin() + 10, 5, 1);
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
index ba030e9e3fb7..5010f89493f0 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
@@ -11,13 +11,12 @@
// iterator insert(const_iterator position, const value_type& x);
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include <cstddef>
+
+#include "test_macros.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -44,7 +43,7 @@ int main()
assert(v.size() == sz + 1);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -60,7 +59,7 @@ int main()
assert(v.size() == sz + 1);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
- int j;
+ std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
assert(v[j] == 1);
@@ -68,8 +67,8 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int, stack_allocator<int, 300> > v(100);
- std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 1);
+ std::vector<int, limited_allocator<int, 300> > v(100);
+ std::vector<int, limited_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 1);
assert(v.size() == 101);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -80,15 +79,6 @@ int main()
for (++j; j < 101; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int> v1(3);
- std::vector<int> v2(3);
- int i = 4;
- v1.insert(v2.begin(), i);
- assert(false);
- }
-#endif
#if TEST_STD_VER >= 11
{
std::vector<int, min_allocator<int>> v(100);
@@ -103,14 +93,5 @@ int main()
for (++j; j < 101; ++j)
assert(v[j] == 0);
}
-#if _LIBCPP_DEBUG >= 1
- {
- std::vector<int, min_allocator<int>> v1(3);
- std::vector<int, min_allocator<int>> v2(3);
- int i = 4;
- v1.insert(v2.begin(), i);
- assert(false);
- }
-#endif
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
index c81e41904fc8..c44023827ea5 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/pop_back.pass.cpp
@@ -11,20 +11,13 @@
// void pop_back();
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
-#include "min_allocator.h"
-#if _LIBCPP_DEBUG >= 1
-#include <cstdlib>
-#include <exception>
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
-#endif
int main()
{
@@ -34,10 +27,7 @@ int main()
assert(c.size() == 1);
c.pop_back();
assert(c.size() == 0);
-#if _LIBCPP_DEBUG >= 1
- c.pop_back();
- assert(false);
-#endif
+
}
#if TEST_STD_VER >= 11
{
@@ -46,10 +36,6 @@ int main()
assert(c.size() == 1);
c.pop_back();
assert(c.size() == 0);
-#if _LIBCPP_DEBUG >= 1
- c.pop_back();
- assert(false);
-#endif
}
#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
index bef3b9c8d17d..3b568b7e06d0 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
@@ -13,7 +13,8 @@
#include <vector>
#include <cassert>
-#include "../../../stack_allocator.h"
+#include <cstddef>
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -24,55 +25,58 @@ int main()
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
{
- std::vector<int, stack_allocator<int, 15> > c;
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<int, limited_allocator<int, 17> > c;
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
#if TEST_STD_VER >= 11
@@ -81,27 +85,27 @@ int main()
c.push_back(0);
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(1);
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(2);
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(3);
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
c.push_back(4);
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == j);
}
#endif
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
index 5fa93aab89c7..eabe029a3a77 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <vector>
// void push_back(const value_type& x);
@@ -16,10 +15,10 @@
#include <cassert>
#include "asan_testing.h"
+#include "test_macros.h"
// Flag that makes the copy constructor for CMyClass throw an exception
-static bool gCopyConstructorShouldThow = false;
-
+static bool gCopyConstructorShouldThrow = false;
class CMyClass {
public: CMyClass(int tag);
@@ -52,8 +51,8 @@ CMyClass::CMyClass(const CMyClass& iOther) :
fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
- if (gCopyConstructorShouldThow) {
- throw std::exception();
+ if (gCopyConstructorShouldThrow) {
+ TEST_THROW(std::exception());
}
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
@@ -76,12 +75,15 @@ int main()
assert(is_contiguous_container_asan_correct(vec));
assert(is_contiguous_container_asan_correct(vec2));
- gCopyConstructorShouldThow = true;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ gCopyConstructorShouldThrow = true;
try {
vec.push_back(instance);
+ assert(false);
}
catch (...) {
assert(vec==vec2);
assert(is_contiguous_container_asan_correct(vec));
}
+#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
index 64762eb374e8..f4a1f5d5f519 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
@@ -13,8 +13,9 @@
#include <vector>
#include <cassert>
+#include <cstddef>
#include "MoveOnly.h"
-#include "../../../stack_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -26,55 +27,58 @@ int main()
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
{
- std::vector<MoveOnly, stack_allocator<MoveOnly, 15> > c;
+ // libc++ needs 15 because it grows by 2x (1 + 2 + 4 + 8).
+ // Use 17 for implementations that dynamically allocate a container proxy
+ // and grow by 1.5x (1 for proxy + 1 + 2 + 3 + 4 + 6).
+ std::vector<MoveOnly, limited_allocator<MoveOnly, 17> > c;
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
#if TEST_STD_VER >= 11
@@ -83,27 +87,27 @@ int main()
c.push_back(MoveOnly(0));
assert(c.size() == 1);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(1));
assert(c.size() == 2);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(2));
assert(c.size() == 3);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(3));
assert(c.size() == 4);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
c.push_back(MoveOnly(4));
assert(c.size() == 5);
assert(is_contiguous_container_asan_correct(c));
- for (int j = 0; j < c.size(); ++j)
+ for (int j = 0; static_cast<std::size_t>(j) < c.size(); ++j)
assert(c[j] == MoveOnly(j));
}
#endif
diff --git a/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp b/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp
deleted file mode 100644
index 1bb761181422..000000000000
--- a/test/std/containers/sequences/vector/vector.special/db_swap_1.pass.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// <vector>
-
-// template <class T, class Alloc>
-// void swap(vector<T,Alloc>& x, vector<T,Alloc>& y);
-
-#if _LIBCPP_DEBUG >= 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
-#include <vector>
-#include <cassert>
-
-#include "min_allocator.h"
-
-int main()
-{
-#if _LIBCPP_DEBUG >= 1
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::vector<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::vector<int>::iterator i1 = c1.begin();
- std::vector<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- c1.erase(i1);
- assert(false);
- }
-#if TEST_STD_VER >= 11
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::vector<int, min_allocator<int>> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::vector<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::vector<int, min_allocator<int>>::iterator i1 = c1.begin();
- std::vector<int, min_allocator<int>>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- c1.erase(i1);
- assert(false);
- }
-#endif
-#endif
-}
diff --git a/test/std/containers/sequences/vector/vector.special/swap.pass.cpp b/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
index 3d01129fa008..0f42d891a587 100644
--- a/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.special/swap.pass.cpp
@@ -77,21 +77,18 @@ int main()
assert(is_contiguous_container_asan_correct(c1));
assert(is_contiguous_container_asan_correct(c2));
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
typedef test_allocator<int> A;
- std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
+ std::vector<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1, 1));
+ std::vector<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(1, 2));
swap(c1, c2);
assert((c1 == std::vector<int, A>(a2, a2+sizeof(a2)/sizeof(a2[0]))));
- assert(c1.get_allocator() == A(1));
+ assert(c1.get_allocator().get_id() == 1);
assert((c2 == std::vector<int, A>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
- assert(c2.get_allocator() == A(2));
+ assert(c2.get_allocator().get_id() == 2);
}
-#endif
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -165,8 +162,6 @@ int main()
assert(is_contiguous_container_asan_correct(c1));
assert(is_contiguous_container_asan_correct(c2));
}
-#ifndef _LIBCPP_DEBUG_LEVEL
-// This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1
{
int a1[] = {1, 3, 7, 9, 10};
int a2[] = {0, 2, 4, 5, 6, 8, 11};
@@ -184,5 +179,4 @@ int main()
assert(is_contiguous_container_asan_correct(c2));
}
#endif
-#endif
}
diff --git a/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
index 89fa301ad9bd..214f9a577571 100644
--- a/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <vector>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -57,35 +58,30 @@ int main()
{
{
typedef std::vector<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<MoveOnly, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<MoveOnly, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
- C c1, c2;
#if TEST_STD_VER >= 14
// In c++14, if POCS is set, swapping the allocator is required not to throw
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#else
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
#endif
}
#if TEST_STD_VER >= 14
{
typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
- C c1, c2;
// if the allocators are always equal, then the swap can be noexcept
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/stack_allocator.h b/test/std/containers/stack_allocator.h
deleted file mode 100644
index d5fab025c9d0..000000000000
--- a/test/std/containers/stack_allocator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef STACK_ALLOCATOR_H
-#define STACK_ALLOCATOR_H
-
-#include <cstddef>
-#include <new>
-
-template <class T, std::size_t N>
-class stack_allocator
-{
- char buf_[sizeof(T)*N];
- char* ptr_;
-public:
- typedef T value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
- template <class U> struct rebind {typedef stack_allocator<U, N> other;};
-
- stack_allocator() : ptr_(buf_) {}
-
-private:
- stack_allocator(const stack_allocator&);// = delete;
- stack_allocator& operator=(const stack_allocator&);// = delete;
-
-public:
- pointer allocate(size_type n, const void* = 0)
- {
- if (n > N - (ptr_ - buf_) / sizeof(value_type)) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_alloc();
-#else
- std::terminate();
-#endif
- }
- pointer r = (T*)ptr_;
- ptr_ += n * sizeof(T);
- return r;
- }
- void deallocate(pointer p, size_type n)
- {
- if ((char*)(p + n) == ptr_)
- ptr_ = (char*)p;
- }
-
- size_type max_size() const {return N;}
-};
-
-template <class T, std::size_t N>
-inline
-void
-swap(stack_allocator<T, N>& x, stack_allocator<T, N>& y) {}
-
-#endif // STACK_ALLOCATOR_H
diff --git a/test/std/containers/unord/unord.map/bucket.pass.cpp b/test/std/containers/unord/unord.map/bucket.pass.cpp
index 1abb58070afd..8931fdf642ff 100644
--- a/test/std/containers/unord/unord.map/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket.pass.cpp
@@ -23,6 +23,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -43,7 +44,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 5);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#if TEST_STD_VER >= 11
{
@@ -63,7 +64,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 5);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.map/bucket_count.pass.cpp b/test/std/containers/unord/unord.map/bucket_count.pass.cpp
index bc3733742600..9ab8bfd19382 100644
--- a/test/std/containers/unord/unord.map/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket_count.pass.cpp
@@ -27,7 +27,7 @@ int main()
{
typedef std::unordered_map<int, std::string> C;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_map<int, std::string> C;
@@ -44,14 +44,14 @@ int main()
P(80, "eighty"),
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
@@ -69,7 +69,7 @@ int main()
P(80, "eighty"),
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#endif
}
diff --git a/test/std/containers/unord/unord.map/bucket_size.pass.cpp b/test/std/containers/unord/unord.map/bucket_size.pass.cpp
index 4344508b7334..af25de4db769 100644
--- a/test/std/containers/unord/unord.map/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket_size.pass.cpp
@@ -23,6 +23,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -41,11 +42,11 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
}
#if TEST_STD_VER >= 11
{
@@ -63,11 +64,11 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.map/iterators.pass.cpp b/test/std/containers/unord/unord.map/iterators.pass.cpp
index 31f4254ea3f8..f99adb52b3f2 100644
--- a/test/std/containers/unord/unord.map/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.map/iterators.pass.cpp
@@ -23,7 +23,9 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -43,8 +45,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -62,8 +64,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#if TEST_STD_VER >= 11
@@ -83,8 +85,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -103,12 +105,12 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::unordered_map<int,double> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/unord/unord.map/max_size.pass.cpp b/test/std/containers/unord/unord.map/max_size.pass.cpp
index 9c1ca18c3054..152741981461 100644
--- a/test/std/containers/unord/unord.map/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_size.pass.cpp
@@ -9,28 +9,45 @@
// <unordered_map>
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
// class unordered_map
// size_type max_size() const;
-#include <unordered_map>
#include <cassert>
+#include <limits>
+#include <type_traits>
+#include <unordered_map>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
- {
- std::unordered_map<int, int> u;
- assert(u.max_size() > 0);
+ typedef std::pair<const int, int> KV;
+ {
+ typedef limited_allocator<KV, 10> A;
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
+ C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<KV, (size_t)-1> A;
+ typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
+ C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- 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);
+ typedef std::unordered_map<char, int> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/unord/unord.map/rehash.pass.cpp b/test/std/containers/unord/unord.map/rehash.pass.cpp
index fce751593a5e..58222b7f924d 100644
--- a/test/std/containers/unord/unord.map/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.map/rehash.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -56,16 +57,16 @@ int main()
assert(c.bucket_count() >= 5);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#if TEST_STD_VER >= 11
@@ -87,16 +88,16 @@ int main()
assert(c.bucket_count() >= 5);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#endif
diff --git a/test/std/containers/unord/unord.map/reserve.pass.cpp b/test/std/containers/unord/unord.map/reserve.pass.cpp
index 5999801a3923..1836c2a41da1 100644
--- a/test/std/containers/unord/unord.map/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.map/reserve.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -64,7 +65,7 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.reserve(3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.reserve(3);
@@ -92,7 +93,7 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.reserve(3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.reserve(3);
diff --git a/test/std/containers/unord/unord.map/swap_member.pass.cpp b/test/std/containers/unord/unord.map/swap_member.pass.cpp
index 0f98b66aa401..86a068cd357b 100644
--- a/test/std/containers/unord/unord.map/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.map/swap_member.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "../../test_compare.h"
#include "../../test_hash.h"
@@ -32,27 +33,27 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -72,12 +73,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -89,18 +90,18 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -118,21 +119,21 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -140,9 +141,9 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -171,12 +172,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -188,12 +189,12 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -201,9 +202,9 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +218,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +258,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -270,17 +271,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +304,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -321,8 +322,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +357,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -369,11 +370,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -382,8 +383,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -397,22 +398,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -437,7 +438,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -450,17 +451,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -483,16 +484,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -501,8 +502,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -536,7 +537,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -549,11 +550,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -562,8 +563,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
index 232f2fd4fd59..6caa59728cef 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -93,7 +94,7 @@ int main()
A a(10);
C c(2, a);
- assert(c.bucket_count() == 2);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
assert(c.hash_function() == HF());
assert(c.key_eq() == Comp());
assert(c.get_allocator() == a);
@@ -113,7 +114,7 @@ int main()
A a(10);
HF hf(12);
C c(2, hf, a);
- assert(c.bucket_count() == 2);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
assert(c.hash_function() == hf);
assert(!(c.hash_function() == HF()));
assert(c.key_eq() == Comp());
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index ee85750f5c36..b793f0934355 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -57,7 +59,7 @@ int main()
A(4)
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -67,8 +69,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -130,8 +132,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -166,7 +168,7 @@ int main()
A()
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -176,8 +178,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
index e4da30bb4efd..4d92b3d4c2c5 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -87,8 +88,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
index fe3eaee4642b..e86d35b0ac8b 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -58,7 +60,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -68,8 +70,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -103,7 +105,7 @@ int main()
A(10)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -113,8 +115,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
@@ -149,7 +151,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -159,8 +161,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
@@ -196,7 +198,7 @@ int main()
A()
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -206,8 +208,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
index 417120b9eb0e..7f62a4fedf83 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/compare_copy_constructible.fail.cpp
@@ -12,7 +12,7 @@
// <unordered_map>
-// Check that std::unordered_map fails to instantiate if the comparison predicate is
+// Check that std::unordered_map fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <unordered_map>
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
index 0590d12818b3..0b1d460ef74b 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -51,7 +53,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -62,12 +64,12 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
@@ -91,7 +93,7 @@ int main()
other_allocator<std::pair<const int, std::string> >(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -102,13 +104,11 @@ int main()
assert(c.get_allocator() ==
(other_allocator<std::pair<const int, std::string> >(-2)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
@@ -132,7 +132,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -143,8 +143,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
index 3c0be631386c..cf83074ae170 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/copy_alloc.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -51,7 +53,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c(c0, test_allocator<std::pair<const int, std::string> >(5));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -62,8 +64,8 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(5)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -91,7 +93,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c(c0, min_allocator<std::pair<const int, std::string> >());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -102,8 +104,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -141,8 +143,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
index ad7f3a914dcb..04d172e4ddfe 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/default.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -100,7 +101,7 @@ int main()
}
{
std::unordered_map<int, int> c = {};
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
index 3585fe7b881a..4fb10afd4e59 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -54,11 +55,11 @@ int main()
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
index 709b56de2453..2525c4444ffb 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/hash_copy_constructible.fail.cpp
@@ -12,7 +12,7 @@
// <unordered_map>
-// Check that std::unordered_map fails to instantiate if the hash function is
+// Check that std::unordered_map fails to instantiate if the hash function is
// not copy-constructible. This is mentioned in LWG issue 2436
#include <unordered_map>
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
index e980b68b57c1..bebab0375d86 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -54,8 +56,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -86,12 +88,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, std::string> P;
typedef test_allocator<std::pair<const int, std::string>> A;
@@ -118,8 +120,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -151,8 +153,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
index 07e77e33504f..9055e3dcd166 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -46,7 +48,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -57,8 +59,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -80,7 +82,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -91,8 +93,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
index 01aca134a604..db0010b3401c 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -47,7 +49,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -58,8 +60,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -82,7 +84,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -93,8 +95,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
index 08efdbd3591f..c76ce3968ad3 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -49,7 +51,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -60,8 +62,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -85,7 +87,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -96,8 +98,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
index e629c7f0782a..6cb57d4ff210 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<std::pair<const int, std::string> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -61,8 +63,8 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -87,7 +89,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<std::pair<const int, std::string> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -98,8 +100,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -134,8 +136,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
index 0f40e349db67..808d8946a7ec 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -42,15 +44,15 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -79,7 +81,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -90,8 +92,8 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -109,15 +111,15 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -146,7 +148,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -157,8 +159,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
index 36a1fa55a3cb..681c0e95b937 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -63,8 +65,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(12));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -94,7 +96,7 @@ int main()
A(10)
);
C c(std::move(c0), A(10));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -104,8 +106,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -136,7 +138,7 @@ int main()
A()
);
C c(std::move(c0), A());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -146,8 +148,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -187,8 +189,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
index 61c2969d9337..c0dc71da45d8 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -56,7 +57,7 @@ int main()
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
index 16dc3dc6d4fa..c40173ede750 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,17 +44,17 @@ int main()
{
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
index d2a18fa45f11..3dbcf4d15823 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
@@ -20,7 +20,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -58,8 +60,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -92,12 +94,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, std::string> P;
typedef test_allocator<std::pair<const int, std::string>> A;
@@ -125,8 +127,8 @@ int main()
assert(c.key_eq() == Comp());
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -160,8 +162,8 @@ int main()
assert(c.key_eq() == Comp());
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
index 9af18ab61f41..426b5dac18ba 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -50,7 +52,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
10
);
- assert(c.bucket_count() == 11);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -61,8 +63,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -86,7 +88,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
10
);
- assert(c.bucket_count() == 11);
+ LIBCPP_ASSERT(c.bucket_count() == 11);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -97,8 +99,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
index e23208dba991..ea058bdff1fc 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -52,7 +54,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -63,8 +65,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -89,7 +91,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -100,8 +102,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
index d296bab32741..1fdde2b12158 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -53,7 +55,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -64,8 +66,8 @@ int main()
assert(c.get_allocator() ==
(test_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -91,7 +93,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -102,8 +104,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
index 3b0fd9829c95..f95efbe5f53c 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -23,7 +23,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -55,7 +57,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<std::pair<const int, std::string> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -66,8 +68,8 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -94,7 +96,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<std::pair<const int, std::string> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.at(1) == "one");
assert(c.at(2) == "two");
@@ -105,8 +107,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -143,8 +145,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
index d2551861ec89..94833c23247d 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size.fail.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
index 465dea21bce1..acf6b11fe9a2 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
index f70ad7a1e5bc..42a248cc1602 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -36,7 +37,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -58,7 +59,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
index 184d77d69d5f..820a3652ec9e 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -37,7 +38,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -60,7 +61,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
index ad4e6482c412..58c397c2b991 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/size_hash_equal_allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -38,7 +39,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -62,7 +63,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
min_allocator<std::pair<const NotConstructible, NotConstructible> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
index 5504d33f299b..8fbded4cd5fb 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -23,6 +22,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -42,6 +42,7 @@ int main()
assert(c.size() == 4);
c.at(1) = "ONE";
assert(c.at(1) == "ONE");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
c.at(11) = "eleven";
@@ -51,6 +52,7 @@ int main()
{
}
assert(c.size() == 4);
+#endif
}
{
typedef std::unordered_map<int, std::string> C;
@@ -67,6 +69,7 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.size() == 4);
assert(c.at(1) == "one");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
c.at(11);
@@ -76,6 +79,7 @@ int main()
{
}
assert(c.size() == 4);
+#endif
}
#if TEST_STD_VER >= 11
{
@@ -95,6 +99,7 @@ int main()
assert(c.size() == 4);
c.at(1) = "ONE";
assert(c.at(1) == "ONE");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
c.at(11) = "eleven";
@@ -104,6 +109,7 @@ int main()
{
}
assert(c.size() == 4);
+#endif
}
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
@@ -121,6 +127,7 @@ int main()
const C c(a, a + sizeof(a)/sizeof(a[0]));
assert(c.size() == 4);
assert(c.at(1) == "one");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
c.at(11);
@@ -130,6 +137,7 @@ int main()
{
}
assert(c.size() == 4);
+#endif
}
#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
index 04d01eb466e7..471040a3374e 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
@@ -37,22 +37,22 @@ int main()
typedef std::pair<double, short> P;
C c;
C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, 3));
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(c.end(), P(3.5, 4));
+ r = c.insert(c.end(), P(3.5, static_cast<short>(4)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(c.end(), P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -90,22 +90,22 @@ int main()
typedef std::pair<double, short> P;
C c;
C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, 3));
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(c.end(), P(3.5, 4));
+ r = c.insert(c.end(), P(3.5, static_cast<short>(4)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(c.end(), P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 5.5);
assert(r->second == 4);
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
index faf5b046b5d8..8c8551e7467a 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
@@ -32,25 +32,25 @@ int main()
typedef std::pair<C::iterator, bool> R;
typedef std::pair<double, short> P;
C c;
- R r = c.insert(P(3.5, 3));
+ R r = c.insert(P(3.5, static_cast<short>(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));
+ r = c.insert(P(3.5, static_cast<short>(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));
+ r = c.insert(P(4.5, static_cast<short>(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));
+ r = c.insert(P(5.5, static_cast<short>(4)));
assert(r.second);
assert(c.size() == 3);
assert(r.first->first == 5.5);
@@ -91,25 +91,25 @@ int main()
typedef std::pair<C::iterator, bool> R;
typedef std::pair<double, short> P;
C c;
- R r = c.insert(P(3.5, 3));
+ R r = c.insert(P(3.5, static_cast<short>(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));
+ r = c.insert(P(3.5, static_cast<short>(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));
+ r = c.insert(P(4.5, static_cast<short>(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));
+ r = c.insert(P(5.5, static_cast<short>(4)));
assert(r.second);
assert(c.size() == 3);
assert(r.first->first == 5.5);
diff --git a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
index f8f17ffec57a..fc286ceec8eb 100644
--- a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp
@@ -26,6 +26,7 @@
// This tests a conforming extension
#include <unordered_map>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -122,79 +123,65 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> MapType;
{
typedef std::unordered_map<MoveOnly, MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MapType>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MapType>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_map<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MapType>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
index f3d51f6da275..2044f42cfc49 100644
--- a/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -32,27 +33,27 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -72,12 +73,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -89,18 +90,18 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -118,21 +119,21 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -140,9 +141,9 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -171,12 +172,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -188,12 +189,12 @@ int main()
assert(c1.at(80) == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -201,9 +202,9 @@ int main()
assert(c2.at(4) == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +218,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +258,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -270,17 +271,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +304,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -321,8 +322,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +357,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -369,11 +370,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -382,8 +383,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -397,22 +398,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -437,7 +438,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -450,17 +451,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -483,16 +484,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -501,8 +502,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -536,7 +537,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.at(10) == "ten");
assert(c1.at(20) == "twenty");
@@ -549,11 +550,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.at(1) == "one");
assert(c2.at(2) == "two");
@@ -562,8 +563,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.multimap/bucket.pass.cpp b/test/std/containers/unord/unord.multimap/bucket.pass.cpp
index 415dce11c128..425c63f9df0a 100644
--- a/test/std/containers/unord/unord.multimap/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/bucket.pass.cpp
@@ -23,6 +23,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -43,7 +44,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 7);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#if TEST_STD_VER >= 11
{
@@ -63,7 +64,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 7);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp b/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
index d44412fedf6d..4eea3d0f6fb5 100644
--- a/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -26,7 +28,7 @@ int main()
typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_multimap<int, std::string> C;
@@ -44,6 +46,6 @@ int main()
P(80, "eighty"),
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
}
diff --git a/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp b/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
index 3bc3f5876fe6..30c0e5e3cd56 100644
--- a/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/bucket_size.pass.cpp
@@ -23,6 +23,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -41,13 +42,13 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
}
#if TEST_STD_VER >= 11
{
@@ -65,13 +66,13 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.multimap/iterators.fail.cpp b/test/std/containers/unord/unord.multimap/iterators.fail.cpp
index d0adb2c25d5e..5ecaba4e500a 100644
--- a/test/std/containers/unord/unord.multimap/iterators.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/iterators.fail.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -39,7 +41,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_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());
@@ -61,7 +63,7 @@ int main()
P(2, "four"),
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_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());
diff --git a/test/std/containers/unord/unord.multimap/iterators.pass.cpp b/test/std/containers/unord/unord.multimap/iterators.pass.cpp
index cc75bb10a811..22aa3a0c0516 100644
--- a/test/std/containers/unord/unord.multimap/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/iterators.pass.cpp
@@ -23,7 +23,9 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -43,8 +45,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
i = c.begin();
i->second = "ONE";
@@ -65,8 +67,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#if TEST_STD_VER >= 11
@@ -86,8 +88,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
i = c.begin();
i->second = "ONE";
@@ -109,12 +111,12 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::unordered_multimap<int,double> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/unord/unord.multimap/local_iterators.fail.cpp b/test/std/containers/unord/unord.multimap/local_iterators.fail.cpp
index 5f66cfe287e3..064e1b1bd6e7 100644
--- a/test/std/containers/unord/unord.multimap/local_iterators.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/local_iterators.fail.cpp
@@ -24,6 +24,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -40,7 +42,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.begin(b);
I j = c.end(b);
@@ -105,7 +107,7 @@ int main()
P(2, "four"),
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.begin(b);
I j = c.end(b);
@@ -169,7 +171,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.cbegin(b);
I j = c.cend(b);
@@ -233,7 +235,7 @@ int main()
P(2, "four"),
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.cbegin(b);
I j = c.cend(b);
diff --git a/test/std/containers/unord/unord.multimap/max_size.pass.cpp b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
index 3bf1f1496f68..5b58bac385a4 100644
--- a/test/std/containers/unord/unord.multimap/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
@@ -9,28 +9,47 @@
// <unordered_map>
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
// class unordered_multimap
// size_type max_size() const;
-#include <unordered_map>
#include <cassert>
+#include <limits>
+#include <type_traits>
+#include <unordered_map>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
- {
- std::unordered_multimap<int, int> u;
- assert(u.max_size() > 0);
+ typedef std::pair<const int, int> KV;
+ {
+ typedef limited_allocator<KV, 10> A;
+ typedef std::unordered_multimap<int, int, std::hash<int>,
+ std::equal_to<int>, A>
+ C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<KV, (size_t)-1> A;
+ typedef std::unordered_multimap<int, int, std::hash<int>,
+ std::equal_to<int>, A>
+ C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- 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);
+ typedef std::unordered_multimap<char, int> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index c099abe2ac05..3d3832a2fe3c 100644
--- a/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -61,8 +63,8 @@ void test(const C& c)
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
}
@@ -85,16 +87,16 @@ int main()
assert(c.bucket_count() >= 7);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#if TEST_STD_VER >= 11
@@ -116,16 +118,16 @@ int main()
assert(c.bucket_count() >= 7);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#endif
diff --git a/test/std/containers/unord/unord.multimap/reserve.pass.cpp b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
index 3f76da11e3d9..d86c69c88f25 100644
--- a/test/std/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -66,11 +67,11 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.reserve(3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.reserve(3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.reserve(31);
assert(c.bucket_count() >= 16);
@@ -94,11 +95,11 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.reserve(3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.reserve(3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.reserve(31);
assert(c.bucket_count() >= 16);
diff --git a/test/std/containers/unord/unord.multimap/scary.pass.cpp b/test/std/containers/unord/unord.multimap/scary.pass.cpp
index e619a7a54294..ad32ff713f56 100644
--- a/test/std/containers/unord/unord.multimap/scary.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/scary.pass.cpp
@@ -21,4 +21,5 @@ int main()
typedef std::unordered_multimap<int, int> M2;
M2::iterator i;
M1::iterator j = i;
+ ((void)j);
}
diff --git a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
index 4653cc32ef36..0f898f1b73e0 100644
--- a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "test_allocator.h"
@@ -33,27 +35,27 @@ int main()
typedef test_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(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -73,12 +75,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -90,18 +92,18 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -119,21 +121,21 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -143,9 +145,9 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -174,12 +176,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -191,12 +193,12 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -206,9 +208,9 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -223,22 +225,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -263,7 +265,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -276,17 +278,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -309,16 +311,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -329,8 +331,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -364,7 +366,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -377,11 +379,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -392,8 +394,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -408,22 +410,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -448,7 +450,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -461,17 +463,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -494,16 +496,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -514,8 +516,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -549,7 +551,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -562,11 +564,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -577,8 +579,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
index 392f375c4b6c..19877738aae7 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c(test_allocator<std::pair<const NotConstructible, NotConstructible> >(10));
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c(min_allocator<std::pair<const NotConstructible, NotConstructible> >{});
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -83,7 +84,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef NotConstructible T;
typedef test_allocator<std::pair<const T, T>> A;
@@ -93,7 +94,7 @@ int main()
A a(10);
C c(2, a);
- assert(c.bucket_count() == 2);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
assert(c.hash_function() == HF());
assert(c.key_eq() == Comp());
assert(c.get_allocator() == a);
@@ -113,7 +114,7 @@ int main()
A a(10);
HF hf(12);
C c(2, hf, a);
- assert(c.bucket_count() == 2);
+ LIBCPP_ASSERT(c.bucket_count() == 2);
assert(c.hash_function() == hf);
assert(!(c.hash_function() == HF()));
assert(c.key_eq() == Comp());
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index 5634a79eff33..62e756cda3b1 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -57,7 +59,7 @@ int main()
A(4)
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -81,8 +83,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -158,8 +160,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -194,7 +196,7 @@ int main()
A()
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -218,8 +220,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
index 0d3b4453dd44..6d27dec98eaa 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -79,8 +80,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -136,8 +137,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
index ed8d792e8178..b9b8723452fe 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -58,7 +60,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -88,8 +90,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -123,7 +125,7 @@ int main()
A(10)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -153,8 +155,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -188,7 +190,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -218,8 +220,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -254,7 +256,7 @@ int main()
A()
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -284,8 +286,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
index d3e31484c8b7..1c46e7adeafa 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/compare_copy_constructible.fail.cpp
@@ -12,7 +12,7 @@
// <unordered_map>
-// Check that std::unordered_multimap fails to instantiate if the comparison predicate is
+// Check that std::unordered_multimap fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <unordered_map>
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
index 7b0adda182cb..5e314db06b8a 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -51,7 +53,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -76,12 +78,12 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
@@ -105,7 +107,7 @@ int main()
other_allocator<std::pair<const int, std::string> >(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -130,13 +132,11 @@ int main()
assert(c.get_allocator() ==
(other_allocator<std::pair<const int, std::string> >(-2)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
@@ -160,7 +160,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -185,8 +185,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
index a208068111c1..cb221abd4150 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy_alloc.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -51,7 +53,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c(c0, test_allocator<std::pair<const int, std::string> >(5));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -76,8 +78,8 @@ int main()
assert(c.get_allocator() ==
(test_allocator<std::pair<const int, std::string> >(5)));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -105,7 +107,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c(c0, min_allocator<std::pair<const int, std::string> >());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(i->first == 1);
@@ -130,8 +132,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -183,8 +185,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
index 915d2f3851a1..8418c885e975 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() ==
@@ -100,7 +101,7 @@ int main()
}
{
std::unordered_multimap<int, int> c = {};
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
index 2797f8dcfb04..b5f4403174b8 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -54,11 +55,11 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
index 4214f694a20f..71e1c9f6d4be 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/hash_copy_constructible.fail.cpp
@@ -12,7 +12,7 @@
// <unordered_map>
-// Check that std::unordered_multimap fails to instantiate if the hash function is
+// Check that std::unordered_multimap fails to instantiate if the hash function is
// not copy-constructible. This is mentioned in LWG issue 2436
#include <unordered_map>
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
index f6bc3a08cae9..445fd2d82bb2 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
@@ -19,7 +19,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -73,8 +75,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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> >());
@@ -127,15 +129,15 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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> >()));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, std::string> P;
typedef test_allocator<std::pair<const int, std::string>> A;
@@ -182,8 +184,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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() == HF());
@@ -238,8 +240,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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() == hf);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
index 5dc4323493e4..92a43b482bdf 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -46,7 +48,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -76,8 +78,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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> >());
@@ -102,7 +104,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -132,8 +134,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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> >());
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
index 8bcbd0bdc352..d7afafcaec92 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -47,7 +49,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -77,8 +79,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -104,7 +106,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -134,8 +136,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
index 8dda376db3f9..9842a4bbdaf9 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -49,7 +51,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -79,8 +81,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -107,7 +109,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -137,8 +139,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
index 358cf41b0317..244c3f5c657c 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<std::pair<const int, std::string> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -80,8 +82,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -109,7 +111,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<std::pair<const int, std::string> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -139,8 +141,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -198,8 +200,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
index 58d1424d8b1e..df69b52878d3 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
@@ -20,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -28,38 +32,28 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multimap<int, std::string,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_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),
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
(test_allocator<std::pair<const int, std::string> >(10)));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -88,7 +82,7 @@ int main()
test_allocator<std::pair<const int, std::string> >(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -118,8 +112,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -128,38 +122,27 @@ int main()
assert(c0.empty());
}
-#if TEST_STD_VER >= 11
{
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);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -188,7 +171,7 @@ int main()
min_allocator<std::pair<const int, std::string> >()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -218,8 +201,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -228,7 +211,6 @@ int main()
assert(c0.empty());
}
-#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_multimap<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}};
@@ -240,5 +222,4 @@ int main()
assert(s2.size() == 2);
}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
index 3e82f4fa626b..878ef598f8cb 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -85,8 +87,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -119,7 +121,7 @@ int main()
A(10)
);
C c(std::move(c0), A(10));
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -149,8 +151,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -184,7 +186,7 @@ int main()
A()
);
C c(std::move(c0), A());
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -214,8 +216,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -278,8 +280,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
index eeda7b39e958..b621449f2b74 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -56,7 +57,7 @@ int main()
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
index 965c46499a16..94067c3161e2 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,17 +44,17 @@ int main()
{
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
index 96ad70a56e0f..11465edae3e5 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
@@ -20,7 +20,9 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -77,8 +79,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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> >());
@@ -133,15 +135,15 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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> >()));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, std::string> P;
typedef test_allocator<std::pair<const int, std::string>> A;
@@ -190,8 +192,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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() == HF());
@@ -248,8 +250,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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() == hf);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
index 15b31b519b74..bc16de5a2ab7 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -50,7 +52,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
10
);
- assert(c.bucket_count() == 11);
+ LIBCPP_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);
@@ -80,8 +82,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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> >());
@@ -108,7 +110,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
10
);
- assert(c.bucket_count() == 11);
+ LIBCPP_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);
@@ -138,8 +140,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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> >());
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
index f565f10c89b5..9ecfc5b7926e 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -52,7 +54,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -82,8 +84,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -111,7 +113,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -141,8 +143,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
index 8f86befbe37f..7c4c535783d8 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -53,7 +55,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -83,8 +85,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -113,7 +115,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -143,8 +145,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
index dd65a07e35f0..782105cb082b 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -23,7 +23,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
@@ -55,7 +57,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<std::pair<const int, std::string> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -85,8 +87,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -116,7 +118,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<std::pair<const int, std::string> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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);
@@ -146,8 +148,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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));
@@ -207,13 +209,13 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::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() == A{});;
+ assert(c.get_allocator() == A{});
}
#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
index 38e6c60df52d..b76fbc0ba436 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.fail.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
index 8aad662610ab..ae3d4f816a7a 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -34,7 +35,7 @@ int main()
NotConstructible> >
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -54,7 +55,7 @@ int main()
NotConstructible> >
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
index 2cc6c0176e5e..742d4f29175e 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -36,7 +37,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -58,7 +59,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
index ebfce9fec564..88cce517cfee 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -37,7 +38,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -60,7 +61,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
index bd37650a3a7c..2b3b0e2ab27b 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/size_hash_equal_allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -38,7 +39,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
@@ -62,7 +63,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
min_allocator<std::pair<const NotConstructible, NotConstructible> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() ==
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
index 8bccd4013a29..a8095135c1c0 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp
@@ -25,6 +25,7 @@
#include "../../../Emplaceable.h"
#include "min_allocator.h"
+#include "test_macros.h"
int main()
{
@@ -44,20 +45,20 @@ int main()
assert(c.size() == 2);
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
- assert(r == next(c.begin()));
+ LIBCPP_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()));
+ LIBCPP_ASSERT(r == next(c.begin()));
r = c.begin();
assert(r->first == 3);
- assert(r->second == Emplaceable());
+ LIBCPP_ASSERT(r->second == Emplaceable());
r = next(r, 2);
assert(r->first == 3);
- assert(r->second == Emplaceable(5, 6));
+ LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
}
#if TEST_STD_VER >= 11
{
@@ -76,20 +77,20 @@ int main()
assert(c.size() == 2);
assert(r->first == 3);
assert(r->second == Emplaceable(5, 6));
- assert(r == next(c.begin()));
+ LIBCPP_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()));
+ LIBCPP_ASSERT(r == next(c.begin()));
r = c.begin();
assert(r->first == 3);
- assert(r->second == Emplaceable());
+ LIBCPP_ASSERT(r->second == Emplaceable());
r = next(r, 2);
assert(r->first == 3);
- assert(r->second == Emplaceable(5, 6));
+ LIBCPP_ASSERT(r->second == Emplaceable(5, 6));
}
#endif
#if _LIBCPP_DEBUG >= 1
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
index 9da1e71cba06..092f3dd91158 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_const_iter.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -46,7 +47,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
assert(c.size() == 5);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;
@@ -73,8 +77,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#if TEST_STD_VER >= 11
{
@@ -92,7 +96,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
assert(c.size() == 5);
typedef std::pair<C::const_iterator, C::const_iterator> Eq;
@@ -119,8 +126,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#endif
#if TEST_STD_VER >= 14
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
index f061d858e3f7..0da6f8a564b8 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_key.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -81,8 +82,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 2);
assert(c.size() == 4);
@@ -104,8 +105,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 0);
assert(c.size() == 4);
@@ -127,8 +128,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 1);
assert(c.size() == 3);
@@ -145,8 +146,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 0);
assert(c.size() == 3);
@@ -163,8 +164,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 2);
assert(c.size() == 1);
@@ -173,8 +174,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 0);
assert(c.size() == 1);
@@ -183,22 +184,22 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#if TEST_STD_VER >= 11
{
@@ -244,8 +245,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 2);
assert(c.size() == 4);
@@ -267,8 +268,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(2) == 0);
assert(c.size() == 4);
@@ -290,8 +291,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 1);
assert(c.size() == 3);
@@ -308,8 +309,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(4) == 0);
assert(c.size() == 3);
@@ -326,8 +327,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 2);
assert(c.size() == 1);
@@ -336,8 +337,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.erase(1) == 0);
assert(c.size() == 1);
@@ -346,22 +347,22 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
{
typedef std::unordered_multimap<int, int> C;
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
index 110cc4542b42..f239af4af314 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/erase_range.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -68,8 +69,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(i, j);
assert(c.size() == 4);
@@ -91,8 +92,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(c.cbegin(), c.cend());
assert(c.size() == 0);
@@ -145,8 +146,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(i, j);
assert(c.size() == 4);
@@ -168,8 +169,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
k = c.erase(c.cbegin(), c.cend());
assert(c.size() == 0);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
index d6c0dbdbed07..94faa8f7fe9f 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_hint_rvalue.pass.cpp
@@ -37,22 +37,22 @@ int main()
typedef std::pair<double, short> P;
C c;
C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, 3));
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(r, P(3.5, 4));
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -90,22 +90,22 @@ int main()
typedef std::pair<double, short> P;
C c;
C::const_iterator e = c.end();
- R r = c.insert(e, P(3.5, 3));
+ R r = c.insert(e, P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(r, P(3.5, 4));
+ r = c.insert(r, P(3.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(4.5, 4));
+ r = c.insert(c.end(), P(4.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(c.end(), P(5.5, 4));
+ r = c.insert(c.end(), P(5.5, static_cast<short>(4)));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
index 851b36e51ca4..e0b1c6941862 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
#include "min_allocator.h"
@@ -67,8 +68,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#if TEST_STD_VER >= 11
{
@@ -114,8 +115,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
index 967ad369da3f..483f22050553 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_range.pass.cpp
@@ -19,6 +19,7 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
#include "min_allocator.h"
@@ -67,8 +68,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#if TEST_STD_VER >= 11
{
@@ -114,8 +115,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
}
#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
index 6735b8af5a0a..0c8ffeb10ee6 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_rvalue.pass.cpp
@@ -32,22 +32,22 @@ int main()
typedef C::iterator R;
typedef std::pair<double, short> P;
C c;
- R r = c.insert(P(3.5, 3));
+ R r = c.insert(P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(P(3.5, 4));
+ r = c.insert(P(3.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(P(4.5, 4));
+ r = c.insert(P(4.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(P(5.5, 4));
+ r = c.insert(P(5.5, static_cast<short>(4)));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
@@ -83,22 +83,22 @@ int main()
typedef C::iterator R;
typedef std::pair<double, short> P;
C c;
- R r = c.insert(P(3.5, 3));
+ R r = c.insert(P(3.5, static_cast<short>(3)));
assert(c.size() == 1);
assert(r->first == 3.5);
assert(r->second == 3);
- r = c.insert(P(3.5, 4));
+ r = c.insert(P(3.5, static_cast<short>(4)));
assert(c.size() == 2);
assert(r->first == 3.5);
assert(r->second == 4);
- r = c.insert(P(4.5, 4));
+ r = c.insert(P(4.5, static_cast<short>(4)));
assert(c.size() == 3);
assert(r->first == 4.5);
assert(r->second == 4);
- r = c.insert(P(5.5, 4));
+ r = c.insert(P(5.5, static_cast<short>(4)));
assert(c.size() == 4);
assert(r->first == 5.5);
assert(r->second == 4);
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
index 553131182315..7a58709c9fc9 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
@@ -26,6 +26,7 @@
// This tests a conforming extension
#include <unordered_map>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -121,78 +122,64 @@ int main()
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<V>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<V>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
index 84911ba01ffb..06e6c65c991d 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_map>
#include <string>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -32,27 +34,27 @@ int main()
typedef test_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(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -72,12 +74,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -89,18 +91,18 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -118,21 +120,21 @@ int main()
P(1, "four"),
P(2, "four"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -142,9 +144,9 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -173,12 +175,12 @@ int main()
P(70, "seventy"),
P(80, "eighty"),
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -190,12 +192,12 @@ int main()
assert(c1.find(80)->second == "eighty");
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -205,9 +207,9 @@ int main()
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -222,22 +224,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -262,7 +264,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -275,17 +277,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -308,16 +310,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -328,8 +330,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -363,7 +365,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -376,11 +378,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -391,8 +393,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -407,22 +409,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -447,7 +449,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -460,17 +462,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -493,16 +495,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -513,8 +515,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -548,7 +550,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(c1.find(10)->second == "ten");
assert(c1.find(20)->second == "twenty");
@@ -561,11 +563,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.find(1)->second == "one");
assert(next(c2.find(1))->second == "four");
@@ -576,8 +578,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.multiset/bucket.pass.cpp b/test/std/containers/unord/unord.multiset/bucket.pass.cpp
index 30858c79a048..b0fb9b334cc9 100644
--- a/test/std/containers/unord/unord.multiset/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -42,7 +43,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 7);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#if TEST_STD_VER >= 11
{
@@ -62,7 +63,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 7);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
index adde647cb246..ec4d0e675501 100644
--- a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -27,7 +28,7 @@ int main()
typedef C::const_iterator I;
typedef int P;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_multiset<int> C;
@@ -45,7 +46,7 @@ int main()
P(80)
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#if TEST_STD_VER >= 11
{
@@ -54,7 +55,7 @@ int main()
typedef C::const_iterator I;
typedef int P;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_multiset<int, std::hash<int>,
@@ -73,7 +74,7 @@ int main()
P(80)
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#endif
}
diff --git a/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp b/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
index 7ca480556349..237b89036c88 100644
--- a/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/bucket_size.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -40,13 +41,13 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
}
#if TEST_STD_VER >= 11
{
@@ -64,13 +65,13 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 2);
+ LIBCPP_ASSERT(c.bucket_size(2) == 2);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
+ LIBCPP_ASSERT(c.bucket_size(5) == 0);
+ LIBCPP_ASSERT(c.bucket_size(6) == 0);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
index 117e8e68efab..362697b2c8e3 100644
--- a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp
@@ -45,7 +45,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
+
assert(c.size() == 5);
assert(c.count(1) == 2);
assert(c.count(2) == 1);
@@ -68,7 +72,10 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
assert(c.size() == 5);
assert(c.count(1) == 2);
assert(c.count(2) == 1);
diff --git a/test/std/containers/unord/unord.multiset/iterators.fail.cpp b/test/std/containers/unord/unord.multiset/iterators.fail.cpp
index f78bccbd423f..9f309a234003 100644
--- a/test/std/containers/unord/unord.multiset/iterators.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/iterators.fail.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -38,7 +40,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_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());
@@ -59,7 +61,7 @@ int main()
P(2)
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_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());
diff --git a/test/std/containers/unord/unord.multiset/iterators.pass.cpp b/test/std/containers/unord/unord.multiset/iterators.pass.cpp
index bf42740c23fb..d87099cdaf8c 100644
--- a/test/std/containers/unord/unord.multiset/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/iterators.pass.cpp
@@ -22,7 +22,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -42,8 +44,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -61,8 +63,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#if TEST_STD_VER >= 11
@@ -82,8 +84,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -102,12 +104,12 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::unordered_multiset<int> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/unord/unord.multiset/local_iterators.fail.cpp b/test/std/containers/unord/unord.multiset/local_iterators.fail.cpp
index 4118987c2ae0..a43e49357873 100644
--- a/test/std/containers/unord/unord.multiset/local_iterators.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/local_iterators.fail.cpp
@@ -23,6 +23,8 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -39,7 +41,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.begin(b);
I j = c.end(b);
@@ -98,7 +100,7 @@ int main()
P(2)
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.begin(b);
I j = c.end(b);
@@ -156,7 +158,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.cbegin(b);
I j = c.cend(b);
@@ -214,7 +216,7 @@ int main()
P(2)
};
const C c(a, a + sizeof(a)/sizeof(a[0]));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
C::size_type b = c.bucket(0);
I i = c.cbegin(b);
I j = c.cend(b);
diff --git a/test/std/containers/unord/unord.multiset/max_size.pass.cpp b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
index b26ad73fed2b..eac4db8b0a91 100644
--- a/test/std/containers/unord/unord.multiset/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
@@ -9,28 +9,46 @@
// <unordered_set>
-// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
-// class Alloc = allocator<Value>>
// class unordered_multiset
// size_type max_size() const;
-#include <unordered_set>
#include <cassert>
+#include <limits>
+#include <type_traits>
+#include <unordered_set>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
{
- std::unordered_multiset<int> u;
- assert(u.max_size() > 0);
+ typedef limited_allocator<int, 10> A;
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
+ A>
+ C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
+ A>
+ C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- std::unordered_multiset<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> u;
- assert(u.max_size() > 0);
+ typedef std::unordered_multiset<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/unord/unord.multiset/rehash.pass.cpp b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
index 3ad16a6bcbfe..2c5d509951a8 100644
--- a/test/std/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -55,16 +56,16 @@ int main()
assert(c.bucket_count() >= 7);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#if TEST_STD_VER >= 11
@@ -86,16 +87,16 @@ int main()
assert(c.bucket_count() >= 7);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#endif
diff --git a/test/std/containers/unord/unord.multiset/reserve.pass.cpp b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
index 52d51011fe36..28187e9cae2b 100644
--- a/test/std/containers/unord/unord.multiset/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -63,11 +64,11 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.reserve(3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.reserve(3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.reserve(31);
assert(c.bucket_count() >= 16);
@@ -91,11 +92,11 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.reserve(3);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.reserve(3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.reserve(31);
assert(c.bucket_count() >= 16);
diff --git a/test/std/containers/unord/unord.multiset/scary.pass.cpp b/test/std/containers/unord/unord.multiset/scary.pass.cpp
index dfd144bb3170..aec6950c48f1 100644
--- a/test/std/containers/unord/unord.multiset/scary.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/scary.pass.cpp
@@ -21,4 +21,5 @@ int main()
typedef std::unordered_multiset<int> M2;
M2::iterator i;
M1::iterator j = i;
+ ((void)j);
}
diff --git a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
index bc3314c867eb..c0c9e9021712 100644
--- a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp
@@ -17,7 +17,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "test_allocator.h"
@@ -31,27 +33,27 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -71,12 +73,12 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -88,18 +90,18 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -117,21 +119,21 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -139,9 +141,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -170,12 +172,12 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -187,12 +189,12 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -200,9 +202,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +219,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +259,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -270,17 +272,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +305,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -321,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +358,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -369,11 +371,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -382,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -398,22 +400,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -438,7 +440,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -451,17 +453,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -484,16 +486,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -502,8 +504,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -537,7 +539,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -550,11 +552,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -563,8 +565,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
index 8d020a52ac04..867ca93fb58a 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c(test_allocator<NotConstructible>(10));
- assert(c.bucket_count() == 0);
+ LIBCPP_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() == test_allocator<NotConstructible>(10));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c(min_allocator<NotConstructible>{});
- assert(c.bucket_count() == 0);
+ LIBCPP_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>());
@@ -61,7 +62,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef NotConstructible T;
typedef test_hash<std::hash<T>> HF;
@@ -71,7 +72,7 @@ int main()
A a(43);
C c(3, a);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
assert(c.hash_function() == HF());
assert(c.key_eq() == Comp ());
assert(c.get_allocator() == a);
@@ -92,7 +93,7 @@ int main()
HF hf(42);
A a(43);
C c(4, hf, a);
- assert(c.bucket_count() == 4);
+ LIBCPP_ASSERT(c.bucket_count() == 4);
assert(c.hash_function() == hf);
assert(!(c.hash_function() == HF()));
assert(c.key_eq() == Comp ());
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index f219073cffcb..b7557c437181 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -56,7 +58,7 @@ int main()
A(4)
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -74,8 +76,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -146,8 +148,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -182,7 +184,7 @@ int main()
A()
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -200,8 +202,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
index 2835cd444c30..3e42305309fd 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -87,8 +88,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
index 52d08f3e2293..658bb93e2b1a 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -57,7 +59,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -75,8 +77,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -110,7 +112,7 @@ int main()
A(10)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -120,8 +122,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -155,7 +157,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -165,8 +167,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -201,26 +203,18 @@ int main()
A()
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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.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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -254,7 +248,7 @@ int main()
A()
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -264,8 +258,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
index b38316c37689..1cda95be6eba 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <unordered_set>
-// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <unordered_set>
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
index e6042b0d9123..3ba35d7a548d 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_allocator<int>(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -68,12 +70,12 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
@@ -97,7 +99,7 @@ int main()
other_allocator<int>(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -115,13 +117,11 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == other_allocator<int>(-2));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
@@ -145,7 +145,7 @@ int main()
min_allocator<int>()
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -163,8 +163,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
index 5e24f7257252..2c018e07734e 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy_alloc.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_allocator<int>(10)
);
C c(c0, test_allocator<int>(5));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -68,8 +70,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(5));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -97,7 +99,7 @@ int main()
min_allocator<int>()
);
C c(c0, min_allocator<int>());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
C::const_iterator i = c.cbegin();
assert(*i == 1);
@@ -115,8 +117,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
index 02aee58525ee..4b4487f00106 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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>()));
@@ -96,7 +97,7 @@ int main()
}
{
std::unordered_multiset<int> c = {};
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
index 733484510ef1..62fe51e29903 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -54,11 +55,11 @@ int main()
}
{
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
index a43f94ca2af3..6fa52a794907 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/hash_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <unordered_set>
-// Check that std::unordered_multiset fails to instantiate if the hash function is
+// Check that std::unordered_multiset fails to instantiate if the hash function is
// not copy-constructible. This is mentioned in LWG issue 2436
#include <unordered_set>
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
index 53a9003b0173..ced52b5e6b46 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -52,8 +54,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -83,12 +85,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int T;
typedef test_hash<std::hash<T>> HF;
@@ -117,8 +119,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -152,8 +154,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
index e5934acc8e7c..845139f98d9c 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -45,7 +47,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -55,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -78,7 +80,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -88,8 +90,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
index 86253214af9c..4dc78bd261cb 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -47,7 +49,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -57,8 +59,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -81,7 +83,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -91,8 +93,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
index 47469c0c5b9b..f331208596b7 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -48,7 +50,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -58,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -83,7 +85,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -93,8 +95,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
index d72ee6f33f50..17f064f46280 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -49,7 +51,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<int>(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -59,8 +61,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -85,7 +87,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<int>()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -95,8 +97,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
index defd90f408b0..9fbb773a463f 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_set>
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
@@ -19,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -27,37 +31,26 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_multiset<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_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),
test_allocator<int>(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == test_allocator<int>(10));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -86,7 +79,7 @@ int main()
test_allocator<int>(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -96,44 +89,33 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c0.empty());
}
-#if TEST_STD_VER >= 11
{
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);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -162,7 +144,7 @@ int main()
min_allocator<int>()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -172,14 +154,13 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c0.empty());
}
-#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_multiset<int> s1 = {1, 2, 3};
@@ -191,5 +172,4 @@ int main()
assert(s2.size() == 2);
}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
index 45b4c8b4f5d5..bc804b42e22d 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -70,8 +72,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(12));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -101,7 +103,7 @@ int main()
A(10)
);
C c(std::move(c0), A(10));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -111,8 +113,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -145,24 +147,16 @@ int main()
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.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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -192,7 +186,7 @@ int main()
A()
);
C c(std::move(c0), A());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -202,8 +196,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
index fbd6df14c052..ac0a10a4b0ea 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -56,7 +57,7 @@ int main()
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
index e84ffb7b2fde..e44be18fa3b4 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,17 +44,17 @@ int main()
{
{
typedef std::unordered_multiset<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
index 12679ef3e13e..a2ee746791d3 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
@@ -19,7 +19,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -55,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -88,12 +90,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int T;
typedef test_hash<std::hash<T>> HF;
@@ -122,8 +124,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -157,8 +159,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
index c9454cf630db..f09f9c860bd9 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -48,7 +50,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -58,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -83,7 +85,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -93,8 +95,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
index 5ff61575d994..167216bf6be4 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -50,7 +52,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -60,8 +62,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -86,7 +88,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -96,8 +98,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
index ecf3176e90a4..8720f59a8fdf 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -51,7 +53,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -61,8 +63,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -88,7 +90,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -98,8 +100,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
index 18a092c83f6a..3373dd0d4c5e 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -53,7 +55,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<int>(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -63,8 +65,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -91,7 +93,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<int>()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 6);
assert(c.count(1) == 2);
assert(c.count(2) == 2);
@@ -101,8 +103,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
index 215b31fef65f..c3056d2f90f5 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.fail.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
index 38211f958c43..c6f12e9ac8c1 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
index baeabd1b2d08..10d48b73e7e4 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -35,7 +36,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -55,7 +56,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
index 380f36df7bf2..6b545a1da3ba 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -36,7 +37,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -57,7 +58,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
index 149d045e07a9..5c87a3a20dd3 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/size_hash_equal_allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -37,7 +38,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
test_allocator<std::pair<const NotConstructible, NotConstructible> >(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>(10)));
@@ -59,7 +60,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
min_allocator<std::pair<const NotConstructible, NotConstructible> >()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
index df9f18b147e3..c221b6f2edb0 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp
@@ -26,6 +26,7 @@
// This tests a conforming extension
#include <unordered_set>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -122,79 +123,65 @@ int main()
{
{
typedef std::unordered_multiset<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_multiset<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
index 4b1c129508e1..d4efb6868026 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
@@ -17,7 +17,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -31,27 +33,27 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -71,12 +73,12 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -88,18 +90,18 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -117,21 +119,21 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -139,9 +141,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -170,12 +172,12 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -187,12 +189,12 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -200,9 +202,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +219,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +259,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -270,17 +272,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +305,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -321,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +358,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -369,11 +371,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -382,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -398,22 +400,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -438,7 +440,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -451,17 +453,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -484,16 +486,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -502,8 +504,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -537,7 +539,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -550,11 +552,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 7);
+ assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
assert(c2.count(1) == 2);
assert(c2.count(2) == 2);
@@ -563,8 +565,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.set/bucket.pass.cpp b/test/std/containers/unord/unord.set/bucket.pass.cpp
index 9b704ccee0c0..3903d96c1967 100644
--- a/test/std/containers/unord/unord.set/bucket.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -42,7 +43,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 5);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#if TEST_STD_VER >= 11
{
@@ -61,7 +62,7 @@ int main()
size_t bc = c.bucket_count();
assert(bc >= 5);
for (size_t i = 0; i < 13; ++i)
- assert(c.bucket(i) == i % bc);
+ LIBCPP_ASSERT(c.bucket(i) == i % bc);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.set/bucket_count.pass.cpp b/test/std/containers/unord/unord.set/bucket_count.pass.cpp
index e35e43615dd3..6f1f526abaf6 100644
--- a/test/std/containers/unord/unord.set/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket_count.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -27,7 +28,7 @@ int main()
typedef C::const_iterator I;
typedef int P;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_set<int> C;
@@ -45,7 +46,7 @@ int main()
P(80)
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#if TEST_STD_VER >= 11
{
@@ -53,7 +54,7 @@ int main()
typedef C::const_iterator I;
typedef int P;
const C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
}
{
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
@@ -71,7 +72,7 @@ int main()
P(80)
};
const C c(std::begin(a), std::end(a));
- assert(c.bucket_count() >= 11);
+ assert(c.bucket_count() >= 8);
}
#endif
}
diff --git a/test/std/containers/unord/unord.set/bucket_size.pass.cpp b/test/std/containers/unord/unord.set/bucket_size.pass.cpp
index 2ae618c85e5b..10dc099ea2db 100644
--- a/test/std/containers/unord/unord.set/bucket_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/bucket_size.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -40,11 +41,11 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
}
#if TEST_STD_VER >= 11
{
@@ -61,11 +62,11 @@ int main()
};
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);
+ LIBCPP_ASSERT(c.bucket_size(0) == 0);
+ LIBCPP_ASSERT(c.bucket_size(1) == 1);
+ LIBCPP_ASSERT(c.bucket_size(2) == 1);
+ LIBCPP_ASSERT(c.bucket_size(3) == 1);
+ LIBCPP_ASSERT(c.bucket_size(4) == 1);
}
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
diff --git a/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
index c78eb138fd90..b584dbb2b300 100644
--- a/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.set/erase_const_iter.pass.cpp
@@ -45,7 +45,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
+
assert(c.size() == 3);
assert(c.count(1) == 1);
assert(c.count(3) == 1);
@@ -66,7 +70,11 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
+ C::const_iterator i_next = i;
+ ++i_next;
C::iterator j = c.erase(i);
+ assert(j == i_next);
+
assert(c.size() == 3);
assert(c.count(1) == 1);
assert(c.count(3) == 1);
diff --git a/test/std/containers/unord/unord.set/iterators.pass.cpp b/test/std/containers/unord/unord.set/iterators.pass.cpp
index 494411854977..9c780e10980a 100644
--- a/test/std/containers/unord/unord.set/iterators.pass.cpp
+++ b/test/std/containers/unord/unord.set/iterators.pass.cpp
@@ -22,7 +22,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -42,8 +44,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -61,8 +63,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#if TEST_STD_VER >= 11
@@ -82,8 +84,8 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::iterator i;
}
{
@@ -102,12 +104,12 @@ int main()
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());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
C::const_iterator i;
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // N3644 testing
typedef std::unordered_set<int> C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/containers/unord/unord.set/max_size.pass.cpp b/test/std/containers/unord/unord.set/max_size.pass.cpp
index 3135ad994737..1b902660d48f 100644
--- a/test/std/containers/unord/unord.set/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/max_size.pass.cpp
@@ -9,28 +9,42 @@
// <unordered_set>
-// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
-// class Alloc = allocator<Value>>
// class unordered_set
// size_type max_size() const;
-#include <unordered_set>
#include <cassert>
+#include <limits>
+#include <type_traits>
+#include <unordered_set>
-#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
int main()
{
{
- std::unordered_set<int> u;
- assert(u.max_size() > 0);
+ typedef limited_allocator<int, 10> A;
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
+ C c;
+ assert(c.max_size() <= 10);
+ LIBCPP_ASSERT(c.max_size() == 10);
+ }
+ {
+ typedef limited_allocator<int, (size_t)-1> A;
+ typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ LIBCPP_ASSERT(c.max_size() == max_dist);
}
-#if TEST_STD_VER >= 11
{
- std::unordered_set<int, std::hash<int>,
- std::equal_to<int>, min_allocator<int>> u;
- assert(u.max_size() > 0);
+ typedef std::unordered_set<char> C;
+ const C::difference_type max_dist =
+ std::numeric_limits<C::difference_type>::max();
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
-#endif
}
diff --git a/test/std/containers/unord/unord.set/rehash.pass.cpp b/test/std/containers/unord/unord.set/rehash.pass.cpp
index a4d4d3fbf02c..fd689bfd9dfa 100644
--- a/test/std/containers/unord/unord.set/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.set/rehash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -55,16 +56,16 @@ int main()
assert(c.bucket_count() >= 5);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#if TEST_STD_VER >= 11
@@ -86,16 +87,16 @@ int main()
assert(c.bucket_count() >= 5);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
rehash_postcondition(c, 3);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
test(c);
c.rehash(31);
rehash_postcondition(c, 31);
- assert(c.bucket_count() == 31);
+ LIBCPP_ASSERT(c.bucket_count() == 31);
test(c);
}
#endif
diff --git a/test/std/containers/unord/unord.set/reserve.pass.cpp b/test/std/containers/unord/unord.set/reserve.pass.cpp
index 4bd5332f0796..c48a72560088 100644
--- a/test/std/containers/unord/unord.set/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.set/reserve.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -63,7 +64,7 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.reserve(3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.reserve(3);
@@ -91,7 +92,7 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.reserve(3);
- assert(c.bucket_count() == 5);
+ LIBCPP_ASSERT(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.reserve(3);
diff --git a/test/std/containers/unord/unord.set/swap_member.pass.cpp b/test/std/containers/unord/unord.set/swap_member.pass.cpp
index 5ddb2d00daef..ea88c53a526c 100644
--- a/test/std/containers/unord/unord.set/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.set/swap_member.pass.cpp
@@ -17,7 +17,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../test_compare.h"
#include "../../test_hash.h"
#include "test_allocator.h"
@@ -31,27 +33,27 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_set<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -71,12 +73,12 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -88,18 +90,18 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -117,21 +119,21 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -139,9 +141,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -170,12 +172,12 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -187,12 +189,12 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -200,9 +202,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +219,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +259,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -270,17 +272,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +305,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -321,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +358,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -369,11 +371,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -382,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -398,22 +400,22 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -438,7 +440,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -451,17 +453,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -484,16 +486,16 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -502,8 +504,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -537,7 +539,7 @@ int main()
c2.max_load_factor(2);
c1.swap(c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -550,11 +552,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -563,8 +565,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
index d0b03b2cd0b8..9cd03809d784 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c(test_allocator<NotConstructible>(10));
- assert(c.bucket_count() == 0);
+ LIBCPP_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() == test_allocator<NotConstructible>(10));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c(min_allocator<NotConstructible>{});
- assert(c.bucket_count() == 0);
+ LIBCPP_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>());
@@ -61,7 +62,7 @@ int main()
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef NotConstructible T;
typedef test_hash<std::hash<T>> HF;
@@ -71,7 +72,7 @@ int main()
A a(43);
C c(3, a);
- assert(c.bucket_count() == 3);
+ LIBCPP_ASSERT(c.bucket_count() == 3);
assert(c.hash_function() == HF());
assert(c.key_eq() == Comp ());
assert(c.get_allocator() == a);
@@ -92,7 +93,7 @@ int main()
HF hf(42);
A a(43);
C c(4, hf, a);
- assert(c.bucket_count() == 4);
+ LIBCPP_ASSERT(c.bucket_count() == 4);
assert(c.hash_function() == hf);
assert(!(c.hash_function() == HF()));
assert(c.key_eq() == Comp ());
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index 05cb0525eb79..0859d8edc85e 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -56,7 +58,7 @@ int main()
A(4)
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -66,8 +68,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -129,8 +131,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -165,7 +167,7 @@ int main()
A()
);
c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -175,8 +177,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
index a99e74af5943..2db01a21eaac 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -54,8 +55,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -87,8 +88,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index d8732268b85f..78a376335c3f 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -57,7 +59,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -67,8 +69,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(4));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -102,7 +104,7 @@ int main()
A(10)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -112,8 +114,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -147,7 +149,7 @@ int main()
A(4)
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -157,8 +159,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -193,7 +195,7 @@ int main()
A()
);
c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -203,8 +205,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
index 6b675f00f16b..79782550d0fe 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <unordered_set>
-// Check that std::unordered_set fails to instantiate if the comparison predicate is
+// Check that std::unordered_set fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <unordered_set>
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
index 07278be79e57..06dcc552db0f 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_allocator<int>(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -60,12 +62,12 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
@@ -89,7 +91,7 @@ int main()
other_allocator<int>(10)
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -99,13 +101,11 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == other_allocator<int>(-2));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#if TEST_STD_VER >= 11
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
@@ -129,7 +129,7 @@ int main()
min_allocator<int>()
);
C c = c0;
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -139,8 +139,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
index 59f4bfabd582..538e349602c4 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/copy_alloc.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -50,7 +52,7 @@ int main()
test_allocator<int>(10)
);
C c(c0, test_allocator<int>(5));
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -60,8 +62,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(5));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -89,7 +91,7 @@ int main()
min_allocator<int>()
);
C c(c0, min_allocator<int>());
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -99,8 +101,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
index 7684277195ad..81ad16b7244b 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c;
- assert(c.bucket_count() == 0);
+ LIBCPP_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>()));
@@ -96,7 +97,7 @@ int main()
}
{
std::unordered_set<int> c = {};
- assert(c.bucket_count() == 0);
+ LIBCPP_ASSERT(c.bucket_count() == 0);
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
index b6837ccaec8d..82e184b8d3ea 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -54,11 +55,11 @@ int main()
}
{
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
index 066f160a2586..9e135e2c141e 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/hash_copy_constructible.fail.cpp
@@ -9,7 +9,7 @@
// <unordered_map>
-// Check that std::unordered_set fails to instantiate if the hash function is
+// Check that std::unordered_set fails to instantiate if the hash function is
// not copy-constructible. This is mentioned in LWG issue 2436
#include <unordered_set>
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
index 3fd0c3926c0b..eea61c7ab46c 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -18,7 +18,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -52,8 +54,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -83,12 +85,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int T;
typedef test_hash<std::hash<T>> HF;
@@ -117,8 +119,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -152,8 +154,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
index b7eed1e5b253..95baa3df2852 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp
@@ -19,7 +19,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -45,7 +47,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -55,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -78,7 +80,7 @@ int main()
},
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -88,8 +90,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
index 735babd522b3..108d67b66b22 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -47,7 +49,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -57,8 +59,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -81,7 +83,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -91,8 +93,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
index 643a57fa99ca..5cb4d499a937 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -48,7 +50,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -58,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -83,7 +85,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -93,8 +95,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
index 72b9ed2a1de0..7c1cbc8667de 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -49,7 +51,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<int>(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -59,8 +61,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -85,7 +87,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<int>()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -95,8 +97,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
index e865986337c4..0910bf15f8e4 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <unordered_set>
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
@@ -19,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -27,37 +31,26 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_set<int,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_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),
test_allocator<int>(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == test_allocator<int>(10));
assert(c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -86,7 +79,7 @@ int main()
test_allocator<int>(10)
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -96,44 +89,33 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c0.empty());
}
-#if TEST_STD_VER >= 11
{
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);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
@@ -162,7 +144,7 @@ int main()
min_allocator<int>()
);
C c = std::move(c0);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -172,14 +154,13 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
assert(c0.empty());
}
-#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_set<int> s1 = {1, 2, 3};
@@ -191,5 +172,4 @@ int main()
assert(s2.size() == 2);
}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
index 2342bbc130be..4d2830b3a808 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp
@@ -19,6 +19,7 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -62,8 +63,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(12));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -103,8 +104,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == A(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
@@ -145,8 +146,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
index 45f18dbbcb5c..b89d68002477 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -56,7 +57,7 @@ int main()
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_assignable<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
index b4046148bc79..7190a01208f0 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "test_allocator.h"
@@ -43,17 +44,17 @@ int main()
{
{
typedef std::unordered_set<MoveOnly> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- static_assert(std::is_nothrow_move_constructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible<C>::value, "");
}
{
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
index c978d8d5d8a4..5bcc288aacbd 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
@@ -19,7 +19,9 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -55,8 +57,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -88,12 +90,12 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef int T;
typedef test_hash<std::hash<T>> HF;
@@ -122,8 +124,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
@@ -157,8 +159,8 @@ int main()
assert(c.get_allocator() == a);
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(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);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
index b87d5615e00e..8900cafc4852 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size.pass.cpp
@@ -20,7 +20,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -48,7 +50,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -58,8 +60,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -83,7 +85,7 @@ int main()
C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0])),
7
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -93,8 +95,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
index 7234d8a80aec..315ded7a0df8 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -50,7 +52,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -60,8 +62,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >());
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -86,7 +88,7 @@ int main()
7,
test_hash<std::hash<int> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -96,8 +98,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
index bcf3058aa835..3f5c829f726e 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal.pass.cpp
@@ -21,7 +21,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -51,7 +53,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -61,8 +63,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>());
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -88,7 +90,7 @@ int main()
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -98,8 +100,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
index ad9b414d7f13..f0d063d2cca8 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range_size_hash_equal_allocator.pass.cpp
@@ -22,7 +22,9 @@
#include <cassert>
#include <cfloat>
#include <cmath>
+#include <cstddef>
+#include "test_macros.h"
#include "test_iterators.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -53,7 +55,7 @@ int main()
test_compare<std::equal_to<int> >(9),
test_allocator<int>(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -63,8 +65,8 @@ int main()
assert(c.key_eq() == test_compare<std::equal_to<int> >(9));
assert(c.get_allocator() == test_allocator<int>(10));
assert(!c.empty());
- assert(std::distance(c.begin(), c.end()) == c.size());
- assert(std::distance(c.cbegin(), c.cend()) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
@@ -91,7 +93,7 @@ int main()
test_compare<std::equal_to<int> >(9),
min_allocator<int>()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_ASSERT(c.bucket_count() == 7);
assert(c.size() == 4);
assert(c.count(1) == 1);
assert(c.count(2) == 1);
@@ -101,8 +103,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size());
+ assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size());
assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
assert(c.max_load_factor() == 1);
}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
index 389c54c58cde..b1ee87f8f7c0 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size.fail.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -32,7 +33,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c = 7;
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
index 88e499773bf3..5b5e861cde42 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -33,7 +34,7 @@ int main()
test_allocator<NotConstructible>
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -51,7 +52,7 @@ int main()
min_allocator<NotConstructible>
> C;
C c(7);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
index eb98dcc7b7e4..5c77839ffa60 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -35,7 +36,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -55,7 +56,7 @@ int main()
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
index 4ae012038ae5..db49bd0e7a9c 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -36,7 +37,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>()));
@@ -57,7 +58,7 @@ int main()
test_hash<std::hash<NotConstructible> >(8),
test_compare<std::equal_to<NotConstructible> >(9)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
index b2ddbe94e741..3958ce4679c3 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/size_hash_equal_allocator.pass.cpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
@@ -37,7 +38,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
test_allocator<NotConstructible>(10)
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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() == (test_allocator<NotConstructible>(10)));
@@ -59,7 +60,7 @@ int main()
test_compare<std::equal_to<NotConstructible> >(9),
min_allocator<NotConstructible>()
);
- assert(c.bucket_count() == 7);
+ LIBCPP_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>()));
diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
index d35d79b31266..4a16ddd3f4ce 100644
--- a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp
@@ -26,6 +26,7 @@
// This tests a conforming extension
#include <unordered_set>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -122,79 +123,65 @@ int main()
{
{
typedef std::unordered_set<MoveOnly> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::unordered_set<MoveOnly, std::hash<MoveOnly>,
some_comp<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, throwable swap for comp
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert(!noexcept(swap(c1, c2)), "");
+ static_assert(!noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ static_assert( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
typedef std::unordered_set<MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
- C c1, c2;
- static_assert( noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
#endif
}
diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
index 2755b5285027..c2bd75960d5b 100644
--- a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp
@@ -17,7 +17,9 @@
#include <unordered_set>
#include <cassert>
+#include <cstddef>
+#include "test_macros.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
@@ -31,27 +33,27 @@ int main()
typedef test_allocator<int> Alloc;
typedef std::unordered_set<int, Hash, Compare, Alloc> C;
typedef int P;
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -71,12 +73,12 @@ int main()
P(70),
P(80)
};
- C c1(0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -88,18 +90,18 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -117,21 +119,21 @@ int main()
P(1),
P(2)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -139,9 +141,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -170,12 +172,12 @@ int main()
P(70),
P(80)
};
- C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
- C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
+ C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
+ C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -187,12 +189,12 @@ int main()
assert(*c1.find(80) == 80);
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
- assert(c1.get_allocator() == Alloc(1));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(c1.get_allocator().get_id() == 1);
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -200,9 +202,9 @@ int main()
assert(c2.count(4) == 1);
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
- assert(c2.get_allocator() == Alloc(2));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(c2.get_allocator().get_id() == 2);
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
@@ -217,22 +219,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -257,7 +259,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -270,17 +272,17 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -303,16 +305,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -321,8 +323,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -356,7 +358,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -369,11 +371,11 @@ int main()
assert(c1.hash_function() == Hash(2));
assert(c1.key_eq() == Compare(2));
assert(c1.get_allocator() == Alloc(2));
- assert(std::distance(c1.begin(), c1.end()) == c1.size());
- assert(std::distance(c1.cbegin(), c1.cend()) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -382,8 +384,8 @@ int main()
assert(c2.hash_function() == Hash(1));
assert(c2.key_eq() == Compare(1));
assert(c2.get_allocator() == Alloc(1));
- assert(std::distance(c2.begin(), c2.end()) == c2.size());
- assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
@@ -398,22 +400,22 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -438,7 +440,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -451,17 +453,17 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -484,16 +486,16 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() == 0);
+ LIBCPP_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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -502,8 +504,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
{
@@ -537,7 +539,7 @@ int main()
c2.max_load_factor(2);
swap(c1, c2);
- assert(c1.bucket_count() >= 11);
+ assert(c1.bucket_count() >= 8);
assert(c1.size() == 8);
assert(*c1.find(10) == 10);
assert(*c1.find(20) == 20);
@@ -550,11 +552,11 @@ int main()
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(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
+ assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
assert(c1.max_load_factor() == 2);
- assert(c2.bucket_count() >= 5);
+ assert(c2.bucket_count() >= 4);
assert(c2.size() == 4);
assert(c2.count(1) == 1);
assert(c2.count(2) == 1);
@@ -563,8 +565,8 @@ int main()
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(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
+ assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
assert(c2.max_load_factor() == 1);
}
#endif