aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt31
-rw-r--r--test/libcxx/algorithms/debug_less.pass.cpp167
-rw-r--r--test/libcxx/atomics/atomics.align/align.pass.sh.cpp93
-rw-r--r--test/libcxx/atomics/libcpp-has-no-threads.fail.cpp1
-rw-r--r--test/libcxx/compiler.py195
-rw-r--r--test/libcxx/containers/sequences/deque/incomplete.pass.cpp1
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp33
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp33
-rw-r--r--test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp59
-rw-r--r--test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp36
-rw-r--r--test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp36
-rw-r--r--test/libcxx/containers/sequences/vector/asan.pass.cpp8
-rw-r--r--test/libcxx/containers/sequences/vector/asan_throw.pass.cpp4
-rw-r--r--test/libcxx/debug/containers/db_associative_container_tests.pass.cpp64
-rw-r--r--test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp265
-rw-r--r--test/libcxx/debug/containers/db_string.pass.cpp96
-rw-r--r--test/libcxx/debug/containers/db_unord_container_tests.pass.cpp66
-rw-r--r--test/libcxx/debug/debug_abort.pass.cpp30
-rw-r--r--test/libcxx/debug/debug_throw.pass.cpp36
-rw-r--r--test/libcxx/debug/debug_throw_register.pass.cpp (renamed from test/libcxx/containers/sequences/list/db_back.pass.cpp)26
-rw-r--r--test/libcxx/depr/depr.c.headers/ciso646.pass.cpp (renamed from test/std/utilities/utility/forward/forward1.fail.cpp)14
-rw-r--r--test/libcxx/depr/depr.c.headers/complex.h.pass.cpp (renamed from test/std/utilities/utility/forward/forward3.fail.cpp)15
-rw-r--r--test/libcxx/depr/depr.c.headers/locale_h.pass.cpp20
-rw-r--r--test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp23
-rw-r--r--test/libcxx/double_include.sh.cpp89
-rw-r--r--test/libcxx/experimental/any/small_type.pass.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp7
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp19
-rw-r--r--test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp74
-rw-r--r--test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp70
-rw-r--r--test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp5
-rw-r--r--test/libcxx/iterators/trivial_iterators.pass.cpp4
-rw-r--r--test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp77
-rw-r--r--test/libcxx/libcpp_version.pass.cpp28
-rw-r--r--test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp4
-rw-r--r--test/libcxx/modules/cinttypes_exports.sh.cpp21
-rw-r--r--test/libcxx/modules/clocale_exports.sh.cpp24
-rw-r--r--test/libcxx/modules/cstdint_exports.sh.cpp (renamed from test/std/utilities/utility/forward/forward2.fail.cpp)18
-rw-r--r--test/libcxx/modules/inttypes_h_exports.sh.cpp20
-rw-r--r--test/libcxx/modules/stdint_h_exports.sh.cpp20
-rw-r--r--test/libcxx/numerics/c.math/constexpr-fns.pass.cpp32
-rw-r--r--test/libcxx/numerics/c.math/ctgmath.pass.cpp24
-rw-r--r--test/libcxx/numerics/c.math/tgmath_h.pass.cpp20
-rw-r--r--test/libcxx/numerics/c.math/version_cmath.pass.cpp (renamed from test/std/numerics/c.math/version_cmath.pass.cpp)0
-rw-r--r--test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp21
-rw-r--r--test/libcxx/strings/iterators.exceptions.pass.cpp24
-rw-r--r--test/libcxx/strings/iterators.noexcept.pass.cpp1
-rw-r--r--test/libcxx/test/config.py216
-rw-r--r--test/libcxx/test/format.py103
-rw-r--r--test/libcxx/test/target_info.py5
-rw-r--r--test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp2
-rw-r--r--test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp1
-rw-r--r--test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp2
-rw-r--r--test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp2
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp1
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp1
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp1
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp1
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp2
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp2
-rw-r--r--test/libcxx/utilities/any/size_and_alignment.pass.cpp23
-rw-r--r--test/libcxx/utilities/any/small_type.pass.cpp114
-rw-r--r--test/libcxx/utilities/any/version.pass.cpp (renamed from test/std/utilities/utility/forward/forward6.fail.cpp)12
-rw-r--r--test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp3
-rw-r--r--test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp74
-rw-r--r--test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp71
-rw-r--r--test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp59
-rw-r--r--test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp60
-rw-r--r--test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp66
-rw-r--r--test/libcxx/utilities/optional/version.pass.cpp20
-rw-r--r--test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp33
-rw-r--r--test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.pass.cpp71
-rw-r--r--test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp108
-rw-r--r--test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp117
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp131
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp208
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp197
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp120
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp153
-rw-r--r--test/libcxx/utilities/variant/version.pass.cpp20
-rw-r--r--test/lit.cfg9
-rw-r--r--test/lit.site.cfg.in6
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp2
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp2
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp2
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp112
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp41
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.pass.cpp160
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.stable.pass.cpp55
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp8
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp8
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp10
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp35
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp8
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp9
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp80
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp79
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp18
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp6
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp2
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp8
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp9
-rw-r--r--test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp9
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp9
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp11
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp11
-rw-r--r--test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp3
-rw-r--r--test/std/atomics/atomics.flag/default.pass.cpp4
-rw-r--r--test/std/atomics/atomics.types.generic/address.pass.cpp4
-rw-r--r--test/std/atomics/atomics.types.generic/bool.pass.cpp4
-rw-r--r--test/std/atomics/atomics.types.generic/integral.pass.cpp6
-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
-rw-r--r--test/std/depr/depr.c.headers/ciso646.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/complex.h.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/inttypes_h.pass.cpp86
-rw-r--r--test/std/depr/depr.c.headers/stdlib_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/tgmath_h.pass.cpp4
-rw-r--r--test/std/diagnostics/syserr/is_error_code_enum.pass.cpp51
-rw-r--r--test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp51
-rw-r--r--test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp2
-rw-r--r--test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp44
-rw-r--r--test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp5
-rw-r--r--test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp18
-rw-r--r--test/std/experimental/any/any.class/any.assign/copy.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.assign/move.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.assign/value.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/copy.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/default.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/move.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.cons/value.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.observers/empty.pass.cpp2
-rw-r--r--test/std/experimental/any/any.class/any.observers/type.pass.cpp2
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp2
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp5
-rw-r--r--test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp7
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp83
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp71
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp18
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp116
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp39
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp8
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp2
-rw-r--r--test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp6
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp77
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp30
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp15
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp25
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp29
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp6
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp1
-rw-r--r--test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp19
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp9
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp4
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp2
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp2
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp5
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp4
-rw-r--r--test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp4
-rw-r--r--test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp4
-rw-r--r--test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp15
-rw-r--r--test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp15
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp132
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp24
-rw-r--r--test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp131
-rw-r--r--test/std/experimental/optional/optional.nullops/less_equal.pass.cpp4
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp19
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp18
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp23
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp23
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp6
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp34
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp7
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp3
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp5
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp18
-rw-r--r--test/std/experimental/optional/optional.specalg/swap.pass.cpp9
-rw-r--r--test/std/experimental/string.view/string.view.access/data.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.access/index.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.cons/default.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp8
-rw-r--r--test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.iterators/begin.pass.cpp2
-rw-r--r--test/std/experimental/string.view/string.view.iterators/end.pass.cpp9
-rw-r--r--test/std/experimental/string.view/string.view.iterators/rend.pass.cpp7
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp4
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp3
-rw-r--r--test/std/experimental/string.view/string.view.ops/substr.pass.cpp1
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp40
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp48
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp37
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp50
-rw-r--r--test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp49
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp68
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp68
-rw-r--r--test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp41
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp1
-rw-r--r--test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp2
-rw-r--r--test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp1
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp32
-rw-r--r--test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp3
-rw-r--r--test/std/input.output/file.streams/c.files/cinttypes.pass.cpp86
-rw-r--r--test/std/input.output/file.streams/c.files/cstdio.pass.cpp4
-rw-r--r--test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp4
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp18
-rw-r--r--test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp18
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp12
-rw-r--r--test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp12
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp21
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp10
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp6
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp5
-rw-r--r--test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp1
-rw-r--r--test/std/input.output/iostream.forward/iosfwd.pass.cpp231
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp5
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp8
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp9
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp6
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp5
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp6
-rw-r--r--test/std/input.output/iostreams.base/is_error_code_enum_io_errc.pass.cpp25
-rw-r--r--test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp4
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp8
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp4
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp8
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp4
-rw-r--r--test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp8
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp2
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp2
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp3
-rw-r--r--test/std/iterators/iterator.range/begin-end.fail.cpp4
-rw-r--r--test/std/iterators/iterator.range/begin-end.pass.cpp19
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp12
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp12
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp9
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp44
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp15
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp37
-rw-r--r--test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp13
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp13
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp18
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp19
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp18
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp18
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp19
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp18
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp14
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp18
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp16
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp11
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp17
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp32
-rw-r--r--test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp18
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp4
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp31
-rw-r--r--test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp15
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp22
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp22
-rw-r--r--test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp22
-rw-r--r--test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp1
-rw-r--r--test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/align_val_t.pass.cpp34
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp89
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp80
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp82
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp83
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp85
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp5
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp14
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp13
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp6
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp90
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp6
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp80
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp82
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp84
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp85
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp13
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp6
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp8
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp14
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp15
-rw-r--r--test/std/language.support/support.exception/except.nested/assign.pass.cpp5
-rw-r--r--test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp5
-rw-r--r--test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp5
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp6
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/propagation/current_exception.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp2
-rw-r--r--test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp2
-rw-r--r--test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp15
-rw-r--r--test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp6
-rw-r--r--test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp15
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp2
-rw-r--r--test/std/language.support/support.runtime/cstdlib.pass.cpp2
-rw-r--r--test/std/language.support/support.types/nullptr_t.pass.cpp25
-rw-r--r--test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp7
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp13
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp30
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp33
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp32
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp37
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp21
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp18
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp13
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp21
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp29
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp27
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp14
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp37
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp12
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp13
-rw-r--r--test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp14
-rw-r--r--test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp2
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp3
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp1
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp4
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp9
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp1
-rw-r--r--test/std/localization/locales/locale.global.templates/use_facet.pass.cpp6
-rw-r--r--test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp5
-rw-r--r--test/std/localization/locales/locale/locale.members/combine.pass.cpp5
-rw-r--r--test/std/numerics/c.math/ctgmath.pass.cpp5
-rw-r--r--test/std/numerics/c.math/tgmath_h.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/cmplx.over/UDT_is_rejected.fail.cpp74
-rw-r--r--test/std/numerics/complex.number/cmplx.over/arg.pass.cpp2
-rw-r--r--test/std/numerics/complex.number/cmplx.over/imag.pass.cpp5
-rw-r--r--test/std/numerics/complex.number/cmplx.over/norm.pass.cpp2
-rw-r--r--test/std/numerics/complex.number/cmplx.over/real.pass.cpp5
-rw-r--r--test/std/numerics/complex.number/complex.members/real_imag.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp4
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp1
-rw-r--r--test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp1
-rw-r--r--test/std/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp1
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.access/access.pass.cpp4
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.access/const_access.pass.cpp2
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.assign/value_assign.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/and_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/divide_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/minus_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/or_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/plus_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/times_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cassign/xor_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cons/copy.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp4
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.cons/pointer_size.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.members/resize.pass.cpp7
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.members/swap.pass.cpp21
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp9
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp11
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp5
-rw-r--r--test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp11
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp5
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp5
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp5
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp5
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp21
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.range/end_const.pass.cpp3
-rw-r--r--test/std/numerics/numarray/valarray.range/end_non_const.pass.cpp3
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp132
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp25
-rw-r--r--test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp131
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp9
-rw-r--r--test/std/numerics/rand/rand.device/ctor.pass.cpp5
-rw-r--r--test/std/numerics/rand/rand.device/entropy.pass.cpp1
-rw-r--r--test/std/numerics/rand/rand.device/eval.pass.cpp4
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp5
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp5
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp38
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp16
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp10
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp10
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp8
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp6
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp7
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp44
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp5
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp66
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp12
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp21
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp23
-rw-r--r--test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp3
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp25
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp18
-rw-r--r--test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp4
-rw-r--r--test/std/re/re.alg/re.alg.match/awk.pass.cpp7
-rw-r--r--test/std/re/re.alg/re.alg.match/basic.pass.cpp52
-rw-r--r--test/std/re/re.alg/re.alg.match/ecma.pass.cpp126
-rw-r--r--test/std/re/re.alg/re.alg.match/extended.pass.cpp68
-rw-r--r--test/std/re/re.alg/re.alg.search/awk.pass.cpp72
-rw-r--r--test/std/re/re.alg/re.alg.search/basic.pass.cpp52
-rw-r--r--test/std/re/re.alg/re.alg.search/ecma.pass.cpp64
-rw-r--r--test/std/re/re.alg/re.alg.search/extended.pass.cpp68
-rw-r--r--test/std/re/re.alg/re.alg.search/grep.pass.cpp5
-rw-r--r--test/std/re/re.const/re.matchflag/match_not_null.pass.cpp46
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign.pass.cpp3
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp44
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp2
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp2
-rw-r--r--test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp39
-rw-r--r--test/std/re/re.regex/types.pass.cpp6
-rw-r--r--test/std/re/re.results/re.results.acc/begin_end.pass.cpp3
-rw-r--r--test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp3
-rw-r--r--test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp2
-rw-r--r--test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp2
-rw-r--r--test/std/re/re.traits/value.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.access/at.pass.cpp31
-rw-r--r--test/std/strings/basic.string/string.access/index.pass.cpp4
-rw-r--r--test/std/strings/basic.string/string.capacity/capacity.pass.cpp7
-rw-r--r--test/std/strings/basic.string/string.capacity/max_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp2
-rw-r--r--test/std/strings/basic.string/string.capacity/reserve.pass.cpp19
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size.pass.cpp18
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp18
-rw-r--r--test/std/strings/basic.string/string.cons/T_size_size.pass.cpp186
-rw-r--r--test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp8
-rw-r--r--test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp17
-rw-r--r--test/std/strings/basic.string/string.cons/string_view.fail.cpp23
-rw-r--r--test/std/strings/basic.string/string.cons/string_view.pass.cpp89
-rw-r--r--test/std/strings/basic.string/string.cons/substr.pass.cpp64
-rw-r--r--test/std/strings/basic.string/string.iterators/end.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.iterators/rend.pass.cpp5
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp200
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp26
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp35
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp83
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp195
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp26
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp14
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp35
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp105
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp21
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp43
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp25
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp1842
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp38
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp38
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp43
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp30
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp16
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp6022
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp43
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp15
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp70
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp5993
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp22
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp49
-rw-r--r--test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp17
-rw-r--r--test/std/strings/basic.string/string.require/contiguous.pass.cpp2
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign3.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp1
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stod.pass.cpp23
-rw-r--r--test/std/strings/string.conversions/stof.pass.cpp19
-rw-r--r--test/std/strings/string.conversions/stoi.pass.cpp5
-rw-r--r--test/std/strings/string.conversions/stol.pass.cpp5
-rw-r--r--test/std/strings/string.conversions/stold.pass.cpp25
-rw-r--r--test/std/strings/string.conversions/stoll.pass.cpp5
-rw-r--r--test/std/strings/string.conversions/stoul.pass.cpp5
-rw-r--r--test/std/strings/string.conversions/stoull.pass.cpp5
-rw-r--r--test/std/strings/string.view/nothing_to_do.pass.cpp12
-rw-r--r--test/std/strings/string.view/string.view.access/at.pass.cpp63
-rw-r--r--test/std/strings/string.view/string.view.access/back.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.access/data.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.access/front.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.access/index.pass.cpp53
-rw-r--r--test/std/strings/string.view/string.view.capacity/capacity.pass.cpp89
-rw-r--r--test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp69
-rw-r--r--test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp51
-rw-r--r--test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp62
-rw-r--r--test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp72
-rw-r--r--test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp65
-rw-r--r--test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp72
-rw-r--r--test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp65
-rw-r--r--test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp72
-rw-r--r--test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp65
-rw-r--r--test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp72
-rw-r--r--test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp65
-rw-r--r--test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp70
-rw-r--r--test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp50
-rw-r--r--test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp62
-rw-r--r--test/std/strings/string.view/string.view.cons/default.pass.cpp48
-rw-r--r--test/std/strings/string.view/string.view.cons/from_literal.pass.cpp65
-rw-r--r--test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp83
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string.pass.cpp56
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string1.fail.cpp32
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string2.fail.cpp32
-rw-r--r--test/std/strings/string.view/string.view.find/find_char_size.pass.cpp85
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp85
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp166
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp393
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp148
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp83
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp166
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp393
-rw-r--r--test/std/strings/string.view/string.view.find/find_first_of_string_view_size.pass.cpp148
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp83
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp166
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp393
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp148
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp83
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp166
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp393
-rw-r--r--test/std/strings/string.view/string.view.find/find_last_of_string_view_size.pass.cpp148
-rw-r--r--test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp172
-rw-r--r--test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp394
-rw-r--r--test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp165
-rw-r--r--test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp84
-rw-r--r--test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp172
-rw-r--r--test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp393
-rw-r--r--test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp165
-rw-r--r--test/std/strings/string.view/string.view.hash/string_view.pass.cpp55
-rw-r--r--test/std/strings/string.view/string.view.io/stream_insert.pass.cpp58
-rw-r--r--test/std/strings/string.view/string.view.iterators/begin.pass.cpp79
-rw-r--r--test/std/strings/string.view/string.view.iterators/end.pass.cpp88
-rw-r--r--test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp61
-rw-r--r--test/std/strings/string.view/string.view.iterators/rend.pass.cpp69
-rw-r--r--test/std/strings/string.view/string.view.modifiers/clear.pass.cpp67
-rw-r--r--test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp78
-rw-r--r--test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp78
-rw-r--r--test/std/strings/string.view/string.view.modifiers/swap.pass.cpp76
-rw-r--r--test/std/strings/string.view/string.view.nonmem/quoted.pass.cpp214
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp127
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp452
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp401
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp1352
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp5847
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp122
-rw-r--r--test/std/strings/string.view/string.view.ops/copy.pass.cpp102
-rw-r--r--test/std/strings/string.view/string.view.ops/substr.pass.cpp121
-rw-r--r--test/std/strings/string.view/string.view.synop/nothing_to_do.pass.cpp12
-rw-r--r--test/std/strings/string.view/string.view.template/nothing_to_do.pass.cpp12
-rw-r--r--test/std/thread/futures/futures.async/async.pass.cpp6
-rw-r--r--test/std/thread/futures/futures.future_error/code.pass.cpp14
-rw-r--r--test/std/thread/futures/futures.future_error/what.pass.cpp10
-rw-r--r--test/std/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp6
-rw-r--r--test/std/thread/futures/futures.promise/dtor.pass.cpp11
-rw-r--r--test/std/thread/futures/futures.promise/get_future.pass.cpp5
-rw-r--r--test/std/thread/futures/futures.promise/move_assign.pass.cpp8
-rw-r--r--test/std/thread/futures/futures.promise/move_ctor.pass.cpp8
-rw-r--r--test/std/thread/futures/futures.promise/set_exception.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.promise/set_lvalue.pass.cpp5
-rw-r--r--test/std/thread/futures/futures.promise/set_value_const.pass.cpp11
-rw-r--r--test/std/thread/futures/futures.promise/set_value_void.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp6
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp6
-rw-r--r--test/std/thread/futures/futures.shared_future/get.pass.cpp9
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp7
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp8
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp5
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp15
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp15
-rw-r--r--test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp7
-rw-r--r--test/std/thread/futures/futures.unique_future/get.pass.cpp9
-rw-r--r--test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp75
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp1
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp6
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp20
-rw-r--r--test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp13
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp5
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/types.pass.cpp6
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp48
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp1
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp11
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp3
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp6
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp6
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp9
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp139
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp155
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp156
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp155
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp147
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp139
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp4
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp6
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp7
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp5
-rw-r--r--test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp6
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp4
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp6
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp4
-rw-r--r--test/std/utilities/allocator.adaptor/types.pass.cpp6
-rw-r--r--test/std/utilities/any/any.class/any.assign/copy.pass.cpp197
-rw-r--r--test/std/utilities/any/any.class/any.assign/move.pass.cpp108
-rw-r--r--test/std/utilities/any/any.class/any.assign/value.pass.cpp209
-rw-r--r--test/std/utilities/any/any.class/any.cons/copy.pass.cpp100
-rw-r--r--test/std/utilities/any/any.class/any.cons/default.pass.cpp47
-rw-r--r--test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp194
-rw-r--r--test/std/utilities/any/any.class/any.cons/move.pass.cpp104
-rw-r--r--test/std/utilities/any/any.class/any.cons/value.pass.cpp154
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp262
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp63
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp133
-rw-r--r--test/std/utilities/any/any.class/any.observers/has_value.pass.cpp64
-rw-r--r--test/std/utilities/any/any.class/any.observers/type.pass.cpp41
-rw-r--r--test/std/utilities/any/any.class/not_literal_type.pass.cpp21
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp171
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp313
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp66
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp46
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp58
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp37
-rw-r--r--test/std/utilities/any/any.nonmembers/make_any.pass.cpp140
-rw-r--r--test/std/utilities/any/any.nonmembers/swap.pass.cpp40
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp8
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp26
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp6
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp39
-rw-r--r--test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp28
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.fail.cpp25
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp29
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp15
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp21
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp21
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp25
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp (renamed from test/libcxx/containers/sequences/list/db_cfront.pass.cpp)25
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp24
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp (renamed from test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp)27
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp (renamed from test/libcxx/containers/sequences/list/db_cback.pass.cpp)23
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp60
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp119
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp175
-rw-r--r--test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/refwrap/type_properties.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/unord.hash/enum.pass.cpp7
-rw-r--r--test/std/utilities/function.objects/unord.hash/integral.pass.cpp4
-rw-r--r--test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp38
-rw-r--r--test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp6
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp3
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp3
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp5
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp17
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp10
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp5
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp6
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp20
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp6
-rw-r--r--test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp8
-rw-r--r--test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp38
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp34
-rw-r--r--test/std/utilities/memory/default.allocator/allocator_types.pass.cpp4
-rw-r--r--test/std/utilities/memory/pointer.traits/rebind.pass.cpp4
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp26
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp2
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.pass.cpp47
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp78
-rw-r--r--test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_n.pass.cpp49
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp112
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp116
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp111
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp115
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp13
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp13
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp13
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp13
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp114
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp117
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp3
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp1
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp11
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp6
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp2
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp42
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp42
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp4
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp4
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp2
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp16
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp16
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp3
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp7
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp3
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp6
-rw-r--r--test/std/utilities/meta/meta.help/integral_constant.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp20
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp209
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp11
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/void_t_feature_test_macro.pass.cpp36
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp193
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp4
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp20
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp36
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp2
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp2
-rw-r--r--test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp23
-rw-r--r--test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp25
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp53
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp55
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp55
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp55
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp55
-rw-r--r--test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp53
-rw-r--r--test/std/utilities/optional/optional.hash/hash.pass.cpp48
-rw-r--r--test/std/utilities/optional/optional.nullops/equal.pass.cpp39
-rw-r--r--test/std/utilities/optional/optional.nullops/greater.pass.cpp39
-rw-r--r--test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp39
-rw-r--r--test/std/utilities/optional/optional.nullops/less_equal.pass.cpp40
-rw-r--r--test/std/utilities/optional/optional.nullops/less_than.pass.cpp39
-rw-r--r--test/std/utilities/optional/optional.nullops/not_equal.pass.cpp39
-rw-r--r--test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp25
-rw-r--r--test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp38
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp273
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp254
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp102
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp237
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp113
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp174
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp67
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp268
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp143
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp128
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/const_optional_U.pass.cpp134
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp155
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp81
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/explicit_const_optional_U.pass.cpp121
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/explicit_optional_U.pass.cpp84
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp148
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp116
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp201
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp73
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp93
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp153
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp68
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp61
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp37
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp73
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp69
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp69
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp73
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp37
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp72
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp76
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp73
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const.fail.cpp (renamed from test/libcxx/containers/sequences/list/db_front.pass.cpp)33
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp64
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp64
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp68
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp77
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp72
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp306
-rw-r--r--test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp50
-rw-r--r--test/std/utilities/optional/optional.object/special_member_gen.pass.cpp74
-rw-r--r--test/std/utilities/optional/optional.object/types.pass.cpp38
-rw-r--r--test/std/utilities/optional/optional.relops/equal.pass.cpp74
-rw-r--r--test/std/utilities/optional/optional.relops/greater_equal.pass.cpp70
-rw-r--r--test/std/utilities/optional/optional.relops/greater_than.pass.cpp70
-rw-r--r--test/std/utilities/optional/optional.relops/less_equal.pass.cpp70
-rw-r--r--test/std/utilities/optional/optional.relops/less_than.pass.cpp70
-rw-r--r--test/std/utilities/optional/optional.relops/not_equal.pass.cpp74
-rw-r--r--test/std/utilities/optional/optional.specalg/make_optional.pass.cpp51
-rw-r--r--test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp45
-rw-r--r--test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp53
-rw-r--r--test/std/utilities/optional/optional.specalg/swap.pass.cpp352
-rw-r--r--test/std/utilities/optional/optional.syn/optional_in_place_t.fail.cpp26
-rw-r--r--test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp (renamed from test/std/utilities/utility/forward/forward4.fail.cpp)17
-rw-r--r--test/std/utilities/optional/optional.syn/optional_nullopt_t.fail.cpp29
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp5
-rw-r--r--test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp31
-rw-r--r--test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp31
-rw-r--r--test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp35
-rw-r--r--test/std/utilities/template.bitset/bitset.members/test.pass.cpp31
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp2
-rw-r--r--test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp2
-rw-r--r--test/std/utilities/time/rep.h10
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp6
-rw-r--r--test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp4
-rw-r--r--test/std/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp4
-rw-r--r--test/std/utilities/time/time.point/time.point.cons/convert.pass.cpp4
-rw-r--r--test/std/utilities/time/time.point/time.point.cons/default.pass.cpp3
-rw-r--r--test/std/utilities/time/time.point/time.point.cons/duration.pass.cpp4
-rw-r--r--test/std/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp4
-rw-r--r--test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp17
-rw-r--r--test/std/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp5
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp8
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp26
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp34
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp50
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp69
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR31384.pass.cpp88
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp24
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_pair.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp12
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp18
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp40
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp30
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp35
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp3
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp6
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp26
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp2
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp56
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp62
-rw-r--r--test/std/utilities/utility/exchange/exchange.pass.cpp4
-rw-r--r--test/std/utilities/utility/forward/forward.fail.cpp53
-rw-r--r--test/std/utilities/utility/forward/forward.pass.cpp114
-rw-r--r--test/std/utilities/utility/forward/forward5.fail.cpp25
-rw-r--r--test/std/utilities/utility/forward/forward_03.pass.cpp58
-rw-r--r--test/std/utilities/utility/forward/move.fail.cpp (renamed from test/std/utilities/utility/forward/move_only.pass.cpp)21
-rw-r--r--test/std/utilities/utility/forward/move.pass.cpp121
-rw-r--r--test/std/utilities/utility/forward/move_copy.pass.cpp61
-rw-r--r--test/std/utilities/utility/forward/move_only1.fail.cpp52
-rw-r--r--test/std/utilities/utility/forward/move_only2.fail.cpp52
-rw-r--r--test/std/utilities/utility/forward/move_only3.fail.cpp49
-rw-r--r--test/std/utilities/utility/forward/move_only4.fail.cpp52
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp4
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp4
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp6
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp74
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp101
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp49
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp68
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp6
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp140
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp76
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_first_const_second_cxx03.pass.cpp42
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp149
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V_cxx03.pass.cpp29
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp4
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp16
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp32
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp2
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/not_constexpr_cxx11.fail.cpp57
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp139
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/special_member_generation_test.pass.cpp127
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp4
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp6
-rw-r--r--test/std/utilities/utility/pairs/pairs.spec/comparison.pass.cpp28
-rw-r--r--test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp17
-rw-r--r--test/std/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp4
-rw-r--r--test/std/utilities/utility/utility.inplace/inplace.pass.cpp74
-rw-r--r--test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp37
-rw-r--r--test/std/utilities/variant/variant.general/nothing_to_do.pass.cpp11
-rw-r--r--test/std/utilities/variant/variant.get/get_if_index.pass.cpp132
-rw-r--r--test/std/utilities/variant/variant.get/get_if_type.pass.cpp130
-rw-r--r--test/std/utilities/variant/variant.get/get_index.pass.cpp287
-rw-r--r--test/std/utilities/variant/variant.get/get_type.pass.cpp287
-rw-r--r--test/std/utilities/variant/variant.get/holds_alternative.pass.cpp38
-rw-r--r--test/std/utilities/variant/variant.hash/hash.pass.cpp124
-rw-r--r--test/std/utilities/variant/variant.helpers/variant_alternative.pass.cpp77
-rw-r--r--test/std/utilities/variant/variant.helpers/variant_size.pass.cpp44
-rw-r--r--test/std/utilities/variant/variant.monostate.relops/relops.pass.cpp55
-rw-r--r--test/std/utilities/variant/variant.monostate/monostate.pass.cpp28
-rw-r--r--test/std/utilities/variant/variant.relops/relops.pass.cpp227
-rw-r--r--test/std/utilities/variant/variant.synopsis/variant_npos.pass.cpp21
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp232
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp397
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp319
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp112
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp159
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp112
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp103
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp103
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp113
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp110
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp197
-rw-r--r--test/std/utilities/variant/variant.variant/variant.dtor/dtor.pass.cpp75
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp137
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp85
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp138
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp85
-rw-r--r--test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp58
-rw-r--r--test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp51
-rw-r--r--test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp591
-rw-r--r--test/std/utilities/variant/variant.variant/variant_array.fail.cpp33
-rw-r--r--test/std/utilities/variant/variant.variant/variant_empty.fail.cpp26
-rw-r--r--test/std/utilities/variant/variant.variant/variant_reference.fail.cpp28
-rw-r--r--test/std/utilities/variant/variant.variant/variant_void.fail.cpp33
-rw-r--r--test/std/utilities/variant/variant.visit/visit.pass.cpp291
-rw-r--r--test/support/any_helpers.h163
-rw-r--r--test/support/archetypes.hpp379
-rw-r--r--test/support/archetypes.ipp169
-rw-r--r--test/support/container_test_types.h2
-rw-r--r--test/support/controlled_allocators.hpp502
-rw-r--r--test/support/count_new.hpp26
-rw-r--r--test/support/debug_mode_helper.h382
-rw-r--r--test/support/demangle.h49
-rw-r--r--test/support/experimental_any_helpers.h326
-rw-r--r--test/support/external_threads.cpp10
-rw-r--r--test/support/filesystem_test_helper.hpp1
-rw-r--r--test/support/is_transparent.h4
-rw-r--r--test/support/min_allocator.h38
-rw-r--r--test/support/nasty_containers.hpp104
-rw-r--r--test/support/test.support/test_demangle.pass.cpp38
-rw-r--r--test/support/test.support/test_macros_header_rtti.pass.cpp1
-rw-r--r--test/support/test_allocator.h157
-rw-r--r--test/support/test_iterators.h24
-rw-r--r--test/support/test_macros.h73
-rw-r--r--test/support/test_memory_resource.hpp356
-rw-r--r--test/support/type_id.h52
-rw-r--r--test/support/uses_alloc_types.hpp168
-rw-r--r--test/support/variant_test_helpers.hpp81
-rw-r--r--test/ubsan_blacklist.txt1
1797 files changed, 68403 insertions, 7754 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d47a9e003fc0..edebaee55408 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,3 +1,5 @@
+include(AddLLVM) # for add_lit_testsuite
+
macro(pythonize_bool var)
if (${var})
set(${var} True)
@@ -9,6 +11,18 @@ endmacro()
set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
"Configuration variant to use for LIT.")
+# The tests shouldn't link to any ABI library when it has been linked into
+# libc++ statically or via a linker script.
+if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+ set(LIBCXX_CXX_ABI_LIBNAME "none")
+endif()
+
+# The tests shouldn't link to libunwind if we have a linker script which
+# already does so.
+if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+ set(LIBCXXABI_USE_LLVM_UNWINDER OFF)
+endif()
+
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
pythonize_bool(LIBCXX_ENABLE_FILESYSTEM)
@@ -20,12 +34,7 @@ pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
-
-# The tests shouldn't link to any ABI library when it has been linked into
-# libc++ statically or via a linker script.
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
- set(LIBCXX_CXX_ABI_LIBNAME "none")
-endif()
+pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API)
# By default, for non-standalone builds, libcxx and libcxxabi share a library
# directory.
@@ -50,10 +59,16 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
set(experimental_dep cxx_experimental)
endif()
-add_lit_testsuite(check-libcxx
+if (LIBCXX_HAS_EXTERNAL_THREAD_API)
+ set(external_threads_dep cxx_external_threads)
+endif()
+
+add_lit_testsuite(check-cxx
"Running libcxx tests"
${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS cxx ${experimental_dep})
+ DEPENDS cxx ${experimental_dep} ${external_threads_dep})
+
+add_custom_target(check-libcxx DEPENDS check-cxx)
if (LIBCXX_GENERATE_COVERAGE)
include(CodeCoverage)
diff --git a/test/libcxx/algorithms/debug_less.pass.cpp b/test/libcxx/algorithms/debug_less.pass.cpp
new file mode 100644
index 000000000000..2e875ff277c4
--- /dev/null
+++ b/test/libcxx/algorithms/debug_less.pass.cpp
@@ -0,0 +1,167 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-no-exceptions
+
+// <algorithm>
+
+// template <class _Compare> struct __debug_less
+
+// __debug_less checks that a comparator actually provides a strict-weak ordering.
+
+struct DebugException {};
+
+#define _LIBCPP_DEBUG 0
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : throw ::DebugException())
+
+#include <algorithm>
+#include <cassert>
+
+template <int ID>
+struct MyType {
+ int value;
+ explicit MyType(int xvalue = 0) : value(xvalue) {}
+};
+
+template <int ID1, int ID2>
+bool operator<(MyType<ID1> const& LHS, MyType<ID2> const& RHS) {
+ return LHS.value < RHS.value;
+}
+
+struct CompareBase {
+ static int called;
+ static void reset() {
+ called = 0;
+ }
+};
+
+int CompareBase::called = 0;
+
+template <class ValueType>
+struct GoodComparator : public CompareBase {
+ bool operator()(ValueType const& lhs, ValueType const& rhs) const {
+ ++CompareBase::called;
+ return lhs < rhs;
+ }
+};
+
+template <class ValueType>
+struct BadComparator : public CompareBase {
+ bool operator()(ValueType const&, ValueType const&) const {
+ ++CompareBase::called;
+ return true;
+ }
+};
+
+template <class T1, class T2>
+struct TwoWayHomoComparator : public CompareBase {
+ bool operator()(T1 const& lhs, T2 const& rhs) const {
+ ++CompareBase::called;
+ return lhs < rhs;
+ }
+
+ bool operator()(T2 const& lhs, T1 const& rhs) const {
+ ++CompareBase::called;
+ return lhs < rhs;
+ }
+};
+
+template <class T1, class T2>
+struct OneWayHomoComparator : public CompareBase {
+ bool operator()(T1 const& lhs, T2 const& rhs) const {
+ ++CompareBase::called;
+ return lhs < rhs;
+ }
+};
+
+using std::__debug_less;
+
+typedef MyType<0> MT0;
+typedef MyType<1> MT1;
+
+void test_passing() {
+ int& called = CompareBase::called;
+ called = 0;
+ MT0 one(1);
+ MT0 two(2);
+ MT1 three(3);
+ MT1 four(4);
+
+ {
+ typedef GoodComparator<MT0> C;
+ typedef __debug_less<C> D;
+
+ C c;
+ D d(c);
+
+ assert(d(one, two) == true);
+ assert(called == 2);
+ called = 0;
+
+ assert(d(one, one) == false);
+ assert(called == 1);
+ called = 0;
+
+ assert(d(two, one) == false);
+ assert(called == 1);
+ called = 0;
+ }
+ {
+ typedef TwoWayHomoComparator<MT0, MT1> C;
+ typedef __debug_less<C> D;
+ C c;
+ D d(c);
+
+ assert(d(one, three) == true);
+ assert(called == 2);
+ called = 0;
+
+ assert(d(three, one) == false);
+ assert(called == 1);
+ called = 0;
+ }
+ {
+ typedef OneWayHomoComparator<MT0, MT1> C;
+ typedef __debug_less<C> D;
+ C c;
+ D d(c);
+
+ assert(d(one, three) == true);
+ assert(called == 1);
+ called = 0;
+ }
+}
+
+void test_failing() {
+ int& called = CompareBase::called;
+ called = 0;
+ MT0 one(1);
+ MT0 two(2);
+
+ {
+ typedef BadComparator<MT0> C;
+ typedef __debug_less<C> D;
+ C c;
+ D d(c);
+
+ try {
+ d(one, two);
+ assert(false);
+ } catch (DebugException const&) {
+ }
+
+ assert(called == 2);
+ called = 0;
+ }
+}
+
+int main() {
+ test_passing();
+ test_failing();
+} \ No newline at end of file
diff --git a/test/libcxx/atomics/atomics.align/align.pass.sh.cpp b/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
new file mode 100644
index 000000000000..e0ae37e9c3bc
--- /dev/null
+++ b/test/libcxx/atomics/atomics.align/align.pass.sh.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
+// REQUIRES: libatomic
+// RUN: %build -latomic
+// RUN: %run
+//
+// GCC currently fails because it needs -fabi-version=6 to fix mangling of
+// std::atomic when used with __attribute__((vector(X))).
+// XFAIL: gcc
+
+// <atomic>
+
+// Verify that the content of atomic<T> is properly aligned if the type is
+// lock-free. This can't be observed through the atomic<T> API. It is
+// nonetheless required for correctness of the implementation: lock-free implies
+// that ISA instructions are used, and these instructions assume "suitable
+// alignment". Supported architectures all require natural alignment for
+// lock-freedom (e.g. load-linked / store-conditional, or cmpxchg).
+
+#include <atomic>
+#include <cassert>
+
+template <typename T> struct atomic_test : public std::__atomic_base<T> {
+ atomic_test() {
+ if (this->is_lock_free())
+ assert(alignof(this->__a_) >= sizeof(this->__a_) &&
+ "expected natural alignment for lock-free type");
+ }
+};
+
+int main() {
+
+// structs and unions can't be defined in the template invocation.
+// Work around this with a typedef.
+#define CHECK_ALIGNMENT(T) \
+ do { \
+ typedef T type; \
+ atomic_test<type> t; \
+ } while (0)
+
+ CHECK_ALIGNMENT(bool);
+ CHECK_ALIGNMENT(char);
+ CHECK_ALIGNMENT(signed char);
+ CHECK_ALIGNMENT(unsigned char);
+ CHECK_ALIGNMENT(char16_t);
+ CHECK_ALIGNMENT(char32_t);
+ CHECK_ALIGNMENT(wchar_t);
+ CHECK_ALIGNMENT(short);
+ CHECK_ALIGNMENT(unsigned short);
+ CHECK_ALIGNMENT(int);
+ CHECK_ALIGNMENT(unsigned int);
+ CHECK_ALIGNMENT(long);
+ CHECK_ALIGNMENT(unsigned long);
+ CHECK_ALIGNMENT(long long);
+ CHECK_ALIGNMENT(unsigned long long);
+ CHECK_ALIGNMENT(std::nullptr_t);
+ CHECK_ALIGNMENT(void *);
+ CHECK_ALIGNMENT(float);
+ CHECK_ALIGNMENT(double);
+ CHECK_ALIGNMENT(long double);
+ CHECK_ALIGNMENT(int __attribute__((vector_size(1 * sizeof(int)))));
+ CHECK_ALIGNMENT(int __attribute__((vector_size(2 * sizeof(int)))));
+ CHECK_ALIGNMENT(int __attribute__((vector_size(4 * sizeof(int)))));
+ CHECK_ALIGNMENT(int __attribute__((vector_size(16 * sizeof(int)))));
+ CHECK_ALIGNMENT(int __attribute__((vector_size(32 * sizeof(int)))));
+ CHECK_ALIGNMENT(float __attribute__((vector_size(1 * sizeof(float)))));
+ CHECK_ALIGNMENT(float __attribute__((vector_size(2 * sizeof(float)))));
+ CHECK_ALIGNMENT(float __attribute__((vector_size(4 * sizeof(float)))));
+ CHECK_ALIGNMENT(float __attribute__((vector_size(16 * sizeof(float)))));
+ CHECK_ALIGNMENT(float __attribute__((vector_size(32 * sizeof(float)))));
+ CHECK_ALIGNMENT(double __attribute__((vector_size(1 * sizeof(double)))));
+ CHECK_ALIGNMENT(double __attribute__((vector_size(2 * sizeof(double)))));
+ CHECK_ALIGNMENT(double __attribute__((vector_size(4 * sizeof(double)))));
+ CHECK_ALIGNMENT(double __attribute__((vector_size(16 * sizeof(double)))));
+ CHECK_ALIGNMENT(double __attribute__((vector_size(32 * sizeof(double)))));
+ CHECK_ALIGNMENT(struct Empty {});
+ CHECK_ALIGNMENT(struct OneInt { int i; });
+ CHECK_ALIGNMENT(struct IntArr2 { int i[2]; });
+ CHECK_ALIGNMENT(struct LLIArr2 { long long int i[2]; });
+ CHECK_ALIGNMENT(struct LLIArr4 { long long int i[4]; });
+ CHECK_ALIGNMENT(struct LLIArr8 { long long int i[8]; });
+ CHECK_ALIGNMENT(struct LLIArr16 { long long int i[16]; });
+ CHECK_ALIGNMENT(struct Padding { char c; /* padding */ long long int i; });
+ CHECK_ALIGNMENT(union IntFloat { int i; float f; });
+}
diff --git a/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp b/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
index fe95e6a5983a..38f89db1749a 100644
--- a/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
+++ b/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
@@ -12,6 +12,7 @@
// Test that including <atomic> fails to compile when _LIBCPP_HAS_NO_THREADS
// is defined.
+// MODULES_DEFINES: _LIBCPP_HAS_NO_THREADS
#ifndef _LIBCPP_HAS_NO_THREADS
#define _LIBCPP_HAS_NO_THREADS
#endif
diff --git a/test/libcxx/compiler.py b/test/libcxx/compiler.py
index 17e6cf441ec1..8585f44ed35f 100644
--- a/test/libcxx/compiler.py
+++ b/test/libcxx/compiler.py
@@ -7,22 +7,85 @@
#
#===----------------------------------------------------------------------===##
+import platform
import os
import lit.util
import libcxx.util
class CXXCompiler(object):
+ CM_Default = 0
+ CM_PreProcess = 1
+ CM_Compile = 2
+ CM_Link = 3
+
def __init__(self, path, flags=None, compile_flags=None, link_flags=None,
- use_ccache=False):
+ warning_flags=None, verify_supported=None,
+ verify_flags=None, use_verify=False,
+ modules_flags=None, use_modules=False,
+ use_ccache=False, use_warnings=False, compile_env=None,
+ cxx_type=None, cxx_version=None):
self.path = path
self.flags = list(flags or [])
self.compile_flags = list(compile_flags or [])
self.link_flags = list(link_flags or [])
+ self.warning_flags = list(warning_flags or [])
+ self.verify_supported = verify_supported
+ self.use_verify = use_verify
+ self.verify_flags = list(verify_flags or [])
+ assert not use_verify or verify_supported
+ assert not use_verify or verify_flags is not None
+ self.modules_flags = list(modules_flags or [])
+ self.use_modules = use_modules
+ assert not use_modules or modules_flags is not None
self.use_ccache = use_ccache
- self.type = None
- self.version = None
- self._initTypeAndVersion()
+ self.use_warnings = use_warnings
+ if compile_env is not None:
+ self.compile_env = dict(compile_env)
+ else:
+ self.compile_env = None
+ self.type = cxx_type
+ self.version = cxx_version
+ if self.type is None or self.version is None:
+ self._initTypeAndVersion()
+
+ def copy(self):
+ new_cxx = CXXCompiler(
+ self.path, flags=self.flags, compile_flags=self.compile_flags,
+ link_flags=self.link_flags, warning_flags=self.warning_flags,
+ verify_supported=self.verify_supported,
+ verify_flags=self.verify_flags, use_verify=self.use_verify,
+ modules_flags=self.modules_flags, use_modules=self.use_modules,
+ use_ccache=self.use_ccache, use_warnings=self.use_warnings,
+ compile_env=self.compile_env, cxx_type=self.type,
+ cxx_version=self.version)
+ return new_cxx
+
+ def isVerifySupported(self):
+ if self.verify_supported is None:
+ self.verify_supported = self.hasCompileFlag(['-Xclang',
+ '-verify-ignore-unexpected'])
+ if self.verify_supported:
+ self.verify_flags = [
+ '-Xclang', '-verify',
+ '-Xclang', '-verify-ignore-unexpected=note',
+ '-ferror-limit=1024'
+ ]
+ return self.verify_supported
+
+ def useVerify(self, value=True):
+ self.use_verify = value
+ assert not self.use_verify or self.verify_flags is not None
+
+ def useModules(self, value=True):
+ self.use_modules = value
+ assert not self.use_modules or self.modules_flags is not None
+
+ def useCCache(self, value=True):
+ self.use_ccache = value
+
+ def useWarnings(self, value=True):
+ self.use_warnings = value
def _initTypeAndVersion(self):
# Get compiler type and version
@@ -47,10 +110,12 @@ class CXXCompiler(object):
self.type = compiler_type
self.version = (major_ver, minor_ver, patchlevel)
- def _basicCmd(self, source_files, out, is_link=False, input_is_cxx=False,
- disable_ccache=False):
+ def _basicCmd(self, source_files, out, mode=CM_Default, flags=[],
+ input_is_cxx=False):
cmd = []
- if self.use_ccache and not disable_ccache and not is_link:
+ if self.use_ccache \
+ and not mode == self.CM_Link \
+ and not mode == self.CM_PreProcess:
cmd += ['ccache']
cmd += [self.path]
if out is not None:
@@ -63,57 +128,69 @@ class CXXCompiler(object):
cmd += [source_files]
else:
raise TypeError('source_files must be a string or list')
+ if mode == self.CM_PreProcess:
+ cmd += ['-E']
+ elif mode == self.CM_Compile:
+ cmd += ['-c']
+ cmd += self.flags
+ if self.use_verify:
+ cmd += self.verify_flags
+ assert mode in [self.CM_Default, self.CM_Compile]
+ if self.use_modules:
+ cmd += self.modules_flags
+ if mode != self.CM_Link:
+ cmd += self.compile_flags
+ if self.use_warnings:
+ cmd += self.warning_flags
+ if mode != self.CM_PreProcess and mode != self.CM_Compile:
+ cmd += self.link_flags
+ cmd += flags
return cmd
def preprocessCmd(self, source_files, out=None, flags=[]):
- cmd = self._basicCmd(source_files, out, input_is_cxx=True,
- disable_ccache=True) + ['-E']
- cmd += self.flags + self.compile_flags + flags
- return cmd
+ return self._basicCmd(source_files, out, flags=flags,
+ mode=self.CM_PreProcess,
+ input_is_cxx=True)
- def compileCmd(self, source_files, out=None, flags=[],
- disable_ccache=False):
- cmd = self._basicCmd(source_files, out, input_is_cxx=True,
- disable_ccache=disable_ccache) + ['-c']
- cmd += self.flags + self.compile_flags + flags
- return cmd
+ def compileCmd(self, source_files, out=None, flags=[]):
+ return self._basicCmd(source_files, out, flags=flags,
+ mode=self.CM_Compile,
+ input_is_cxx=True) + ['-c']
def linkCmd(self, source_files, out=None, flags=[]):
- cmd = self._basicCmd(source_files, out, is_link=True)
- cmd += self.flags + self.link_flags + flags
- return cmd
+ return self._basicCmd(source_files, out, flags=flags,
+ mode=self.CM_Link)
def compileLinkCmd(self, source_files, out=None, flags=[]):
- cmd = self._basicCmd(source_files, out, is_link=True)
- cmd += self.flags + self.compile_flags + self.link_flags + flags
- return cmd
+ return self._basicCmd(source_files, out, flags=flags)
- def preprocess(self, source_files, out=None, flags=[], env=None, cwd=None):
+ def preprocess(self, source_files, out=None, flags=[], cwd=None):
cmd = self.preprocessCmd(source_files, out, flags)
- out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
+ out, err, rc = lit.util.executeCommand(cmd, env=self.compile_env,
+ cwd=cwd)
return cmd, out, err, rc
- def compile(self, source_files, out=None, flags=[], env=None, cwd=None,
- disable_ccache=False):
- cmd = self.compileCmd(source_files, out, flags,
- disable_ccache=disable_ccache)
- out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
+ def compile(self, source_files, out=None, flags=[], cwd=None):
+ cmd = self.compileCmd(source_files, out, flags)
+ out, err, rc = lit.util.executeCommand(cmd, env=self.compile_env,
+ cwd=cwd)
return cmd, out, err, rc
- def link(self, source_files, out=None, flags=[], env=None, cwd=None):
+ def link(self, source_files, out=None, flags=[], cwd=None):
cmd = self.linkCmd(source_files, out, flags)
- out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
+ out, err, rc = lit.util.executeCommand(cmd, env=self.compile_env,
+ cwd=cwd)
return cmd, out, err, rc
- def compileLink(self, source_files, out=None, flags=[], env=None,
+ def compileLink(self, source_files, out=None, flags=[],
cwd=None):
cmd = self.compileLinkCmd(source_files, out, flags)
- out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
+ out, err, rc = lit.util.executeCommand(cmd, env=self.compile_env,
+ cwd=cwd)
return cmd, out, err, rc
def compileLinkTwoSteps(self, source_file, out=None, object_file=None,
- flags=[], env=None, cwd=None,
- disable_ccache=False):
+ flags=[], cwd=None):
if not isinstance(source_file, str):
raise TypeError('This function only accepts a single input file')
if object_file is None:
@@ -124,22 +201,20 @@ class CXXCompiler(object):
with_fn = lambda: libcxx.util.nullContext(object_file)
with with_fn() as object_file:
cc_cmd, cc_stdout, cc_stderr, rc = self.compile(
- source_file, object_file, flags=flags, env=env, cwd=cwd,
- disable_ccache=disable_ccache)
+ source_file, object_file, flags=flags, cwd=cwd)
if rc != 0:
return cc_cmd, cc_stdout, cc_stderr, rc
link_cmd, link_stdout, link_stderr, rc = self.link(
- object_file, out=out, flags=flags, env=env, cwd=cwd)
+ object_file, out=out, flags=flags, cwd=cwd)
return (cc_cmd + ['&&'] + link_cmd, cc_stdout + link_stdout,
cc_stderr + link_stderr, rc)
- def dumpMacros(self, source_files=None, flags=[], env=None, cwd=None):
+ def dumpMacros(self, source_files=None, flags=[], cwd=None):
if source_files is None:
source_files = os.devnull
flags = ['-dM'] + flags
- cmd, out, err, rc = self.preprocess(source_files, flags=flags, env=env,
- cwd=cwd)
+ cmd, out, err, rc = self.preprocess(source_files, flags=flags, cwd=cwd)
if rc != 0:
return None
parsed_macros = {}
@@ -163,11 +238,22 @@ class CXXCompiler(object):
# Add -Werror to ensure that an unrecognized flag causes a non-zero
# exit code. -Werror is supported on all known compiler types.
if self.type is not None:
- flags += ['-Werror']
+ flags += ['-Werror', '-fsyntax-only']
cmd, out, err, rc = self.compile(os.devnull, out=os.devnull,
flags=flags)
return rc == 0
+ def addFlagIfSupported(self, flag):
+ if isinstance(flag, list):
+ flags = list(flag)
+ else:
+ flags = [flag]
+ if self.hasCompileFlag(flags):
+ self.flags += flags
+ return True
+ else:
+ return False
+
def addCompileFlagIfSupported(self, flag):
if isinstance(flag, list):
flags = list(flag)
@@ -179,27 +265,38 @@ class CXXCompiler(object):
else:
return False
- def addWarningFlagIfSupported(self, flag):
+ def hasWarningFlag(self, flag):
"""
- addWarningFlagIfSupported - Add a warning flag if the compiler
- supports it. Unlike addCompileFlagIfSupported, this function detects
- when "-Wno-<warning>" flags are unsupported. If flag is a
+ hasWarningFlag - Test if the compiler supports a given warning flag.
+ Unlike addCompileFlagIfSupported, this function detects when
+ "-Wno-<warning>" flags are unsupported. If flag is a
"-Wno-<warning>" GCC will not emit an unknown option diagnostic unless
another error is triggered during compilation.
"""
assert isinstance(flag, str)
+ assert flag.startswith('-W')
if not flag.startswith('-Wno-'):
- return self.addCompileFlagIfSupported(flag)
+ return self.hasCompileFlag(flag)
flags = ['-Werror', flag]
+ old_use_warnings = self.use_warnings
+ self.useWarnings(False)
cmd = self.compileCmd('-', os.devnull, flags)
+ self.useWarnings(old_use_warnings)
# Remove '-v' because it will cause the command line invocation
# to be printed as part of the error output.
# TODO(EricWF): Are there other flags we need to worry about?
if '-v' in cmd:
cmd.remove('-v')
out, err, rc = lit.util.executeCommand(cmd, input='#error\n')
+
assert rc != 0
if flag in err:
return False
- self.compile_flags += [flag]
return True
+
+ def addWarningFlagIfSupported(self, flag):
+ if self.hasWarningFlag(flag):
+ assert flag not in self.warning_flags
+ self.warning_flags += [flag]
+ return True
+ return False
diff --git a/test/libcxx/containers/sequences/deque/incomplete.pass.cpp b/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
index dbeea5f9aefb..c23195ed297f 100644
--- a/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
+++ b/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
@@ -12,6 +12,7 @@
// deque()
// deque::iterator()
+// MODULES_DEFINES: _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
#include <deque>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp
deleted file mode 100644
index 3f0fd015e9a4..000000000000
--- a/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp
+++ /dev/null
@@ -1,33 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// Decrement iterator prior to begin.
-
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <list>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
-
-int main()
-{
- typedef int T;
- typedef std::list<T> C;
- C c(1);
- C::iterator i = c.end();
- --i;
- assert(i == c.begin());
- --i;
- assert(false);
-}
diff --git a/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp
deleted file mode 100644
index bc2b7f4e1da2..000000000000
--- a/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp
+++ /dev/null
@@ -1,33 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// Increment iterator past end.
-
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <list>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
-
-int main()
-{
- typedef int T;
- typedef std::list<T> C;
- C c(1);
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- ++i;
- assert(false);
-}
diff --git a/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp b/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp
deleted file mode 100644
index e2b95d8b1664..000000000000
--- a/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp
+++ /dev/null
@@ -1,59 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03
-// UNSUPPORTED: libcpp-no-exceptions
-
-// <list>
-
-// Operations on "NULL" iterators
-
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) do { if (!x) throw 1; } while(0)
-
-#include <list>
-#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
-
-struct S { int val; };
-
-int main()
-{
- {
- unsigned lib_asserts;
-
- typedef S T;
- typedef std::list<T> C;
- C::iterator i{};
- C::const_iterator ci{};
-
- lib_asserts = 0;
- try { ++i; } catch (int) { ++lib_asserts; }
- try { i++; } catch (int) { ++lib_asserts; }
- try { ++ci; } catch (int) { ++lib_asserts; }
- try { ci++; } catch (int) { ++lib_asserts; }
- assert(lib_asserts == 4);
-
- lib_asserts = 0;
- try { --i; } catch (int) { ++lib_asserts; }
- try { i--; } catch (int) { ++lib_asserts; }
- try { --ci; } catch (int) { ++lib_asserts; }
- try { ci--; } catch (int) { ++lib_asserts; }
- assert(lib_asserts == 4);
-
- lib_asserts = 0;
- try { *i; } catch (int) { ++lib_asserts; }
- try { *ci; } catch (int) { ++lib_asserts; }
- try { (void) i->val; } catch (int) { ++lib_asserts; }
- try { (void) ci->val; } catch (int) { ++lib_asserts; }
- assert(lib_asserts == 4);
- }
-}
diff --git a/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp b/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp
deleted file mode 100644
index 900f338c29eb..000000000000
--- a/test/libcxx/containers/sequences/list/list.special/db_swap_1.pass.cpp
+++ /dev/null
@@ -1,36 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// template <class T, class Alloc>
-// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
-
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <list>
-#include <cstdlib>
-#include <cassert>
-
-int main()
-{
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
- std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
- std::list<int>::iterator i1 = c1.begin();
- std::list<int>::iterator i2 = c2.begin();
- swap(c1, c2);
- c1.erase(i2);
- c2.erase(i1);
- std::list<int>::iterator j = i1;
- c1.erase(i1); // called with iterator not refering to list.
- assert(false);
-}
diff --git a/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp b/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
deleted file mode 100644
index ace9a713aae7..000000000000
--- a/test/libcxx/containers/sequences/list/list.special/db_swap_2.pass.cpp
+++ /dev/null
@@ -1,36 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <list>
-
-// template <class T, class Alloc>
-// void swap(list<T,Alloc>& x, list<T,Alloc>& y);
-
-
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <list>
-#include <cassert>
-#include "test_allocator.h"
-#include "min_allocator.h"
-
-int main()
-{
- // allocators do not compare equal
- {
- int a1[] = {1, 3, 7, 9, 10};
- int a2[] = {0, 2, 4, 5, 6, 8, 11};
- typedef test_allocator<int> A;
- std::list<int, A> c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1));
- std::list<int, A> c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2));
- swap(c1, c2);
- assert(false);
- }
-}
diff --git a/test/libcxx/containers/sequences/vector/asan.pass.cpp b/test/libcxx/containers/sequences/vector/asan.pass.cpp
index b102fc08dafb..db337e6b2364 100644
--- a/test/libcxx/containers/sequences/vector/asan.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -38,7 +38,8 @@ int main()
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
- T foo = c[c.size()]; // bad, but not caught by ASAN
+ volatile T foo = c[c.size()]; // bad, but not caught by ASAN
+ ((void)foo);
}
#endif
@@ -61,9 +62,10 @@ int main()
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
assert(is_contiguous_container_asan_correct(c));
- assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity()));
- T foo = c[c.size()]; // should trigger ASAN
+ assert(!__sanitizer_verify_contiguous_container( c.data(), c.data() + 1, c.data() + c.capacity()));
+ volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
assert(false); // if we got here, ASAN didn't trigger
+ ((void)foo);
}
}
#else
diff --git a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
index 9af3f6be53e8..43324e9418f9 100644
--- a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// Test asan vector annotations with a class that throws in a CTOR.
#include <vector>
@@ -41,7 +41,7 @@ private:
class ThrowOnCopy {
public:
ThrowOnCopy() : should_throw(false) {}
- explicit ThrowOnCopy(bool should_throw) : should_throw(should_throw) {}
+ explicit ThrowOnCopy(bool xshould_throw) : should_throw(xshould_throw) {}
ThrowOnCopy(ThrowOnCopy const & other)
: should_throw(other.should_throw)
diff --git a/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
new file mode 100644
index 000000000000..c2c2d9221cf1
--- /dev/null
+++ b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
+
+// test container debugging
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_DEBUG_USE_EXCEPTIONS
+#include <map>
+#include <set>
+#include <utility>
+#include <cassert>
+#include "debug_mode_helper.h"
+
+using namespace IteratorDebugChecks;
+
+template <class Container, ContainerType CT>
+struct AssociativeContainerChecks : BasicContainerChecks<Container, CT> {
+ using Base = BasicContainerChecks<Container, CT>;
+ using value_type = typename Container::value_type;
+ using iterator = typename Container::iterator;
+ using const_iterator = typename Container::const_iterator;
+ using traits = std::iterator_traits<iterator>;
+ using category = typename traits::iterator_category;
+
+ using Base::makeContainer;
+public:
+ static void run() {
+ Base::run();
+ try {
+ // FIXME Add tests
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+private:
+ // FIXME Add tests here
+};
+
+int main()
+{
+ using SetAlloc = test_allocator<int>;
+ using MapAlloc = test_allocator<std::pair<const int, int>>;
+ // FIXME: Add debug mode to these containers
+ if ((false)) {
+ AssociativeContainerChecks<
+ std::set<int, std::less<int>, SetAlloc>, CT_Set>::run();
+ AssociativeContainerChecks<
+ std::multiset<int, std::less<int>, SetAlloc>, CT_MultiSet>::run();
+ AssociativeContainerChecks<
+ std::map<int, int, std::less<int>, MapAlloc>, CT_Map>::run();
+ AssociativeContainerChecks<
+ std::multimap<int, int, std::less<int>, MapAlloc>, CT_MultiMap>::run();
+ }
+}
diff --git a/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
new file mode 100644
index 000000000000..46f960c15b1e
--- /dev/null
+++ b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp
@@ -0,0 +1,265 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
+
+// test container debugging
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_DEBUG_USE_EXCEPTIONS
+#include <forward_list>
+#include <list>
+#include <vector>
+#include <deque>
+#include "debug_mode_helper.h"
+
+using namespace IteratorDebugChecks;
+
+template <class Container, ContainerType CT>
+struct SequenceContainerChecks : BasicContainerChecks<Container, CT> {
+ using Base = BasicContainerChecks<Container, CT>;
+ using value_type = typename Container::value_type;
+ using allocator_type = typename Container::allocator_type;
+ using iterator = typename Container::iterator;
+ using const_iterator = typename Container::const_iterator;
+
+ using Base::makeContainer;
+ using Base::makeValueType;
+public:
+ static void run() {
+ Base::run();
+ try {
+ FrontOnEmptyContainer();
+ if constexpr (CT != CT_ForwardList) {
+ AssignInvalidates();
+ BackOnEmptyContainer();
+ InsertIterValue();
+ InsertIterSizeValue();
+ InsertIterIterIter();
+ EmplaceIterValue();
+ EraseIterIter();
+ }
+ if constexpr (CT == CT_Vector || CT == CT_Deque || CT == CT_List) {
+ PopBack();
+ }
+ if constexpr (CT == CT_List || CT == CT_Deque) {
+ PopFront(); // FIXME: Run with forward list as well
+ }
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+private:
+ static void AssignInvalidates() {
+ CHECKPOINT("assign(Size, Value)");
+ Container C(allocator_type{});
+ iterator it1, it2, it3;
+ auto reset = [&]() {
+ C = makeContainer(3);
+ it1 = C.begin();
+ it2 = ++C.begin();
+ it3 = C.end();
+ };
+ auto check = [&]() {
+ CHECK_DEBUG_THROWS( C.erase(it1) );
+ CHECK_DEBUG_THROWS( C.erase(it2) );
+ CHECK_DEBUG_THROWS( C.erase(it3, C.end()) );
+ };
+ reset();
+ C.assign(2, makeValueType(4));
+ check();
+ reset();
+ CHECKPOINT("assign(Iter, Iter)");
+ std::vector<value_type> V = {
+ makeValueType(1),
+ makeValueType(2),
+ makeValueType(3)
+ };
+ C.assign(V.begin(), V.end());
+ check();
+ reset();
+ CHECKPOINT("assign(initializer_list)");
+ C.assign({makeValueType(1), makeValueType(2), makeValueType(3)});
+ check();
+ }
+
+ static void BackOnEmptyContainer() {
+ CHECKPOINT("testing back on empty");
+ Container C = makeContainer(1);
+ Container const& CC = C;
+ (void)C.back();
+ (void)CC.back();
+ C.clear();
+ CHECK_DEBUG_THROWS( C.back() );
+ CHECK_DEBUG_THROWS( CC.back() );
+ }
+
+ static void FrontOnEmptyContainer() {
+ CHECKPOINT("testing front on empty");
+ Container C = makeContainer(1);
+ Container const& CC = C;
+ (void)C.front();
+ (void)CC.front();
+ C.clear();
+ CHECK_DEBUG_THROWS( C.front() );
+ CHECK_DEBUG_THROWS( CC.front() );
+ }
+
+ static void EraseIterIter() {
+ CHECKPOINT("testing erase iter iter invalidation");
+ Container C1 = makeContainer(3);
+ iterator it1 = C1.begin();
+ iterator it1_next = ++C1.begin();
+ iterator it1_after_next = ++C1.begin();
+ ++it1_after_next;
+ iterator it1_back = --C1.end();
+ assert(it1_next != it1_back);
+ if (CT == CT_Vector) {
+ CHECK_DEBUG_THROWS( C1.erase(it1_next, it1) ); // bad range
+ }
+ C1.erase(it1, it1_after_next);
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ CHECK_DEBUG_THROWS( C1.erase(it1_next) );
+ if (CT == CT_List) {
+ C1.erase(it1_back);
+ } else {
+ CHECK_DEBUG_THROWS( C1.erase(it1_back) );
+ }
+ }
+
+ static void PopBack() {
+ CHECKPOINT("testing pop_back() invalidation");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.end();
+ --it1;
+ C1.pop_back();
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ C1.erase(C1.begin());
+ assert(C1.size() == 0);
+ CHECK_DEBUG_THROWS( C1.pop_back() );
+ }
+
+ static void PopFront() {
+ CHECKPOINT("testing pop_front() invalidation");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ C1.pop_front();
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ C1.erase(C1.begin());
+ assert(C1.size() == 0);
+ CHECK_DEBUG_THROWS( C1.pop_front() );
+ }
+
+ static void InsertIterValue() {
+ CHECKPOINT("testing insert(iter, value)");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ const value_type value = makeValueType(3);
+ value_type rvalue = makeValueType(3);
+ CHECK_DEBUG_THROWS( C2.insert(it1, value) ); // wrong container
+ CHECK_DEBUG_THROWS( C2.insert(it1, std::move(rvalue)) ); // wrong container
+ C1.insert(it1_next, value);
+ if (CT == CT_List) {
+ C1.insert(it1_next, value);
+ C1.insert(it1, value);
+ C1.insert(it1_next, std::move(rvalue));
+ C1.insert(it1, std::move(rvalue));
+ } else {
+ CHECK_DEBUG_THROWS( C1.insert(it1_next, value) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.insert(it1, value) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.insert(it1_next, std::move(rvalue)) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.insert(it1, std::move(rvalue)) ); // invalidated iterator
+ }
+ }
+
+ static void EmplaceIterValue() {
+ CHECKPOINT("testing emplace(iter, value)");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ const value_type value = makeValueType(3);
+ CHECK_DEBUG_THROWS( C2.emplace(it1, value) ); // wrong container
+ CHECK_DEBUG_THROWS( C2.emplace(it1, makeValueType(4)) ); // wrong container
+ C1.emplace(it1_next, value);
+ if (CT == CT_List) {
+ C1.emplace(it1_next, value);
+ C1.emplace(it1, value);
+ } else {
+ CHECK_DEBUG_THROWS( C1.emplace(it1_next, value) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.emplace(it1, value) ); // invalidated iterator
+ }
+ }
+
+ static void InsertIterSizeValue() {
+ CHECKPOINT("testing insert(iter, size, value)");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ const value_type value = makeValueType(3);
+ CHECK_DEBUG_THROWS( C2.insert(it1, 1, value) ); // wrong container
+ C1.insert(it1_next, 2, value);
+ if (CT == CT_List) {
+ C1.insert(it1_next, 3, value);
+ C1.insert(it1, 1, value);
+ } else {
+ CHECK_DEBUG_THROWS( C1.insert(it1_next, 1, value) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.insert(it1, 1, value) ); // invalidated iterator
+ }
+ }
+
+ static void InsertIterIterIter() {
+ CHECKPOINT("testing insert(iter, iter, iter)");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ std::vector<value_type> V = {
+ makeValueType(1),
+ makeValueType(2),
+ makeValueType(3)
+ };
+ CHECK_DEBUG_THROWS( C2.insert(it1, V.begin(), V.end()) ); // wrong container
+ C1.insert(it1_next, V.begin(), V.end());
+ if (CT == CT_List) {
+ C1.insert(it1_next, V.begin(), V.end());
+ C1.insert(it1, V.begin(), V.end());
+ } else {
+ CHECK_DEBUG_THROWS( C1.insert(it1_next, V.begin(), V.end()) ); // invalidated iterator
+ CHECK_DEBUG_THROWS( C1.insert(it1, V.begin(), V.end()) ); // invalidated iterator
+ }
+ }
+};
+
+int main()
+{
+ using Alloc = test_allocator<int>;
+ {
+ SequenceContainerChecks<std::list<int, Alloc>, CT_List>::run();
+ SequenceContainerChecks<std::vector<int, Alloc>, CT_Vector>::run();
+ }
+ // FIXME these containers don't support iterator debugging
+ if ((false)) {
+ SequenceContainerChecks<
+ std::vector<bool, test_allocator<bool>>, CT_VectorBool>::run();
+ SequenceContainerChecks<
+ std::forward_list<int, Alloc>, CT_ForwardList>::run();
+ SequenceContainerChecks<
+ std::deque<int, Alloc>, CT_Deque>::run();
+ }
+}
diff --git a/test/libcxx/debug/containers/db_string.pass.cpp b/test/libcxx/debug/containers/db_string.pass.cpp
new file mode 100644
index 000000000000..ee1634140ff6
--- /dev/null
+++ b/test/libcxx/debug/containers/db_string.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
+
+// test container debugging
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_DEBUG_USE_EXCEPTIONS
+#include <string>
+#include <vector>
+
+#include "test_macros.h"
+#include "debug_mode_helper.h"
+
+using namespace IteratorDebugChecks;
+
+typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> StringType;
+
+template <class Container = StringType, ContainerType CT = CT_String>
+struct StringContainerChecks : BasicContainerChecks<Container, CT> {
+ using Base = BasicContainerChecks<Container, CT_String>;
+ using value_type = typename Container::value_type;
+ using allocator_type = typename Container::allocator_type;
+ using iterator = typename Container::iterator;
+ using const_iterator = typename Container::const_iterator;
+
+ using Base::makeContainer;
+ using Base::makeValueType;
+
+public:
+ static void run() {
+ Base::run_iterator_tests();
+ // FIXME: get these passing
+ // Base::run_allocator_aware_tests();
+ try {
+ for (int N : {3, 128}) {
+ FrontOnEmptyContainer(N);
+ BackOnEmptyContainer(N);
+ PopBack(N);
+ }
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+private:
+ static void BackOnEmptyContainer(int N) {
+ CHECKPOINT("testing back on empty");
+ Container C = makeContainer(N);
+ Container const& CC = C;
+ iterator it = --C.end();
+ (void)C.back();
+ (void)CC.back();
+ C.pop_back();
+ CHECK_DEBUG_THROWS( C.erase(it) );
+ C.clear();
+ CHECK_DEBUG_THROWS( C.back() );
+ CHECK_DEBUG_THROWS( CC.back() );
+ }
+
+ static void FrontOnEmptyContainer(int N) {
+ CHECKPOINT("testing front on empty");
+ Container C = makeContainer(N);
+ Container const& CC = C;
+ (void)C.front();
+ (void)CC.front();
+ C.clear();
+ CHECK_DEBUG_THROWS( C.front() );
+ CHECK_DEBUG_THROWS( CC.front() );
+ }
+
+ static void PopBack(int N) {
+ CHECKPOINT("testing pop_back() invalidation");
+ Container C1 = makeContainer(N);
+ iterator it1 = C1.end();
+ --it1;
+ C1.pop_back();
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ C1.erase(C1.begin(), C1.end());
+ assert(C1.size() == 0);
+ CHECK_DEBUG_THROWS( C1.pop_back() );
+ }
+};
+
+int main()
+{
+ StringContainerChecks<>::run();
+}
diff --git a/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
new file mode 100644
index 000000000000..708fc7f8b950
--- /dev/null
+++ b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr
+
+// test container debugging
+
+#define _LIBCPP_DEBUG 1
+#define _LIBCPP_DEBUG_USE_EXCEPTIONS
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <cassert>
+#include "debug_mode_helper.h"
+
+using namespace IteratorDebugChecks;
+
+template <class Container, ContainerType CT>
+struct UnorderedContainerChecks : BasicContainerChecks<Container, CT> {
+ using Base = BasicContainerChecks<Container, CT>;
+ using value_type = typename Container::value_type;
+ using iterator = typename Container::iterator;
+ using const_iterator = typename Container::const_iterator;
+ using traits = std::iterator_traits<iterator>;
+ using category = typename traits::iterator_category;
+
+ using Base::makeContainer;
+public:
+ static void run() {
+ Base::run();
+ try {
+ // FIXME
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+private:
+
+};
+
+int main()
+{
+ using SetAlloc = test_allocator<int>;
+ using MapAlloc = test_allocator<std::pair<const int, int>>;
+ {
+ UnorderedContainerChecks<
+ std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, MapAlloc>,
+ CT_UnorderedMap>::run();
+ UnorderedContainerChecks<
+ std::unordered_set<int, std::hash<int>, std::equal_to<int>, SetAlloc>,
+ CT_UnorderedSet>::run();
+ UnorderedContainerChecks<
+ std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, MapAlloc>,
+ CT_UnorderedMultiMap>::run();
+ UnorderedContainerChecks<
+ std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, SetAlloc>,
+ CT_UnorderedMultiSet>::run();
+ }
+}
diff --git a/test/libcxx/debug/debug_abort.pass.cpp b/test/libcxx/debug/debug_abort.pass.cpp
new file mode 100644
index 000000000000..cfe63202705d
--- /dev/null
+++ b/test/libcxx/debug/debug_abort.pass.cpp
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+// Test that the default debug handler aborts the program.
+
+#define _LIBCPP_DEBUG 0
+
+#include <csignal>
+#include <cstdlib>
+#include <__debug>
+
+void signal_handler(int signal)
+{
+ if (signal == SIGABRT)
+ std::_Exit(EXIT_SUCCESS);
+ std::_Exit(EXIT_FAILURE);
+}
+
+int main()
+{
+ if (std::signal(SIGABRT, signal_handler) != SIG_ERR)
+ _LIBCPP_ASSERT(false, "foo");
+ return EXIT_FAILURE;
+}
diff --git a/test/libcxx/debug/debug_throw.pass.cpp b/test/libcxx/debug/debug_throw.pass.cpp
new file mode 100644
index 000000000000..bc5625c60093
--- /dev/null
+++ b/test/libcxx/debug/debug_throw.pass.cpp
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-no-exceptions
+
+// Test that the default debug handler can be overridden and test the
+// throwing debug handler.
+
+#define _LIBCPP_DEBUG 0
+
+#include <cstdlib>
+#include <exception>
+#include <type_traits>
+#include <__debug>
+
+int main()
+{
+ {
+ std::__libcpp_debug_function = std::__libcpp_throw_debug_function;
+ try {
+ _LIBCPP_ASSERT(false, "foo");
+ } catch (std::__libcpp_debug_exception const&) {}
+ }
+ {
+ // test that the libc++ exception type derives from std::exception
+ static_assert((std::is_base_of<std::exception,
+ std::__libcpp_debug_exception
+ >::value), "must be an exception");
+ }
+}
diff --git a/test/libcxx/containers/sequences/list/db_back.pass.cpp b/test/libcxx/debug/debug_throw_register.pass.cpp
index 96dfd2d8d2ec..21b1d5255d3d 100644
--- a/test/libcxx/containers/sequences/list/db_back.pass.cpp
+++ b/test/libcxx/debug/debug_throw_register.pass.cpp
@@ -1,3 +1,4 @@
+// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -6,27 +7,24 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: libcpp-no-exceptions
-// <list>
-
-// Call back() on empty container.
+// Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT
+// to throw on failure.
#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#define _LIBCPP_DEBUG_USE_EXCEPTIONS
-#include <list>
-#include <cassert>
-#include <iterator>
-#include <exception>
#include <cstdlib>
+#include <exception>
+#include <type_traits>
+#include <__debug>
+#include <cassert>
int main()
{
- typedef int T;
- typedef std::list<T> C;
- C c(1);
- assert(c.back() == 0);
- c.clear();
- assert(c.back() == 0);
+ try {
+ _LIBCPP_ASSERT(false, "foo");
assert(false);
+ } catch (...) {}
}
diff --git a/test/std/utilities/utility/forward/forward1.fail.cpp b/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp
index 43884d54bf86..725a7ab1331b 100644
--- a/test/std/utilities/utility/forward/forward1.fail.cpp
+++ b/test/libcxx/depr/depr.c.headers/ciso646.pass.cpp
@@ -7,18 +7,14 @@
//
//===----------------------------------------------------------------------===//
-// test forward
+// <ciso646>
-#include <utility>
+#include <ciso646>
-struct A
-{
-};
-
-A source() {return A();}
-const A csource() {return A();}
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
int main()
{
- std::forward<A&>(source()); // error
}
diff --git a/test/std/utilities/utility/forward/forward3.fail.cpp b/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
index 7e1e9b38fdc2..da0707990d80 100644
--- a/test/std/utilities/utility/forward/forward3.fail.cpp
+++ b/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
@@ -7,18 +7,15 @@
//
//===----------------------------------------------------------------------===//
-// test forward
+// <complex.h>
-#include <utility>
+#include <complex.h>
-struct A
-{
-};
-
-A source() {return A();}
-const A csource() {return A();}
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
int main()
{
- std::forward<A&>(csource()); // error
+ std::complex<double> d;
}
diff --git a/test/libcxx/depr/depr.c.headers/locale_h.pass.cpp b/test/libcxx/depr/depr.c.headers/locale_h.pass.cpp
new file mode 100644
index 000000000000..bd4d3501d072
--- /dev/null
+++ b/test/libcxx/depr/depr.c.headers/locale_h.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <locale.h>
+
+#include <locale.h>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp b/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
new file mode 100644
index 000000000000..a2ef814dcae1
--- /dev/null
+++ b/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tgmath.h>
+
+#include <tgmath.h>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+ std::complex<double> cd;
+ double x = sin(1.0);
+ (void)x; // to placate scan-build
+}
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 99767cf1bbc8..46dfc999be8b 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -15,14 +15,18 @@
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
// RUN: %run
-
// Prevent <ext/hash_map> from generating deprecated warnings for this test.
#if defined(__DEPRECATED)
#undef __DEPRECATED
#endif
+// Top level headers
#include <algorithm>
+#include <any>
#include <array>
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <atomic>
+#endif
#include <bitset>
#include <cassert>
#include <ccomplex>
@@ -51,25 +55,21 @@
#include <cstring>
#include <ctgmath>
#include <ctime>
+#include <ctype.h>
#include <cwchar>
#include <cwctype>
#include <deque>
+#include <errno.h>
#include <exception>
-#include <experimental/algorithm>
-#include <experimental/any>
-#include <experimental/chrono>
-#include <experimental/dynarray>
-#include <experimental/optional>
-#include <experimental/string_view>
-#include <experimental/system_error>
-#include <experimental/type_traits>
-#include <experimental/utility>
-#include <ext/hash_map>
-#include <ext/hash_set>
+#include <float.h>
#include <forward_list>
#include <fstream>
#include <functional>
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <future>
+#endif
#include <initializer_list>
+#include <inttypes.h>
#include <iomanip>
#include <ios>
#include <iosfwd>
@@ -77,12 +77,19 @@
#include <istream>
#include <iterator>
#include <limits>
+#include <limits.h>
#include <list>
#include <locale>
+#include <locale.h>
#include <map>
+#include <math.h>
#include <memory>
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <mutex>
+#endif
#include <new>
#include <numeric>
+#include <optional>
#include <ostream>
#include <queue>
#include <random>
@@ -90,14 +97,28 @@
#include <regex>
#include <scoped_allocator>
#include <set>
+#include <setjmp.h>
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <shared_mutex>
+#endif
#include <sstream>
#include <stack>
+#include <stdbool.h>
+#include <stddef.h>
#include <stdexcept>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <streambuf>
#include <string>
+#include <string.h>
+#include <string_view>
#include <strstream>
#include <system_error>
#include <tgmath.h>
+#ifndef _LIBCPP_HAS_NO_THREADS
+#include <thread>
+#endif
#include <tuple>
#include <typeindex>
#include <typeinfo>
@@ -106,15 +127,45 @@
#include <unordered_set>
#include <utility>
#include <valarray>
+#include <variant>
#include <vector>
+#include <wchar.h>
+#include <wctype.h>
-#ifndef _LIBCPP_HAS_NO_THREADS
-#include <atomic>
-#include <future>
-#include <mutex>
-#include <shared_mutex>
-#include <thread>
-#endif
+// experimental headers
+#if __cplusplus >= 201103L
+#include <experimental/algorithm>
+#include <experimental/any>
+#include <experimental/chrono>
+#include <experimental/deque>
+#include <experimental/dynarray>
+#include <experimental/filesystem>
+#include <experimental/forward_list>
+#include <experimental/functional>
+#include <experimental/iterator>
+#include <experimental/list>
+#include <experimental/map>
+#include <experimental/memory_resource>
+#include <experimental/numeric>
+#include <experimental/optional>
+#include <experimental/propagate_const>
+#include <experimental/ratio>
+#include <experimental/regex>
+#include <experimental/set>
+#include <experimental/string>
+#include <experimental/string_view>
+#include <experimental/system_error>
+#include <experimental/tuple>
+#include <experimental/type_traits>
+#include <experimental/unordered_map>
+#include <experimental/unordered_set>
+#include <experimental/utility>
+#include <experimental/vector>
+#endif // __cplusplus >= 201103L
+
+// extended headers
+#include <ext/hash_map>
+#include <ext/hash_set>
#if defined(WITH_MAIN)
int main() {}
diff --git a/test/libcxx/experimental/any/small_type.pass.cpp b/test/libcxx/experimental/any/small_type.pass.cpp
index e6595d4a4ab3..96754126c996 100644
--- a/test/libcxx/experimental/any/small_type.pass.cpp
+++ b/test/libcxx/experimental/any/small_type.pass.cpp
@@ -14,7 +14,7 @@
// Check that the size and alignment of any are what we expect.
#include <experimental/any>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
constexpr std::size_t BufferSize = (sizeof(void*) * 3);
constexpr std::size_t BufferAlignment = alignof(void*);
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
index cd5c56c7ac51..14f5c4ed8596 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: c++98, c++03, c++11
// dynarray.cons
@@ -29,6 +28,8 @@
#include <new>
#include <string>
+#include "test_macros.h"
+
using std::experimental::dynarray;
@@ -61,12 +62,14 @@ void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
void test_bad_length () {
try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
catch ( std::bad_array_length & ) { return ; }
catch (...) { assert(false); }
assert ( false );
}
+#endif
int main()
@@ -87,5 +90,7 @@ int main()
assert ( d1.size() == 20 );
assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
+#ifndef TEST_HAS_NO_EXCEPTIONS
test_bad_length ();
+#endif
}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
index 612e661ea6db..8d7d28b8395f 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// dynarray.cons
// explicit dynarray(size_type c);
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
index a6825b68d0f1..ef9be4532dd7 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// dynarray.overview
// const_reference at(size_type n) const;
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
index fe425b7e8c18..38aefdfbaf47 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
@@ -29,6 +29,7 @@
#include <__config>
#include <experimental/dynarray>
+#include <cstddef>
#include <cassert>
#include <algorithm>
@@ -46,10 +47,11 @@ void dyn_test_const ( const dynarray<T> &dyn ) {
assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
- assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
- assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
- assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
- assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+ std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
+ assert (ds == std::distance ( dyn.begin(), dyn.end()));
+ assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
+ assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
+ assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
assert ( dyn.begin () == dyn.cbegin ());
assert ( &*dyn.begin () == &*dyn.cbegin ());
@@ -68,10 +70,11 @@ void dyn_test ( dynarray<T> &dyn ) {
assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
- assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
- assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
- assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
- assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+ std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
+ assert (ds == std::distance ( dyn.begin(), dyn.end()));
+ assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
+ assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
+ assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
assert ( dyn.begin () == dyn.cbegin ());
assert ( &*dyn.begin () == &*dyn.cbegin ());
diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp
new file mode 100644
index 000000000000..a98a9ccd2a80
--- /dev/null
+++ b/test/libcxx/experimental/filesystem/class.path/path.itr/iterator_db.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// UNSUPPORTED: libcpp-no-exceptions
+
+// <experimental/filesystem>
+
+// class path
+
+#define _LIBCPP_DEBUG 0
+#define _LIBCPP_ASSERT(cond, msg) ((cond) ? ((void)0) : throw 42)
+
+#include <experimental/filesystem>
+#include <iterator>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main() {
+ using namespace fs;
+ // Test incrementing/decrementing a singular iterator
+ {
+ path::iterator singular;
+ try {
+ ++singular;
+ assert(false);
+ } catch (int) {}
+ try {
+ --singular;
+ assert(false);
+ } catch (int) {}
+ }
+ // Test decrementing the begin iterator
+ {
+ path p("foo/bar");
+ auto it = p.begin();
+ try {
+ --it;
+ assert(false);
+ } catch (int) {}
+ ++it;
+ ++it;
+ try {
+ ++it;
+ assert(false);
+ } catch (int) {}
+ }
+ // Test incrementing the end iterator
+ {
+ path p("foo/bar");
+ auto it = p.end();
+ try {
+ ++it;
+ assert(false);
+ } catch (int) {}
+ --it;
+ --it;
+ try {
+ --it;
+ assert(false);
+ } catch (int) {}
+ }
+} \ No newline at end of file
diff --git a/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
new file mode 100644
index 000000000000..c43ea078f989
--- /dev/null
+++ b/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <experimental/filesystem>
+
+// class path
+
+// path& operator/=(path const&)
+// path operator/(path const&, path const&)
+
+
+#define _LIBCPP_DEBUG 0
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
+int AssertCount = 0;
+
+#include <experimental/filesystem>
+#include <type_traits>
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+#include "count_new.hpp"
+#include "filesystem_test_helper.hpp"
+
+namespace fs = std::experimental::filesystem;
+
+int main()
+{
+ using namespace fs;
+ {
+ path lhs("//foo");
+ path rhs("/bar");
+ assert(AssertCount == 0);
+ lhs /= rhs;
+ assert(AssertCount == 0);
+ }
+ {
+ path lhs("//foo");
+ path rhs("/bar");
+ assert(AssertCount == 0);
+ (void)(lhs / rhs);
+ assert(AssertCount == 0);
+ }
+ {
+ path lhs("//foo");
+ path rhs("//bar");
+ assert(AssertCount == 0);
+ lhs /= rhs;
+ assert(AssertCount == 1);
+ AssertCount = 0;
+ }
+ {
+ path lhs("//foo");
+ path rhs("//bar");
+ assert(AssertCount == 0);
+ (void)(lhs / rhs);
+ assert(AssertCount == 1);
+ }
+ // FIXME The same error is not diagnosed for the append(Source) and
+ // append(It, It) overloads.
+}
diff --git a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp
index 94de2108f8b5..61d322524071 100644
--- a/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp
+++ b/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp
@@ -28,6 +28,7 @@
#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
+#include "constexpr_char_traits.hpp"
namespace fs = std::experimental::filesystem;
@@ -59,6 +60,8 @@ struct MakeTestType {
using value_type = CharT;
using string_type = std::basic_string<CharT>;
using string_type2 = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>;
+ using string_view_type = std::basic_string_view<CharT>;
+ using string_view_type2 = std::basic_string_view<CharT, constexpr_char_traits<CharT>>;
using cstr_type = CharT* const;
using const_cstr_type = const CharT*;
using array_type = CharT[25];
@@ -81,6 +84,8 @@ struct MakeTestType {
static void Test() {
AssertPathable<string_type>();
AssertPathable<string_type2>();
+ AssertPathable<string_view_type>();
+ AssertPathable<string_view_type2>();
AssertPathable<cstr_type>();
AssertPathable<const_cstr_type>();
AssertPathable<array_type>();
diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp
index 33c830251769..c4b3aae92ff2 100644
--- a/test/libcxx/iterators/trivial_iterators.pass.cpp
+++ b/test/libcxx/iterators/trivial_iterators.pass.cpp
@@ -42,7 +42,7 @@ class my_input_iterator
{
It it_;
- template <class U> friend class input_iterator;
+ template <class U> friend class my_input_iterator;
public:
typedef my_input_iterator_tag iterator_category;
typedef typename std::iterator_traits<It>::value_type value_type;
@@ -55,7 +55,7 @@ public:
my_input_iterator() : it_() {}
explicit my_input_iterator(It it) : it_(it) {}
template <class U>
- my_input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
+ my_input_iterator(const my_input_iterator<U>& u) :it_(u.it_) {}
reference operator*() const {return *it_;}
pointer operator->() const {return it_;}
diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
new file mode 100644
index 000000000000..04b40009cda9
--- /dev/null
+++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test libc++'s implementation of align_val_t, and the relevent new/delete
+// overloads in all dialects when -faligned-allocation is present.
+
+// REQUIRES: -faligned-allocation
+
+// RUN: %build -faligned-allocation
+// RUN: %run
+
+#include <new>
+#include <typeinfo>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ static_assert(std::is_enum<std::align_val_t>::value, "");
+ typedef std::underlying_type<std::align_val_t>::type UT;
+ static_assert((std::is_same<UT, std::size_t>::value), "");
+ }
+ {
+ static_assert((!std::is_constructible<std::align_val_t, std::size_t>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert(!std::is_constructible<std::size_t, std::align_val_t>::value, "");
+#else
+ static_assert((std::is_constructible<std::size_t, std::align_val_t>::value), "");
+#endif
+ }
+ {
+ std::align_val_t a = std::align_val_t(0);
+ std::align_val_t b = std::align_val_t(32);
+ assert(a != b);
+ assert(a == std::align_val_t(0));
+ assert(b == std::align_val_t(32));
+ }
+ {
+ void *ptr = ::operator new(1, std::align_val_t(128));
+ assert(ptr);
+ assert(reinterpret_cast<std::uintptr_t>(ptr) % 128 == 0);
+ ::operator delete(ptr, std::align_val_t(128));
+ }
+ {
+ void *ptr = ::operator new(1, std::align_val_t(128), std::nothrow);
+ assert(ptr);
+ assert(reinterpret_cast<std::uintptr_t>(ptr) % 128 == 0);
+ ::operator delete(ptr, std::align_val_t(128), std::nothrow);
+ }
+ {
+ void *ptr = ::operator new[](1, std::align_val_t(128));
+ assert(ptr);
+ assert(reinterpret_cast<std::uintptr_t>(ptr) % 128 == 0);
+ ::operator delete[](ptr, std::align_val_t(128));
+ }
+ {
+ void *ptr = ::operator new[](1, std::align_val_t(128), std::nothrow);
+ assert(ptr);
+ assert(reinterpret_cast<std::uintptr_t>(ptr) % 128 == 0);
+ ::operator delete[](ptr, std::align_val_t(128), std::nothrow);
+ }
+#ifndef TEST_HAS_NO_RTTI
+ {
+ // Check that libc++ doesn't define align_val_t in a versioning namespace.
+ // And that it mangles the same in C++03 through C++17
+ assert(typeid(std::align_val_t).name() == std::string("St11align_val_t"));
+ }
+#endif
+} \ No newline at end of file
diff --git a/test/libcxx/libcpp_version.pass.cpp b/test/libcxx/libcpp_version.pass.cpp
new file mode 100644
index 000000000000..b83233837c9f
--- /dev/null
+++ b/test/libcxx/libcpp_version.pass.cpp
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that the __libcpp_version file matches the value of _LIBCPP_VERSION
+
+#include <__config>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION must be defined
+#endif
+
+static const int libcpp_version =
+#include <__libcpp_version>
+;
+
+static_assert(_LIBCPP_VERSION == libcpp_version,
+ "_LIBCPP_VERSION doesn't match __libcpp_version");
+
+int main() {
+
+}
diff --git a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
index 75e2aeb064eb..9ba422fc0c9e 100644
--- a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
+++ b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp
@@ -27,9 +27,9 @@ int main()
// interesting state.
Myconv myconv;
myconv.from_bytes("\xF1\x80\x80\x83");
- const int old_converted = myconv.converted();
+ const auto old_converted = myconv.converted();
assert(myconv.converted() == 4);
// move construct a new converter and make sure the state is the same.
Myconv myconv2(std::move(myconv));
- assert(myconv2.converted() == 4);
+ assert(myconv2.converted() == old_converted);
}
diff --git a/test/libcxx/modules/cinttypes_exports.sh.cpp b/test/libcxx/modules/cinttypes_exports.sh.cpp
new file mode 100644
index 000000000000..99d20ec65027
--- /dev/null
+++ b/test/libcxx/modules/cinttypes_exports.sh.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-support
+
+// Test that <cinttypes> re-exports <cstdint>
+
+// RUN: %build_module
+
+#include <cinttypes>
+
+int main() {
+ int8_t x; ((void)x);
+ std::int8_t y; ((void)y);
+}
diff --git a/test/libcxx/modules/clocale_exports.sh.cpp b/test/libcxx/modules/clocale_exports.sh.cpp
new file mode 100644
index 000000000000..69b1a9bd6624
--- /dev/null
+++ b/test/libcxx/modules/clocale_exports.sh.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-support
+// UNSUPPORTED: c++98, c++03
+
+// RUN: %build_module
+
+#include <clocale>
+
+#define TEST(...) do { using T = decltype( __VA_ARGS__ ); } while(false)
+
+int main() {
+ std::lconv l; ((void)l);
+
+ TEST(std::setlocale(0, ""));
+ TEST(std::localeconv());
+}
diff --git a/test/std/utilities/utility/forward/forward2.fail.cpp b/test/libcxx/modules/cstdint_exports.sh.cpp
index 9ff07233fee8..8ecc1da28f1a 100644
--- a/test/std/utilities/utility/forward/forward2.fail.cpp
+++ b/test/libcxx/modules/cstdint_exports.sh.cpp
@@ -7,19 +7,15 @@
//
//===----------------------------------------------------------------------===//
-// test forward
+// REQUIRES: modules-support
-#include <utility>
+// Test that <cstdint> re-exports <stdint.h>
-struct A
-{
-};
+// RUN: %build_module
-A source() {return A();}
-const A csource() {return A();}
+#include <cstdint>
-int main()
-{
- const A ca = A();
- std::forward<A&>(ca); // error
+int main() {
+ int8_t x; ((void)x);
+ std::int8_t y; ((void)y);
}
diff --git a/test/libcxx/modules/inttypes_h_exports.sh.cpp b/test/libcxx/modules/inttypes_h_exports.sh.cpp
new file mode 100644
index 000000000000..d1598d7eab3f
--- /dev/null
+++ b/test/libcxx/modules/inttypes_h_exports.sh.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-support
+
+// Test that intypes.h re-exports stdint.h
+
+// RUN: %build_module
+
+#include <inttypes.h>
+
+int main() {
+ int8_t x; ((void)x);
+}
diff --git a/test/libcxx/modules/stdint_h_exports.sh.cpp b/test/libcxx/modules/stdint_h_exports.sh.cpp
new file mode 100644
index 000000000000..78e1101383b1
--- /dev/null
+++ b/test/libcxx/modules/stdint_h_exports.sh.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: modules-support
+
+// Test that int8_t and the like are exported from stdint.h not inttypes.h
+
+// RUN: %build_module
+
+#include <stdint.h>
+
+int main() {
+ int8_t x; ((void)x);
+}
diff --git a/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp b/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp
new file mode 100644
index 000000000000..9123be1f0990
--- /dev/null
+++ b/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// Check that the overloads of std::__libcpp_{isnan,isinf,isfinite} that take
+// floating-point values are evaluatable from constexpr contexts.
+//
+// These functions need to be constexpr in order to be called from CUDA, see
+// https://reviews.llvm.org/D25403. They don't actually need to be
+// constexpr-evaluatable, but that's what we check here, since we can't check
+// true constexpr-ness.
+//
+// This fails with gcc because __builtin_isnan and friends, which libcpp_isnan
+// and friends call, are not themselves constexpr-evaluatable.
+//
+// UNSUPPORTED: c++98, c++03
+// XFAIL: gcc
+
+#include <cmath>
+
+static_assert(std::__libcpp_isnan(0.) == false, "");
+static_assert(std::__libcpp_isinf(0.0) == false, "");
+static_assert(std::__libcpp_isfinite(0.0) == true, "");
+
+int main()
+{
+}
diff --git a/test/libcxx/numerics/c.math/ctgmath.pass.cpp b/test/libcxx/numerics/c.math/ctgmath.pass.cpp
new file mode 100644
index 000000000000..815502f1ccaf
--- /dev/null
+++ b/test/libcxx/numerics/c.math/ctgmath.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ctgmath>
+
+#include <ctgmath>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+ std::complex<double> cd;
+ ((void)cd);
+ double x = std::sin(0);
+ ((void)x);
+}
diff --git a/test/libcxx/numerics/c.math/tgmath_h.pass.cpp b/test/libcxx/numerics/c.math/tgmath_h.pass.cpp
new file mode 100644
index 000000000000..23143c7140a6
--- /dev/null
+++ b/test/libcxx/numerics/c.math/tgmath_h.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tgmath.h>
+
+#include <tgmath.h>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/std/numerics/c.math/version_cmath.pass.cpp b/test/libcxx/numerics/c.math/version_cmath.pass.cpp
index 1249a902e7af..1249a902e7af 100644
--- a/test/std/numerics/c.math/version_cmath.pass.cpp
+++ b/test/libcxx/numerics/c.math/version_cmath.pass.cpp
diff --git a/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp b/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp
new file mode 100644
index 000000000000..21aaa669fd43
--- /dev/null
+++ b/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <ccomplex>
+
+#include <ccomplex>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+ std::complex<double> d;
+}
diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp
index 02ec921cc613..b236c5180b93 100644
--- a/test/libcxx/strings/iterators.exceptions.pass.cpp
+++ b/test/libcxx/strings/iterators.exceptions.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// <iterator>
// __libcpp_is_trivial_iterator<Tp>
@@ -26,6 +25,15 @@
#include "test_macros.h"
#include "test_iterators.h"
+#ifndef TEST_HAS_NO_EXCEPTIONS
+static const bool expected = false;
+#else
+// Under libcpp-no-exceptions all noexcept expressions are trivially true, so
+// any check for a noexcept returning false must actually check for it being
+// true.
+static const bool expected = true;
+#endif
+
int main()
{
// basic tests
@@ -43,17 +51,17 @@ int main()
static_assert(( std::__libcpp_string_gets_noexcept_iterator<std::reverse_iterator<std::__wrap_iter<char *> > > ::value), "");
// iterators in the libc++ test suite
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<forward_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value), "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<output_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<input_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<forward_iterator <char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<bidirectional_iterator<char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<random_access_iterator<char *> >::value == expected, "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<ThrowingIterator <char *> >::value == expected, "");
#if TEST_STD_VER >= 11
static_assert(( std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
#else
- static_assert((!std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value), "");
+ static_assert(std::__libcpp_string_gets_noexcept_iterator<NonThrowingIterator <char *> >::value == expected, "");
#endif
//
diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp
index 283cf0897cca..b8e0b4cdf34d 100644
--- a/test/libcxx/strings/iterators.noexcept.pass.cpp
+++ b/test/libcxx/strings/iterators.noexcept.pass.cpp
@@ -19,6 +19,7 @@
// When exceptions are disabled, all iterators should get this "fast path"
//
+// MODULES_DEFINES: _LIBCPP_NO_EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#include <iterator>
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index 593f9805447d..4551845104d2 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -13,6 +13,7 @@ import platform
import pkgutil
import re
import shlex
+import shutil
import sys
import lit.Test # pylint: disable=import-error,no-name-in-module
@@ -57,6 +58,7 @@ class Configuration(object):
self.lit_config = lit_config
self.config = config
self.cxx = None
+ self.cxx_stdlib_under_test = None
self.project_obj_root = None
self.libcxx_src_root = None
self.libcxx_obj_root = None
@@ -82,6 +84,10 @@ class Configuration(object):
conf = self.get_lit_conf(name)
if conf is None:
return default
+ if isinstance(conf, bool):
+ return conf
+ if not isinstance(conf, str):
+ raise TypeError('expected bool or string')
if conf.lower() in ('1', 'true'):
return True
if conf.lower() in ('', '0', 'false'):
@@ -96,6 +102,7 @@ class Configuration(object):
self.configure_triple()
self.configure_src_root()
self.configure_obj_root()
+ self.configure_cxx_stdlib_under_test()
self.configure_cxx_library_root()
self.configure_use_system_cxx_lib()
self.configure_use_clang_verify()
@@ -111,6 +118,7 @@ class Configuration(object):
self.configure_warnings()
self.configure_sanitizer()
self.configure_coverage()
+ self.configure_modules()
self.configure_substitutions()
self.configure_features()
@@ -118,8 +126,13 @@ class Configuration(object):
# Print the final compile and link flags.
self.lit_config.note('Using compiler: %s' % self.cxx.path)
self.lit_config.note('Using flags: %s' % self.cxx.flags)
+ if self.cxx.use_modules:
+ self.lit_config.note('Using modules flags: %s' %
+ self.cxx.modules_flags)
self.lit_config.note('Using compile flags: %s'
% self.cxx.compile_flags)
+ if len(self.cxx.warning_flags):
+ self.lit_config.note('Using warnings: %s' % self.cxx.warning_flags)
self.lit_config.note('Using link flags: %s' % self.cxx.link_flags)
# Print as list to prevent "set([...])" from being printed.
self.lit_config.note('Using available_features: %s' %
@@ -177,6 +190,7 @@ class Configuration(object):
assert self.cxx.version is not None
maj_v, min_v, _ = self.cxx.version
self.config.available_features.add(cxx_type)
+ self.config.available_features.add('%s-%s' % (cxx_type, maj_v))
self.config.available_features.add('%s-%s.%s' % (
cxx_type, maj_v, min_v))
@@ -212,14 +226,34 @@ class Configuration(object):
self.lit_config.note(
"inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib)
+ def configure_cxx_stdlib_under_test(self):
+ self.cxx_stdlib_under_test = self.get_lit_conf(
+ 'cxx_stdlib_under_test', 'libc++')
+ if self.cxx_stdlib_under_test not in \
+ ['libc++', 'libstdc++', 'cxx_default']:
+ self.lit_config.fatal(
+ 'unsupported value for "cxx_stdlib_under_test": %s'
+ % self.cxx_stdlib_under_test)
+ self.config.available_features.add(self.cxx_stdlib_under_test)
+ if self.cxx_stdlib_under_test == 'libstdc++':
+ self.config.available_features.add('libstdc++')
+ # Manually enable the experimental and filesystem tests for libstdc++
+ # if the options aren't present.
+ # FIXME this is a hack.
+ if self.get_lit_conf('enable_experimental') is None:
+ self.config.enable_experimental = 'true'
+ if self.get_lit_conf('enable_filesystem') is None:
+ self.config.enable_filesystem = 'true'
+
def configure_use_clang_verify(self):
'''If set, run clang with -verify on failing tests.'''
self.use_clang_verify = self.get_lit_bool('use_clang_verify')
if self.use_clang_verify is None:
# NOTE: We do not test for the -verify flag directly because
# -verify will always exit with non-zero on an empty file.
- self.use_clang_verify = self.cxx.hasCompileFlag(
- ['-Xclang', '-verify-ignore-unexpected'])
+ self.use_clang_verify = self.cxx.isVerifySupported()
+ if self.use_clang_verify:
+ self.config.available_features.add('verify-support')
self.lit_config.note(
"inferred use_clang_verify as: %r" % self.use_clang_verify)
@@ -267,6 +301,7 @@ class Configuration(object):
# XFAIL markers for tests that are known to fail with versions of
# libc++ as were shipped with a particular triple.
if self.use_system_cxx_lib:
+ self.config.available_features.add('with_system_cxx_lib')
self.config.available_features.add(
'with_system_cxx_lib=%s' % self.config.target_triple)
@@ -290,9 +325,19 @@ class Configuration(object):
if self.cxx.hasCompileFlag('-fsized-deallocation'):
self.config.available_features.add('fsized-deallocation')
+ if self.cxx.hasCompileFlag('-faligned-allocation'):
+ self.config.available_features.add('-faligned-allocation')
+ else:
+ # FIXME remove this once more than just clang-4.0 support
+ # C++17 aligned allocation.
+ self.config.available_features.add('no-aligned-allocation')
+
if self.get_lit_bool('has_libatomic', False):
self.config.available_features.add('libatomic')
+ if '__cpp_if_constexpr' not in self.cxx.dumpMacros():
+ self.config.available_features.add('libcpp-no-if-constexpr')
+
def configure_compile_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
@@ -324,9 +369,8 @@ class Configuration(object):
'Failed to infer a supported language dialect from one of %r'
% possible_stds)
self.cxx.compile_flags += ['-std={0}'.format(std)]
- self.config.available_features.add(std)
+ self.config.available_features.add(std.replace('gnu++', 'c++'))
# Configure include paths
- self.cxx.compile_flags += ['-nostdinc++']
self.configure_compile_flags_header_includes()
self.target_info.add_cxx_compile_flags(self.cxx.compile_flags)
# Configure feature flags.
@@ -345,18 +389,32 @@ class Configuration(object):
if gcc_toolchain:
self.cxx.flags += ['-gcc-toolchain', gcc_toolchain]
if self.use_target:
- self.cxx.flags += ['-target', self.config.target_triple]
+ if not self.cxx.addFlagIfSupported(
+ ['-target', self.config.target_triple]):
+ self.lit_config.warning('use_target is true but -target is '\
+ 'not supported by the compiler')
def configure_compile_flags_header_includes(self):
support_path = os.path.join(self.libcxx_src_root, 'test/support')
- self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
+ if self.cxx_stdlib_under_test != 'libstdc++':
+ self.cxx.compile_flags += [
+ '-include', os.path.join(support_path, 'nasty_macros.hpp')]
self.configure_config_site_header()
- libcxx_headers = self.get_lit_conf(
- 'libcxx_headers', os.path.join(self.libcxx_src_root, 'include'))
- if not os.path.isdir(libcxx_headers):
- self.lit_config.fatal("libcxx_headers='%s' is not a directory."
- % libcxx_headers)
- self.cxx.compile_flags += ['-I' + libcxx_headers]
+ cxx_headers = self.get_lit_conf('cxx_headers')
+ if cxx_headers == '' or (cxx_headers is None
+ and self.cxx_stdlib_under_test != 'libc++'):
+ self.lit_config.note('using the system cxx headers')
+ return
+ self.cxx.compile_flags += ['-nostdinc++']
+ if cxx_headers is None:
+ cxx_headers = os.path.join(self.libcxx_src_root, 'include')
+ if not os.path.isdir(cxx_headers):
+ self.lit_config.fatal("cxx_headers='%s' is not a directory."
+ % cxx_headers)
+ self.cxx.compile_flags += ['-I' + cxx_headers]
+ cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include', 'c++-build')
+ if os.path.isdir(cxxabi_headers):
+ self.cxx.compile_flags += ['-I' + cxxabi_headers]
def configure_config_site_header(self):
# Check for a possible __config_site in the build directory. We
@@ -446,7 +504,7 @@ class Configuration(object):
assert os.path.isdir(static_env)
self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="%s"' % static_env]
- dynamic_env = os.path.join(self.libcxx_obj_root, 'test',
+ dynamic_env = os.path.join(self.config.test_exec_root,
'filesystem', 'Output', 'dynamic_env')
dynamic_env = os.path.realpath(dynamic_env)
if not os.path.isdir(dynamic_env):
@@ -465,16 +523,29 @@ class Configuration(object):
def configure_link_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
- self.cxx.link_flags += ['-nodefaultlibs']
-
# Configure library path
self.configure_link_flags_cxx_library_path()
self.configure_link_flags_abi_library_path()
# Configure libraries
- self.configure_link_flags_cxx_library()
- self.configure_link_flags_abi_library()
- self.configure_extra_library_flags()
+ if self.cxx_stdlib_under_test == 'libc++':
+ self.cxx.link_flags += ['-nodefaultlibs']
+ self.configure_link_flags_cxx_library()
+ self.configure_link_flags_abi_library()
+ self.configure_extra_library_flags()
+ elif self.cxx_stdlib_under_test == 'libstdc++':
+ enable_fs = self.get_lit_bool('enable_filesystem',
+ default=False)
+ if enable_fs:
+ self.config.available_features.add('c++experimental')
+ self.cxx.link_flags += ['-lstdc++fs']
+ self.cxx.link_flags += ['-lm', '-pthread']
+ elif self.cxx_stdlib_under_test == 'cxx_default':
+ self.cxx.link_flags += ['-pthread']
+ else:
+ self.lit_config.fatal(
+ 'unsupported value for "use_stdlib_type": %s'
+ % use_stdlib_type)
link_flags_str = self.get_lit_conf('link_flags', '')
self.cxx.link_flags += shlex.split(link_flags_str)
@@ -508,6 +579,10 @@ class Configuration(object):
self.cxx.link_flags += [abs_path]
else:
self.cxx.link_flags += ['-lc++']
+ # This needs to come after -lc++ as we want its unresolved thread-api symbols
+ # to be picked up from this one.
+ if self.get_lit_bool('libcxx_external_thread_api', default=False):
+ self.cxx.link_flags += ['-lc++external_threads']
def configure_link_flags_abi_library(self):
cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
@@ -567,23 +642,34 @@ class Configuration(object):
self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level]
def configure_warnings(self):
- enable_warnings = self.get_lit_bool('enable_warnings', False)
+ # Turn on warnings by default for Clang based compilers when C++ >= 11
+ default_enable_warnings = self.cxx.type in ['clang', 'apple-clang'] \
+ and len(self.config.available_features.intersection(
+ ['c++11', 'c++14', 'c++1z'])) != 0
+ enable_warnings = self.get_lit_bool('enable_warnings',
+ default_enable_warnings)
if enable_warnings:
- self.cxx.compile_flags += [
+ self.cxx.useWarnings(True)
+ self.cxx.warning_flags += [
'-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
'-Wall', '-Wextra', '-Werror'
]
+ self.cxx.addWarningFlagIfSupported('-Wshadow')
self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
self.cxx.addWarningFlagIfSupported('-Wno-attributes')
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
- # TODO(EricWF) Remove the unused warnings once the test suite
- # compiles clean with them.
+ # These warnings should be enabled in order to support the MSVC
+ # team using the test suite; They enable the warnings below and
+ # expect the test suite to be clean.
+ self.cxx.addWarningFlagIfSupported('-Wsign-compare')
+ self.cxx.addWarningFlagIfSupported('-Wunused-variable')
+ self.cxx.addWarningFlagIfSupported('-Wunused-parameter')
+ self.cxx.addWarningFlagIfSupported('-Wunreachable-code')
+ # FIXME: Enable the two warnings below.
+ self.cxx.addWarningFlagIfSupported('-Wno-conversion')
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
- self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
- self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
- self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
std = self.get_lit_conf('std', None)
if std in ['c++98', 'c++03']:
# The '#define static_assert' provided by libc++ in C++03 mode
@@ -604,9 +690,17 @@ class Configuration(object):
os.pathsep + symbolizer_search_paths)
llvm_symbolizer = lit.util.which('llvm-symbolizer',
symbolizer_search_paths)
+
+ def add_ubsan():
+ self.cxx.flags += ['-fsanitize=undefined',
+ '-fno-sanitize=vptr,function,float-divide-by-zero',
+ '-fno-sanitize-recover=all']
+ self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
+ self.config.available_features.add('ubsan')
+
# Setup the sanitizer compile flags
self.cxx.flags += ['-g', '-fno-omit-frame-pointer']
- if san == 'Address':
+ if san == 'Address' or san == 'Address;Undefined' or san == 'Undefined;Address':
self.cxx.flags += ['-fsanitize=address']
if llvm_symbolizer is not None:
self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
@@ -615,6 +709,9 @@ class Configuration(object):
self.env['ASAN_OPTIONS'] = 'detect_odr_violation=0'
self.config.available_features.add('asan')
self.config.available_features.add('sanitizer-new-delete')
+ self.cxx.compile_flags += ['-O1']
+ if san == 'Address;Undefined' or san == 'Undefined;Address':
+ add_ubsan()
elif san == 'Memory' or san == 'MemoryWithOrigins':
self.cxx.flags += ['-fsanitize=memory']
if san == 'MemoryWithOrigins':
@@ -624,16 +721,10 @@ class Configuration(object):
self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
self.config.available_features.add('msan')
self.config.available_features.add('sanitizer-new-delete')
+ self.cxx.compile_flags += ['-O1']
elif san == 'Undefined':
- blacklist = os.path.join(self.libcxx_src_root,
- 'test/ubsan_blacklist.txt')
- self.cxx.flags += ['-fsanitize=undefined',
- '-fno-sanitize=vptr,function,float-divide-by-zero',
- '-fno-sanitize-recover=all',
- '-fsanitize-blacklist=' + blacklist]
- self.cxx.compile_flags += ['-O3']
- self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1'
- self.config.available_features.add('ubsan')
+ add_ubsan()
+ self.cxx.compile_flags += ['-O2']
elif san == 'Thread':
self.cxx.flags += ['-fsanitize=thread']
self.config.available_features.add('tsan')
@@ -652,9 +743,36 @@ class Configuration(object):
self.cxx.flags += ['-g', '--coverage']
self.cxx.compile_flags += ['-O0']
+ def configure_modules(self):
+ modules_flags = ['-fmodules']
+ if platform.system() != 'Darwin':
+ modules_flags += ['-Xclang', '-fmodules-local-submodule-visibility']
+ supports_modules = self.cxx.hasCompileFlag(modules_flags)
+ enable_modules_default = supports_modules and \
+ os.environ.get('LIBCXX_USE_MODULES') is not None
+ enable_modules = self.get_lit_bool('enable_modules',
+ enable_modules_default)
+ if enable_modules and not supports_modules:
+ self.lit_config.fatal(
+ '-fmodules is enabled but not supported by the compiler')
+ if not supports_modules:
+ return
+ self.config.available_features.add('modules-support')
+ module_cache = os.path.join(self.config.test_exec_root,
+ 'modules.cache')
+ module_cache = os.path.realpath(module_cache)
+ if os.path.isdir(module_cache):
+ shutil.rmtree(module_cache)
+ os.makedirs(module_cache)
+ self.cxx.modules_flags = modules_flags + \
+ ['-fmodules-cache-path=' + module_cache]
+ if enable_modules:
+ self.config.available_features.add('-fmodules')
+ self.cxx.useModules()
+
def configure_substitutions(self):
sub = self.config.substitutions
- # Configure compiler substitions
+ # Configure compiler substitutions
sub.append(('%cxx', self.cxx.path))
# Configure flags substitutions
flags_str = ' '.join(self.cxx.flags)
@@ -665,13 +783,23 @@ class Configuration(object):
sub.append(('%compile_flags', compile_flags_str))
sub.append(('%link_flags', link_flags_str))
sub.append(('%all_flags', all_flags))
+ if self.cxx.isVerifySupported():
+ verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' '
+ sub.append(('%verify', verify_str))
# Add compile and link shortcuts
compile_str = (self.cxx.path + ' -o %t.o %s -c ' + flags_str
- + compile_flags_str)
- link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str
+ + ' ' + compile_flags_str)
+ link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str + ' '
+ link_flags_str)
assert type(link_str) is str
build_str = self.cxx.path + ' -o %t.exe %s ' + all_flags
+ if self.cxx.use_modules:
+ sub.append(('%compile_module', compile_str))
+ sub.append(('%build_module', build_str))
+ elif self.cxx.modules_flags is not None:
+ modules_str = ' '.join(self.cxx.modules_flags) + ' '
+ sub.append(('%compile_module', compile_str + ' ' + modules_str))
+ sub.append(('%build_module', build_str + ' ' + modules_str))
sub.append(('%compile', compile_str))
sub.append(('%link', link_str))
sub.append(('%build', build_str))
@@ -686,18 +814,20 @@ class Configuration(object):
sub.append(('%exec', exec_str))
# Configure run shortcut
sub.append(('%run', exec_str + ' %t.exe'))
- # Configure not program substitions
+ # Configure not program substitutions
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not', 'not.py')
- not_str = '%s %s' % (sys.executable, not_py)
- sub.append(('not', not_str))
+ not_str = '%s %s ' % (sys.executable, not_py)
+ sub.append(('not ', not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf('target_triple')
- self.use_target = bool(self.config.target_triple)
+ self.use_target = self.get_lit_bool('use_target', False)
+ if self.use_target and self.config.target_triple:
+ self.lit_config.warning('use_target is true but no triple is specified')
# If no target triple was given, try to infer it from the compiler
# under test.
- if not self.use_target:
+ if not self.config.target_triple:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
diff --git a/test/libcxx/test/format.py b/test/libcxx/test/format.py
index b9ec2ba2aa7b..ee6ab82c6e3a 100644
--- a/test/libcxx/test/format.py
+++ b/test/libcxx/test/format.py
@@ -10,11 +10,15 @@
import errno
import os
import time
+import random
import lit.Test # pylint: disable=import-error
import lit.TestRunner # pylint: disable=import-error
+from lit.TestRunner import ParserKind, IntegratedTestKeywordParser \
+ # pylint: disable=import-error
import lit.util # pylint: disable=import-error
+
from libcxx.test.executor import LocalExecutor as LocalExecutor
import libcxx.util
@@ -32,11 +36,32 @@ class LibcxxTestFormat(object):
def __init__(self, cxx, use_verify_for_fail, execute_external,
executor, exec_env):
- self.cxx = cxx
+ self.cxx = cxx.copy()
self.use_verify_for_fail = use_verify_for_fail
self.execute_external = execute_external
self.executor = executor
self.exec_env = dict(exec_env)
+ self.cxx.compile_env = dict(os.environ)
+ # 'CCACHE_CPP2' prevents ccache from stripping comments while
+ # preprocessing. This is required to prevent stripping of '-verify'
+ # comments.
+ self.cxx.compile_env['CCACHE_CPP2'] = '1'
+
+ @staticmethod
+ def _make_custom_parsers():
+ return [
+ IntegratedTestKeywordParser('FLAKY_TEST.', ParserKind.TAG,
+ initial_value=False),
+ IntegratedTestKeywordParser('MODULES_DEFINES:', ParserKind.LIST,
+ initial_value=[])
+ ]
+
+ @staticmethod
+ def _get_parser(key, parsers):
+ for p in parsers:
+ if p.keyword == key:
+ return p
+ assert False and "parser not found"
# TODO: Move this into lit's FileBasedTest
def getTestsInDirectory(self, testSuite, path_in_suite,
@@ -65,16 +90,20 @@ class LibcxxTestFormat(object):
def _execute(self, test, lit_config):
name = test.path_in_suite[-1]
- is_sh_test = name.endswith('.sh.cpp')
+ name_root, name_ext = os.path.splitext(name)
+ is_libcxx_test = test.path_in_suite[0] == 'libcxx'
+ is_sh_test = name_root.endswith('.sh')
is_pass_test = name.endswith('.pass.cpp')
is_fail_test = name.endswith('.fail.cpp')
+ assert is_sh_test or name_ext == '.cpp', 'non-cpp file must be sh test'
if test.config.unsupported:
return (lit.Test.UNSUPPORTED,
"A lit.local.cfg marked this unsupported")
+ parsers = self._make_custom_parsers()
script = lit.TestRunner.parseIntegratedTestScript(
- test, require_script=is_sh_test)
+ test, additional_parsers=parsers, require_script=is_sh_test)
# Check if a result for the test was returned. If so return that
# result.
if isinstance(script, lit.Test.Result):
@@ -91,6 +120,25 @@ class LibcxxTestFormat(object):
tmpBase)
script = lit.TestRunner.applySubstitutions(script, substitutions)
+ test_cxx = self.cxx.copy()
+ if is_fail_test:
+ test_cxx.useCCache(False)
+ test_cxx.useWarnings(False)
+ extra_modules_defines = self._get_parser('MODULES_DEFINES:',
+ parsers).getValue()
+ if '-fmodules' in test.config.available_features:
+ test_cxx.compile_flags += [('-D%s' % mdef.strip()) for
+ mdef in extra_modules_defines]
+ test_cxx.addWarningFlagIfSupported('-Wno-macro-redefined')
+ # FIXME: libc++ debug tests #define _LIBCPP_ASSERT to override it
+ # If we see this we need to build the test against uniquely built
+ # modules.
+ if is_libcxx_test:
+ with open(test.getSourcePath(), 'r') as f:
+ contents = f.read()
+ if '#define _LIBCPP_ASSERT' in contents:
+ test_cxx.useModules(False)
+
# Dispatch the test based on its suffix.
if is_sh_test:
if not isinstance(self.executor, LocalExecutor):
@@ -101,9 +149,10 @@ class LibcxxTestFormat(object):
self.execute_external, script,
tmpBase)
elif is_fail_test:
- return self._evaluate_fail_test(test)
+ return self._evaluate_fail_test(test, test_cxx, parsers)
elif is_pass_test:
- return self._evaluate_pass_test(test, tmpBase, lit_config)
+ return self._evaluate_pass_test(test, tmpBase, lit_config,
+ test_cxx, parsers)
else:
# No other test type is supported
assert False
@@ -111,7 +160,8 @@ class LibcxxTestFormat(object):
def _clean(self, exec_path): # pylint: disable=no-self-use
libcxx.util.cleanFile(exec_path)
- def _evaluate_pass_test(self, test, tmpBase, lit_config):
+ def _evaluate_pass_test(self, test, tmpBase, lit_config,
+ test_cxx, parsers):
execDir = os.path.dirname(test.getExecPath())
source_path = test.getSourcePath()
exec_path = tmpBase + '.exe'
@@ -120,7 +170,7 @@ class LibcxxTestFormat(object):
lit.util.mkdir_p(os.path.dirname(tmpBase))
try:
# Compile the test
- cmd, out, err, rc = self.cxx.compileLinkTwoSteps(
+ cmd, out, err, rc = test_cxx.compileLinkTwoSteps(
source_path, out=exec_path, object_file=object_path,
cwd=execDir)
compile_cmd = cmd
@@ -139,22 +189,31 @@ class LibcxxTestFormat(object):
# should add a `// FILE-DEP: foo.dat` to each test to track this.
data_files = [os.path.join(local_cwd, f)
for f in os.listdir(local_cwd) if f.endswith('.dat')]
- cmd, out, err, rc = self.executor.run(exec_path, [exec_path],
- local_cwd, data_files, env)
- if rc != 0:
- report = libcxx.util.makeReport(cmd, out, err, rc)
- report = "Compiled With: %s\n%s" % (compile_cmd, report)
- report += "Compiled test failed unexpectedly!"
- return lit.Test.FAIL, report
- return lit.Test.PASS, ''
+ is_flaky = self._get_parser('FLAKY_TEST.', parsers).getValue()
+ max_retry = 3 if is_flaky else 1
+ for retry_count in range(max_retry):
+ cmd, out, err, rc = self.executor.run(exec_path, [exec_path],
+ local_cwd, data_files,
+ env)
+ if rc == 0:
+ res = lit.Test.PASS if retry_count == 0 else lit.Test.FLAKYPASS
+ return res, ''
+ elif rc != 0 and retry_count + 1 == max_retry:
+ report = libcxx.util.makeReport(cmd, out, err, rc)
+ report = "Compiled With: %s\n%s" % (compile_cmd, report)
+ report += "Compiled test failed unexpectedly!"
+ return lit.Test.FAIL, report
+
+ assert False # Unreachable
finally:
# Note that cleanup of exec_file happens in `_clean()`. If you
# override this, cleanup is your reponsibility.
libcxx.util.cleanFile(object_path)
self._clean(exec_path)
- def _evaluate_fail_test(self, test):
+ def _evaluate_fail_test(self, test, test_cxx, parsers):
source_path = test.getSourcePath()
+ # FIXME: lift this detection into LLVM/LIT.
with open(source_path, 'r') as f:
contents = f.read()
verify_tags = ['expected-note', 'expected-remark', 'expected-warning',
@@ -165,15 +224,11 @@ class LibcxxTestFormat(object):
# are dependant on a template parameter when '-fsyntax-only' is passed.
# This is fixed in GCC 6. However for now we only pass "-fsyntax-only"
# when using Clang.
- extra_flags = []
- if self.cxx.type != 'gcc':
- extra_flags += ['-fsyntax-only']
+ if test_cxx.type != 'gcc':
+ test_cxx.flags += ['-fsyntax-only']
if use_verify:
- extra_flags += ['-Xclang', '-verify',
- '-Xclang', '-verify-ignore-unexpected=note']
- cmd, out, err, rc = self.cxx.compile(source_path, out=os.devnull,
- flags=extra_flags,
- disable_ccache=True)
+ test_cxx.useVerify()
+ cmd, out, err, rc = test_cxx.compile(source_path, out=os.devnull)
expected_rc = 0 if use_verify else 1
if rc == expected_rc:
return lit.Test.PASS, ''
diff --git a/test/libcxx/test/target_info.py b/test/libcxx/test/target_info.py
index a743595a1046..dc94e7afe0a9 100644
--- a/test/libcxx/test/target_info.py
+++ b/test/libcxx/test/target_info.py
@@ -115,7 +115,7 @@ class DarwinLocalTI(DefaultTargetInfo):
return False
def add_sanitizer_features(self, sanitizer_type, features):
- if san == 'Undefined':
+ if sanitizer_type == 'Undefined':
features.add('sanitizer-new-delete')
@@ -180,7 +180,8 @@ class LinuxLocalTI(DefaultTargetInfo):
if llvm_unwinder:
flags += ['-lunwind', '-ldl']
else:
- flags += ['-lgcc_s', '-lgcc']
+ flags += ['-lgcc_s']
+ flags += ['-lgcc']
use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
if use_libatomic:
flags += ['-latomic']
diff --git a/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
index bf28e01a0e86..6ebba1467db9 100644
--- a/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// <condition_variable>
diff --git a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
index aae0afbffd37..d3568caa81a3 100644
--- a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp
@@ -23,6 +23,7 @@
// C++11 and C++03. This is important since the mangling of `lock_guard` depends
// on it being declared as a variadic template, even in C++03.
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <string>
diff --git a/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
index 12c80f02c340..c6ed66ce41d9 100644
--- a/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// <mutex>
diff --git a/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
index 10626bc4072e..2031e4d7d4bb 100644
--- a/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// <mutex>
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 4e85a039686a..bff682ec4e00 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -12,6 +12,7 @@
// <mutex>
+// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
index 40b97c396ad6..3898d08d8378 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
@@ -12,6 +12,7 @@
// <mutex>
+// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
index c1425c960c00..941e9ff8f678 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp
@@ -12,6 +12,7 @@
// <mutex>
+// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
index e03f5eabffcf..1a5685e8deb8 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -12,6 +12,7 @@
// <mutex>
+// MODULES_DEFINES: _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
#include <mutex>
diff --git a/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
index c8807a965c44..1b1cbf89a099 100644
--- a/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// <thread>
diff --git a/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp
index a5bf77031cca..e864af7f05b2 100644
--- a/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.class/types.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external
// <thread>
diff --git a/test/libcxx/utilities/any/size_and_alignment.pass.cpp b/test/libcxx/utilities/any/size_and_alignment.pass.cpp
new file mode 100644
index 000000000000..a1bdf1604907
--- /dev/null
+++ b/test/libcxx/utilities/any/size_and_alignment.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// Check that the size and alignment of any are what we expect.
+
+#include <any>
+
+int main()
+{
+ using std::any;
+ static_assert(sizeof(any) == sizeof(void*)*4, "");
+ static_assert(alignof(any) == alignof(void*), "");
+}
diff --git a/test/libcxx/utilities/any/small_type.pass.cpp b/test/libcxx/utilities/any/small_type.pass.cpp
new file mode 100644
index 000000000000..54de0c3ead57
--- /dev/null
+++ b/test/libcxx/utilities/any/small_type.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// Check that the size and alignment of any are what we expect.
+
+#include <any>
+#include "any_helpers.h"
+
+constexpr std::size_t BufferSize = (sizeof(void*) * 3);
+constexpr std::size_t BufferAlignment = alignof(void*);
+// Clang doesn't like "alignof(BufferAlignment * 2)" due to PR13986.
+// So we create "DoubleBufferAlignment" instead.
+constexpr std::size_t DoubleBufferAlignment = BufferAlignment * 2;
+
+class SmallThrowsDtor
+{
+public:
+ SmallThrowsDtor() {}
+ SmallThrowsDtor(SmallThrowsDtor const &) noexcept {}
+ SmallThrowsDtor(SmallThrowsDtor &&) noexcept {}
+ ~SmallThrowsDtor() noexcept(false) {}
+};
+
+
+struct alignas(1) MaxSizeType {
+ char buff[BufferSize];
+};
+
+struct alignas(BufferAlignment) MaxAlignType {
+};
+
+struct alignas(BufferAlignment) MaxSizeAndAlignType {
+ char buff[BufferSize];
+};
+
+
+struct alignas(1) OverSizeType {
+ char buff[BufferSize + 1];
+};
+
+struct alignas(DoubleBufferAlignment) OverAlignedType {
+};
+
+struct alignas(DoubleBufferAlignment) OverSizeAndAlignedType {
+ char buff[BufferSize + 1];
+};
+
+int main()
+{
+ using std::any;
+ using std::__any_imp::_IsSmallObject;
+ static_assert(_IsSmallObject<small>::value, "");
+ static_assert(_IsSmallObject<void*>::value, "");
+ static_assert(!_IsSmallObject<SmallThrowsDtor>::value, "");
+ static_assert(!_IsSmallObject<large>::value, "");
+ {
+ // Check a type that meets the size requirement *exactly* and has
+ // a lesser alignment requirement is considered small.
+ typedef MaxSizeType T;
+ static_assert(sizeof(T) == BufferSize, "");
+ static_assert(alignof(T) < BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the alignment requirement *exactly* and has
+ // a lesser size is considered small.
+ typedef MaxAlignType T;
+ static_assert(sizeof(T) < BufferSize, "");
+ static_assert(alignof(T) == BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the size and alignment requirements *exactly*
+ // is considered small.
+ typedef MaxSizeAndAlignType T;
+ static_assert(sizeof(T) == BufferSize, "");
+ static_assert(alignof(T) == BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the alignment requirements but is over-sized
+ // is not considered small.
+ typedef OverSizeType T;
+ static_assert(sizeof(T) > BufferSize, "");
+ static_assert(alignof(T) < BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the size requirements but is over-aligned
+ // is not considered small.
+ typedef OverAlignedType T;
+ static_assert(sizeof(T) < BufferSize, "");
+ static_assert(alignof(T) > BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that exceeds both the size an alignment requirements
+ // is not considered small.
+ typedef OverSizeAndAlignedType T;
+ static_assert(sizeof(T) > BufferSize, "");
+ static_assert(alignof(T) > BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+}
diff --git a/test/std/utilities/utility/forward/forward6.fail.cpp b/test/libcxx/utilities/any/version.pass.cpp
index 1f4b37d946ca..5edee710d585 100644
--- a/test/std/utilities/utility/forward/forward6.fail.cpp
+++ b/test/libcxx/utilities/any/version.pass.cpp
@@ -7,16 +7,14 @@
//
//===----------------------------------------------------------------------===//
-// test forward
+// <any>
-#include <utility>
+#include <any>
-struct A
-{
-};
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
int main()
{
- A a;
- std::forward(a); // error
}
diff --git a/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp b/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
index 509c751b455d..7fb1568c0619 100644
--- a/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
+++ b/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
@@ -266,6 +266,7 @@ void test_derived_from_ref_wrap() {
auto& ret2 = std::__invoke(get_fn, d);
auto& cret2 = std::__invoke_constexpr(get_fn, d);
assert(&ret2 == &x);
+ assert(&cret2 == &x);
auto& ret3 = std::__invoke(get_fn, r2);
assert(&ret3 == &x);
}
@@ -367,4 +368,4 @@ int main() {
test_derived_from_ref_wrap();
#endif
-} \ No newline at end of file
+}
diff --git a/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
new file mode 100644
index 000000000000..cc04e4e87f0c
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional<T>& operator=(const optional<T>& rhs);
+
+#include <optional>
+#include <string>
+#include <type_traits>
+
+using std::optional;
+
+struct X {};
+
+struct Y
+{
+ Y() = default;
+ Y& operator=(const Y&) { return *this; }
+};
+
+struct Z1
+{
+ Z1() = default;
+ Z1(Z1&&) = default;
+ Z1(const Z1&) = default;
+ Z1& operator=(Z1&&) = default;
+ Z1& operator=(const Z1&) = delete;
+};
+
+struct Z2
+{
+ Z2() = default;
+ Z2(Z2&&) = default;
+ Z2(const Z2&) = delete;
+ Z2& operator=(Z2&&) = default;
+ Z2& operator=(const Z2&) = default;
+};
+
+template <class T>
+constexpr bool
+test()
+{
+ optional<T> opt;
+ optional<T> opt2;
+ opt = opt2;
+ return true;
+}
+
+int main()
+{
+ {
+ using T = int;
+ static_assert((std::is_trivially_copy_assignable<optional<T>>::value), "");
+ static_assert(test<T>(), "");
+ }
+ {
+ using T = X;
+ static_assert((std::is_trivially_copy_assignable<optional<T>>::value), "");
+ static_assert(test<T>(), "");
+ }
+ static_assert(!(std::is_trivially_copy_assignable<optional<Y>>::value), "");
+ static_assert(!(std::is_trivially_copy_assignable<optional<std::string>>::value), "");
+
+ static_assert(!(std::is_copy_assignable<optional<Z1>>::value), "");
+ static_assert(!(std::is_copy_assignable<optional<Z2>>::value), "");
+}
diff --git a/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp b/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
new file mode 100644
index 000000000000..6f421153cafb
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional<T>& operator=(optional<T>&& rhs);
+
+#include <optional>
+#include <string>
+#include <type_traits>
+#include <utility>
+
+using std::optional;
+
+struct X {};
+
+struct Y
+{
+ Y() = default;
+ Y& operator=(Y&&) { return *this; }
+};
+
+struct Z1
+{
+ Z1() = default;
+ Z1(Z1&&) = default;
+ Z1& operator=(Z1&&) = delete;
+};
+
+struct Z2
+{
+ Z2() = default;
+ Z2(Z2&&) = delete;
+ Z2& operator=(Z2&&) = default;
+};
+
+template <class T>
+constexpr bool
+test()
+{
+ optional<T> opt;
+ optional<T> opt2;
+ opt = std::move(opt2);
+ return true;
+}
+
+int main()
+{
+ {
+ using T = int;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ static_assert(test<T>(), "");
+ }
+ {
+ using T = X;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ static_assert(test<T>(), "");
+ }
+ static_assert(!(std::is_trivially_move_assignable<optional<Y>>::value), "");
+ static_assert(!(std::is_trivially_move_assignable<optional<std::string>>::value), "");
+
+ static_assert(!(std::is_move_assignable<optional<Z1>>::value), "");
+ static_assert(!(std::is_move_assignable<optional<Z2>>::value), "");
+}
diff --git a/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
new file mode 100644
index 000000000000..62eb6cd34880
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// optional(const optional<T>& rhs);
+
+#include <optional>
+#include <string>
+#include <type_traits>
+
+using std::optional;
+
+struct X {};
+
+struct Y
+{
+ Y() = default;
+ Y(const Y&) {}
+};
+
+struct Z
+{
+ Z() = default;
+ Z(Z&&) = delete;
+ Z(const Z&) = delete;
+ Z& operator=(Z&&) = delete;
+ Z& operator=(const Z&) = delete;
+};
+
+int main()
+{
+ {
+ using T = int;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ constexpr optional<T> opt;
+ constexpr optional<T> opt2 = opt;
+ (void)opt2;
+ }
+ {
+ using T = X;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ constexpr optional<T> opt;
+ constexpr optional<T> opt2 = opt;
+ (void)opt2;
+ }
+ static_assert(!(std::is_trivially_copy_constructible<optional<Y>>::value), "");
+ static_assert(!(std::is_trivially_copy_constructible<optional<std::string>>::value), "");
+
+ static_assert(!(std::is_copy_constructible<optional<Z>>::value), "");
+}
diff --git a/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
new file mode 100644
index 000000000000..f13ca92e2807
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// optional(optional<T>&& rhs);
+
+#include <optional>
+#include <string>
+#include <type_traits>
+#include <utility>
+
+using std::optional;
+
+struct X {};
+
+struct Y
+{
+ Y() = default;
+ Y(Y&&) {}
+};
+
+struct Z
+{
+ Z() = default;
+ Z(Z&&) = delete;
+ Z(const Z&) = delete;
+ Z& operator=(Z&&) = delete;
+ Z& operator=(const Z&) = delete;
+};
+
+int main()
+{
+ {
+ using T = int;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ constexpr optional<T> opt;
+ constexpr optional<T> opt2 = std::move(opt);
+ (void)opt2;
+ }
+ {
+ using T = X;
+ static_assert((std::is_trivially_copy_constructible<optional<T>>::value), "");
+ constexpr optional<T> opt;
+ constexpr optional<T> opt2 = std::move(opt);
+ (void)opt2;
+ }
+ static_assert(!(std::is_trivially_move_constructible<optional<Y>>::value), "");
+ static_assert(!(std::is_trivially_move_constructible<optional<std::string>>::value), "");
+
+ static_assert(!(std::is_move_constructible<optional<Z>>::value), "");
+}
diff --git a/test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp b/test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp
new file mode 100644
index 000000000000..9493d6bb766c
--- /dev/null
+++ b/test/libcxx/utilities/optional/optional.object/special_member_gen.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "archetypes.hpp"
+
+template <class T>
+struct SpecialMemberTest {
+ using O = std::optional<T>;
+
+ template <template <class> class TestMF>
+ static constexpr bool check_same() {
+ return TestMF<O>::value == TestMF<T>::value;
+ }
+
+ // Test that optional inherits the correct trivial/non-trivial members
+ static_assert(check_same<std::is_trivially_destructible>(), "");
+ static_assert(check_same<std::is_trivially_copyable>(), "");
+};
+
+template <class ...Args> static void sink(Args&&...) {}
+
+template <class ...TestTypes>
+struct DoTestsMetafunction {
+ DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); }
+};
+
+struct TrivialMoveNonTrivialCopy {
+ TrivialMoveNonTrivialCopy() = default;
+ TrivialMoveNonTrivialCopy(const TrivialMoveNonTrivialCopy&) {}
+ TrivialMoveNonTrivialCopy(TrivialMoveNonTrivialCopy&&) = default;
+ TrivialMoveNonTrivialCopy& operator=(const TrivialMoveNonTrivialCopy&) { return *this; }
+ TrivialMoveNonTrivialCopy& operator=(TrivialMoveNonTrivialCopy&&) = default;
+};
+
+struct TrivialCopyNonTrivialMove {
+ TrivialCopyNonTrivialMove() = default;
+ TrivialCopyNonTrivialMove(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove(TrivialCopyNonTrivialMove&&) {}
+ TrivialCopyNonTrivialMove& operator=(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove& operator=(TrivialCopyNonTrivialMove&&) { return *this; }
+};
+
+int main()
+{
+ sink(
+ ImplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ ExplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{},
+ DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{}
+ );
+}
diff --git a/test/libcxx/utilities/optional/version.pass.cpp b/test/libcxx/utilities/optional/version.pass.cpp
new file mode 100644
index 000000000000..e7581b5431b1
--- /dev/null
+++ b/test/libcxx/utilities/optional/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <optional>
+
+#include <optional>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp
new file mode 100644
index 000000000000..a35dfd696259
--- /dev/null
+++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// Test the diagnostics libc++ generates for invalid reference binding.
+// Libc++ attempts to diagnose the following cases:
+// * Constructing an lvalue reference from an rvalue.
+// * Constructing an rvalue reference from an lvalue.
+
+#include <tuple>
+#include <string>
+
+int main() {
+ std::allocator<void> alloc;
+
+ // expected-error@tuple:* 4 {{static_assert failed "Attempted to construct a reference element in a tuple with an rvalue"}}
+
+ // bind lvalue to rvalue
+ std::tuple<int const&> t(42); // expected-note {{requested here}}
+ std::tuple<int const&> t1(std::allocator_arg, alloc, 42); // expected-note {{requested here}}
+ // bind rvalue to constructed non-rvalue
+ std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}}
+ std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}}
+}
diff --git a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.pass.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.pass.cpp
new file mode 100644
index 000000000000..a90a2912d3a8
--- /dev/null
+++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// Test the diagnostics libc++ generates for invalid reference binding.
+// Libc++ attempts to diagnose the following cases:
+// * Constructing an lvalue reference from an rvalue.
+// * Constructing an rvalue reference from an lvalue.
+
+#include <tuple>
+#include <string>
+#include <functional>
+#include <cassert>
+
+static_assert(std::is_constructible<int&, std::reference_wrapper<int>>::value, "");
+static_assert(std::is_constructible<int const&, std::reference_wrapper<int>>::value, "");
+
+
+int main() {
+ std::allocator<void> alloc;
+ int x = 42;
+ {
+ std::tuple<int&> t(std::ref(x));
+ assert(&std::get<0>(t) == &x);
+ std::tuple<int&> t1(std::allocator_arg, alloc, std::ref(x));
+ assert(&std::get<0>(t1) == &x);
+ }
+ {
+ auto r = std::ref(x);
+ auto const& cr = r;
+ std::tuple<int&> t(r);
+ assert(&std::get<0>(t) == &x);
+ std::tuple<int&> t1(cr);
+ assert(&std::get<0>(t1) == &x);
+ std::tuple<int&> t2(std::allocator_arg, alloc, r);
+ assert(&std::get<0>(t2) == &x);
+ std::tuple<int&> t3(std::allocator_arg, alloc, cr);
+ assert(&std::get<0>(t3) == &x);
+ }
+ {
+ std::tuple<int const&> t(std::ref(x));
+ assert(&std::get<0>(t) == &x);
+ std::tuple<int const&> t2(std::cref(x));
+ assert(&std::get<0>(t2) == &x);
+ std::tuple<int const&> t3(std::allocator_arg, alloc, std::ref(x));
+ assert(&std::get<0>(t3) == &x);
+ std::tuple<int const&> t4(std::allocator_arg, alloc, std::cref(x));
+ assert(&std::get<0>(t4) == &x);
+ }
+ {
+ auto r = std::ref(x);
+ auto cr = std::cref(x);
+ std::tuple<int const&> t(r);
+ assert(&std::get<0>(t) == &x);
+ std::tuple<int const&> t2(cr);
+ assert(&std::get<0>(t2) == &x);
+ std::tuple<int const&> t3(std::allocator_arg, alloc, r);
+ assert(&std::get<0>(t3) == &x);
+ std::tuple<int const&> t4(std::allocator_arg, alloc, cr);
+ assert(&std::get<0>(t4) == &x);
+ }
+} \ No newline at end of file
diff --git a/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp b/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
new file mode 100644
index 000000000000..4808c51cd4d1
--- /dev/null
+++ b/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/disable_reduced_arity_initialization_extension.pass.cpp
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class... UTypes>
+// explicit tuple(UTypes&&... u);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <cassert>
+#include <type_traits>
+#include <string>
+#include <system_error>
+
+#include "test_macros.h"
+#include "test_convertible.hpp"
+#include "MoveOnly.h"
+
+#if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION)
+#error This macro should not be defined by default
+#endif
+
+struct NoDefault { NoDefault() = delete; };
+
+
+// Make sure the _Up... constructor SFINAEs out when the types that
+// are not explicitly initialized are not all default constructible.
+// Otherwise, std::is_constructible would return true but instantiating
+// the constructor would fail.
+void test_default_constructible_extension_sfinae()
+{
+ typedef MoveOnly MO;
+ typedef NoDefault ND;
+ {
+ typedef std::tuple<MO, ND> Tuple;
+ static_assert(!std::is_constructible<Tuple, MO>::value, "");
+ static_assert(std::is_constructible<Tuple, MO, ND>::value, "");
+ static_assert(test_convertible<Tuple, MO, ND>(), "");
+ }
+ {
+ typedef std::tuple<MO, MO, ND> Tuple;
+ static_assert(!std::is_constructible<Tuple, MO, MO>::value, "");
+ static_assert(std::is_constructible<Tuple, MO, MO, ND>::value, "");
+ static_assert(test_convertible<Tuple, MO, MO, ND>(), "");
+ }
+ {
+ // Same idea as above but with a nested tuple type.
+ typedef std::tuple<MO, ND> Tuple;
+ typedef std::tuple<MO, Tuple, MO, MO> NestedTuple;
+
+ static_assert(!std::is_constructible<
+ NestedTuple, MO, MO, MO, MO>::value, "");
+ static_assert(std::is_constructible<
+ NestedTuple, MO, Tuple, MO, MO>::value, "");
+ }
+}
+
+using ExplicitTup = std::tuple<std::string, int, std::error_code>;
+ExplicitTup doc_example() {
+ return ExplicitTup{"hello world", 42}; // explicit constructor called. OK.
+}
+
+// Test that the example given in UsingLibcxx.rst actually works.
+void test_example_from_docs() {
+ auto tup = doc_example();
+ assert(std::get<0>(tup) == "hello world");
+ assert(std::get<1>(tup) == 42);
+ assert(std::get<2>(tup) == std::error_code{});
+}
+
+int main()
+{
+ {
+ using E = MoveOnly;
+ using Tup = std::tuple<E, E, E>;
+ // Test that the reduced arity initialization extension is only
+ // allowed on the explicit constructor.
+ static_assert(test_convertible<Tup, E, E, E>(), "");
+
+ Tup t(E(0), E(1));
+ static_assert(std::is_constructible<Tup, E, E>::value, "");
+ static_assert(!test_convertible<Tup, E, E>(), "");
+ assert(std::get<0>(t) == 0);
+ assert(std::get<1>(t) == 1);
+ assert(std::get<2>(t) == MoveOnly());
+
+ Tup t2(E(0));
+ static_assert(std::is_constructible<Tup, E>::value, "");
+ static_assert(!test_convertible<Tup, E>(), "");
+ assert(std::get<0>(t) == 0);
+ assert(std::get<1>(t) == E());
+ assert(std::get<2>(t) == E());
+ }
+ // Check that SFINAE is properly applied with the default reduced arity
+ // constructor extensions.
+ test_default_constructible_extension_sfinae();
+ test_example_from_docs();
+}
diff --git a/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp b/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
new file mode 100644
index 000000000000..99b6eb78f268
--- /dev/null
+++ b/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/enable_reduced_arity_initialization_extension.pass.cpp
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class... UTypes>
+// explicit tuple(UTypes&&... u);
+
+// UNSUPPORTED: c++98, c++03
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION
+#define _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION
+#include <tuple>
+#include <cassert>
+#include <type_traits>
+#include <string>
+#include <system_error>
+
+#include "test_macros.h"
+#include "test_convertible.hpp"
+#include "MoveOnly.h"
+
+
+struct NoDefault { NoDefault() = delete; };
+
+
+// Make sure the _Up... constructor SFINAEs out when the types that
+// are not explicitly initialized are not all default constructible.
+// Otherwise, std::is_constructible would return true but instantiating
+// the constructor would fail.
+void test_default_constructible_extension_sfinae()
+{
+ typedef MoveOnly MO;
+ typedef NoDefault ND;
+ {
+ typedef std::tuple<MO, ND> Tuple;
+ static_assert(!std::is_constructible<Tuple, MO>::value, "");
+ static_assert(std::is_constructible<Tuple, MO, ND>::value, "");
+ static_assert(test_convertible<Tuple, MO, ND>(), "");
+ }
+ {
+ typedef std::tuple<MO, MO, ND> Tuple;
+ static_assert(!std::is_constructible<Tuple, MO, MO>::value, "");
+ static_assert(std::is_constructible<Tuple, MO, MO, ND>::value, "");
+ static_assert(test_convertible<Tuple, MO, MO, ND>(), "");
+ }
+ {
+ // Same idea as above but with a nested tuple type.
+ typedef std::tuple<MO, ND> Tuple;
+ typedef std::tuple<MO, Tuple, MO, MO> NestedTuple;
+
+ static_assert(!std::is_constructible<
+ NestedTuple, MO, MO, MO, MO>::value, "");
+ static_assert(std::is_constructible<
+ NestedTuple, MO, Tuple, MO, MO>::value, "");
+ }
+ {
+ typedef std::tuple<MO, int> Tuple;
+ typedef std::tuple<MO, Tuple, MO, MO> NestedTuple;
+
+ static_assert(std::is_constructible<
+ NestedTuple, MO, MO, MO, MO>::value, "");
+ static_assert(test_convertible<
+ NestedTuple, MO, MO, MO, MO>(), "");
+
+ static_assert(std::is_constructible<
+ NestedTuple, MO, Tuple, MO, MO>::value, "");
+ static_assert(test_convertible<
+ NestedTuple, MO, Tuple, MO, MO>(), "");
+ }
+}
+
+std::tuple<std::string, int, std::error_code> doc_example() {
+ return {"hello world", 42};
+}
+
+// Test that the example given in UsingLibcxx.rst actually works.
+void test_example_from_docs() {
+ auto tup = doc_example();
+ assert(std::get<0>(tup) == "hello world");
+ assert(std::get<1>(tup) == 42);
+ assert(std::get<2>(tup) == std::error_code{});
+}
+
+int main()
+{
+
+ {
+ using E = MoveOnly;
+ using Tup = std::tuple<E, E, E>;
+ static_assert(test_convertible<Tup, E, E, E>(), "");
+
+ Tup t = {E(0), E(1)};
+ static_assert(test_convertible<Tup, E, E>(), "");
+ assert(std::get<0>(t) == 0);
+ assert(std::get<1>(t) == 1);
+ assert(std::get<2>(t) == MoveOnly());
+
+ Tup t2 = {E(0)};
+ static_assert(test_convertible<Tup, E>(), "");
+ assert(std::get<0>(t) == 0);
+ assert(std::get<1>(t) == E());
+ assert(std::get<2>(t) == E());
+ }
+ // Check that SFINAE is properly applied with the default reduced arity
+ // constructor extensions.
+ test_default_constructible_extension_sfinae();
+ test_example_from_docs();
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
index c012ac6265e0..8b5969d5198c 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -7,49 +7,146 @@
//
//===----------------------------------------------------------------------===//
+// The test fails due to the missing is_trivially_constructible intrinsic.
+// XFAIL: gcc-4.9
+
+// The test suite needs to define the ABI macros on the command line when
+// modules are enabled.
+// UNSUPPORTED: -fmodules
+
// <utility>
// template <class T1, class T2> struct pair
-// Test that we properly provide the old non-trivial copy operations
-// when the ABI macro is defined.
+// Test that we properly provide the trivial copy operations by default.
+// FreeBSD provides the old ABI. This test checks the new ABI so we need
+// to manually turn it on.
+#undef _LIBCPP_ABI_UNSTABLE
+#undef _LIBCPP_ABI_VERSION
+#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+
#include <utility>
+#include <type_traits>
+#include <cstdlib>
#include <cassert>
#include "test_macros.h"
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
+#error trivial ctor ABI macro defined
+#endif
+
+template <class T>
+struct HasNonTrivialABI : std::integral_constant<bool,
+ !std::is_trivially_destructible<T>::value
+ || (std::is_copy_constructible<T>::value && !std::is_trivially_copy_constructible<T>::value)
#if TEST_STD_VER >= 11
-struct Dummy {
- Dummy(Dummy const&) = delete;
- Dummy(Dummy &&) = default;
+ || (std::is_move_constructible<T>::value && !std::is_trivially_move_constructible<T>::value)
+#endif
+> {};
+
+#if TEST_STD_VER >= 11
+struct NonTrivialDtor {
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
+};
+NonTrivialDtor::~NonTrivialDtor() {}
+static_assert(HasNonTrivialABI<NonTrivialDtor>::value, "");
+
+struct NonTrivialCopy {
+ NonTrivialCopy(NonTrivialCopy const&);
+};
+NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
+static_assert(HasNonTrivialABI<NonTrivialCopy>::value, "");
+
+struct NonTrivialMove {
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
+};
+NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
+static_assert(HasNonTrivialABI<NonTrivialMove>::value, "");
+
+struct DeletedCopy {
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
+};
+static_assert(!HasNonTrivialABI<DeletedCopy>::value, "");
+
+struct TrivialMove {
+ TrivialMove(TrivialMove &&) = default;
};
+static_assert(!HasNonTrivialABI<TrivialMove>::value, "");
+
+struct Trivial {
+ Trivial(Trivial const&) = default;
+};
+static_assert(!HasNonTrivialABI<Trivial>::value, "");
#endif
+
int main()
{
- typedef std::pair<int, short> P;
{
+ typedef std::pair<int, short> P;
static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copyable<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
}
#if TEST_STD_VER >= 11
{
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
static_assert(std::is_move_constructible<P>::value, "");
static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_copyable<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
}
{
- using P1 = std::pair<Dummy, int>;
- // These lines fail because the non-trivial constructors do not provide
- // SFINAE.
- // static_assert(!std::is_copy_constructible<P1>::value, "");
- // static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
- static_assert(std::is_move_constructible<P1>::value, "");
- static_assert(!std::is_trivially_move_constructible<P1>::value, "");
- static_assert(!std::is_trivially_copyable<P>::value, "");
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
}
#endif
}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
new file mode 100644
index 000000000000..a94aa2f78299
--- /dev/null
+++ b/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
@@ -0,0 +1,208 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// Clang 3.8 doesn't generate constexpr special members correctly.
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant& operator=(variant const&);
+
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NTCopyAssign {
+ constexpr NTCopyAssign(int v) : value(v) {}
+ NTCopyAssign(const NTCopyAssign &) = default;
+ NTCopyAssign(NTCopyAssign &&) = default;
+ NTCopyAssign &operator=(const NTCopyAssign &that) {
+ value = that.value;
+ return *this;
+ };
+ NTCopyAssign &operator=(NTCopyAssign &&) = delete;
+ int value;
+};
+
+static_assert(!std::is_trivially_copy_assignable<NTCopyAssign>::value, "");
+static_assert(std::is_copy_assignable<NTCopyAssign>::value, "");
+
+struct TCopyAssign {
+ constexpr TCopyAssign(int v) : value(v) {}
+ TCopyAssign(const TCopyAssign &) = default;
+ TCopyAssign(TCopyAssign &&) = default;
+ TCopyAssign &operator=(const TCopyAssign &) = default;
+ TCopyAssign &operator=(TCopyAssign &&) = delete;
+ int value;
+};
+
+static_assert(std::is_trivially_copy_assignable<TCopyAssign>::value, "");
+
+struct TCopyAssignNTMoveAssign {
+ constexpr TCopyAssignNTMoveAssign(int v) : value(v) {}
+ TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default;
+ TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default;
+ TCopyAssignNTMoveAssign &operator=(const TCopyAssignNTMoveAssign &) = default;
+ TCopyAssignNTMoveAssign &operator=(TCopyAssignNTMoveAssign &&that) {
+ value = that.value;
+ that.value = -1;
+ return *this;
+ }
+ int value;
+};
+
+static_assert(std::is_trivially_copy_assignable_v<TCopyAssignNTMoveAssign>);
+
+void test_copy_assignment_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_trivially_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NTCopyAssign>;
+ static_assert(!std::is_trivially_copy_assignable<V>::value, "");
+ static_assert(std::is_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TCopyAssign>;
+ static_assert(std::is_trivially_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TCopyAssignNTMoveAssign>;
+ static_assert(std::is_trivially_copy_assignable<V>::value, "");
+ }
+}
+
+template <typename T> struct Result { size_t index; T value; };
+
+void test_copy_assignment_same_index() {
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int>;
+ V v(43);
+ V v2(42);
+ v = v2;
+ return {v.index(), std::get<0>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 0);
+ static_assert(result.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ using V = std::variant<int, long, unsigned>;
+ V v(43l);
+ V v2(42l);
+ v = v2;
+ return {v.index(), std::get<1>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42l);
+ }
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int, TCopyAssign, unsigned>;
+ V v(std::in_place_type<TCopyAssign>, 43);
+ V v2(std::in_place_type<TCopyAssign>, 42);
+ v = v2;
+ return {v.index(), std::get<1>(v).value};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int, TCopyAssignNTMoveAssign, unsigned>;
+ V v(std::in_place_type<TCopyAssignNTMoveAssign>, 43);
+ V v2(std::in_place_type<TCopyAssignNTMoveAssign>, 42);
+ v = v2;
+ return {v.index(), std::get<1>(v).value};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+}
+
+void test_copy_assignment_different_index() {
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ using V = std::variant<int, long, unsigned>;
+ V v(43);
+ V v2(42l);
+ v = v2;
+ return {v.index(), std::get<1>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42l);
+ }
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int, TCopyAssign, unsigned>;
+ V v(std::in_place_type<unsigned>, 43);
+ V v2(std::in_place_type<TCopyAssign>, 42);
+ v = v2;
+ return {v.index(), std::get<1>(v).value};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+}
+
+template <size_t NewIdx, class ValueType>
+constexpr bool test_constexpr_assign_extension_imp(
+ std::variant<long, void*, int>&& v, ValueType&& new_value)
+{
+ const std::variant<long, void*, int> cp(
+ std::forward<ValueType>(new_value));
+ v = cp;
+ return v.index() == NewIdx &&
+ std::get<NewIdx>(v) == std::get<NewIdx>(cp);
+}
+
+void test_constexpr_copy_assignment_extension() {
+#ifdef _LIBCPP_VERSION
+ using V = std::variant<long, void*, int>;
+ static_assert(std::is_trivially_copyable<V>::value, "");
+ static_assert(std::is_trivially_copy_assignable<V>::value, "");
+ static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
+ static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
+ static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
+ static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+#endif
+}
+
+int main() {
+ test_copy_assignment_same_index();
+ test_copy_assignment_different_index();
+ test_copy_assignment_sfinae();
+ test_constexpr_copy_assignment_extension();
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
new file mode 100644
index 000000000000..a3d92472dd5e
--- /dev/null
+++ b/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// Clang 3.8 doesn't generate constexpr special members correctly.
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
+
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant& operator=(variant&&) noexcept(see below);
+
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NTMoveAssign {
+ constexpr NTMoveAssign(int v) : value(v) {}
+ NTMoveAssign(const NTMoveAssign &) = default;
+ NTMoveAssign(NTMoveAssign &&) = default;
+ NTMoveAssign &operator=(const NTMoveAssign &that) = default;
+ NTMoveAssign &operator=(NTMoveAssign &&that) {
+ value = that.value;
+ that.value = -1;
+ return *this;
+ };
+ int value;
+};
+
+static_assert(!std::is_trivially_move_assignable<NTMoveAssign>::value, "");
+static_assert(std::is_move_assignable<NTMoveAssign>::value, "");
+
+struct TMoveAssign {
+ constexpr TMoveAssign(int v) : value(v) {}
+ TMoveAssign(const TMoveAssign &) = delete;
+ TMoveAssign(TMoveAssign &&) = default;
+ TMoveAssign &operator=(const TMoveAssign &) = delete;
+ TMoveAssign &operator=(TMoveAssign &&) = default;
+ int value;
+};
+
+static_assert(std::is_trivially_move_assignable<TMoveAssign>::value, "");
+
+struct TMoveAssignNTCopyAssign {
+ constexpr TMoveAssignNTCopyAssign(int v) : value(v) {}
+ TMoveAssignNTCopyAssign(const TMoveAssignNTCopyAssign &) = default;
+ TMoveAssignNTCopyAssign(TMoveAssignNTCopyAssign &&) = default;
+ TMoveAssignNTCopyAssign &operator=(const TMoveAssignNTCopyAssign &that) {
+ value = that.value;
+ return *this;
+ }
+ TMoveAssignNTCopyAssign &operator=(TMoveAssignNTCopyAssign &&) = default;
+ int value;
+};
+
+static_assert(std::is_trivially_move_assignable_v<TMoveAssignNTCopyAssign>);
+
+void test_move_assignment_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_trivially_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NTMoveAssign>;
+ static_assert(!std::is_trivially_move_assignable<V>::value, "");
+ static_assert(std::is_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TMoveAssign>;
+ static_assert(std::is_trivially_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TMoveAssignNTCopyAssign>;
+ static_assert(std::is_trivially_move_assignable<V>::value, "");
+ }
+}
+
+template <typename T> struct Result { size_t index; T value; };
+
+void test_move_assignment_same_index() {
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int>;
+ V v(43);
+ V v2(42);
+ v = std::move(v2);
+ return {v.index(), std::get<0>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 0);
+ static_assert(result.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ using V = std::variant<int, long, unsigned>;
+ V v(43l);
+ V v2(42l);
+ v = std::move(v2);
+ return {v.index(), std::get<1>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42l);
+ }
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ using V = std::variant<int, TMoveAssign, unsigned>;
+ V v(std::in_place_type<TMoveAssign>, 43);
+ V v2(std::in_place_type<TMoveAssign>, 42);
+ v = std::move(v2);
+ return {v.index(), std::get<1>(v).value};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+}
+
+void test_move_assignment_different_index() {
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ using V = std::variant<int, long, unsigned>;
+ V v(43);
+ V v2(42l);
+ v = std::move(v2);
+ return {v.index(), std::get<1>(v)};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42l);
+ }
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ using V = std::variant<int, TMoveAssign, unsigned>;
+ V v(std::in_place_type<unsigned>, 43);
+ V v2(std::in_place_type<TMoveAssign>, 42);
+ v = std::move(v2);
+ return {v.index(), std::get<1>(v).value};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+}
+
+
+template <size_t NewIdx, class ValueType>
+constexpr bool test_constexpr_assign_extension_imp(
+ std::variant<long, void*, int>&& v, ValueType&& new_value)
+{
+ std::variant<long, void*, int> v2(
+ std::forward<ValueType>(new_value));
+ const auto cp = v2;
+ v = std::move(v2);
+ return v.index() == NewIdx &&
+ std::get<NewIdx>(v) == std::get<NewIdx>(cp);
+}
+
+void test_constexpr_move_assignment_extension() {
+#ifdef _LIBCPP_VERSION
+ using V = std::variant<long, void*, int>;
+ static_assert(std::is_trivially_copyable<V>::value, "");
+ static_assert(std::is_trivially_move_assignable<V>::value, "");
+ static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
+ static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
+ static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
+ static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+#endif
+}
+
+int main() {
+ test_move_assignment_same_index();
+ test_move_assignment_different_index();
+ test_move_assignment_sfinae();
+ test_constexpr_move_assignment_extension();
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
new file mode 100644
index 000000000000..59c433050590
--- /dev/null
+++ b/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant(variant const&);
+
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NTCopy {
+ constexpr NTCopy(int v) : value(v) {}
+ NTCopy(const NTCopy &that) : value(that.value) {}
+ NTCopy(NTCopy &&) = delete;
+ int value;
+};
+
+static_assert(!std::is_trivially_copy_constructible<NTCopy>::value, "");
+static_assert(std::is_copy_constructible<NTCopy>::value, "");
+
+struct TCopy {
+ constexpr TCopy(int v) : value(v) {}
+ TCopy(TCopy const &) = default;
+ TCopy(TCopy &&) = delete;
+ int value;
+};
+
+static_assert(std::is_trivially_copy_constructible<TCopy>::value, "");
+
+struct TCopyNTMove {
+ constexpr TCopyNTMove(int v) : value(v) {}
+ TCopyNTMove(const TCopyNTMove&) = default;
+ TCopyNTMove(TCopyNTMove&& that) : value(that.value) { that.value = -1; }
+ int value;
+};
+
+static_assert(std::is_trivially_copy_constructible<TCopyNTMove>::value, "");
+
+void test_copy_ctor_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_trivially_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NTCopy>;
+ static_assert(!std::is_trivially_copy_constructible<V>::value, "");
+ static_assert(std::is_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TCopy>;
+ static_assert(std::is_trivially_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TCopyNTMove>;
+ static_assert(std::is_trivially_copy_constructible<V>::value, "");
+ }
+}
+
+void test_copy_ctor_basic() {
+ {
+ constexpr std::variant<int> v(std::in_place_index<0>, 42);
+ static_assert(v.index() == 0);
+ constexpr std::variant<int> v2 = v;
+ static_assert(v2.index() == 0);
+ static_assert(std::get<0>(v2) == 42);
+ }
+ {
+ constexpr std::variant<int, long> v(std::in_place_index<1>, 42);
+ static_assert(v.index() == 1);
+ constexpr std::variant<int, long> v2 = v;
+ static_assert(v2.index() == 1);
+ static_assert(std::get<1>(v2) == 42);
+ }
+ {
+ constexpr std::variant<TCopy> v(std::in_place_index<0>, 42);
+ static_assert(v.index() == 0);
+ constexpr std::variant<TCopy> v2(v);
+ static_assert(v2.index() == 0);
+ static_assert(std::get<0>(v2).value == 42);
+ }
+ {
+ constexpr std::variant<int, TCopy> v(std::in_place_index<1>, 42);
+ static_assert(v.index() == 1);
+ constexpr std::variant<int, TCopy> v2(v);
+ static_assert(v2.index() == 1);
+ static_assert(std::get<1>(v2).value == 42);
+ }
+ {
+ constexpr std::variant<TCopyNTMove> v(std::in_place_index<0>, 42);
+ static_assert(v.index() == 0);
+ constexpr std::variant<TCopyNTMove> v2(v);
+ static_assert(v2.index() == 0);
+ static_assert(std::get<0>(v2).value == 42);
+ }
+ {
+ constexpr std::variant<int, TCopyNTMove> v(std::in_place_index<1>, 42);
+ static_assert(v.index() == 1);
+ constexpr std::variant<int, TCopyNTMove> v2(v);
+ static_assert(v2.index() == 1);
+ static_assert(std::get<1>(v2).value == 42);
+ }
+}
+
+int main() {
+ test_copy_ctor_basic();
+ test_copy_ctor_sfinae();
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
new file mode 100644
index 000000000000..e67a495d9799
--- /dev/null
+++ b/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -0,0 +1,153 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant(variant&&) noexcept(see below);
+
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NTMove {
+ constexpr NTMove(int v) : value(v) {}
+ NTMove(const NTMove &) = delete;
+ NTMove(NTMove &&that) : value(that.value) { that.value = -1; }
+ int value;
+};
+
+static_assert(!std::is_trivially_move_constructible<NTMove>::value, "");
+static_assert(std::is_move_constructible<NTMove>::value, "");
+
+struct TMove {
+ constexpr TMove(int v) : value(v) {}
+ TMove(const TMove &) = delete;
+ TMove(TMove &&) = default;
+ int value;
+};
+
+static_assert(std::is_trivially_move_constructible<TMove>::value, "");
+
+struct TMoveNTCopy {
+ constexpr TMoveNTCopy(int v) : value(v) {}
+ TMoveNTCopy(const TMoveNTCopy& that) : value(that.value) {}
+ TMoveNTCopy(TMoveNTCopy&&) = default;
+ int value;
+};
+
+static_assert(std::is_trivially_move_constructible<TMoveNTCopy>::value, "");
+
+void test_move_ctor_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_trivially_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NTMove>;
+ static_assert(!std::is_trivially_move_constructible<V>::value, "");
+ static_assert(std::is_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TMove>;
+ static_assert(std::is_trivially_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, TMoveNTCopy>;
+ static_assert(std::is_trivially_move_constructible<V>::value, "");
+ }
+}
+
+template <typename T>
+struct Result { size_t index; T value; };
+
+void test_move_ctor_basic() {
+ {
+ struct {
+ constexpr Result<int> operator()() const {
+ std::variant<int> v(std::in_place_index<0>, 42);
+ std::variant<int> v2 = std::move(v);
+ return {v2.index(), std::get<0>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 0);
+ static_assert(result.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<long> operator()() const {
+ std::variant<int, long> v(std::in_place_index<1>, 42);
+ std::variant<int, long> v2 = std::move(v);
+ return {v2.index(), std::get<1>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<TMove> operator()() const {
+ std::variant<TMove> v(std::in_place_index<0>, 42);
+ std::variant<TMove> v2(std::move(v));
+ return {v2.index(), std::get<0>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 0);
+ static_assert(result.value.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<TMove> operator()() const {
+ std::variant<int, TMove> v(std::in_place_index<1>, 42);
+ std::variant<int, TMove> v2(std::move(v));
+ return {v2.index(), std::get<1>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<TMoveNTCopy> operator()() const {
+ std::variant<TMoveNTCopy> v(std::in_place_index<0>, 42);
+ std::variant<TMoveNTCopy> v2(std::move(v));
+ return {v2.index(), std::get<0>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 0);
+ static_assert(result.value.value == 42);
+ }
+ {
+ struct {
+ constexpr Result<TMoveNTCopy> operator()() const {
+ std::variant<int, TMoveNTCopy> v(std::in_place_index<1>, 42);
+ std::variant<int, TMoveNTCopy> v2(std::move(v));
+ return {v2.index(), std::get<1>(std::move(v2))};
+ }
+ } test;
+ constexpr auto result = test();
+ static_assert(result.index == 1);
+ static_assert(result.value.value == 42);
+ }
+}
+
+int main() {
+ test_move_ctor_basic();
+ test_move_ctor_sfinae();
+}
diff --git a/test/libcxx/utilities/variant/version.pass.cpp b/test/libcxx/utilities/variant/version.pass.cpp
new file mode 100644
index 000000000000..1db93e0e9392
--- /dev/null
+++ b/test/libcxx/utilities/variant/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <variant>
+
+#include <variant>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/lit.cfg b/test/lit.cfg
index f7fa6144f08f..eee17fdaa1c8 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -20,14 +20,17 @@ config.suffixes = ['.pass.cpp', '.fail.cpp', '.sh.cpp']
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
+loaded_site_cfg = getattr(config, 'loaded_site_config', False)
+if not loaded_site_cfg:
+ import libcxx.test.config
+ libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
+ 'LIBCXX_SITE_CONFIG')
+
# Infer the test_exec_root from the libcxx_object root.
obj_root = getattr(config, 'libcxx_obj_root', None)
# Check that the test exec root is known.
if obj_root is None:
- import libcxx.test.config
- libcxx.test.config.loadSiteConfig(lit_config, config, 'libcxx_site_config',
- 'LIBCXX_SITE_CONFIG')
obj_root = getattr(config, 'libcxx_obj_root', None)
if obj_root is None:
import tempfile
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index a1ae90cb479e..741e9c89ac44 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -15,7 +15,9 @@ config.use_sanitizer = "@LLVM_USE_SANITIZER@"
config.sanitizer_library = "@LIBCXX_SANITIZER_LIBRARY@"
config.abi_library_path = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
-config.target_triple = "@LIBCXX_TARGET_TRIPLE@"
+config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.use_target = len("@LIBCXX_TARGET_TRIPLE@") > 0
config.sysroot = "@LIBCXX_SYSROOT@"
config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@"
config.generate_coverage = "@LIBCXX_GENERATE_COVERAGE@"
@@ -26,6 +28,8 @@ config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
+config.libcxx_external_thread_api = "@LIBCXX_HAS_EXTERNAL_THREAD_API@"
# Let the main config do the real work.
+config.loaded_site_config = True
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
index b56d31b9d0db..f39436048aef 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp
@@ -81,7 +81,7 @@ test_int_array_struct_source()
struct test1 {
test1() : c(0) { }
- test1(char c) : c(c + 1) { }
+ test1(char xc) : c(xc + 1) { }
char c;
};
diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp
index 43234be5d3b8..9a954d934c4e 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp
@@ -53,7 +53,7 @@ test1()
OutIter r = std::move(InIter(ia), InIter(ia+N), OutIter(ib));
assert(base(r) == ib+N);
for (unsigned i = 0; i < N; ++i)
- assert(*ib[i] == i);
+ assert(*ib[i] == static_cast<int>(i));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp
index 02b6b16eca0c..c5f9d3ac7b6b 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp
@@ -53,7 +53,7 @@ test1()
OutIter r = std::move_backward(InIter(ia), InIter(ia+N), OutIter(ib+N));
assert(base(r) == ib);
for (unsigned i = 0; i < N; ++i)
- assert(*ib[i] == i);
+ assert(*ib[i] == static_cast<int>(i));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp
index aa23d19a8a3b..8597b08da8cf 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp
@@ -14,64 +14,70 @@
// is_partitioned(InputIterator first, InputIterator last, Predicate pred);
#include <algorithm>
+#include <functional>
+#include <cstddef>
#include <cassert>
#include "test_iterators.h"
#include "counting_predicates.hpp"
-struct is_odd
-{
- bool operator()(const int& i) const {return i & 1;}
+struct is_odd {
+ bool operator()(const int &i) const { return i & 1; }
};
-int main()
-{
- {
- const int ia[] = {1, 2, 3, 4, 5, 6};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {2, 4, 6, 1, 3, 5};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6, 7};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6, 7};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::begin(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::begin(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 7, 9, 11, 2};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
+int main() {
+ {
+ const int ia[] = {1, 2, 3, 4, 5, 6};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {2, 4, 6, 1, 3, 5};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6, 7};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6, 7};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::begin(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::begin(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 7, 9, 11, 2};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp
new file mode 100644
index 000000000000..d769ad850c31
--- /dev/null
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <algorithm>
+
+// template <class PopulationIterator, class SampleIterator, class Distance,
+// class UniformRandomNumberGenerator>
+// SampleIterator sample(PopulationIterator first, PopulationIterator last,
+// SampleIterator out, Distance n,
+// UniformRandomNumberGenerator &&g);
+
+#include <algorithm>
+#include <random>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class PopulationIterator, class SampleIterator> void test() {
+ int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ const unsigned is = sizeof(ia) / sizeof(ia[0]);
+ const unsigned os = 4;
+ int oa[os];
+ std::minstd_rand g;
+ std::sample(PopulationIterator(ia), PopulationIterator(ia + is),
+ SampleIterator(oa), os, g);
+}
+
+int main() {
+ // expected-error@algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}}
+ // expected-error@algorithm:* 2 {{does not provide a subscript operator}}
+ // expected-error@algorithm:* {{invalid operands}}
+ test<input_iterator<int *>, output_iterator<int *> >();
+}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.pass.cpp
new file mode 100644
index 000000000000..0a14c6695b06
--- /dev/null
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.pass.cpp
@@ -0,0 +1,160 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <algorithm>
+
+// template <class PopulationIterator, class SampleIterator, class Distance,
+// class UniformRandomNumberGenerator>
+// SampleIterator sample(PopulationIterator first, PopulationIterator last,
+// SampleIterator out, Distance n,
+// UniformRandomNumberGenerator &&g);
+
+#include <algorithm>
+#include <random>
+#include <type_traits>
+#include <cassert>
+#include <cstddef>
+
+#include "test_iterators.h"
+#include "test_macros.h"
+
+struct ReservoirSampleExpectations {
+ enum { os = 4 };
+ static int oa1[os];
+ static int oa2[os];
+};
+
+int ReservoirSampleExpectations::oa1[] = {10, 5, 9, 4};
+int ReservoirSampleExpectations::oa2[] = {5, 2, 10, 4};
+
+struct SelectionSampleExpectations {
+ enum { os = 4 };
+ static int oa1[os];
+ static int oa2[os];
+};
+
+int SelectionSampleExpectations::oa1[] = {1, 4, 6, 7};
+int SelectionSampleExpectations::oa2[] = {1, 2, 6, 8};
+
+template <class IteratorCategory> struct TestExpectations
+ : public SelectionSampleExpectations {};
+
+template <>
+struct TestExpectations<std::input_iterator_tag>
+ : public ReservoirSampleExpectations {};
+
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
+void test() {
+ typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
+ typedef SampleIteratorType<SampleItem *> SampleIterator;
+ PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ const unsigned is = sizeof(ia) / sizeof(ia[0]);
+ typedef TestExpectations<typename std::iterator_traits<
+ PopulationIterator>::iterator_category> Expectations;
+ const unsigned os = Expectations::os;
+ SampleItem oa[os];
+ const int *oa1 = Expectations::oa1;
+ ((void)oa1); // Prevent unused warning
+ const int *oa2 = Expectations::oa2;
+ ((void)oa2); // Prevent unused warning
+ std::minstd_rand g;
+ SampleIterator end;
+ end = std::sample(PopulationIterator(ia),
+ PopulationIterator(ia + is),
+ SampleIterator(oa), os, g);
+ assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is));
+ // sample() is deterministic but non-reproducible;
+ // its results can vary between implementations.
+ LIBCPP_ASSERT(std::equal(oa, oa + os, oa1));
+ end = std::sample(PopulationIterator(ia),
+ PopulationIterator(ia + is),
+ SampleIterator(oa), os, std::move(g));
+ assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is));
+ LIBCPP_ASSERT(std::equal(oa, oa + os, oa2));
+}
+
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
+void test_empty_population() {
+ typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
+ typedef SampleIteratorType<SampleItem *> SampleIterator;
+ PopulationItem ia[] = {42};
+ const unsigned os = 4;
+ SampleItem oa[os];
+ std::minstd_rand g;
+ SampleIterator end =
+ std::sample(PopulationIterator(ia), PopulationIterator(ia),
+ SampleIterator(oa), os, g);
+ assert(end.base() == oa);
+}
+
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
+void test_empty_sample() {
+ typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
+ typedef SampleIteratorType<SampleItem *> SampleIterator;
+ PopulationItem ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ const unsigned is = sizeof(ia) / sizeof(ia[0]);
+ SampleItem oa[1];
+ std::minstd_rand g;
+ SampleIterator end =
+ std::sample(PopulationIterator(ia), PopulationIterator(ia + is),
+ SampleIterator(oa), 0, g);
+ assert(end.base() == oa);
+}
+
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
+void test_small_population() {
+ // The population size is less than the sample size.
+ typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
+ typedef SampleIteratorType<SampleItem *> SampleIterator;
+ PopulationItem ia[] = {1, 2, 3, 4, 5};
+ const unsigned is = sizeof(ia) / sizeof(ia[0]);
+ const unsigned os = 8;
+ SampleItem oa[os];
+ const SampleItem oa1[] = {1, 2, 3, 4, 5};
+ std::minstd_rand g;
+ SampleIterator end;
+ end = std::sample(PopulationIterator(ia),
+ PopulationIterator(ia + is),
+ SampleIterator(oa), os, g);
+ assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is));
+ typedef typename std::iterator_traits<PopulationIterator>::iterator_category PopulationCategory;
+ if (std::is_base_of<std::forward_iterator_tag, PopulationCategory>::value) {
+ assert(std::equal(oa, end.base(), oa1));
+ } else {
+ assert(std::is_permutation(oa, end.base(), oa1));
+ }
+}
+
+int main() {
+ test<input_iterator, int, random_access_iterator, int>();
+ test<forward_iterator, int, output_iterator, int>();
+ test<forward_iterator, int, random_access_iterator, int>();
+
+ test<input_iterator, int, random_access_iterator, double>();
+ test<forward_iterator, int, output_iterator, double>();
+ test<forward_iterator, int, random_access_iterator, double>();
+
+ test_empty_population<input_iterator, int, random_access_iterator, int>();
+ test_empty_population<forward_iterator, int, output_iterator, int>();
+ test_empty_population<forward_iterator, int, random_access_iterator, int>();
+
+ test_empty_sample<input_iterator, int, random_access_iterator, int>();
+ test_empty_sample<forward_iterator, int, output_iterator, int>();
+ test_empty_sample<forward_iterator, int, random_access_iterator, int>();
+
+ test_small_population<input_iterator, int, random_access_iterator, int>();
+ test_small_population<forward_iterator, int, output_iterator, int>();
+ test_small_population<forward_iterator, int, random_access_iterator, int>();
+}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.stable.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.stable.pass.cpp
new file mode 100644
index 000000000000..db484238c95f
--- /dev/null
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.stable.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <algorithm>
+
+// template <class PopulationIterator, class SampleIterator, class Distance,
+// class UniformRandomNumberGenerator>
+// SampleIterator sample(PopulationIterator first, PopulationIterator last,
+// SampleIterator out, Distance n,
+// UniformRandomNumberGenerator &&g);
+
+#include <algorithm>
+#include <random>
+#include <cassert>
+
+#include "test_iterators.h"
+
+// Stable if and only if PopulationIterator meets the requirements of a
+// ForwardIterator type.
+template <class PopulationIterator, class SampleIterator>
+void test_stability(bool expect_stable) {
+ const unsigned kPopulationSize = 100;
+ int ia[kPopulationSize];
+ for (unsigned i = 0; i < kPopulationSize; ++i)
+ ia[i] = i;
+ PopulationIterator first(ia);
+ PopulationIterator last(ia + kPopulationSize);
+
+ const unsigned kSampleSize = 20;
+ int oa[kPopulationSize];
+ SampleIterator out(oa);
+
+ std::minstd_rand g;
+
+ const int kIterations = 1000;
+ bool unstable = false;
+ for (int i = 0; i < kIterations; ++i) {
+ std::sample(first, last, out, kSampleSize, g);
+ unstable |= !std::is_sorted(oa, oa + kSampleSize);
+ }
+ assert(expect_stable == !unstable);
+}
+
+int main() {
+ test_stability<forward_iterator<int *>, output_iterator<int *> >(true);
+ test_stability<input_iterator<int *>, random_access_iterator<int *> >(false);
+}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
index a14ccf9e5e6c..e24598a9bc12 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
@@ -17,6 +17,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
int ia[] = {1, 2, 3, 4};
@@ -24,7 +26,9 @@ int main()
int ia2[] = {4, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
std::random_shuffle(ia, ia+sa);
- assert(std::equal(ia, ia+sa, ia1));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
std::random_shuffle(ia, ia+sa);
- assert(std::equal(ia, ia+sa, ia2));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia2));
+ assert(std::is_permutation(ia, ia+sa, ia2));
}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
index b944c89e3519..c923d847f11e 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
@@ -17,10 +17,13 @@
#include <algorithm>
#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
struct gen
{
- int operator()(int n)
+ std::ptrdiff_t operator()(std::ptrdiff_t n)
{
return n-1;
}
@@ -33,5 +36,6 @@ int main()
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
gen r;
std::random_shuffle(ia, ia+sa, r);
- assert(std::equal(ia, ia+sa, ia1));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
index 343ae90101ff..512acc392de8 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@@ -25,7 +27,9 @@ int main()
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
std::minstd_rand g;
std::shuffle(ia, ia+sa, g);
- assert(std::equal(ia, ia+sa, ia1));
- std::shuffle(ia, ia+sa, g);
- assert(std::equal(ia, ia+sa, ia2));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
+ std::shuffle(ia, ia+sa, std::move(g));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia2));
+ assert(std::is_permutation(ia, ia+sa, ia2));
}
diff --git a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp
index b7da7354ca25..515c79761ee8 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.rotate/rotate.pass.cpp
@@ -15,10 +15,9 @@
#include <algorithm>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -26,7 +25,7 @@ void
test()
{
int ia[] = {0};
- const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0]));
Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia));
assert(base(r) == ia);
assert(ia[0] == 0);
@@ -38,7 +37,7 @@ test()
assert(ia[0] == 0);
int ib[] = {0, 1};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0]));
r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb));
assert(base(r) == ib+sb);
assert(ib[0] == 0);
@@ -53,7 +52,7 @@ test()
assert(ib[1] == 0);
int ic[] = {0, 1, 2};
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0]));
r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc));
assert(base(r) == ic+sc);
assert(ic[0] == 0);
@@ -76,7 +75,7 @@ test()
assert(ic[2] == 2);
int id[] = {0, 1, 2, 3};
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const int sd = static_cast<int>(sizeof(id)/sizeof(id[0]));
r = std::rotate(Iter(id), Iter(id), Iter(id+sd));
assert(base(r) == id+sd);
assert(id[0] == 0);
@@ -109,7 +108,7 @@ test()
assert(id[3] == 1);
int ie[] = {0, 1, 2, 3, 4};
- const unsigned se = sizeof(ie)/sizeof(ie[0]);
+ const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0]));
r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se));
assert(base(r) == ie+se);
assert(ie[0] == 0);
@@ -154,7 +153,7 @@ test()
assert(ie[4] == 4);
int ig[] = {0, 1, 2, 3, 4, 5};
- const unsigned sg = sizeof(ig)/sizeof(ig[0]);
+ const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0]));
r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg));
assert(base(r) == ig+sg);
assert(ig[0] == 0);
@@ -213,14 +212,14 @@ test()
assert(ig[5] == 2);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
template <class Iter>
void
test1()
{
std::unique_ptr<int> ia[1];
- const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0]));
for (int i = 0; i < sa; ++i)
ia[i].reset(new int(i));
Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia));
@@ -234,7 +233,7 @@ test1()
assert(*ia[0] == 0);
std::unique_ptr<int> ib[2];
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0]));
for (int i = 0; i < sb; ++i)
ib[i].reset(new int(i));
r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb));
@@ -251,7 +250,7 @@ test1()
assert(*ib[1] == 0);
std::unique_ptr<int> ic[3];
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0]));
for (int i = 0; i < sc; ++i)
ic[i].reset(new int(i));
r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc));
@@ -276,7 +275,7 @@ test1()
assert(*ic[2] == 2);
std::unique_ptr<int> id[4];
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const int sd = static_cast<int>(sizeof(id)/sizeof(id[0]));
for (int i = 0; i < sd; ++i)
id[i].reset(new int(i));
r = std::rotate(Iter(id), Iter(id), Iter(id+sd));
@@ -311,7 +310,7 @@ test1()
assert(*id[3] == 1);
std::unique_ptr<int> ie[5];
- const unsigned se = sizeof(ie)/sizeof(ie[0]);
+ const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0]));
for (int i = 0; i < se; ++i)
ie[i].reset(new int(i));
r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se));
@@ -358,7 +357,7 @@ test1()
assert(*ie[4] == 4);
std::unique_ptr<int> ig[6];
- const unsigned sg = sizeof(ig)/sizeof(ig[0]);
+ const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0]));
for (int i = 0; i < sg; ++i)
ig[i].reset(new int(i));
r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg));
@@ -419,7 +418,7 @@ test1()
assert(*ig[5] == 2);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // TEST_STD_VER >= 11
int main()
{
@@ -428,12 +427,12 @@ int main()
test<random_access_iterator<int*> >();
test<int*>();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test1<forward_iterator<std::unique_ptr<int>*> >();
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
test1<random_access_iterator<std::unique_ptr<int>*> >();
test1<std::unique_ptr<int>*>();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
index 449753fc263a..e867b86b8312 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
@@ -17,11 +17,9 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
int main()
{
@@ -31,7 +29,7 @@ int main()
assert(std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ia)));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ia),
@@ -44,7 +42,7 @@ int main()
assert(!std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ib)));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(!std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ib),
diff --git a/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp
index 047f72062ebd..d57e365a9192 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.equal/equal_pred.pass.cpp
@@ -19,12 +19,9 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
-
int comparison_count = 0;
template <typename T>
bool counting_equals ( const T &a, const T &b ) {
@@ -41,7 +38,7 @@ int main()
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ia),
std::equal_to<int>()));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ia),
@@ -72,7 +69,7 @@ int main()
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ib),
std::equal_to<int>()));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(!std::equal(input_iterator<const int*>(ia),
input_iterator<const int*>(ia+s),
input_iterator<const int*>(ib),
diff --git a/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp
index bf80c2c6edd4..d6fdd18968d1 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.foreach/test.pass.cpp
@@ -35,5 +35,5 @@ int main()
for_each_test(0));
assert(f.count == s);
for (unsigned i = 0; i < s; ++i)
- assert(ia[i] == i+1);
+ assert(ia[i] == static_cast<int>(i+1));
}
diff --git a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp
index 028aec5e7f29..e3f7c3cd87db 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp
@@ -19,9 +19,7 @@
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
+#include "test_macros.h"
int main()
{
@@ -32,7 +30,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + 0),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + 0),
forward_iterator<const int*>(ib),
@@ -41,7 +39,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -59,7 +57,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -74,7 +72,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -92,7 +90,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -106,7 +104,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -120,7 +118,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -134,7 +132,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -148,7 +146,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -166,7 +164,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -180,7 +178,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -194,7 +192,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -208,7 +206,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -222,7 +220,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -236,7 +234,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -250,7 +248,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -264,7 +262,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -278,7 +276,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -292,7 +290,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -307,7 +305,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -321,7 +319,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -335,7 +333,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -349,7 +347,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -363,7 +361,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -377,7 +375,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -391,7 +389,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -405,7 +403,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -419,7 +417,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -433,7 +431,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -451,7 +449,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -465,7 +463,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -483,7 +481,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -501,7 +499,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -519,7 +517,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -537,7 +535,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -551,7 +549,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -573,7 +571,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -595,7 +593,7 @@ int main()
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib)) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
diff --git a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
index ceb897da5148..6e9cdaabd308 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
@@ -18,12 +18,9 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
-
int comparison_count = 0;
template <typename T>
bool counting_equals ( const T &a, const T &b ) {
@@ -46,7 +43,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -67,7 +64,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -84,7 +81,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -105,7 +102,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -121,7 +118,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -137,7 +134,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -153,7 +150,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -169,7 +166,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -190,7 +187,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -211,7 +208,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -227,7 +224,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -243,7 +240,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -264,7 +261,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -285,7 +282,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -301,7 +298,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -317,7 +314,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -333,7 +330,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -349,7 +346,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -371,7 +368,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -387,7 +384,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -403,7 +400,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -419,7 +416,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -435,7 +432,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -451,7 +448,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -467,7 +464,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -483,7 +480,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -499,7 +496,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -515,7 +512,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -536,7 +533,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -552,7 +549,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -573,7 +570,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -594,7 +591,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -615,7 +612,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -636,7 +633,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -652,7 +649,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -678,7 +675,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == true);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
@@ -718,7 +715,7 @@ int main()
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
std::equal_to<const int>()) == false);
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::is_permutation(forward_iterator<const int*>(ia),
forward_iterator<const int*>(ia + sa),
forward_iterator<const int*>(ib),
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
index 054bc656cdb1..d78809b48524 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
@@ -49,7 +49,7 @@ int main()
assert(bcp.count() > 0 && bcp.count() < sa);
bcp.reset();
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ())
== (std::pair<II, II>(II(ia+3), II(ib+3))));
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib + sb), EQ())
@@ -63,7 +63,7 @@ int main()
assert(std::mismatch(ia, ia + sa, ib, EQ()) ==
(std::pair<int*,int*>(ia+3,ib+3)));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER >= 14
assert(std::mismatch(ia, ia + sa, ib, ib + sb, EQ()) ==
(std::pair<int*,int*>(ia+3,ib+3)));
assert(std::mismatch(ia, ia + sa, ib, ib + 2, EQ()) ==
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
index 253e0e38690b..d4d31cb3088f 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -33,10 +34,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
index 1d2840921e83..e0b148499ca8 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <vector>
#include <functional>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -34,10 +35,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
index ce659c1b50f5..bc968f5b2aab 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range.pass.cpp
@@ -18,6 +18,7 @@
#include <algorithm>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -41,10 +42,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
index 2b29e2c84353..de0bbf25613e 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/equal.range/equal_range_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -42,10 +43,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
index ce4f7ced5e63..1fff1d7f5b63 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -36,10 +37,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
index ae65c59e3159..4ec5f6c000d6 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -37,10 +38,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
index 3659e08fb28e..710edb61c9b6 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -36,10 +37,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
index dd5fcfc28523..3268075b1b0b 100644
--- a/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#include "test_iterators.h"
@@ -37,10 +38,10 @@ void
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
{
v[i] = x;
if (++x == M)
diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
index 3fec12b6b53d..50bcff9c90e5 100644
--- a/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.comp.pass.cpp
@@ -22,11 +22,11 @@ struct Tag {
Tag() : val(0), tag("Default") {}
Tag(int a, const char *b) : val(a), tag(b) {}
~Tag() {}
-
+
int val;
const char *tag;
};
-
+
bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; }
// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; }
bool comp (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; }
diff --git a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
index 779c41827c92..1e18720bfbb3 100644
--- a/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.clamp/clamp.pass.cpp
@@ -21,11 +21,11 @@ struct Tag {
Tag() : val(0), tag("Default") {}
Tag(int a, const char *b) : val(a), tag(b) {}
~Tag() {}
-
+
int val;
const char *tag;
};
-
+
bool eq(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val && rhs.tag == lhs.tag; }
// bool operator==(const Tag& rhs, const Tag& lhs) { return rhs.val == lhs.val; }
bool operator< (const Tag& rhs, const Tag& lhs) { return rhs.val < lhs.val; }
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
index 51b912768f35..9da9356b0be1 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
@@ -17,7 +17,7 @@
#include <algorithm>
#include <cassert>
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
index 0e16d9bd17c7..9d0545f0d9c5 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
@@ -16,13 +16,12 @@
#include <algorithm>
#include <functional>
+#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "counting_predicates.hpp"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#include <memory>
-
struct indirect_less
{
template <class P>
@@ -30,9 +29,8 @@ struct indirect_less
{return *x < *y;}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
{
@@ -49,7 +47,7 @@ void test(unsigned N)
for (int i = 0; i < N; ++i)
ia[i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -59,7 +57,7 @@ void test(unsigned N)
for (int i = 0; i < N; ++i)
ia[N-1-i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -68,7 +66,7 @@ void test(unsigned N)
binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
std::random_shuffle(ia, ia+N);
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
@@ -86,7 +84,7 @@ int main()
test(10000);
test(100000);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
const int N = 1000;
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
@@ -97,5 +95,5 @@ int main()
assert(std::is_heap(ia, ia+N, indirect_less()));
delete [] ia;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp
index 823985df6ca0..252fc758cb1f 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp
@@ -17,7 +17,7 @@
#include <algorithm>
#include <cassert>
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp
index 1db4428a1c1f..0bfad61961ed 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp
@@ -29,7 +29,7 @@ struct indirect_less
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp
index 0fc50a81207e..d82896d6a916 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp
@@ -18,7 +18,7 @@
#include <algorithm>
#include <cassert>
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp
index 217217b38ee3..5d2985cc07fa 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp
@@ -30,7 +30,7 @@ struct indirect_less
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp
index 4a08f111e6dd..c6eaa8ccec86 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp
@@ -17,7 +17,7 @@
#include <algorithm>
#include <cassert>
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp
index 7d3e2d570158..1c072c5a12ca 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp
@@ -29,7 +29,7 @@ struct indirect_less
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
index 9c411730196c..33a42a2f62a1 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
@@ -58,7 +58,7 @@ test_one(unsigned N, unsigned M)
if(N > 0)
{
assert(ia[0] == 0);
- assert(ia[N-1] == N-1);
+ assert(ia[N-1] == static_cast<value_type>(N-1));
assert(std::is_sorted(ia, ia+N));
}
delete [] ia;
diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
index b4d25a93e50e..fd9e5f13c26a 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp
@@ -74,7 +74,7 @@ test_one(unsigned N, unsigned M)
std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N), std::ref(pred));
if(N > 0)
{
- assert(ia[0] == N-1);
+ assert(ia[0] == static_cast<int>(N)-1);
assert(ia[N-1] == 0);
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
assert(pred.count() <= (N-1));
@@ -125,10 +125,10 @@ int main()
test<S*>();
{
- unsigned N = 100;
+ int N = 100;
unsigned M = 50;
std::unique_ptr<int>* ia = new std::unique_ptr<int>[N];
- for (unsigned i = 0; i < N; ++i)
+ for (int i = 0; i < N; ++i)
ia[i].reset(new int(i));
std::random_shuffle(ia, ia+N);
std::sort(ia, ia+M, indirect_less());
diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
index de96c419c4ea..2a20cac0b79b 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp
@@ -40,7 +40,7 @@ test()
InIter2(ib), InIter2(ib+N), OutIter(ic));
assert(base(r) == ic+2*N);
assert(ic[0] == 0);
- assert(ic[2*N-1] == 2*N-1);
+ assert(ic[2*N-1] == static_cast<int>(2*N-1));
assert(std::is_sorted(ic, ic+2*N));
delete [] ic;
delete [] ib;
@@ -62,7 +62,7 @@ test()
InIter2(ib), InIter2(ib+N), OutIter(ic));
assert(base(r) == ic+2*N);
assert(ic[0] == 0);
- assert(ic[2*N-1] == 2*N-1);
+ assert(ic[2*N-1] == static_cast<int>(2*N-1));
assert(std::is_sorted(ic, ic+2*N));
delete [] ic;
delete [] ib;
diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
index bd38d7de6894..152c552381b9 100644
--- a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp
@@ -46,7 +46,7 @@ test()
OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
InIter2(ib), InIter2(ib+N), OutIter(ic), pred);
assert(base(r) == ic+2*N);
- assert(ic[0] == 2*N-1);
+ assert(ic[0] == static_cast<int>(2*N-1));
assert(ic[2*N-1] == 0);
assert(std::is_sorted(ic, ic+2*N, std::greater<int>()));
assert(pred.count() <= (N + N - 1));
@@ -70,7 +70,7 @@ test()
OutIter r = std::merge(InIter1(ia), InIter1(ia+N),
InIter2(ib), InIter2(ib+N), OutIter(ic), pred);
assert(base(r) == ic+2*N);
- assert(ic[0] == 2*N-1);
+ assert(ic[0] == static_cast<int>(2*N-1));
assert(ic[2*N-1] == 0);
assert(std::is_sorted(ic, ic+2*N, std::greater<int>()));
assert(pred.count() <= (N + N - 1));
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
index c560c22f2d72..f453a234d2e1 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x)
@@ -43,7 +45,7 @@ int main()
test(x, y, x);
test(y, x, x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
index 95241af50063..6c185c2a8036 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_comp.pass.cpp
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x)
@@ -45,7 +47,7 @@ int main()
test(x, y, std::greater<int>(), y);
test(y, x, std::greater<int>(), y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
index 3ecc250a9c8f..e9cd086ab13d 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp
@@ -35,7 +35,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
index fc88268aa84b..e60e156455f3 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -36,7 +37,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -66,7 +67,7 @@ void test_eq0(Iter first, Iter last, Pred p)
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
index 0438412d236e..e003acaa5aa8 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template <class T>
@@ -16,9 +18,10 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::max({2, 3, 1});
assert(i == 3);
i = std::max({2, 1, 3});
@@ -31,12 +34,11 @@ int main()
assert(i == 3);
i = std::max({1, 3, 2});
assert(i == 3);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::max({1, 3, 2}) == 3, "");
static_assert(std::max({2, 1, 3}) == 3, "");
static_assert(std::max({3, 2, 1}) == 3, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
index 4dd47a73ef3b..6b3c72b1de9e 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/max_init_list_comp.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -17,9 +19,10 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::max({2, 3, 1}, std::greater<int>());
assert(i == 1);
i = std::max({2, 1, 3}, std::greater<int>());
@@ -32,12 +35,11 @@ int main()
assert(i == 1);
i = std::max({1, 3, 2}, std::greater<int>());
assert(i == 1);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::max({1, 3, 2}, std::greater<int>()) == 1, "");
static_assert(std::max({2, 1, 3}, std::greater<int>()) == 1, "");
static_assert(std::max({3, 2, 1}, std::greater<int>()) == 1, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
index bbbd97bc5a4a..3d0241f80dbe 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min.pass.cpp
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x)
@@ -43,7 +45,7 @@ int main()
test(x, y, y);
test(y, x, y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
index 4ef705e77718..9dc74380261b 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_comp.pass.cpp
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x)
@@ -45,7 +47,7 @@ int main()
test(x, y, std::greater<int>(), x);
test(y, x, std::greater<int>(), x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
constexpr int x = 1;
constexpr int y = 0;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
index 45dd54b1ee40..c41884220857 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp
@@ -35,7 +35,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
index 94ef482ddbde..c4c6e31eb6dd 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -36,7 +37,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -66,7 +67,7 @@ void test_eq0(Iter first, Iter last, Pred p)
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
index eed4ebd45756..d212bf6cfe88 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T>
@@ -16,9 +18,10 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::min({2, 3, 1});
assert(i == 1);
i = std::min({2, 1, 3});
@@ -31,12 +34,11 @@ int main()
assert(i == 1);
i = std::min({1, 3, 2});
assert(i == 1);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::min({1, 3, 2}) == 1, "");
static_assert(std::min({2, 1, 3}) == 1, "");
static_assert(std::min({3, 2, 1}) == 1, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
index 5e0301b657b9..7435da1661ad 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/min_init_list_comp.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -17,9 +19,10 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int i = std::min({2, 3, 1}, std::greater<int>());
assert(i == 3);
i = std::min({2, 1, 3}, std::greater<int>());
@@ -32,12 +35,11 @@ int main()
assert(i == 3);
i = std::min({1, 3, 2}, std::greater<int>());
assert(i == 3);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert(std::min({1, 3, 2}, std::greater<int>()) == 3, "");
static_assert(std::min({2, 1, 3}, std::greater<int>()) == 3, "");
static_assert(std::min({3, 2, 1}, std::greater<int>()) == 3, "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
index 8276c3a5dfd5..6ef4d06467bf 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp
@@ -16,6 +16,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(const T& a, const T& b, const T& x, const T& y)
@@ -45,7 +47,7 @@ int main()
test(x, y, y, x);
test(y, x, y, x);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
index 3289f8a7582c..a2027d440c46 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp
@@ -18,6 +18,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
template <class T, class C>
void
test(const T& a, const T& b, C c, const T& x, const T& y)
@@ -48,7 +50,7 @@ int main()
test(x, y, std::greater<int>(), x, y);
test(y, x, std::greater<int>(), x, y);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
// Note that you can't take a reference to a local var, since
// its address is not a compile-time constant.
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
index ef5474091db5..c2805a656137 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
@@ -41,7 +41,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -62,7 +62,7 @@ test()
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
index 3a0c2dbbba1b..7840638f742c 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp
@@ -18,6 +18,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
@@ -44,7 +45,7 @@ test(Iter first, Iter last)
template <class Iter>
void
-test(unsigned N)
+test(int N)
{
int* a = new int[N];
for (int i = 0; i < N; ++i)
@@ -65,7 +66,7 @@ test()
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
index 0196d10dcd96..dd62dfd78a8d 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T>
@@ -16,16 +18,17 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 1, 3}) == std::pair<int, int>(1, 3)));
assert((std::minmax({2, 3, 1}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 1, 2}) == std::pair<int, int>(1, 3)));
assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert((std::minmax({1, 2, 3}) == std::pair<int, int>(1, 3)), "");
static_assert((std::minmax({1, 3, 2}) == std::pair<int, int>(1, 3)), "");
@@ -35,5 +38,4 @@ int main()
static_assert((std::minmax({3, 2, 1}) == std::pair<int, int>(1, 3)), "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
index 789ccef0fca4..ab20b2a0461b 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template<class T, class Compare>
@@ -19,11 +21,11 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "counting_predicates.hpp"
bool all_equal(int, int) { return false; } // everything is equal
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void test_all_equal(std::initializer_list<int> il)
{
binary_counting_predicate<bool(*)(int, int), int, int> pred (all_equal);
@@ -33,11 +35,9 @@ void test_all_equal(std::initializer_list<int> il)
assert(p.second == *--ptr);
assert(pred.count() <= ((3 * il.size()) / 2));
}
-#endif
int main()
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)));
assert((std::minmax({2, 1, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)));
@@ -63,7 +63,7 @@ int main()
test_all_equal({0,1,2,3,4,5,6,7,8,9,10});
test_all_equal({0,1,2,3,4,5,6,7,8,9,10,11});
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 14
{
static_assert((std::minmax({1, 2, 3}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
static_assert((std::minmax({1, 3, 2}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
@@ -73,5 +73,4 @@ int main()
static_assert((std::minmax({3, 2, 1}, std::greater<int>()) == std::pair<int, int>(3, 1)), "");
}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
}
diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp
index dc5564eb3fc9..560bc902b482 100644
--- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp
@@ -19,7 +19,7 @@
#include <cassert>
void
-test_one(unsigned N, unsigned M)
+test_one(int N, int M)
{
assert(N != 0);
assert(M < N);
@@ -34,7 +34,7 @@ test_one(unsigned N, unsigned M)
}
void
-test(unsigned N)
+test(int N)
{
test_one(N, 0);
test_one(N, 1);
diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
index cf8659038f14..f2c962724f09 100644
--- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -32,7 +33,7 @@ struct indirect_less
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void
-test_one(unsigned N, unsigned M)
+test_one(int N, int M)
{
assert(N != 0);
assert(M < N);
@@ -47,7 +48,7 @@ test_one(unsigned N, unsigned M)
}
void
-test(unsigned N)
+test(int N)
{
test_one(N, 0);
test_one(N, 1);
@@ -77,10 +78,10 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
- assert(*v[v.size()/2] == v.size()/2);
+ assert(static_cast<std::size_t>(*v[v.size()/2]) == v.size()/2);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp
index 5f298fde7b34..1d4ca9925a86 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp
@@ -24,7 +24,7 @@
template <class Iter>
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
int* input = new int[N];
int* output = new int[M];
@@ -43,7 +43,7 @@ test_larger_sorts(unsigned N, unsigned M)
template <class Iter>
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts<Iter>(N, 0);
test_larger_sorts<Iter>(N, 1);
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp
index df8fb9eacacd..460ea4c08275 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp
@@ -27,7 +27,7 @@
template <class Iter>
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
int* input = new int[N];
int* output = new int[M];
@@ -47,7 +47,7 @@ test_larger_sorts(unsigned N, unsigned M)
template <class Iter>
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts<Iter>(N, 0);
test_larger_sorts<Iter>(N, 1);
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
index 62458eca9302..0d32ba898b8f 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp
@@ -19,7 +19,7 @@
#include <cassert>
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
assert(N != 0);
assert(N >= M);
@@ -37,7 +37,7 @@ test_larger_sorts(unsigned N, unsigned M)
}
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts(N, 0);
test_larger_sorts(N, 1);
diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
index 0289cf8391f9..a4fe1cc5e7ca 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <vector>
#include <functional>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -32,7 +33,7 @@ struct indirect_less
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
assert(N != 0);
assert(N >= M);
@@ -50,7 +51,7 @@ test_larger_sorts(unsigned N, unsigned M)
}
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts(N, 0);
test_larger_sorts(N, 1);
@@ -83,10 +84,10 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::partial_sort(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less());
- for (int i = 0; i < v.size()/2; ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size()/2; ++i)
assert(*v[i] == i);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
index 2ea697a63b2a..689433f9e45b 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
@@ -16,6 +16,7 @@
// sort(Iter first, Iter last);
#include <algorithm>
+#include <iterator>
#include <cassert>
template <class RI>
@@ -23,9 +24,11 @@ void
test_sort_helper(RI f, RI l)
{
typedef typename std::iterator_traits<RI>::value_type value_type;
+ typedef typename std::iterator_traits<RI>::difference_type difference_type;
+
if (f != l)
{
- long len = l - f;
+ difference_type len = l - f;
value_type* save(new value_type[len]);
do
{
@@ -60,7 +63,7 @@ test_sort_driver(RI f, RI l, int start)
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
@@ -72,7 +75,7 @@ test_sort_()
}
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
assert(N != 0);
assert(M != 0);
@@ -112,7 +115,7 @@ test_larger_sorts(unsigned N, unsigned M)
}
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts(N, 1);
test_larger_sorts(N, 2);
diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
index d6c4f0467844..c77015993c8c 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -35,7 +36,7 @@ int main()
{
{
std::vector<int> v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i] = i;
std::sort(v.begin(), v.end(), std::greater<int>());
std::reverse(v.begin(), v.end());
@@ -45,7 +46,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::sort(v.begin(), v.end(), indirect_less());
assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
index 5faa1682135d..336fcd0b3dde 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
@@ -16,6 +16,7 @@
// stable_sort(Iter first, Iter last);
#include <algorithm>
+#include <iterator>
#include <cassert>
template <class RI>
@@ -23,9 +24,11 @@ void
test_sort_helper(RI f, RI l)
{
typedef typename std::iterator_traits<RI>::value_type value_type;
+ typedef typename std::iterator_traits<RI>::difference_type difference_type;
+
if (f != l)
{
- long len = l - f;
+ difference_type len = l - f;
value_type* save(new value_type[len]);
do
{
@@ -60,7 +63,7 @@ test_sort_driver(RI f, RI l, int start)
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
@@ -72,7 +75,7 @@ test_sort_()
}
void
-test_larger_sorts(unsigned N, unsigned M)
+test_larger_sorts(int N, int M)
{
assert(N != 0);
assert(M != 0);
@@ -112,7 +115,7 @@ test_larger_sorts(unsigned N, unsigned M)
}
void
-test_larger_sorts(unsigned N)
+test_larger_sorts(int N)
{
test_larger_sorts(N, 1);
test_larger_sorts(N, 2);
diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
index 68e817ebeb3b..49f7122cdb31 100644
--- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp
@@ -19,6 +19,7 @@
#include <functional>
#include <vector>
#include <cassert>
+#include <cstddef>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
@@ -71,7 +72,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::vector<std::unique_ptr<int> > v(1000);
- for (int i = 0; i < v.size(); ++i)
+ for (int i = 0; static_cast<std::size_t>(i) < v.size(); ++i)
v[i].reset(new int(i));
std::stable_sort(v.begin(), v.end(), indirect_less());
assert(std::is_sorted(v.begin(), v.end(), indirect_less()));
diff --git a/test/std/atomics/atomics.flag/default.pass.cpp b/test/std/atomics/atomics.flag/default.pass.cpp
index 11c08f50266a..b4c2b9c80833 100644
--- a/test/std/atomics/atomics.flag/default.pass.cpp
+++ b/test/std/atomics/atomics.flag/default.pass.cpp
@@ -19,6 +19,8 @@
#include <new>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
std::atomic_flag f;
@@ -26,7 +28,7 @@ int main()
assert(f.test_and_set() == 0);
{
typedef std::atomic_flag A;
- _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
+ TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
A& zero = *new (storage) A();
assert(!zero.test_and_set());
zero.~A();
diff --git a/test/std/atomics/atomics.types.generic/address.pass.cpp b/test/std/atomics/atomics.types.generic/address.pass.cpp
index 137e46b6a155..c31a99c9b9ad 100644
--- a/test/std/atomics/atomics.types.generic/address.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/address.pass.cpp
@@ -75,6 +75,8 @@
#include <cmpxchg_loop.h>
+#include "test_macros.h"
+
template <class A, class T>
void
do_test()
@@ -121,7 +123,7 @@ do_test()
assert(obj == T(2*sizeof(X)));
{
- _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
+ TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
A& zero = *new (storage) A();
assert(zero == T(0));
zero.~A();
diff --git a/test/std/atomics/atomics.types.generic/bool.pass.cpp b/test/std/atomics/atomics.types.generic/bool.pass.cpp
index e85893d12b8d..ba38154ed46b 100644
--- a/test/std/atomics/atomics.types.generic/bool.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/bool.pass.cpp
@@ -57,6 +57,8 @@
#include <cmpxchg_loop.h>
+#include "test_macros.h"
+
int main()
{
{
@@ -226,7 +228,7 @@ int main()
}
{
typedef std::atomic<bool> A;
- _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
+ TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
A& zero = *new (storage) A();
assert(zero == false);
zero.~A();
diff --git a/test/std/atomics/atomics.types.generic/integral.pass.cpp b/test/std/atomics/atomics.types.generic/integral.pass.cpp
index a449dc6d5f57..63cc02befb7e 100644
--- a/test/std/atomics/atomics.types.generic/integral.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/integral.pass.cpp
@@ -92,6 +92,8 @@
#include <cmpxchg_loop.h>
+#include "test_macros.h"
+
template <class A, class T>
void
do_test()
@@ -151,7 +153,7 @@ do_test()
assert(obj == T(8));
{
- _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
+ TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23};
A& zero = *new (storage) A();
assert(zero == 0);
zero.~A();
@@ -193,7 +195,7 @@ int main()
test<std::atomic_uint32_t, uint32_t>();
test<std::atomic_int64_t, int64_t>();
test<std::atomic_uint64_t, uint64_t>();
-
+
test<volatile std::atomic_char, char>();
test<volatile std::atomic_schar, signed char>();
test<volatile std::atomic_uchar, unsigned char>();
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
diff --git a/test/std/depr/depr.c.headers/ciso646.pass.cpp b/test/std/depr/depr.c.headers/ciso646.pass.cpp
index 725a7ab1331b..6a686dc0cf65 100644
--- a/test/std/depr/depr.c.headers/ciso646.pass.cpp
+++ b/test/std/depr/depr.c.headers/ciso646.pass.cpp
@@ -11,10 +11,6 @@
#include <ciso646>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
}
diff --git a/test/std/depr/depr.c.headers/complex.h.pass.cpp b/test/std/depr/depr.c.headers/complex.h.pass.cpp
index da0707990d80..0e3fd3e990b1 100644
--- a/test/std/depr/depr.c.headers/complex.h.pass.cpp
+++ b/test/std/depr/depr.c.headers/complex.h.pass.cpp
@@ -11,10 +11,6 @@
#include <complex.h>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
std::complex<double> d;
diff --git a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
index ff045a913fdb..5b0bb3bff373 100644
--- a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
@@ -872,54 +872,56 @@
#error SCNxPTR not defined
#endif
+template <class T> void test()
+{
+ T t = 0;
+ ((void)t); // Prevent unused warning
+}
+
int main()
{
- {
- int8_t i1 = 0;
- int16_t i2 = 0;
- int32_t i3 = 0;
- int64_t i4 = 0;
- }
- {
- uint8_t i1 = 0;
- uint16_t i2 = 0;
- uint32_t i3 = 0;
- uint64_t i4 = 0;
- }
- {
- int_least8_t i1 = 0;
- int_least16_t i2 = 0;
- int_least32_t i3 = 0;
- int_least64_t i4 = 0;
- }
- {
- uint_least8_t i1 = 0;
- uint_least16_t i2 = 0;
- uint_least32_t i3 = 0;
- uint_least64_t i4 = 0;
- }
- {
- int_fast8_t i1 = 0;
- int_fast16_t i2 = 0;
- int_fast32_t i3 = 0;
- int_fast64_t i4 = 0;
- }
- {
- uint_fast8_t i1 = 0;
- uint_fast16_t i2 = 0;
- uint_fast32_t i3 = 0;
- uint_fast64_t i4 = 0;
- }
- {
- intptr_t i1 = 0;
- uintptr_t i2 = 0;
- intmax_t i3 = 0;
- uintmax_t i4 = 0;
- }
+ test<int8_t >();
+ test<int16_t>();
+ test<int32_t>();
+ test<int64_t>();
+
+ test<uint8_t >();
+ test<uint16_t>();
+ test<uint32_t>();
+ test<uint64_t>();
+
+ test<int_least8_t >();
+ test<int_least16_t>();
+ test<int_least32_t>();
+ test<int_least64_t>();
+
+ test<uint_least8_t >();
+ test<uint_least16_t>();
+ test<uint_least32_t>();
+ test<uint_least64_t>();
+
+ test<int_fast8_t >();
+ test<int_fast16_t>();
+ test<int_fast32_t>();
+ test<int_fast64_t>();
+
+ test<uint_fast8_t >();
+ test<uint_fast16_t>();
+ test<uint_fast32_t>();
+ test<uint_fast64_t>();
+
+ test<intptr_t >();
+ test<uintptr_t>();
+ test<intmax_t >();
+ test<uintmax_t>();
+
{
imaxdiv_t i1 = {};
+ ((void)i1); // Prevent unused warning
}
+
intmax_t i = 0;
+ ((void)i); // Prevent unused warning
static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");
static_assert((std::is_same<decltype(imaxdiv(i, i)), imaxdiv_t>::value), "");
static_assert((std::is_same<decltype(strtoimax("", (char**)0, 0)), intmax_t>::value), "");
diff --git a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
index 96d1143d4de6..1680f4349bb5 100644
--- a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -104,11 +104,9 @@ int main()
wchar_t* pw = 0;
const wchar_t* pwc = 0;
char* pc = 0;
-#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(mblen("",0)), int>::value), "");
static_assert((std::is_same<decltype(mbtowc(pw,"",0)), int>::value), "");
static_assert((std::is_same<decltype(wctomb(pc,L' ')), int>::value), "");
-#endif
static_assert((std::is_same<decltype(mbstowcs(pw,"",0)), size_t>::value), "");
static_assert((std::is_same<decltype(wcstombs(pc,pwc,0)), size_t>::value), "");
}
diff --git a/test/std/depr/depr.c.headers/tgmath_h.pass.cpp b/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
index a2ef814dcae1..965a8de3c56e 100644
--- a/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
@@ -11,10 +11,6 @@
#include <tgmath.h>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
std::complex<double> cd;
diff --git a/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp b/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
new file mode 100644
index 000000000000..bd843621def8
--- /dev/null
+++ b/test/std/diagnostics/syserr/is_error_code_enum.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++03
+
+// <system_error>
+
+// template <> struct is_error_code_enum<> : public false_type {};
+
+#include <system_error>
+#include <string>
+#include "test_macros.h"
+
+template <bool Expected, class T>
+void
+test()
+{
+ static_assert((std::is_error_code_enum<T>::value == Expected), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_error_code_enum_v<T> == Expected), "");
+#endif
+}
+
+class A {
+ A();
+ operator std::error_code () const { return std::error_code(); }
+};
+
+// Specialize the template for my class
+namespace std
+{
+ template <>
+ struct is_error_code_enum<A> : public std::true_type {};
+}
+
+
+int main()
+{
+ test<false, void>();
+ test<false, int>();
+ test<false, std::nullptr_t>();
+ test<false, std::string>();
+
+ test<true, A>();
+}
diff --git a/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp b/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
new file mode 100644
index 000000000000..b2efd9e07750
--- /dev/null
+++ b/test/std/diagnostics/syserr/is_error_condition_enum.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <system_error>
+
+// template <class T> constexpr bool is_error_condition_enum_v;
+
+#include <system_error>
+#include <type_traits>
+#include "test_macros.h"
+
+template <bool Expected, class T>
+void
+test()
+{
+ static_assert((std::is_error_condition_enum<T>::value == Expected), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_error_condition_enum_v<T> == Expected), "");
+#endif
+}
+
+class A {
+ A();
+ operator std::error_condition () const { return std::error_condition(); }
+};
+
+// Specialize the template for my class
+namespace std
+{
+ template <>
+ struct is_error_condition_enum<A> : public std::true_type {};
+}
+
+
+int main()
+{
+ test<false, void>();
+ test<false, int>();
+ test<false, std::nullptr_t>();
+ test<false, std::string>();
+
+ test<true, A>();
+}
diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
index c8b3d98103c4..4091f446af27 100644
--- a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -32,7 +32,7 @@ test(int i)
H h;
T ec(i, std::system_category());
const std::size_t result = h(ec);
- LIBCPP_ASSERT(result == i);
+ LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
((void)result); // Prevent unused warning
}
diff --git a/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
new file mode 100644
index 000000000000..d455210c2697
--- /dev/null
+++ b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class T>
+// struct hash
+// : public unary_function<T, size_t>
+// {
+// size_t operator()(T val) const;
+// };
+
+#include <system_error>
+#include <cassert>
+#include <type_traits>
+
+#include "test_macros.h"
+
+void
+test(int i)
+{
+ typedef std::error_condition T;
+ typedef std::hash<T> H;
+ static_assert((std::is_same<H::argument_type, T>::value), "" );
+ static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
+ H h;
+ T ec(i, std::system_category());
+ const std::size_t result = h(ec);
+ LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
+ ((void)result); // Prevent unused warning
+}
+
+int main()
+{
+ test(0);
+ test(2);
+ test(10);
+}
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
index eeb437379325..85ff8e15d162 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <algorithm>
// template <class PopulationIterator, class SampleIterator, class Distance,
@@ -32,5 +34,8 @@ template <class PopulationIterator, class SampleIterator> void test() {
}
int main() {
+ // expected-error@algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}}
+ // expected-error@algorithm:* 2 {{does not provide a subscript operator}}
+ // expected-error@algorithm:* {{invalid operands}}
test<input_iterator<int *>, output_iterator<int *> >();
}
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
index 1a9f9b099b20..531731791c5d 100644
--- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
+++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp
@@ -46,8 +46,8 @@ template <>
struct TestExpectations<std::input_iterator_tag>
: public ReservoirSampleExpectations {};
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -68,13 +68,13 @@ void test() {
assert(std::equal(oa, oa + os, oa1));
end = std::experimental::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
- SampleIterator(oa), os, g);
+ SampleIterator(oa), os, std::move(g));
assert(end.base() - oa == std::min(os, is));
assert(std::equal(oa, oa + os, oa2));
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_population() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -88,8 +88,8 @@ void test_empty_population() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_empty_sample() {
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
typedef SampleIteratorType<SampleItem *> SampleIterator;
@@ -103,8 +103,8 @@ void test_empty_sample() {
assert(end.base() == oa);
}
-template <template<class> class PopulationIteratorType, class PopulationItem,
- template<class> class SampleIteratorType, class SampleItem>
+template <template<class...> class PopulationIteratorType, class PopulationItem,
+ template<class...> class SampleIteratorType, class SampleItem>
void test_small_population() {
// The population size is less than the sample size.
typedef PopulationIteratorType<PopulationItem *> PopulationIterator;
diff --git a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
index 8ee575c408f9..17b01fe630bf 100644
--- a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.assign/move.pass.cpp b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
index 0a2d71967cd4..49508febd941 100644
--- a/test/std/experimental/any/any.class/any.assign/move.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "test_macros.h"
using std::experimental::any;
diff --git a/test/std/experimental/any/any.class/any.assign/value.pass.cpp b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
index 8262990523c3..b42a4ba2b050 100644
--- a/test/std/experimental/any/any.class/any.assign/value.pass.cpp
+++ b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
index 3d0b34b27406..69341ca6b801 100644
--- a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/default.pass.cpp b/test/std/experimental/any/any.class/any.cons/default.pass.cpp
index b52c83fc3881..3839e3afc81d 100644
--- a/test/std/experimental/any/any.class/any.cons/default.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/default.pass.cpp
@@ -17,7 +17,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
diff --git a/test/std/experimental/any/any.class/any.cons/move.pass.cpp b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
index 40534cb55066..2a050946afab 100644
--- a/test/std/experimental/any/any.class/any.cons/move.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
@@ -18,7 +18,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.cons/value.pass.cpp b/test/std/experimental/any/any.class/any.cons/value.pass.cpp
index 7bb134efd28a..a3ab0edc8b6b 100644
--- a/test/std/experimental/any/any.class/any.cons/value.pass.cpp
+++ b/test/std/experimental/any/any.class/any.cons/value.pass.cpp
@@ -23,7 +23,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
diff --git a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
index 603490cef43d..781ed73f2b33 100644
--- a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
+++ b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
index 064935167eb5..b1d315468968 100644
--- a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
+++ b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
@@ -18,7 +18,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
using std::experimental::any;
using std::experimental::any_cast;
diff --git a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
index 8c681f37017f..bdf0d511b811 100644
--- a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
+++ b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
@@ -16,7 +16,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.class/any.observers/type.pass.cpp b/test/std/experimental/any/any.class/any.observers/type.pass.cpp
index 682b73bc98c4..6d0048403677 100644
--- a/test/std/experimental/any/any.class/any.observers/type.pass.cpp
+++ b/test/std/experimental/any/any.class/any.observers/type.pass.cpp
@@ -17,7 +17,7 @@
#include <experimental/any>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
int main()
{
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
index 9d9a5cdb4726..46ddbe5b05a1 100644
--- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -21,7 +21,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
using std::experimental::any;
using std::experimental::any_cast;
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
index e97560937fb0..47fe52f7b1dd 100644
--- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -24,7 +24,7 @@
#include <type_traits>
#include <cassert>
-#include "any_helpers.h"
+#include "experimental_any_helpers.h"
#include "count_new.hpp"
#include "test_macros.h"
@@ -98,6 +98,8 @@ void checkThrows(any& a)
} catch (...) {
assert(false);
}
+#else
+ ((void)a);
#endif
}
@@ -176,7 +178,6 @@ void test_cast_to_value() {
Type::reset();
{
any a((Type(42)));
- any const& ca = a;
assert(Type::count == 1);
assert(Type::copied == 0);
assert(Type::moved == 1);
diff --git a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
index a6becb1bafaa..830e8123150a 100644
--- a/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
+++ b/test/std/experimental/filesystem/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
@@ -87,9 +87,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- directory_iterator it(testDir);
- TEST_REQUIRE(it != directory_iterator{});
-
+ {
+ directory_iterator it(testDir);
+ TEST_REQUIRE(it != directory_iterator{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
index 1118497e06a8..f344e1153071 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp
@@ -24,6 +24,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -77,6 +78,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
@@ -99,6 +101,16 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
}
assert(LHS == E);
}
+ // basic_string_view
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ StrView RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS /= RHS;
+ }
+ assert(LHS == E);
+ }
// CharT*
{
path LHS(L); PathReserve(LHS, ReserveSize);
@@ -153,6 +165,7 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
@@ -172,6 +185,21 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
assert(LHS == E);
assert(&Ref == &LHS);
}
+ // basic_string_view
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = (LHS /= RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = LHS.append(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
// Char*
{
path LHS(L);
@@ -218,6 +246,60 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
}
}
+
+
+template <class It, class = decltype(fs::path{}.append(std::declval<It>()))>
+constexpr bool has_append(int) { return true; }
+template <class It>
+constexpr bool has_append(long) { return false; }
+
+template <class It, class = decltype(fs::path{}.operator/=(std::declval<It>()))>
+constexpr bool has_append_op(int) { return true; }
+template <class It>
+constexpr bool has_append_op(long) { return false; }
+
+template <class It>
+constexpr bool has_append() {
+ static_assert(has_append<It>(0) == has_append_op<It>(0), "must be same");
+ return has_append<It>(0) && has_append_op<It>(0);
+}
+
+void test_sfinae()
+{
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(has_append<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!has_append<It>(), "");
+
+ }
+ {
+ static_assert(!has_append<int*>(), "");
+ }
+ {
+ static_assert(!has_append<char>(), "");
+ static_assert(!has_append<const char>(), "");
+ }
+}
+
int main()
{
using namespace fs;
@@ -238,4 +320,5 @@ int main()
doAppendSourceAllocTest<char>(TC);
doAppendSourceAllocTest<wchar_t>(TC);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
index 4c2d5112d10b..9e48cbf1e7f2 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp
@@ -23,6 +23,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -69,6 +70,32 @@ void RunTestCase(MultiStringType const& MS) {
assert(p.string<CharT>() == TestPath);
assert(p.string<CharT>() == S);
}
+ // basic_string<Char, Traits, Alloc>
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ // string provides a contigious iterator. No allocation needed.
+ DisableAllocationGuard g;
+ path& pref = (p = S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p; PathReserve(p, S.length() + 1);
+ {
+ DisableAllocationGuard g;
+ path& pref = p.assign(S);
+ assert(&pref == &p);
+ }
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
//////////////////////////////////////////////////////////////////////////////
// Char* pointers
{
@@ -143,6 +170,49 @@ void RunTestCase(MultiStringType const& MS) {
}
}
+template <class It, class = decltype(fs::path{}.assign(std::declval<It>()))>
+constexpr bool has_assign(int) { return true; }
+template <class It>
+constexpr bool has_assign(long) { return false; }
+template <class It>
+constexpr bool has_assign() { return has_assign<It>(0); }
+
+void test_sfinae() {
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(std::is_assignable<path, It>::value, "");
+ static_assert(has_assign<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!std::is_assignable<path, It>::value, "");
+ static_assert(!has_assign<It>(), "");
+
+ }
+ {
+ static_assert(!std::is_assignable<path, int*>::value, "");
+ static_assert(!has_assign<int*>(), "");
+ }
+}
+
int main() {
for (auto const& MS : PathList) {
RunTestCase<char>(MS);
@@ -150,4 +220,5 @@ int main() {
RunTestCase<char16_t>(MS);
RunTestCase<char32_t>(MS);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
index 557c1b24d88f..69d08e6eb49a 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
@@ -73,6 +73,11 @@ const PathCompareTest CompareTestCases[] =
#undef LONGC
#undef LONGD
+static inline int normalize_ret(int ret)
+{
+ return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
+}
+
int main()
{
using namespace fs;
@@ -80,17 +85,18 @@ int main()
const path p1(TC.LHS);
const path p2(TC.RHS);
const std::string R(TC.RHS);
+ const std::string_view RV(TC.RHS);
const int E = TC.expect;
{ // compare(...) functions
DisableAllocationGuard g; // none of these operations should allocate
// check runtime results
- int ret1 = p1.compare(p2);
- int ret2 = p1.compare(R);
- int ret3 = p1.compare(TC.RHS);
- assert(ret1 == ret2 && ret1 == ret3);
- int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
- assert(normalized_ret == E);
+ int ret1 = normalize_ret(p1.compare(p2));
+ int ret2 = normalize_ret(p1.compare(R));
+ int ret3 = normalize_ret(p1.compare(TC.RHS));
+ int ret4 = normalize_ret(p1.compare(RV));
+ assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
+ assert(ret1 == E);
// check signatures
ASSERT_NOEXCEPT(p1.compare(p2));
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
index 6e00afe0b49c..89269362d06f 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp
@@ -14,8 +14,9 @@
// class path
// path& operator+=(const path& x);
-// path& operator+=(const string_type& x); // Implemented as Source template
-// path& operator+=(const value_type* x); // Implemented as Source template
+// path& operator+=(const string_type& x);
+// path& operator+=(string_view x);
+// path& operator+=(const value_type* x);
// path& operator+=(value_type x);
// template <class Source>
// path& operator+=(const Source& x);
@@ -29,6 +30,8 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <string>
+#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -82,6 +85,7 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
@@ -98,6 +102,16 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC)
}
assert(LHS == E);
}
+ // basic_string_view
+ {
+ path LHS(L); PathReserve(LHS, ReserveSize);
+ StrView RHS(R);
+ {
+ DisableAllocationGuard g;
+ LHS += RHS;
+ }
+ assert(LHS == E);
+ }
// CharT*
{
path LHS(L); PathReserve(LHS, ReserveSize);
@@ -152,6 +166,7 @@ void doConcatSourceTest(ConcatOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
+ using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
@@ -171,6 +186,21 @@ void doConcatSourceTest(ConcatOperatorTestcase const& TC)
assert(LHS == E);
assert(&Ref == &LHS);
}
+ // basic_string_view
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = (LHS += RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
+ {
+ path LHS(L);
+ StrView RHS(R);
+ path& Ref = LHS.concat(RHS);
+ assert(LHS == E);
+ assert(&Ref == &LHS);
+ }
// Char*
{
path LHS(L);
@@ -235,6 +265,68 @@ void doConcatECharTest(ConcatOperatorTestcase const& TC)
}
}
+
+template <class It, class = decltype(fs::path{}.concat(std::declval<It>()))>
+constexpr bool has_concat(int) { return true; }
+template <class It>
+constexpr bool has_concat(long) { return false; }
+
+template <class It, class = decltype(fs::path{}.operator+=(std::declval<It>()))>
+constexpr bool has_concat_op(int) { return true; }
+template <class It>
+constexpr bool has_concat_op(long) { return false; }
+template <class It>
+constexpr bool has_concat_op() { return has_concat_op<It>(0); }
+
+template <class It>
+constexpr bool has_concat() {
+ static_assert(has_concat<It>(0) == has_concat_op<It>(0), "must be same");
+ return has_concat<It>(0) && has_concat_op<It>(0);
+}
+
+void test_sfinae() {
+ using namespace fs;
+ {
+ static_assert(has_concat_op<char>(), "");
+ static_assert(has_concat_op<const char>(), "");
+ static_assert(has_concat_op<char16_t>(), "");
+ static_assert(has_concat_op<const char16_t>(), "");
+ }
+ {
+ using It = const char* const;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(has_concat<It>(), "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!has_concat<It>(), "");
+ }
+ {
+ static_assert(!has_concat<int>(0), "");
+ // operator+=(int) is well formed since it converts to operator+=(value_type)
+ // but concat(int) isn't valid because there is no concat(value_type).
+ // This should probably be addressed by a LWG issue.
+ static_assert(has_concat_op<int>(), "");
+ }
+ {
+ static_assert(!has_concat<int*>(), "");
+ }
+}
+
int main()
{
using namespace fs;
@@ -246,6 +338,13 @@ int main()
assert(LHS == (const char*)TC.expect);
assert(&Ref == &LHS);
}
+ {
+ path LHS((const char*)TC.lhs);
+ std::string_view RHS((const char*)TC.rhs);
+ path& Ref = (LHS += RHS);
+ assert(LHS == (const char*)TC.expect);
+ assert(&Ref == &LHS);
+ }
doConcatSourceTest<char> (TC);
doConcatSourceTest<wchar_t> (TC);
doConcatSourceTest<char16_t>(TC);
@@ -265,6 +364,18 @@ int main()
}
assert(LHS == E);
}
+ {
+ path LHS((const char*)TC.lhs);
+ std::string_view RHS((const char*)TC.rhs);
+ const char* E = TC.expect;
+ PathReserve(LHS, StrLen(E) + 5);
+ {
+ DisableAllocationGuard g;
+ path& Ref = (LHS += RHS);
+ assert(&Ref == &LHS);
+ }
+ assert(LHS == E);
+ }
doConcatSourceAllocTest<char>(TC);
doConcatSourceAllocTest<wchar_t>(TC);
}
@@ -274,4 +385,5 @@ int main()
doConcatECharTest<char16_t>(TC);
doConcatECharTest<char32_t>(TC);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
index d89e7c815efb..a04f35af5780 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
@@ -47,6 +47,13 @@ void RunTestCase(MultiStringType const& MS) {
assert(p.string<CharT>() == TestPath);
assert(p.string<CharT>() == S);
}
+ {
+ const std::basic_string_view<CharT> S(TestPath);
+ path p(S);
+ assert(p.native() == Expect);
+ assert(p.string<CharT>() == TestPath);
+ assert(p.string<CharT>() == S);
+ }
// Char* pointers
{
path p(TestPath);
@@ -73,6 +80,37 @@ void RunTestCase(MultiStringType const& MS) {
}
}
+void test_sfinae() {
+ using namespace fs;
+ {
+ using It = const char* const;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ using It = input_iterator<const char*>;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ struct Traits {
+ using iterator_category = std::input_iterator_tag;
+ using value_type = const char;
+ using pointer = const char*;
+ using reference = const char&;
+ using difference_type = std::ptrdiff_t;
+ };
+ using It = input_iterator<const char*, Traits>;
+ static_assert(std::is_constructible<path, It>::value, "");
+ }
+ {
+ using It = output_iterator<const char*>;
+ static_assert(!std::is_constructible<path, It>::value, "");
+
+ }
+ {
+ static_assert(!std::is_constructible<path, int*>::value, "");
+ }
+}
+
int main() {
for (auto const& MS : PathList) {
RunTestCase<char>(MS);
@@ -80,4 +118,5 @@ int main() {
RunTestCase<char16_t>(MS);
RunTestCase<char32_t>(MS);
}
+ test_sfinae();
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
index 5be934968c46..7881c9700d6e 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
@@ -28,7 +28,6 @@ namespace fs = std::experimental::filesystem;
int main() {
using namespace fs;
- const path p("/foo/bar/baz");
{
path p;
ASSERT_NOEXCEPT(p.clear());
@@ -37,6 +36,7 @@ int main() {
assert(p.empty());
}
{
+ const path p("/foo/bar/baz");
path p2(p);
assert(p == p2);
p2.clear();
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
index 4ad9084dbf81..e414202bf8ff 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.modifiers/remove_filename.pass.cpp
@@ -35,16 +35,24 @@ const RemoveFilenameTestcase TestCases[] =
{
{"", ""}
, {"/", ""}
+ , {"//", ""}
+ , {"///", ""}
, {"\\", ""}
, {".", ""}
, {"..", ""}
, {"/foo", "/"}
+ , {"//foo", ""}
+ , {"//foo/", ""}
+ , {"//foo///", ""}
+ , {"///foo", "/"}
+ , {"///foo/", "///foo"}
, {"/foo/", "/foo"}
, {"/foo/.", "/foo"}
, {"/foo/..", "/foo"}
, {"/foo/////", "/foo"}
, {"/foo\\\\", "/"}
, {"/foo//\\/", "/foo//\\"}
+ , {"///foo", "/"}
, {"file.txt", ""}
, {"bar/../baz/./file.txt", "bar/../baz/."}
};
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
index 7cf3564bb9b1..796609432727 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
const char* const value = "hello world";
const std::string str_value = value;
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));
ASSERT_NOEXCEPT(p.c_str());
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
index 7f8df27faf0a..db1326483776 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/native.pass.cpp
@@ -28,8 +28,8 @@ int main()
{
using namespace fs;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native()));
ASSERT_NOEXCEPT(p.native());
}
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
index 9ef83f989aa5..013d26cdb7f6 100644
--- a/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.member/path.native.obs/operator_string.pass.cpp
@@ -30,8 +30,8 @@ int main()
using namespace fs;
using string_type = path::string_type;
const char* const value = "hello world";
- path p(value);
{ // Check signature
+ path p(value);
static_assert(std::is_convertible<path, string_type>::value, "");
static_assert(std::is_constructible<string_type, path>::value, "");
ASSERT_SAME_TYPE(string_type, decltype(p.operator string_type()));
diff --git a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
index e8d150f1e39d..4b7ad735c7f8 100644
--- a/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
+++ b/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp
@@ -40,7 +40,6 @@ void doIOTest() {
using namespace fs;
using Ptr = const CharT*;
using StrStream = std::basic_stringstream<CharT>;
- const char* const InCStr = InStr;
const Ptr E = OutStr;
const path p((const char*)InStr);
StrStream ss;
diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
index 1cddccd0d724..8f6009d399c1 100644
--- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
+++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
@@ -91,8 +91,10 @@ TEST_CASE(access_denied_test_case)
env.create_file(testFile, 42);
// Test that we can iterator over the directory before changing the perms
- RDI it(testDir);
- TEST_REQUIRE(it != RDI{});
+ {
+ RDI it(testDir);
+ TEST_REQUIRE(it != RDI{});
+ }
// Change the permissions so we can no longer iterate
permissions(testDir, perms::none);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
index 7d318719f740..c9b42b3596ad 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy/copy.pass.cpp
@@ -19,6 +19,7 @@
#include <experimental/filesystem>
#include <type_traits>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -59,6 +60,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
@@ -69,37 +71,44 @@ TEST_CASE(test_error_reporting)
const path fifo = env.create_fifo("fifo");
TEST_REQUIRE(is_other(fifo));
+ const auto test_ec = GetTestEC();
+
// !exists(f)
{
- std::error_code ec;
+ std::error_code ec = test_ec;
const path f = StaticEnv::DNE;
const path t = env.test_root;
fs::copy(f, t, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(f, t, ec));
}
{ // equivalent(f, t) == true
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(file, file, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(file, file, ec));
}
{ // is_directory(from) && is_file(to)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(dir, file, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(dir, file, ec));
}
{ // is_other(from)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(fifo, dir, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(fifo, dir, ec));
}
{ // is_other(to)
- std::error_code ec;
+ std::error_code ec = test_ec;
fs::copy(file, fifo, ec);
TEST_REQUIRE(ec);
+ TEST_REQUIRE(ec != test_ec);
TEST_CHECK(checkThrow(file, fifo, ec));
}
}
@@ -129,11 +138,13 @@ TEST_CASE(from_is_symlink)
std::error_code ec = GetTestEC();
fs::copy(symlink, file, copy_options::copy_symlinks, ec);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
}
{ // create symlinks but target exists
std::error_code ec = GetTestEC();
fs::copy(symlink, file, copy_options::create_symlinks, ec);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
}
}
@@ -187,7 +198,7 @@ TEST_CASE(from_is_directory)
{
struct FileInfo {
path filename;
- int size;
+ std::size_t size;
};
const FileInfo files[] = {
{"file1", 0},
@@ -246,6 +257,60 @@ TEST_CASE(from_is_directory)
TEST_CHECK(file_size(nested_created) == FI.size);
}
}
+}
+TEST_CASE(test_copy_symlinks_to_symlink_dir)
+{
+ scoped_test_env env;
+ const path file1 = env.create_file("file1", 42);
+ const path file2 = env.create_file("file2", 101);
+ const path file2_sym = env.create_symlink(file2, "file2_sym");
+ const path dir = env.create_dir("dir");
+ const path dir_sym = env.create_symlink(dir, "dir_sym");
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(file1, dir_sym, copy_options::copy_symlinks, ec);
+ TEST_CHECK(!ec);
+ const path dest = env.make_env_path("dir/file1");
+ TEST_CHECK(exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ TEST_CHECK(file_size(dest) == 42);
+ }
}
+
+
+TEST_CASE(test_dir_create_symlink)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ const path dest = env.make_env_path("dne");
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, copy_options::create_symlinks, ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+ TEST_CHECK(!exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ }
+ {
+ std::error_code ec = GetTestEC();
+ fs::copy(dir, dest, copy_options::create_symlinks|copy_options::recursive, ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::is_a_directory));
+ TEST_CHECK(!exists(dest));
+ TEST_CHECK(!is_symlink(dest));
+ }
+}
+
+TEST_CASE(test_otherwise_no_effects_clause)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir1");
+ { // skip copy because of directory
+ const path dest = env.make_env_path("dest1");
+ std::error_code ec;
+ fs::copy(dir, dest, CO::directories_only, ec);
+ TEST_CHECK(!ec);
+ TEST_CHECK(!exists(dest));
+ }
+}
+
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index ac9877bbd9ce..8c5241c71af8 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -62,6 +62,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
@@ -138,7 +139,6 @@ TEST_CASE(test_attributes_get_copied)
const path file = env.create_file("file1", 42);
const path dest = env.make_env_path("file2");
auto st = status(file);
- perms default_perms = st.permissions();
perms new_perms = perms::owner_read;
permissions(file, new_perms);
std::error_code ec;
@@ -153,12 +153,36 @@ TEST_CASE(copy_dir_test)
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path dest = env.create_dir("dir1");
- std::error_code ec;
+ std::error_code ec = GetTestEC();
TEST_CHECK(fs::copy_file(file, dest, ec) == false);
TEST_CHECK(ec);
- ec.clear();
+ TEST_CHECK(ec != GetTestEC());
+ ec = GetTestEC();
TEST_CHECK(fs::copy_file(dest, file, ec) == false);
TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+}
+
+TEST_CASE(non_regular_file_test)
+{
+ scoped_test_env env;
+ const path fifo = env.create_fifo("fifo");
+ const path dest = env.make_env_path("dest");
+ const path file = env.create_file("file", 42);
+ {
+ std::error_code ec = GetTestEC();
+ TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(!exists(dest));
+ }
+ {
+ std::error_code ec = GetTestEC();
+ TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(is_fifo(fifo));
+ }
}
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
index 6fae11195206..fe4729806772 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
index e0473754cc88..85a3b6cb3465 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_directory_symlink(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
index 4a865fdee7e8..7aefece46a4a 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
@@ -36,21 +36,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_hard_link(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
index 35ba57f3ab46..d261d987a1ee 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
@@ -37,21 +37,6 @@ TEST_CASE(test_signatures)
TEST_CASE(test_error_reporting)
{
- auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
- {
-#ifndef TEST_HAS_NO_EXCEPTIONS
- try {
- fs::create_symlink(f, t);
- return true;
- } catch (filesystem_error const& err) {
- return err.path1() == f
- && err.code() == ec;
- }
-#else
- return true;
-#endif
- };
-
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
index abc50e9c6a41..7537ac20c757 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -45,18 +45,27 @@ TEST_CASE(hard_link_count_for_file)
TEST_CASE(hard_link_count_for_directory)
{
- uintmax_t DirExpect = 3;
- uintmax_t Dir3Expect = 2;
+ uintmax_t DirExpect = 3; // hard link from . .. and Dir2
+ uintmax_t Dir3Expect = 2; // hard link from . ..
+ uintmax_t DirExpectAlt = DirExpect;
+ uintmax_t Dir3ExpectAlt = Dir3Expect;
#if defined(__APPLE__)
- DirExpect += 2;
- Dir3Expect += 1;
+ // Filesystems formatted with case sensitive hfs+ behave unixish as
+ // expected. Normal hfs+ filesystems report the number of directory
+ // entries instead.
+ DirExpectAlt = 5; // . .. Dir2 file1 file2
+ Dir3Expect = 3; // . .. file5
#endif
- TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect);
- TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
+ hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
+ hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
std::error_code ec;
- TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect);
- TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
+ hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+ TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
+ hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
}
TEST_CASE(hard_link_count_increments_test)
{
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
index ba07d09d10d9..bc62086c2cff 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
@@ -77,4 +77,33 @@ TEST_CASE(test_is_empty_fails)
TEST_CHECK_THROW(filesystem_error, is_empty(dir2));
}
+TEST_CASE(test_directory_access_denied)
+{
+ scoped_test_env env;
+ const path dir = env.create_dir("dir");
+ const path file1 = env.create_file("dir/file", 42);
+ permissions(dir, perms::none);
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(is_empty(dir, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+
+ TEST_CHECK_THROW(filesystem_error, is_empty(dir));
+}
+
+
+TEST_CASE(test_fifo_fails)
+{
+ scoped_test_env env;
+ const path fifo = env.create_fifo("fifo");
+
+ std::error_code ec = GetTestEC();
+ TEST_CHECK(is_empty(fifo, ec) == false);
+ TEST_CHECK(ec);
+ TEST_CHECK(ec != GetTestEC());
+
+ TEST_CHECK_THROW(filesystem_error, is_empty(fifo));
+}
+
TEST_SUITE_END()
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
index b177693c09bd..4177392141e5 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
@@ -35,7 +35,8 @@ TEST_CASE(test_signatures)
std::error_code ec; ((void)ec);
ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts));
// Not noexcept because of narrow contract
- ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec));
+ LIBCPP_ONLY(
+ ASSERT_NOT_NOEXCEPT(fs::permissions(p, opts, ec)));
}
TEST_CASE(test_error_reporting)
@@ -52,6 +53,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)opts); ((void)ec);
return true;
#endif
};
@@ -115,7 +117,7 @@ TEST_CASE(basic_permissions_test)
permissions(TC.p, TC.set_perms, ec);
TEST_CHECK(!ec);
auto pp = status(TC.p).permissions();
- TEST_CHECK(status(TC.p).permissions() == TC.expected);
+ TEST_CHECK(pp == TC.expected);
}
}
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
index 00581cbe8bcc..d69e95ce5d5c 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
@@ -51,6 +51,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
index edb0c4fc76c9..f7ce8a30e64e 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove/remove.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
index aecfce7885e9..b84c18c1da06 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
index c2ae854c0bf6..e265c7af6b10 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.rename/rename.pass.cpp
@@ -50,6 +50,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)t); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
index 8a6aa09b14c7..f7c2ee14e83a 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
@@ -52,6 +52,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)s); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
index 865191520be3..8f241810fc7d 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.space/space.pass.cpp
@@ -57,6 +57,7 @@ TEST_CASE(test_error_reporting)
&& err.code() == ec;
}
#else
+ ((void)f); ((void)ec);
return true;
#endif
};
diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
index 215c35a33f30..148564e61961 100644
--- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -51,7 +51,6 @@ TEST_CASE(basic_tests)
const path dir_perms = env.create_dir("bad_perms_dir");
const path nested_dir = env.create_dir("bad_perms_dir/nested");
permissions(dir_perms, perms::none);
- const std::error_code set_ec = std::make_error_code(std::errc::address_in_use);
const std::error_code expect_ec = std::make_error_code(std::errc::not_a_directory);
struct TestCase {
std::string name;
@@ -66,7 +65,7 @@ TEST_CASE(basic_tests)
PutEnv(TC.name, TC.p);
}
for (auto& TC : cases) {
- std::error_code ec = set_ec;
+ std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
TEST_CHECK(ret == TC.p);
@@ -75,21 +74,25 @@ TEST_CASE(basic_tests)
// Set the env variable to a path that does not exist and check
// that it fails.
PutEnv(TC.name, dne);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
- TEST_CHECK(ec == expect_ec);
+ LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(ec);
TEST_CHECK(ret == "");
// Set the env variable to point to a file and check that it fails.
PutEnv(TC.name, file);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
- TEST_CHECK(ec == expect_ec);
+ LIBCPP_ONLY(TEST_CHECK(ec == expect_ec));
+ TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(ec);
TEST_CHECK(ret == "");
// Set the env variable to point to a dir we can't access
PutEnv(TC.name, nested_dir);
- ec = set_ec;
+ ec = GetTestEC();
ret = temp_directory_path(ec);
TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied));
TEST_CHECK(ret == "");
@@ -99,7 +102,7 @@ TEST_CASE(basic_tests)
}
// No env variables are defined
{
- std::error_code ec = set_ec;
+ std::error_code ec = GetTestEC();
path ret = temp_directory_path(ec);
TEST_CHECK(!ec);
TEST_CHECK(ret == "/tmp");
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
index bc44f1f6cbbf..467e09d5d2b6 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
@@ -43,7 +43,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
-void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
index 743ab92156be..b0e5e877dfe1 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
@@ -58,7 +58,9 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
+ count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -78,7 +80,9 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
- do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
@@ -93,6 +97,7 @@ test()
const unsigned sh = sizeof(ih)/sizeof(ih[0]);
int ii[] = {1, 1, 2};
do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+
}
template <class Iter1, class Iter2>
@@ -112,7 +117,9 @@ test2()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
char ic[] = {1};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
index b27cabd76ab3..c80ef7968628 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
@@ -54,7 +54,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
-// assert(count_equal::count <= max_count);
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
@@ -74,7 +74,9 @@ test()
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+
do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+
int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
index 28a3f6d912f8..abfab17d02ce 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
@@ -42,7 +42,7 @@ template <typename T> struct MyHash {
};
template <typename Iter1, typename Iter2>
-void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned /*max_count*/) {
std::experimental::boyer_moore_horspool_searcher<Iter2,
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
s{b2, e2};
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
index 3a6647dbc7f5..28f3324966ea 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
@@ -57,7 +57,9 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
count_equal>
s{b2, e2};
+ count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
index 8c78b9de0b35..4e961ec9e20c 100644
--- a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
@@ -53,7 +53,7 @@ void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned ma
typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
count_equal::count = 0;
assert(result == std::experimental::search(b1, e1, s));
-// assert(count_equal::count <= max_count);
+ assert(count_equal::count <= max_count);
}
template <class Iter1, class Iter2>
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
index 50a71eeca82b..acc42d39f60c 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
index b6adb558b1e4..05cf82cfbd2b 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
index a913742a854b..1a76072661d6 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp
@@ -23,7 +23,12 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
index d0d76503da50..8f78521995d8 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -24,7 +24,11 @@
#include <tuple>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
index 73e4f0e101a8..a02dcf336960 100644
--- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
+++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
@@ -21,7 +21,11 @@
#include <type_traits>
#include <cassert>
#include <cstdlib>
+
+#include "test_macros.h"
+#include "test_memory_resource.hpp"
#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
#include "test_allocator.h"
namespace ex = std::experimental::pmr;
diff --git a/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
index 26cf903fe0d8..efb529b3c118 100644
--- a/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
+++ b/test/std/experimental/memory/memory.resource/memory.resource.public/allocate.pass.cpp
@@ -73,8 +73,8 @@ int main()
#ifndef TEST_HAS_NO_EXCEPTIONS
{
TestResource R2;
- auto& P = R2.getController();
- P.throw_on_alloc = true;
+ auto& P2 = R2.getController();
+ P2.throw_on_alloc = true;
memory_resource& M2 = R2;
try {
M2.allocate(42);
diff --git a/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..7b2527f22bf4
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+#include <experimental/numeric>
+
+int main () {}
diff --git a/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp b/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..7b2527f22bf4
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
@@ -0,0 +1,15 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+#include <experimental/numeric>
+
+int main () {}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
new file mode 100644
index 000000000000..8b069832aac8
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::gcd(2.0, 4);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
new file mode 100644
index 000000000000..ca9b871ef5e0
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::gcd(4, 6.0);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
new file mode 100644
index 000000000000..a52b50b391cd
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
@@ -0,0 +1,132 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <experimental/numeric>
+#include <cassert>
+#include <cstdlib> // for rand()
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 1},
+ {0, 1, 1},
+ {1, 1, 1},
+ {2, 3, 1},
+ {2, 4, 2},
+ {36, 17, 1},
+ {36, 18, 18}
+};
+
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::experimental::gcd(in1, in2))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::experimental::gcd(in2, in1))>::value), "" );
+ return out == std::experimental::gcd(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
new file mode 100644
index 000000000000..d12b35609b1e
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::lcm(2.0, 4);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
new file mode 100644
index 000000000000..d5731870eb19
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type, the program is ill-formed.
+
+#include <experimental/numeric>
+
+
+int main()
+{
+ std::experimental::lcm(4, 6.0);
+}
diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
new file mode 100644
index 000000000000..e3c109f7447b
--- /dev/null
+++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <experimental/numeric>
+#include <cassert>
+#include <cstdlib>
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 0},
+ {0, 1, 0},
+ {1, 1, 1},
+ {2, 3, 6},
+ {2, 4, 4},
+ {3, 17, 51},
+ {36, 18, 36}
+};
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input1(0), Input2(0)))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input2(0), Input1(0)))>::value), "" );
+ return out == std::experimental::lcm(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
index cddb27e93a6a..ac7be156c69c 100644
--- a/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
+++ b/test/std/experimental/optional/optional.nullops/less_equal.pass.cpp
@@ -15,9 +15,11 @@
#include <experimental/optional>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
using std::experimental::optional;
using std::experimental::nullopt_t;
using std::experimental::nullopt;
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
index 3d0d2e03158b..0215417ce0b2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/assign_value.pass.cpp
@@ -19,6 +19,14 @@
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign() {}
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
};
@@ -53,6 +61,11 @@ int main()
assert(*opt == i);
}
{
+ optional<const AllowConstAssign> opt;
+ const AllowConstAssign other;
+ opt = other;
+ }
+ {
optional<std::unique_ptr<int>> opt;
opt = std::unique_ptr<int>(new int(3));
assert(static_cast<bool>(opt) == true);
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
index 89ea345029c2..17ee9754531f 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(const optional<T>& rhs);
@@ -17,8 +16,17 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
static bool throw_now;
@@ -27,7 +35,7 @@ struct X
X(const X&)
{
if (throw_now)
- throw 6;
+ TEST_THROW(6);
}
};
@@ -43,6 +51,11 @@ int main()
assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
}
{
+ optional<const AllowConstAssign> opt;
+ optional<const AllowConstAssign> opt2;
+ opt = opt2;
+ }
+ {
optional<int> opt;
constexpr optional<int> opt2(2);
opt = opt2;
@@ -67,6 +80,7 @@ int main()
assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
assert(*opt == *opt2);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<X> opt;
optional<X> opt2(X{});
@@ -83,4 +97,5 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
index 94f2bb21a475..256396094a90 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class... Args> void optional<T>::emplace(Args&&... args);
@@ -18,6 +17,8 @@
#include <cassert>
#include <memory>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -48,7 +49,7 @@ class Z
public:
static bool dtor_called;
Z() = default;
- Z(int) {throw 6;}
+ Z(int) {TEST_THROW(6);}
~Z() {dtor_called = true;}
};
@@ -81,6 +82,12 @@ int main()
assert(*opt == 1);
}
{
+ optional<const int> opt(2);
+ opt.emplace(1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == 1);
+ }
+ {
optional<X> opt;
opt.emplace();
assert(static_cast<bool>(opt) == true);
@@ -125,6 +132,7 @@ int main()
assert(Y::dtor_called == true);
}
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Z z;
optional<Z> opt(z);
@@ -141,4 +149,5 @@ int main()
assert(Z::dtor_called == true);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
index fec37408e43b..8a265808a3c3 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
@@ -19,6 +18,8 @@
#include <cassert>
#include <vector>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -60,7 +61,7 @@ public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
- {throw 6;}
+ {TEST_THROW(6);}
~Z() {dtor_called = true;}
friend constexpr bool operator==(const Z& x, const Z& y)
@@ -81,6 +82,17 @@ int main()
assert(*opt == X({1, 2}));
}
}
+ X::dtor_called = false;
+ {
+ X x;
+ {
+ optional<const X> opt(x);
+ assert(X::dtor_called == false);
+ opt.emplace({1, 2});
+ assert(X::dtor_called == true);
+ assert(*opt == X({1, 2}));
+ }
+ }
{
optional<std::vector<int>> opt;
opt.emplace({1, 2, 3}, std::allocator<int>());
@@ -93,6 +105,7 @@ int main()
assert(static_cast<bool>(opt) == true);
assert(*opt == Y({1, 2}));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Z z;
optional<Z> opt(z);
@@ -109,4 +122,5 @@ int main()
assert(Z::dtor_called == true);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
index fa00f5602c7f..4e2aca978865 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(optional<T>&& rhs)
@@ -19,8 +18,17 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
+struct AllowConstAssign {
+ AllowConstAssign(AllowConstAssign const&) {}
+ AllowConstAssign const& operator=(AllowConstAssign const&) const {
+ return *this;
+ }
+};
+
struct X
{
static bool throw_now;
@@ -29,7 +37,7 @@ struct X
X(X&&)
{
if (throw_now)
- throw 6;
+ TEST_THROW(6);
}
X& operator=(X&&) noexcept
{
@@ -37,10 +45,10 @@ struct X
}
};
-struct Y {};
-
bool X::throw_now = false;
+struct Y {};
+
int main()
{
{
@@ -77,6 +85,12 @@ int main()
assert(*opt == *opt2);
}
{
+ optional<const AllowConstAssign> opt;
+ optional<const AllowConstAssign> opt2;
+ opt = std::move(opt2);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
optional<X> opt;
optional<X> opt2(X{});
@@ -93,6 +107,7 @@ int main()
assert(static_cast<bool>(opt) == false);
}
}
+#endif
{
static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
index 9b6511a0006d..6371dcb4e51c 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -42,7 +43,7 @@ class Z
{
public:
Z(int) {}
- Z(const Z&) {throw 6;}
+ Z(const Z&) {TEST_THROW(6);}
};
@@ -97,6 +98,7 @@ int main()
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef Z T;
try
@@ -110,4 +112,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
index 144af2e3a7dc..4b66fe80bbb2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional(const optional<T>& rhs);
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
template <class T>
@@ -24,7 +25,12 @@ void
test(const optional<T>& rhs, bool is_going_to_throw = false)
{
bool rhs_engaged = static_cast<bool>(rhs);
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (is_going_to_throw)
+ return;
+#else
try
+#endif
{
optional<T> lhs = rhs;
assert(is_going_to_throw == false);
@@ -32,10 +38,13 @@ test(const optional<T>& rhs, bool is_going_to_throw = false)
if (rhs_engaged)
assert(*lhs == *rhs);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (int i)
{
assert(i == 6);
+ assert(is_going_to_throw);
}
+#endif
}
class X
@@ -68,7 +77,7 @@ public:
Z(const Z&)
{
if (++count == 2)
- throw 6;
+ TEST_THROW(6);
}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
@@ -88,6 +97,11 @@ int main()
test(rhs);
}
{
+ typedef const int T;
+ optional<T> rhs(3);
+ test(rhs);
+ }
+ {
typedef X T;
optional<T> rhs;
test(rhs);
@@ -98,6 +112,11 @@ int main()
test(rhs);
}
{
+ typedef const X T;
+ optional<T> rhs(X(3));
+ test(rhs);
+ }
+ {
typedef Y T;
optional<T> rhs;
test(rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
index dc1666b10362..c46407896576 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -19,6 +18,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
using std::experimental::optional;
using std::experimental::in_place_t;
@@ -55,7 +55,7 @@ public:
class Z
{
public:
- Z(int i) {throw 6;}
+ Z(int) {TEST_THROW(6);}
};
@@ -128,6 +128,7 @@ int main()
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -139,4 +140,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
index 9bd6b18989fc..b75c147df513 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
@@ -20,6 +19,8 @@
#include <vector>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -60,7 +61,7 @@ public:
constexpr Z() : i_(0) {}
constexpr Z(int i) : i_(i) {}
Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
- {throw 6;}
+ {TEST_THROW(6);}
friend constexpr bool operator==(const Z& x, const Z& y)
{return x.i_ == y.i_ && x.j_ == y.j_;}
@@ -100,6 +101,7 @@ int main()
constexpr test_constexpr_ctor dopt(in_place, {42, 101, -1});
static_assert(*dopt == Y{42, 101, -1}, "");
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
try
@@ -112,4 +114,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
index 851157f960f9..a8bb6e9c275c 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// optional(optional<T>&& rhs) noexcept(is_nothrow_move_constructible<T>::value);
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
template <class T>
@@ -26,16 +27,24 @@ test(optional<T>& rhs, bool is_going_to_throw = false)
static_assert(std::is_nothrow_move_constructible<optional<T>>::value ==
std::is_nothrow_move_constructible<T>::value, "");
bool rhs_engaged = static_cast<bool>(rhs);
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (is_going_to_throw)
+ return;
+#else
try
+#endif
{
optional<T> lhs = std::move(rhs);
assert(is_going_to_throw == false);
assert(static_cast<bool>(lhs) == rhs_engaged);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (int i)
{
assert(i == 6);
+ assert(is_going_to_throw);
}
+#endif
}
class X
@@ -68,12 +77,23 @@ public:
Z(Z&&)
{
if (++count == 2)
- throw 6;
+ TEST_THROW(6);
}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
};
+
+class ConstMovable
+{
+ int i_;
+public:
+ ConstMovable(int i) : i_(i) {}
+ ConstMovable(const ConstMovable&& x) : i_(x.i_) {}
+ ~ConstMovable() {i_ = 0;}
+ friend bool operator==(const ConstMovable& x, const ConstMovable& y) {return x.i_ == y.i_;}
+};
+
int main()
{
{
@@ -87,6 +107,11 @@ int main()
test(rhs);
}
{
+ typedef const int T;
+ optional<T> rhs(3);
+ test(rhs);
+ }
+ {
typedef X T;
optional<T> rhs;
test(rhs);
@@ -97,6 +122,11 @@ int main()
test(rhs);
}
{
+ typedef const ConstMovable T;
+ optional<T> rhs(ConstMovable(3));
+ test(rhs);
+ }
+ {
typedef Y T;
optional<T> rhs;
test(rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
index ef21fcdf9e6d..1941546a53f7 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -44,7 +45,7 @@ class Z
{
public:
Z(int) {}
- Z(Z&&) {throw 6;}
+ Z(Z&&) {TEST_THROW(6);}
};
@@ -92,6 +93,7 @@ int main()
constexpr test_constexpr_ctor(T&&) {}
};
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef Z T;
try
@@ -104,4 +106,5 @@ int main()
assert(i == 6);
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
index cf900d7029e1..46586c65a6e0 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
@@ -51,6 +51,9 @@ int main()
{
constexpr optional<Z> opt(Z{});
assert(opt->test() == 1);
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+ static_assert(opt->test() == 1, "");
+#endif
}
#ifdef _LIBCPP_DEBUG
{
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
index b998f3067f4f..c8f07111c23d 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// T& optional<T>::value();
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::bad_optional_access;
@@ -35,6 +36,7 @@ int main()
opt.emplace();
assert(opt.value().test() == 4);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<X> opt;
try
@@ -46,4 +48,5 @@ int main()
{
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
index a38b1f930c72..98ff16e4d13b 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// constexpr const T& optional<T>::value() const;
@@ -17,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
using std::experimental::in_place_t;
using std::experimental::in_place;
@@ -40,6 +41,7 @@ int main()
const optional<X> opt(in_place);
assert(opt.value().test() == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
const optional<X> opt;
try
@@ -51,4 +53,5 @@ int main()
{
}
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
index 620dda19e3ff..f2d373c299bf 100644
--- a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// void swap(optional&)
@@ -19,6 +18,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -56,11 +57,15 @@ class Z
int i_;
public:
Z(int i) : i_(i) {}
- Z(Z&&) {throw 7;}
+ Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
- friend void swap(Z& x, Z& y) {throw 6;}
+ friend void swap(Z&, Z&) {TEST_THROW(6);}
+};
+
+struct ConstSwappable {
};
+void swap(ConstSwappable const&, ConstSwappable const&) {}
int main()
{
@@ -113,6 +118,11 @@ int main()
assert(*opt2 == 1);
}
{
+ optional<const ConstSwappable> opt;
+ optional<const ConstSwappable> opt2;
+ opt.swap(opt2);
+ }
+ {
optional<X> opt1;
optional<X> opt2;
static_assert(noexcept(opt1.swap(opt2)) == true, "");
@@ -222,6 +232,7 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 1);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<Z> opt1;
optional<Z> opt2;
@@ -298,4 +309,5 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
+#endif
}
diff --git a/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
index d339c53c1f77..4d643cb44b67 100644
--- a/test/std/experimental/optional/optional.specalg/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
// <optional>
// template <class T> void swap(optional<T>& x, optional<T>& y)
@@ -18,6 +17,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
using std::experimental::optional;
class X
@@ -55,10 +56,10 @@ class Z
int i_;
public:
Z(int i) : i_(i) {}
- Z(Z&&) {throw 7;}
+ Z(Z&&) {TEST_THROW(7);}
friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
- friend void swap(Z& x, Z& y) {throw 6;}
+ friend void swap(Z&, Z&) {TEST_THROW(6);}
};
int main()
@@ -231,6 +232,7 @@ int main()
assert(static_cast<bool>(opt1) == false);
assert(static_cast<bool>(opt2) == false);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
optional<Z> opt1;
opt1.emplace(1);
@@ -297,4 +299,5 @@ int main()
assert(static_cast<bool>(opt2) == true);
assert(*opt2 == 2);
}
+#endif // TEST_HAS_NO_EXCEPTIONS
}
diff --git a/test/std/experimental/string.view/string.view.access/data.pass.cpp b/test/std/experimental/string.view/string.view.access/data.pass.cpp
index 53e95ddaea31..4b581d653eac 100644
--- a/test/std/experimental/string.view/string.view.access/data.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/data.pass.cpp
@@ -39,7 +39,7 @@ int main () {
test ( U"a", 1 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char *s = "ABC";
constexpr std::experimental::basic_string_view<char> sv( s, 2 );
diff --git a/test/std/experimental/string.view/string.view.access/index.pass.cpp b/test/std/experimental/string.view/string.view.access/index.pass.cpp
index 2c1bd1dc91cb..0cb385eeff58 100644
--- a/test/std/experimental/string.view/string.view.access/index.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/index.pass.cpp
@@ -42,7 +42,7 @@ int main () {
test ( U"a", 1 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::experimental::basic_string_view<char> sv ( "ABC", 2 );
static_assert ( sv.length() == 2, "" );
diff --git a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
index 9f5d86f2f82b..a5108bf12660 100644
--- a/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
+++ b/test/std/experimental/string.view/string.view.capacity/capacity.pass.cpp
@@ -23,7 +23,7 @@
template<typename SV>
void test1 () {
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr SV sv1;
static_assert ( sv1.size() == 0, "" );
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
index 0df37a6ffd9f..bd566a986276 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
index 5971f6974380..51decdca67cd 100644
--- a/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
index f5bcb7e97b73..cf8a30a3942c 100644
--- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
index e13a4ea119d1..1bacf285f4eb 100644
--- a/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
index 63002a5c415c..0aae3d41a825 100644
--- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
index 3047cc7be118..e014872a613c 100644
--- a/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
index c542efea99a7..bdc4c966fd06 100644
--- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
index 17219a42602c..e814283ad5b6 100644
--- a/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
index 2c0461481e78..10e82437cd6d 100644
--- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
index df9e90893f7c..77d8fa3e5b27 100644
--- a/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
index 1deee9ac7fc6..9c13199d24a7 100644
--- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
@@ -17,6 +17,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -49,7 +50,7 @@ int main()
test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
index c99489eb3070..c74b327f14bb 100644
--- a/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
+++ b/test/std/experimental/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
@@ -16,6 +16,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -48,7 +49,7 @@ int main()
test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.cons/default.pass.cpp b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
index e817bfffb89d..37df020e7ea4 100644
--- a/test/std/experimental/string.view/string.view.cons/default.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/default.pass.cpp
@@ -15,9 +15,11 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
+
template<typename T>
void test () {
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T sv1;
static_assert ( sv1.size() == 0, "" );
diff --git a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
index 9de3a3039523..a8638389e168 100644
--- a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template<typename CharT>
@@ -55,7 +56,7 @@ int main () {
test ( U"" );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::experimental::basic_string_view<char, constexpr_char_traits<char>> sv1 ( "ABCDE" );
static_assert ( sv1.size() == 5, "");
diff --git a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
index 663d25e954f9..c2f312daa863 100644
--- a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
+++ b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -34,7 +34,7 @@ int main () {
test ( "QBCDE", 5 );
test ( "QBCDE", 2 );
test ( "", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char *s = "QBCDE";
constexpr std::experimental::basic_string_view<char> sv1 ( s, 2 );
@@ -46,7 +46,7 @@ int main () {
test ( L"QBCDE", 5 );
test ( L"QBCDE", 2 );
test ( L"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const wchar_t *s = L"QBCDE";
constexpr std::experimental::basic_string_view<wchar_t> sv1 ( s, 2 );
@@ -59,7 +59,7 @@ int main () {
test ( u"QBCDE", 5 );
test ( u"QBCDE", 2 );
test ( u"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char16_t *s = u"QBCDE";
constexpr std::experimental::basic_string_view<char16_t> sv1 ( s, 2 );
@@ -71,7 +71,7 @@ int main () {
test ( U"QBCDE", 5 );
test ( U"QBCDE", 2 );
test ( U"", 0 );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr const char32_t *s = U"QBCDE";
constexpr std::experimental::basic_string_view<char32_t> sv1 ( s, 2 );
diff --git a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
index 6e6a1f55710a..fdaf8aa066f5 100644
--- a/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("abcdeabcdeabcdeabcde"), 'c', 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
index 73580aed89ad..859980af2956 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -68,7 +69,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'q', 0);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
index de93288cc010..1f7ce3ef54d1 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
index cfb0029fa180..28255dd457f7 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
index dde2f2c9f378..ffafcfc04481 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'e', 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
index e49e82ccab11..7b37fe057213 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
index 1dc8d85472c7..1f7ea383a589 100644
--- a/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
index ed1a35e91845..307be23708b3 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'i', 19);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
index e07c4f361da3..b0d3f0636b21 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
index 3ddf03365060..8a591ccbe44a 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
index d28e0079561f..b949eec1b3c3 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_char_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -66,7 +67,7 @@ int main()
test(S("laenfsbridchgotmkqpj"), 'm', 15);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
index f01e277f5ada..3755b2653d19 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -149,7 +150,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
index a38ffa692f48..64b29ec7da6f 100644
--- a/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
index 5ebe414be096..bdccb2f22645 100644
--- a/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -155,7 +156,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
index 382cbaf07934..856dc4a3a072 100644
--- a/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_pointer_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -376,7 +377,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
index 84132ac7a161..f25efdd02072 100644
--- a/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/find_string_view_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -148,7 +149,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
index 9014d888d4ef..f07071101c77 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_char_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -65,7 +66,7 @@ int main()
test(S("abcdeabcdeabcdeabcde"), 'b', 16);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
index 0559d3121db9..7a8795be0816 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -155,7 +156,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
index 9116e3aa95a8..2755d2c567b6 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
@@ -13,6 +13,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -375,7 +376,7 @@ int main()
test3<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp b/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
index 88457c662016..e77d668d79ba 100644
--- a/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
template <class S>
@@ -148,7 +149,7 @@ int main()
test1<S>();
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
index 8040b81d4efe..5f28f63f8275 100644
--- a/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/begin.pass.cpp
@@ -58,7 +58,7 @@ int main()
test(u32string_view{U"123"});
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
constexpr u16string_view u16sv {u"123", 3 };
diff --git a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
index 3a1091e9983c..1f22b3fbe4ba 100644
--- a/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/end.pass.cpp
@@ -12,6 +12,7 @@
// constexpr const_iterator end() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -38,9 +39,9 @@ test(S s)
assert(ce2 != s.begin());
}
- assert( e - s.begin() == s.size());
- assert(ce1 - cs.begin() == cs.size());
- assert(ce2 - s.cbegin() == s.size());
+ assert( e - s.begin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.begin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.cbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
@@ -66,7 +67,7 @@ int main()
test(u32string_view{U"123"});
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
constexpr u16string_view u16sv {u"123", 3 };
diff --git a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
index 55e28a266948..bd24c327e090 100644
--- a/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
+++ b/test/std/experimental/string.view/string.view.iterators/rend.pass.cpp
@@ -12,6 +12,7 @@
// constexpr const_iterator rend() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -38,9 +39,9 @@ test(S s)
assert(ce2 != s.rbegin());
}
- assert( e - s.rbegin() == s.size());
- assert(ce1 - cs.rbegin() == cs.size());
- assert(ce2 - s.crbegin() == s.size());
+ assert( e - s.rbegin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.rbegin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.crbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
diff --git a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
index 9a4891c8f259..00b0661d85f5 100644
--- a/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/clear.pass.cpp
@@ -32,7 +32,7 @@ void test ( const CharT *s, size_t len ) {
}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -60,7 +60,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert ( test_ce (5) == 0, "" );
#endif
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
index 4a31486afaa0..03484a0b5ebb 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -39,7 +39,7 @@ void test ( const CharT *s, size_t len ) {
}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -67,7 +67,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce ( 5, 0 ) == 5, "" );
static_assert ( test_ce ( 5, 1 ) == 4, "" );
diff --git a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
index 9ddc6de84bf3..6b632d0efad8 100644
--- a/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -39,7 +39,7 @@ void test ( const CharT *s, size_t len ) {
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -67,7 +67,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce ( 5, 0 ) == 5, "" );
static_assert ( test_ce ( 5, 1 ) == 4, "" );
diff --git a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
index d747def8549e..2912fd8b9150 100644
--- a/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
+++ b/test/std/experimental/string.view/string.view.modifiers/swap.pass.cpp
@@ -36,7 +36,7 @@ void test ( const CharT *s, size_t len ) {
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr size_t test_ce ( size_t n, size_t k ) {
typedef std::experimental::basic_string_view<char> SV;
SV sv1{ "ABCDEFGHIJKL", n };
@@ -66,7 +66,7 @@ int main () {
test ( U"", 0 );
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static_assert ( test_ce (2, 3) == 3, "" );
static_assert ( test_ce (5, 3) == 3, "" );
diff --git a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
index 6ba03212d42b..202e9ced451f 100644
--- a/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
+++ b/test/std/experimental/string.view/string.view.nonmem/quoted.pass.cpp
@@ -16,7 +16,9 @@
#include <experimental/string_view>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
// quoted is C++14 only
bool is_skipws ( const std::istream *is ) {
diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
index 583395451fd4..93014ea119f9 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.pointer.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -112,7 +113,7 @@ int main()
}
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
index 4364ab063543..ff01daaf1ce4 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.sv.pass.cpp
@@ -14,6 +14,7 @@
#include <experimental/string_view>
#include <cassert>
+#include "test_macros.h"
#include "constexpr_char_traits.hpp"
int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
@@ -106,7 +107,7 @@ int main () {
test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0);
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::experimental::basic_string_view<char, constexpr_char_traits<char>> SV;
constexpr SV sv1 { "abcde", 5 };
diff --git a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
index a651010d4b27..a3a1dbf418b8 100644
--- a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
@@ -27,6 +27,7 @@ void test1 ( std::experimental::basic_string_view<CharT> sv, size_t n, size_t po
try {
std::experimental::basic_string_view<CharT> sv1 = sv.substr(pos, n);
assert(false);
+ ((void)sv1);
} catch (const std::out_of_range&) {
return;
} catch (...) {
diff --git a/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
new file mode 100644
index 000000000000..ffce81459478
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/detected_or.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using hasFoo = typename T::Foo;
+
+struct yesFoo {
+ using Foo = int;
+};
+
+struct noFoo {
+};
+
+
+template <typename T, typename Res>
+void test() {
+ static_assert( std::is_same<Res, typename ex::detected_or <double, hasFoo, T>::type>::value, "" );
+ static_assert( std::is_same<Res, typename ex::detected_or_t<double, hasFoo, T> >::value, "" );
+}
+
+int main () {
+ test<yesFoo, int>();
+ test<noFoo, double>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/detected_t.pass.cpp
new file mode 100644
index 000000000000..136fb068be3c
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/detected_t.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+
+template <typename T, typename Res>
+void test() {
+ static_assert( std::is_same<Res, typename ex::detected_t<callFoo, T>>::value, "" );
+}
+
+int main () {
+ test<yesFoo, int>();
+ test<noFoo, ex::nonesuch>(); // lookup failure returns nonesuch
+ test<wrongFoo, std::string>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp
new file mode 100644
index 000000000000..d8528a25161e
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using copy_assign_t = decltype(std::declval<T&>() = std::declval<T const &>());
+
+struct not_assignable {
+ not_assignable & operator=(const not_assignable&) = delete;
+};
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected <copy_assign_t, T>::value, "" );
+ static_assert( b == ex::is_detected_v<copy_assign_t, T>, "" );
+}
+
+int main () {
+ test<int, true>();
+ test<std::string, true>();
+ test<not_assignable, false>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp
new file mode 100644
index 000000000000..8d1e0ae825d5
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected_convertible.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected_convertible <int, callFoo, T>::value, "" );
+ static_assert( b == ex::is_detected_convertible_v<int, callFoo, T>, "" );
+}
+
+int main () {
+ test<yesFoo, true>();
+ test<noFoo, false>();
+ test<wrongFoo, false>();
+ test<convertibleFoo, true>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp b/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp
new file mode 100644
index 000000000000..e9e5d8ce0056
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.detect/is_detected_exact.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+#include <experimental/type_traits>
+#include <string>
+
+#include "test_macros.h"
+
+namespace ex = std::experimental;
+
+template <typename T>
+ using callFoo = decltype(std::declval<T&>().Foo());
+
+struct yesFoo {
+ int Foo() { return 0; }
+};
+
+struct noFoo {
+};
+
+struct wrongFoo {
+ std::string Foo() { return ""; }
+};
+
+struct convertibleFoo {
+ long Foo() { return 0; }
+};
+
+template <typename T, bool b>
+void test() {
+ static_assert( b == ex::is_detected_exact <int, callFoo, T>::value, "" );
+ static_assert( b == ex::is_detected_exact_v<int, callFoo, T>, "" );
+}
+
+int main () {
+ test<yesFoo, true>();
+ test<noFoo, false>();
+ test<wrongFoo, false>();
+ test<convertibleFoo, false>();
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
new file mode 100644
index 000000000000..cb8db1febd27
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/conjunction.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class... B> struct conjunction; // C++17
+// template<class... B>
+// constexpr bool conjunction_v = conjunction<B...>::value; // C++17
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert ( ex::conjunction<>::value, "" );
+ static_assert ( ex::conjunction<std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<>, "" );
+ static_assert ( ex::conjunction_v<std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type>, "" );
+
+ static_assert ( ex::conjunction<std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::conjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::conjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::conjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::conjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::conjunction<True >::value, "" );
+ static_assert (!ex::conjunction<False>::value, "" );
+
+ static_assert ( ex::conjunction_v<True >, "" );
+ static_assert (!ex::conjunction_v<False>, "" );
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp
new file mode 100644
index 000000000000..dcdbf09fb099
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/disjunction.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class... B> struct disjunction;
+// template<class... B>
+// constexpr bool disjunction_v = disjunction<B...>::value;
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!ex::disjunction<>::value, "" );
+ static_assert ( ex::disjunction<std::true_type >::value, "" );
+ static_assert (!ex::disjunction<std::false_type>::value, "" );
+
+ static_assert (!ex::disjunction_v<>, "" );
+ static_assert ( ex::disjunction_v<std::true_type >, "" );
+ static_assert (!ex::disjunction_v<std::false_type>, "" );
+
+ static_assert ( ex::disjunction<std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!ex::disjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!ex::disjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::disjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert ( ex::disjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!ex::disjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert ( ex::disjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!ex::disjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( ex::disjunction<True >::value, "" );
+ static_assert (!ex::disjunction<False>::value, "" );
+
+ static_assert ( ex::disjunction_v<True >, "" );
+ static_assert (!ex::disjunction_v<False>, "" );
+}
diff --git a/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp
new file mode 100644
index 000000000000..b0d43d7e5122
--- /dev/null
+++ b/test/std/experimental/utilities/meta/meta.logical/negation.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// <experimental/type_traits>
+
+// template<class B> struct negation;
+// template<class B>
+// constexpr bool negation_v = negation<B>::value;
+
+#include <experimental/type_traits>
+#include <cassert>
+
+namespace ex = std::experimental;
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!ex::negation<std::true_type >::value, "" );
+ static_assert ( ex::negation<std::false_type>::value, "" );
+
+ static_assert (!ex::negation_v<std::true_type >, "" );
+ static_assert ( ex::negation_v<std::false_type>, "" );
+
+ static_assert (!ex::negation<True >::value, "" );
+ static_assert ( ex::negation<False>::value, "" );
+
+ static_assert (!ex::negation_v<True >, "" );
+ static_assert ( ex::negation_v<False>, "" );
+
+ static_assert ( ex::negation<ex::negation<std::true_type >>::value, "" );
+ static_assert (!ex::negation<ex::negation<std::false_type>>::value, "" );
+}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
index a5adf2d1f7f0..0e46f91cfd1e 100644
--- a/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.class/propagate_const.ctors/move_ctor.pass.cpp
@@ -25,4 +25,5 @@ int main() {
P p1(2);
P p2(std::move(p1));
+ assert(*p2 == 2);
}
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
index 8cf670a25402..488738d32072 100644
--- a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
+++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/hash.pass.cpp
@@ -24,7 +24,7 @@ template <> struct hash<X>
{
typedef X first_argument_type;
- size_t operator()(const first_argument_type& x1) const
+ size_t operator()(const first_argument_type&) const
{
return 99;
}
diff --git a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp b/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
index f19a8211cdac..485da33cdec7 100644
--- a/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
+++ b/test/std/experimental/utilities/ratio/header.ratio.synop/includes.pass.cpp
@@ -18,4 +18,5 @@
int main()
{
std::ratio<100> x;
+ ((void)x);
}
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
index 314d2783f7ec..01d36637e1c3 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/return_type.pass.cpp
@@ -20,32 +20,32 @@
static int my_int = 42;
-template <int N> struct index {};
+template <int N> struct index_t {};
-void f(index<0>) {}
+void f(index_t<0>) {}
-int f(index<1>) { return 0; }
+int f(index_t<1>) { return 0; }
-int & f(index<2>) { return static_cast<int &>(my_int); }
-int const & f(index<3>) { return static_cast<int const &>(my_int); }
-int volatile & f(index<4>) { return static_cast<int volatile &>(my_int); }
-int const volatile & f(index<5>) { return static_cast<int const volatile &>(my_int); }
+int & f(index_t<2>) { return static_cast<int &>(my_int); }
+int const & f(index_t<3>) { return static_cast<int const &>(my_int); }
+int volatile & f(index_t<4>) { return static_cast<int volatile &>(my_int); }
+int const volatile & f(index_t<5>) { return static_cast<int const volatile &>(my_int); }
-int && f(index<6>) { return static_cast<int &&>(my_int); }
-int const && f(index<7>) { return static_cast<int const &&>(my_int); }
-int volatile && f(index<8>) { return static_cast<int volatile &&>(my_int); }
-int const volatile && f(index<9>) { return static_cast<int const volatile &&>(my_int); }
+int && f(index_t<6>) { return static_cast<int &&>(my_int); }
+int const && f(index_t<7>) { return static_cast<int const &&>(my_int); }
+int volatile && f(index_t<8>) { return static_cast<int volatile &&>(my_int); }
+int const volatile && f(index_t<9>) { return static_cast<int const volatile &&>(my_int); }
-int * f(index<10>) { return static_cast<int *>(&my_int); }
-int const * f(index<11>) { return static_cast<int const *>(&my_int); }
-int volatile * f(index<12>) { return static_cast<int volatile *>(&my_int); }
-int const volatile * f(index<13>) { return static_cast<int const volatile *>(&my_int); }
+int * f(index_t<10>) { return static_cast<int *>(&my_int); }
+int const * f(index_t<11>) { return static_cast<int const *>(&my_int); }
+int volatile * f(index_t<12>) { return static_cast<int volatile *>(&my_int); }
+int const volatile * f(index_t<13>) { return static_cast<int const volatile *>(&my_int); }
template <int Func, class Expect>
void test()
{
- using F = decltype(f(index<Func>{}));
+ using F = decltype(f(index_t<Func>{}));
static_assert(std::is_same<F, Expect>::value, "");
}
diff --git a/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp b/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
index 51f9ab6bee18..7ac96d2502d8 100644
--- a/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
+++ b/test/std/experimental/utilities/utility/utility.erased.type/erased_type.pass.cpp
@@ -13,5 +13,6 @@
int main()
{
- std::experimental::erased_type e;
+ std::experimental::erased_type e;
+ ((void)e);
}
diff --git a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
index 8937950522c8..ab2f15e9576c 100644
--- a/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
+++ b/test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
@@ -872,54 +872,56 @@
#error SCNxPTR not defined
#endif
+template <class T> void test()
+{
+ T t = 0;
+ ((void)t); // Prevent unused warning
+}
+
int main()
{
- {
- std::int8_t i1 = 0;
- std::int16_t i2 = 0;
- std::int32_t i3 = 0;
- std::int64_t i4 = 0;
- }
- {
- std::uint8_t i1 = 0;
- std::uint16_t i2 = 0;
- std::uint32_t i3 = 0;
- std::uint64_t i4 = 0;
- }
- {
- std::int_least8_t i1 = 0;
- std::int_least16_t i2 = 0;
- std::int_least32_t i3 = 0;
- std::int_least64_t i4 = 0;
- }
- {
- std::uint_least8_t i1 = 0;
- std::uint_least16_t i2 = 0;
- std::uint_least32_t i3 = 0;
- std::uint_least64_t i4 = 0;
- }
- {
- std::int_fast8_t i1 = 0;
- std::int_fast16_t i2 = 0;
- std::int_fast32_t i3 = 0;
- std::int_fast64_t i4 = 0;
- }
- {
- std::uint_fast8_t i1 = 0;
- std::uint_fast16_t i2 = 0;
- std::uint_fast32_t i3 = 0;
- std::uint_fast64_t i4 = 0;
- }
- {
- std::intptr_t i1 = 0;
- std::uintptr_t i2 = 0;
- std::intmax_t i3 = 0;
- std::uintmax_t i4 = 0;
- }
+ test<std::int8_t >();
+ test<std::int16_t>();
+ test<std::int32_t>();
+ test<std::int64_t>();
+
+ test<std::uint8_t >();
+ test<std::uint16_t>();
+ test<std::uint32_t>();
+ test<std::uint64_t>();
+
+ test<std::int_least8_t >();
+ test<std::int_least16_t>();
+ test<std::int_least32_t>();
+ test<std::int_least64_t>();
+
+ test<std::uint_least8_t >();
+ test<std::uint_least16_t>();
+ test<std::uint_least32_t>();
+ test<std::uint_least64_t>();
+
+ test<std::int_fast8_t >();
+ test<std::int_fast16_t>();
+ test<std::int_fast32_t>();
+ test<std::int_fast64_t>();
+
+ test<std::uint_fast8_t >();
+ test<std::uint_fast16_t>();
+ test<std::uint_fast32_t>();
+ test<std::uint_fast64_t>();
+
+ test<std::intptr_t >();
+ test<std::uintptr_t>();
+ test<std::intmax_t >();
+ test<std::uintmax_t>();
+
{
std::imaxdiv_t i1 = {};
+ ((void)i1); // Prevent unused warning
}
+
std::intmax_t i = 0;
+ ((void)i); // Prevent unused warning
static_assert((std::is_same<decltype(std::imaxabs(i)), std::intmax_t>::value), "");
static_assert((std::is_same<decltype(std::imaxdiv(i, i)), std::imaxdiv_t>::value), "");
static_assert((std::is_same<decltype(std::strtoimax("", (char**)0, 0)), std::intmax_t>::value), "");
diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
index 4c2be7d4aa9e..5df8691ef1f9 100644
--- a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -12,6 +12,8 @@
#include <cstdio>
#include <type_traits>
+#include "test_macros.h"
+
#ifndef BUFSIZ
#error BUFSIZ not defined
#endif
@@ -140,7 +142,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_STDIN
static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
-#if _LIBCPP_STD_VER <= 11
+#if TEST_STD_VER <= 11
static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
#endif
static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
index 9ada23b45468..3c9c0d35db20 100644
--- a/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/filebuf.virtuals/underflow.pass.cpp
@@ -16,6 +16,7 @@
// This test is not entirely portable
#include <fstream>
+#include <cstddef>
#include <cassert>
#include "platform_support.h" // locale name macros
@@ -111,6 +112,7 @@ int main()
assert(f.egptr() - f.gptr() == 1);
}
{
+ typedef std::char_traits<wchar_t> Traits;
test_buf<wchar_t> f;
f.pubimbue(std::locale(LOCALE_en_US_UTF_8));
assert(f.open("underflow_utf8.dat", std::ios_base::in) != 0);
@@ -118,6 +120,6 @@ int main()
assert(f.sbumpc() == 0x4E51);
assert(f.sbumpc() == 0x4E52);
assert(f.sbumpc() == 0x4E53);
- assert(f.sbumpc() == -1);
+ assert(f.sbumpc() == static_cast<Traits::int_type>(-1));
}
}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
index f43df3c9f84a..ef3959cfcefb 100644
--- a/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp
@@ -25,22 +25,16 @@ int main()
fs >> x;
assert(x == 3.25);
}
- {
- std::ifstream fs("test.dat", std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
+ // std::ifstream(const char*, std::ios_base::openmode) is tested in
+ // test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+ // which creates writable files.
{
std::wifstream fs("test.dat");
double x = 0;
fs >> x;
assert(x == 3.25);
}
- {
- std::wifstream fs("test.dat", std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
+ // std::wifstream(const char*, std::ios_base::openmode) is tested in
+ // test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+ // which creates writable files.
}
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
index ad5fe5149df2..d4155ea8e7f5 100644
--- a/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp
@@ -25,22 +25,16 @@ int main()
fs >> x;
assert(x == 3.25);
}
- {
- std::ifstream fs(std::string("test.dat"), std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
+ // std::ifstream(const std::string&, std::ios_base::openmode) is tested in
+ // test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
+ // which creates writable files.
{
std::wifstream fs(std::string("test.dat"));
double x = 0;
fs >> x;
assert(x == 3.25);
}
- {
- std::wifstream fs(std::string("test.dat"), std::ios_base::out);
- double x = 0;
- fs >> x;
- assert(x == 3.25);
- }
+ // std::wifstream(const std::string&, std::ios_base::openmode) is tested in
+ // test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
+ // which creates writable files.
}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
index bd5832abeb59..60f92569049d 100644
--- a/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
@@ -31,6 +31,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
+ {
+ std::ifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
std::remove(temp.c_str());
{
std::wofstream fs(temp.c_str());
@@ -42,5 +48,11 @@ int main()
fs >> x;
assert(x == 3.25);
}
+ {
+ std::wifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
std::remove(temp.c_str());
}
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
index 7112b17fb8be..b95db6626020 100644
--- a/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
@@ -31,6 +31,12 @@ int main()
fs >> x;
assert(x == 3.25);
}
+ {
+ std::ifstream fs(temp, std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
std::remove(temp.c_str());
{
std::wofstream fs(temp);
@@ -42,5 +48,11 @@ int main()
fs >> x;
assert(x == 3.25);
}
+ {
+ std::wifstream fs(temp, std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
std::remove(temp.c_str());
}
diff --git a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
index e907708d0f22..d12b91cc0cba 100644
--- a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
index 5b7664e3f55c..77c41b09ad7b 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
@@ -7,17 +7,18 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <istream>
// template <class charT, class traits, class T>
// basic_istream<charT, traits>&
-// operator>>(basic_istream<charT, traits>&& is, T& x);
+// operator>>(basic_istream<charT, traits>&& is, T&& x);
#include <istream>
+#include <sstream>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@@ -42,11 +43,13 @@ public:
CharT* egptr() const {return base::egptr();}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+struct A{};
+bool called = false;
+void operator>>(std::istream&, A&&){ called = true; }
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
testbuf<char> sb(" 123");
int i = 0;
@@ -59,5 +62,11 @@ int main()
std::wistream(&sb) >> i;
assert(i == 123);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ { // test perfect forwarding
+ assert(called == false);
+ std::istringstream ss;
+ auto& out = (std::move(ss) >> A{});
+ assert(&out == &ss);
+ assert(called);
+ }
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
index 41a721d50f13..0f356e26d237 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
@@ -43,7 +43,7 @@ int main()
{
testbuf<char> sb(" ");
std::istream is(&sb);
- char c = is.get();
+ char c = static_cast<char>(is.get());
assert(!is.eof());
assert(!is.fail());
assert(c == ' ');
@@ -52,22 +52,22 @@ int main()
{
testbuf<char> sb(" abc");
std::istream is(&sb);
- char c = is.get();
+ char c = static_cast<char>(is.get());
assert(!is.eof());
assert(!is.fail());
assert(c == ' ');
assert(is.gcount() == 1);
- c = is.get();
+ c = static_cast<char>(is.get());
assert(!is.eof());
assert(!is.fail());
assert(c == 'a');
assert(is.gcount() == 1);
- c = is.get();
+ c = static_cast<char>(is.get());
assert(!is.eof());
assert(!is.fail());
assert(c == 'b');
assert(is.gcount() == 1);
- c = is.get();
+ c = static_cast<char>(is.get());
assert(!is.eof());
assert(!is.fail());
assert(c == 'c');
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
index 7a55f847d734..e7327293bf82 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
@@ -42,8 +42,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
index cbc007587d5e..292cf7c3b11d 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
@@ -43,8 +43,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
index e498172aa8b1..ed68279d7b57 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
@@ -27,8 +27,8 @@ int main()
std::istringstream is(s);
const unsigned int ignoreLen=10;
- size_t a=is.tellg();
+ std::istringstream::pos_type a=is.tellg();
is.ignore(ignoreLen);
- size_t b=is.tellg();
+ std::istringstream::pos_type b=is.tellg();
assert((b-a)==ignoreLen);
}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
index 13035b74436e..fe038a7cc1a9 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/bool.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
index 38ee37ff1892..197e4602ff3a 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/double.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
index 1da0ac685fcb..d31da5a18be6 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/float.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
index efcb08a3da10..1b33280e6693 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/int.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
index 6d617a453ebc..7cf46096d029 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
index 20b20b2231a2..dba3f8a68151 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_double.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
index dc77eb72192d..1174a0934ed6 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/long_long.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
index 47e257a18684..e68fb774335d 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
@@ -51,7 +51,7 @@ void test_hex(const char *expected)
std::string str = ss.str();
for (size_t i = 0; i < str.size(); ++i )
- str[i] = std::toupper(str[i]);
+ str[i] = static_cast<char>(std::toupper(str[i]));
assert(str == expected);
}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
index b74d99a34ec9..f6589397ed88 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
index ebd349bcbb79..3b8182c1b621 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/short.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
index ac60fa9c1979..61057f7b3063 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_int.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
index b5a38017dce4..4558993e8e1f 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
index 25dc4d834975..1727b3657ce0 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_long_long.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
@@ -76,7 +76,7 @@ int main()
testbuf<char> sb;
std::ostream os(&sb);
hex(os);
- unsigned long long n = -10;
+ unsigned long long n = static_cast<unsigned long long>(-10);
os << n;
assert(sb.str() == "fffffffffffffff6");
}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
index 7c28a8ee79c4..a42cd5628856 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/unsigned_short.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
index f74e2a4abd9e..b778da2240a0 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT.pass.cpp
@@ -39,7 +39,7 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
+ int n = static_cast<int>(str_.size());
str_.push_back(__c);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
index 2b78fa75aa30..29153c1d4241 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/CharT_pointer.pass.cpp
@@ -39,7 +39,7 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
+ int n = static_cast<int>(str_.size());
str_.push_back(__c);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
index 253b524308c0..91ee08cd0563 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
index c544554ae0e2..1eb48d378e4c 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_pointer.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
index 6449a13a6426..a50e376643c3 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide.pass.cpp
@@ -39,7 +39,7 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
+ int n = static_cast<int>(str_.size());
str_.push_back(__c);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
index e679a5c48ba4..5c900e6ae533 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/char_to_wide_pointer.pass.cpp
@@ -39,7 +39,7 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
+ int n = static_cast<int>(str_.size());
str_.push_back(__c);
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
index dc0ee4266c77..d57d0e7075b5 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
index e465b94b6b93..e51e8815730f 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/signed_char_pointer.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
index d818c5f358f2..9956f3b0162b 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
index 3257f4a776ca..d87e733c09dd 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.character/unsigned_char_pointer.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
index e26466e13f6e..ef7e292e901a 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/basic_ios.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
index 238a62108249..933e01c66e8d 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ios_base.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
index 3ed400a705ca..5c0604b73d4d 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/ostream.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
index 1cb9413a7cc9..a26450ae5bf2 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters/streambuf.pass.cpp
@@ -45,8 +45,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
index d503544a97f2..72df6085571f 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/endl.pass.cpp
@@ -41,8 +41,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
index 975b660b4770..dcded343431a 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.manip/ends.pass.cpp
@@ -39,8 +39,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
index ec0e8e1e8c7a..8be0b51d9fdf 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp
@@ -42,8 +42,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
index 396bb093f9c7..0958f8330236 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/put.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
index 8dd4e4cf76a6..0d6eb3f226f9 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.unformatted/write.pass.cpp
@@ -38,8 +38,8 @@ protected:
{
if (__c != base::traits_type::eof())
{
- int n = str_.size();
- str_.push_back(__c);
+ int n = static_cast<int>(str_.size());
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
diff --git a/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
index a8ef34e49278..d351c565eb66 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <ostream>
// template <class charT, class traits = char_traits<charT> >
@@ -18,6 +17,8 @@
#include <ostream>
#include <cassert>
+#include "test_macros.h"
+
int sync_called = 0;
template <class CharT>
@@ -58,6 +59,7 @@ int main()
unitbuf(os);
}
assert(sync_called == 1);
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
testbuf1<char> sb;
std::ostream os(&sb);
@@ -73,4 +75,5 @@ int main()
}
assert(sync_called == 1);
}
+#endif
}
diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
index ee9aabcb6ac8..8f07742c673f 100644
--- a/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
+++ b/test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
@@ -32,6 +32,7 @@ void both_ways ( const CharT *p ) {
std::basic_stringstream<CharT, Traits> ss;
bool skippingws = is_skipws ( ss );
+ ((void)skippingws); // Prevent unused warning
ss << q;
ss >> q;
}
diff --git a/test/std/input.output/iostream.forward/iosfwd.pass.cpp b/test/std/input.output/iostream.forward/iosfwd.pass.cpp
index 7250c2adb279..53d12ecfc77c 100644
--- a/test/std/input.output/iostream.forward/iosfwd.pass.cpp
+++ b/test/std/input.output/iostream.forward/iosfwd.pass.cpp
@@ -12,131 +12,112 @@
#include <iosfwd>
#include <cwchar> // for mbstate_t
+template <class Ptr> void test()
+{
+ Ptr p = 0;
+ ((void)p); // Prevent unused warning
+}
+
int main()
{
- {
- std::char_traits<char>* t1 = 0;
- std::char_traits<wchar_t>* t2 = 0;
- std::char_traits<unsigned short>* t3 = 0;
- }
- {
- std::basic_ios<char>* t1 = 0;
- std::basic_ios<wchar_t>* t2 = 0;
- std::basic_ios<unsigned short>* t3 = 0;
- }
- {
- std::basic_streambuf<char>* t1 = 0;
- std::basic_streambuf<wchar_t>* t2 = 0;
- std::basic_streambuf<unsigned short>* t3 = 0;
- }
- {
- std::basic_istream<char>* t1 = 0;
- std::basic_istream<wchar_t>* t2 = 0;
- std::basic_istream<unsigned short>* t3 = 0;
- }
- {
- std::basic_ostream<char>* t1 = 0;
- std::basic_ostream<wchar_t>* t2 = 0;
- std::basic_ostream<unsigned short>* t3 = 0;
- }
- {
- std::basic_iostream<char>* t1 = 0;
- std::basic_iostream<wchar_t>* t2 = 0;
- std::basic_iostream<unsigned short>* t3 = 0;
- }
- {
- std::basic_stringbuf<char>* t1 = 0;
- std::basic_stringbuf<wchar_t>* t2 = 0;
- std::basic_stringbuf<unsigned short>* t3 = 0;
- }
- {
- std::basic_istringstream<char>* t1 = 0;
- std::basic_istringstream<wchar_t>* t2 = 0;
- std::basic_istringstream<unsigned short>* t3 = 0;
- }
- {
- std::basic_ostringstream<char>* t1 = 0;
- std::basic_ostringstream<wchar_t>* t2 = 0;
- std::basic_ostringstream<unsigned short>* t3 = 0;
- }
- {
- std::basic_stringstream<char>* t1 = 0;
- std::basic_stringstream<wchar_t>* t2 = 0;
- std::basic_stringstream<unsigned short>* t3 = 0;
- }
- {
- std::basic_filebuf<char>* t1 = 0;
- std::basic_filebuf<wchar_t>* t2 = 0;
- std::basic_filebuf<unsigned short>* t3 = 0;
- }
- {
- std::basic_ifstream<char>* t1 = 0;
- std::basic_ifstream<wchar_t>* t2 = 0;
- std::basic_ifstream<unsigned short>* t3 = 0;
- }
- {
- std::basic_ofstream<char>* t1 = 0;
- std::basic_ofstream<wchar_t>* t2 = 0;
- std::basic_ofstream<unsigned short>* t3 = 0;
- }
- {
- std::basic_fstream<char>* t1 = 0;
- std::basic_fstream<wchar_t>* t2 = 0;
- std::basic_fstream<unsigned short>* t3 = 0;
- }
- {
- std::istreambuf_iterator<char>* t1 = 0;
- std::istreambuf_iterator<wchar_t>* t2 = 0;
- std::istreambuf_iterator<unsigned short>* t3 = 0;
- }
- {
- std::ostreambuf_iterator<char>* t1 = 0;
- std::ostreambuf_iterator<wchar_t>* t2 = 0;
- std::ostreambuf_iterator<unsigned short>* t3 = 0;
- }
- {
- std::ios* t1 = 0;
- std::wios* t2 = 0;
- }
- {
- std::streambuf* t1 = 0;
- std::istream* t2 = 0;
- std::ostream* t3 = 0;
- std::iostream* t4 = 0;
- }
- {
- std::stringbuf* t1 = 0;
- std::istringstream* t2 = 0;
- std::ostringstream* t3 = 0;
- std::stringstream* t4 = 0;
- }
- {
- std::filebuf* t1 = 0;
- std::ifstream* t2 = 0;
- std::ofstream* t3 = 0;
- std::fstream* t4 = 0;
- }
- {
- std::wstreambuf* t1 = 0;
- std::wistream* t2 = 0;
- std::wostream* t3 = 0;
- std::wiostream* t4 = 0;
- }
- {
- std::wstringbuf* t1 = 0;
- std::wistringstream* t2 = 0;
- std::wostringstream* t3 = 0;
- std::wstringstream* t4 = 0;
- }
- {
- std::wfilebuf* t1 = 0;
- std::wifstream* t2 = 0;
- std::wofstream* t3 = 0;
- std::wfstream* t4 = 0;
- }
- {
- std::fpos<std::mbstate_t>* t1 = 0;
- std::streampos* t2 = 0;
- std::wstreampos* t3 = 0;
- }
+ test<std::char_traits<char>* >();
+ test<std::char_traits<wchar_t>* >();
+ test<std::char_traits<unsigned short>*>();
+
+ test<std::basic_ios<char>* >();
+ test<std::basic_ios<wchar_t>* >();
+ test<std::basic_ios<unsigned short>*>();
+
+ test<std::basic_streambuf<char>* >();
+ test<std::basic_streambuf<wchar_t>* >();
+ test<std::basic_streambuf<unsigned short>*>();
+
+ test<std::basic_istream<char>* >();
+ test<std::basic_istream<wchar_t>* >();
+ test<std::basic_istream<unsigned short>*>();
+
+ test<std::basic_ostream<char>* >();
+ test<std::basic_ostream<wchar_t>* >();
+ test<std::basic_ostream<unsigned short>*>();
+
+ test<std::basic_iostream<char>* >();
+ test<std::basic_iostream<wchar_t>* >();
+ test<std::basic_iostream<unsigned short>*>();
+
+ test<std::basic_stringbuf<char>* >();
+ test<std::basic_stringbuf<wchar_t>* >();
+ test<std::basic_stringbuf<unsigned short>*>();
+
+ test<std::basic_istringstream<char>* >();
+ test<std::basic_istringstream<wchar_t>* >();
+ test<std::basic_istringstream<unsigned short>*>();
+
+ test<std::basic_ostringstream<char>* >();
+ test<std::basic_ostringstream<wchar_t>* >();
+ test<std::basic_ostringstream<unsigned short>*>();
+
+ test<std::basic_stringstream<char>* >();
+ test<std::basic_stringstream<wchar_t>* >();
+ test<std::basic_stringstream<unsigned short>*>();
+
+ test<std::basic_filebuf<char>* >();
+ test<std::basic_filebuf<wchar_t>* >();
+ test<std::basic_filebuf<unsigned short>*>();
+
+ test<std::basic_ifstream<char>* >();
+ test<std::basic_ifstream<wchar_t>* >();
+ test<std::basic_ifstream<unsigned short>*>();
+
+ test<std::basic_ofstream<char>* >();
+ test<std::basic_ofstream<wchar_t>* >();
+ test<std::basic_ofstream<unsigned short>*>();
+
+ test<std::basic_fstream<char>* >();
+ test<std::basic_fstream<wchar_t>* >();
+ test<std::basic_fstream<unsigned short>*>();
+
+ test<std::istreambuf_iterator<char>* >();
+ test<std::istreambuf_iterator<wchar_t>* >();
+ test<std::istreambuf_iterator<unsigned short>*>();
+
+ test<std::ostreambuf_iterator<char>* >();
+ test<std::ostreambuf_iterator<wchar_t>* >();
+ test<std::ostreambuf_iterator<unsigned short>*>();
+
+ test<std::ios* >();
+ test<std::wios*>();
+
+ test<std::streambuf*>();
+ test<std::istream* >();
+ test<std::ostream* >();
+ test<std::iostream* >();
+
+ test<std::stringbuf* >();
+ test<std::istringstream*>();
+ test<std::ostringstream*>();
+ test<std::stringstream* >();
+
+ test<std::filebuf* >();
+ test<std::ifstream*>();
+ test<std::ofstream*>();
+ test<std::fstream* >();
+
+ test<std::wstreambuf*>();
+ test<std::wistream* >();
+ test<std::wostream* >();
+ test<std::wiostream* >();
+
+ test<std::wstringbuf* >();
+ test<std::wistringstream*>();
+ test<std::wostringstream*>();
+ test<std::wstringstream* >();
+
+ test<std::wfilebuf* >();
+ test<std::wifstream*>();
+ test<std::wofstream*>();
+ test<std::wfstream* >();
+
+ test<std::fpos<std::mbstate_t>*>();
+ test<std::streampos* >();
+ test<std::wstreampos* >();
}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
index acefb8d16176..77b4336538ed 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
@@ -23,6 +22,8 @@
#include "platform_support.h" // locale name macros
+#include "test_macros.h"
+
struct testbuf
: public std::streambuf
{
@@ -158,6 +159,7 @@ int main()
ios1.copyfmt(ios1);
assert(!f1_called);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios1.copyfmt(ios2);
@@ -188,4 +190,5 @@ int main()
assert(ios1.pword(1) == &d2);
assert(ios1.tie() == (std::ostream*)2);
assert(ios1.fill() == '2');
+#endif
}
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
index 1c40a81aa069..8852c9b55bb4 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
@@ -18,6 +17,8 @@
#include <streambuf>
#include <cassert>
+#include "test_macros.h"
+
struct testbuf
: public std::streambuf
{
@@ -35,16 +36,20 @@ int main()
testbuf sb1;
testbuf sb2;
testios ios(&sb1);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios.setstate(std::ios::badbit);
ios.exceptions(std::ios::badbit);
+ assert(false);
}
catch (...)
{
}
+#endif
ios.set_rdbuf(&sb2);
assert(ios.rdbuf() == &sb2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios.setstate(std::ios::badbit);
@@ -53,6 +58,7 @@ int main()
catch (...)
{
}
+#endif
ios.set_rdbuf(0);
assert(ios.rdbuf() == 0);
}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
index 0de889e549cc..4e3faa27c401 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/bool.pass.cpp
@@ -14,12 +14,21 @@
// operator unspecified-bool-type() const;
#include <ios>
+#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
std::ios ios(0);
assert(static_cast<bool>(ios) == !ios.fail());
ios.setstate(std::ios::failbit);
assert(static_cast<bool>(ios) == !ios.fail());
+ static_assert((!std::is_convertible<std::ios, void*>::value), "");
+ static_assert((!std::is_convertible<std::ios, int>::value), "");
+ static_assert((!std::is_convertible<std::ios const&, int>::value), "");
+#if TEST_STD_VER >= 11
+ static_assert((!std::is_convertible<std::ios, bool>::value), "");
+#endif
}
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
index c4aad797801d..3efe910b32b0 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
@@ -18,6 +17,8 @@
#include <streambuf>
#include <cassert>
+#include "test_macros.h"
+
struct testbuf : public std::streambuf {};
int main()
@@ -26,9 +27,11 @@ int main()
std::ios ios(0);
ios.clear();
assert(ios.rdstate() == std::ios::badbit);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios.exceptions(std::ios::badbit);
+ assert(false);
}
catch (...)
{
@@ -51,6 +54,7 @@ int main()
{
assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
}
+#endif
}
{
testbuf sb;
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
index 9347644b12b1..d99269be704f 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
@@ -18,6 +17,8 @@
#include <streambuf>
#include <cassert>
+#include "test_macros.h"
+
struct testbuf : public std::streambuf {};
int main()
@@ -27,6 +28,7 @@ int main()
assert(ios.exceptions() == std::ios::goodbit);
ios.exceptions(std::ios::eofbit);
assert(ios.exceptions() == std::ios::eofbit);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios.exceptions(std::ios::badbit);
@@ -36,6 +38,7 @@ int main()
{
}
assert(ios.exceptions() == std::ios::badbit);
+#endif
}
{
testbuf sb;
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
index 41cb61db194d..6d2fe0691353 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
@@ -18,6 +17,8 @@
#include <streambuf>
#include <cassert>
+#include "test_macros.h"
+
struct testbuf : public std::streambuf {};
int main()
@@ -26,9 +27,11 @@ int main()
std::ios ios(0);
ios.setstate(std::ios::goodbit);
assert(ios.rdstate() == std::ios::badbit);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
ios.exceptions(std::ios::badbit);
+ assert(false);
}
catch (...)
{
@@ -51,6 +54,7 @@ int main()
{
assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit));
}
+#endif
}
{
testbuf sb;
diff --git a/test/std/input.output/iostreams.base/is_error_code_enum_io_errc.pass.cpp b/test/std/input.output/iostreams.base/is_error_code_enum_io_errc.pass.cpp
new file mode 100644
index 000000000000..5bba8bd3a8bb
--- /dev/null
+++ b/test/std/input.output/iostreams.base/is_error_code_enum_io_errc.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++03
+
+// <ios>
+
+// template <> struct is_error_code_enum<io_errc> : public true_type {};
+
+#include <ios>
+#include "test_macros.h"
+
+int main()
+{
+ static_assert(std::is_error_code_enum <std::io_errc>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(std::is_error_code_enum_v<std::io_errc>, "");
+#endif
+}
diff --git a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
index 469c7449971e..03f6d7d0b243 100644
--- a/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
+++ b/test/std/input.output/stream.buffers/streambuf/streambuf.cons/copy.fail.cpp
@@ -17,9 +17,9 @@
#include <streambuf>
#include <cassert>
-std::streambuf get();
+std::streambuf &get();
int main()
{
- std::streambuf sb = get();
+ std::streambuf sb = get(); // expected-error {{calling a protected constructor}}
}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
index eff47452c58f..5e24542abeca 100644
--- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/member_swap.pass.cpp
@@ -27,9 +27,9 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
- ss0 << i << ' ' << 567;;
+ ss0 << i << ' ' << 567;
assert(ss0.str() == "234 567");
}
{
@@ -40,9 +40,9 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
- ss0 << i << ' ' << 567;;
+ ss0 << i << ' ' << 567;
assert(ss0.str() == L"234 567");
}
}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
index a6fb8ba69b2e..a52068595178 100644
--- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp
@@ -28,7 +28,7 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
}
{
@@ -39,7 +39,7 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
index 3d7081d8e241..c98a2e367978 100644
--- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/nonmember_swap.pass.cpp
@@ -27,9 +27,9 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
- ss0 << i << ' ' << 567;;
+ ss0 << i << ' ' << 567;
assert(ss0.str() == "234 567");
}
{
@@ -40,9 +40,9 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
- ss0 << i << ' ' << 567;;
+ ss0 << i << ' ' << 567;
assert(ss0.str() == L"234 567");
}
}
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
index dc63b59fe39f..3d9e305e0408 100644
--- a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp
@@ -27,7 +27,7 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
}
{
@@ -37,7 +37,7 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
index 89c91bdee05d..8b90f72d4d12 100644
--- a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
+++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp
@@ -26,7 +26,7 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
}
{
@@ -35,7 +35,7 @@ int main()
assert(ss.good());
assert(ss.str() == " 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == "234 5676");
}
{
@@ -44,7 +44,7 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
}
{
@@ -53,7 +53,7 @@ int main()
assert(ss.good());
assert(ss.str() == L" 123 456");
int i = 234;
- ss << i << ' ' << 567;;
+ ss << i << ' ' << 567;
assert(ss.str() == L"234 5676");
}
}
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
index 67363b559d99..7eec808378dd 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
@@ -38,7 +38,7 @@ struct testbuf
int main()
{
{ // sanity check
- testbuf<char> tb("");;
+ testbuf<char> tb("");
tb.overflow();
}
{
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
index a0509008d50b..d6adf6964178 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
@@ -36,7 +36,7 @@ struct testbuf
int main()
{
{ // sanity check
- testbuf<char> tb("");;
+ testbuf<char> tb("");
tb.pbackfail();
}
{
diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
index 856cf3cbeafd..78d682fc44f6 100644
--- a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
+++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp
@@ -18,6 +18,7 @@
#include <vector>
#include <string>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
vecis.back().str("hub started at [00 6b 8b 45 69]");
vecis.push_back(std::istringstream());
vecis.back().str("hub started at [00 6b 8b 45 69]");
- for (int n = 0; n < vecis.size(); n++)
+ for (std::size_t n = 0; n < vecis.size(); n++)
{
assert(vecis[n].str().size() == 31);
vecis[n].seekg(0, std::ios_base::beg);
diff --git a/test/std/iterators/iterator.range/begin-end.fail.cpp b/test/std/iterators/iterator.range/begin-end.fail.cpp
index 1a1493099664..94a3d8c2004d 100644
--- a/test/std/iterators/iterator.range/begin-end.fail.cpp
+++ b/test/std/iterators/iterator.range/begin-end.fail.cpp
@@ -39,13 +39,13 @@ namespace Foo {
FakeIter crbegin(const FakeContainer &) { return 13; }
FakeIter crend (const FakeContainer &) { return 14; }
}
-
+
int main(){
// Bug #28927 - shouldn't find these via ADL
(void) std::cbegin (Foo::FakeContainer());
(void) std::cend (Foo::FakeContainer());
(void) std::crbegin(Foo::FakeContainer());
- (void) std::crend (Foo::FakeContainer());
+ (void) std::crend (Foo::FakeContainer());
}
#endif
diff --git a/test/std/iterators/iterator.range/begin-end.pass.cpp b/test/std/iterators/iterator.range/begin-end.pass.cpp
index ec3f61789b27..68186919198d 100644
--- a/test/std/iterators/iterator.range/begin-end.pass.cpp
+++ b/test/std/iterators/iterator.range/begin-end.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: c++03, c++98
+
// <iterator>
// template <class C> auto begin(C& c) -> decltype(c.begin());
// template <class C> auto begin(const C& c) -> decltype(c.begin());
@@ -17,7 +19,6 @@
#include "test_macros.h"
-#if TEST_STD_VER >= 11
#include <iterator>
#include <cassert>
#include <vector>
@@ -31,7 +32,7 @@ void test_const_container( const C & c, typename C::value_type val ) {
assert (*std::begin(c) == val );
assert ( std::begin(c) != c.end());
assert ( std::end(c) == c.end());
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
assert ( std::cbegin(c) == c.cbegin());
assert ( std::cbegin(c) != c.cend());
assert ( std::cend(c) == c.cend());
@@ -50,7 +51,7 @@ void test_const_container( const std::initializer_list<T> & c, T val ) {
assert (*std::begin(c) == val );
assert ( std::begin(c) != c.end());
assert ( std::end(c) == c.end());
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
// initializer_list doesn't have cbegin/cend/rbegin/rend
// but std::cbegin(),etc work (b/c they're general fn templates)
// assert ( std::cbegin(c) == c.cbegin());
@@ -71,7 +72,7 @@ void test_container( C & c, typename C::value_type val ) {
assert (*std::begin(c) == val );
assert ( std::begin(c) != c.end());
assert ( std::end(c) == c.end());
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
assert ( std::cbegin(c) == c.cbegin());
assert ( std::cbegin(c) != c.cend());
assert ( std::cend(c) == c.cend());
@@ -90,7 +91,7 @@ void test_container( std::initializer_list<T> & c, T val ) {
assert (*std::begin(c) == val );
assert ( std::begin(c) != c.end());
assert ( std::end(c) == c.end());
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
// initializer_list doesn't have cbegin/cend/rbegin/rend
// assert ( std::cbegin(c) == c.cbegin());
// assert ( std::cbegin(c) != c.cend());
@@ -110,7 +111,7 @@ void test_const_array( const T (&array)[Sz] ) {
assert (*std::begin(array) == array[0] );
assert ( std::begin(array) != std::end(array));
assert ( std::end(array) == array + Sz);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
assert ( std::cbegin(array) == array );
assert (*std::cbegin(array) == array[0] );
assert ( std::cbegin(array) != std::cend(array));
@@ -136,13 +137,9 @@ int main(){
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr const int *b = std::cbegin(arrA);
constexpr const int *e = std::cend(arrA);
static_assert(e - b == 3, "");
#endif
}
-
-#else
-int main(){}
-#endif
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
index 06834981ef38..d2ad79af66fd 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
@@ -14,10 +14,13 @@
// template <InputIterator Iter>
// move_iterator<Iter>
// make_move_iterator(const Iter& i);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -43,4 +46,12 @@ int main()
std::make_move_iterator(a+4);
std::make_move_iterator(a); // test for LWG issue 2061
}
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr auto iter = std::make_move_iterator<const char *>(p);
+ static_assert(iter.base() == p);
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
index d52175c92296..758ef0f213e8 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/minus.pass.cpp
@@ -16,10 +16,13 @@
// auto
// operator-(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y)
// -> decltype(x.base() - y.base());
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -36,4 +39,15 @@ int main()
char s[] = "1234567890";
test(random_access_iterator<char*>(s+5), random_access_iterator<char*>(s), 5);
test(s+5, s, 5);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert( it1 - it2 == -1, "");
+ static_assert( it2 - it1 == 1, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
index e67ebfca3717..54b79b511d82 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/plus.pass.cpp
@@ -14,10 +14,13 @@
// template <RandomAccessIterator Iter>
// move_iterator<Iter>
// operator+(Iter::difference_type n, const move_iterator<Iter>& x);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
char s[] = "1234567890";
test(random_access_iterator<char*>(s+5), 5, random_access_iterator<char*>(s+10));
test(s+5, 5, s+10);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = it1 + 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
index e9a19f4932c5..e74be5e24080 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+/difference_type.pass.cpp
@@ -13,10 +13,13 @@
// requires RandomAccessIterator<Iter>
// move_iterator operator+(difference_type n) const;
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -33,4 +36,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
test(s+5, 5, s+10);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = it1 + 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
index 5de1bccf877f..6b4396c83d30 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.+=/difference_type.pass.cpp
@@ -13,10 +13,13 @@
// requires RandomAccessIterator<Iter>
// move_iterator& operator+=(difference_type n);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
test(s+5, 5, s+10);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p) += 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
index 852f76a4a4d3..460636df7c99 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/difference_type.pass.cpp
@@ -13,10 +13,13 @@
// requires RandomAccessIterator<Iter>
// move_iterator operator-(difference_type n) const;
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -33,4 +36,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = it2 - 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
index f8630736980d..1b2ce8f0dfce 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-=/difference_type.pass.cpp
@@ -13,10 +13,13 @@
// requires RandomAccessIterator<Iter>
// move_iterator& operator-=(difference_type n);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,13 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr auto it1 = std::make_move_iterator(p);
+ constexpr auto it2 = std::make_move_iterator(p+5) -= 5;
+ static_assert(it1 == it2, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
index fb4f0fa1dc12..a365f08f3737 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_eq.pass.cpp
@@ -15,10 +15,13 @@
// requires HasEqualTo<Iter1, Iter2>
// bool
// operator==(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -43,4 +46,17 @@ int main()
test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), false);
test(s, s, true);
test(s, s+1, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert(!(it1 == it2), "");
+ static_assert( (it1 == it3), "");
+ static_assert(!(it2 == it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
index 0edd2857c081..ddd59a6174d5 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gt.pass.cpp
@@ -15,10 +15,13 @@
// requires HasLess<Iter2, Iter1>
// bool
// operator>(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,17 @@ int main()
test(s, s, false);
test(s, s+1, false);
test(s+1, s, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert(!(it1 > it2), "");
+ static_assert(!(it1 > it3), "");
+ static_assert( (it2 > it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
index cb9cdb9aeb4f..e78082e34d26 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_gte.pass.cpp
@@ -15,10 +15,13 @@
// requires HasLess<Iter1, Iter2>
// bool
// operator>=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,17 @@ int main()
test(s, s, true);
test(s, s+1, false);
test(s+1, s, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert(!(it1 >= it2), "");
+ static_assert( (it1 >= it3), "");
+ static_assert( (it2 >= it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
index e7979ddd746e..37034d516d3f 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lt.pass.cpp
@@ -15,10 +15,13 @@
// requires HasLess<Iter1, Iter2>
// bool
// operator<(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,17 @@ int main()
test(s, s, false);
test(s, s+1, true);
test(s+1, s, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert( (it1 < it2), "");
+ static_assert(!(it1 < it3), "");
+ static_assert(!(it2 < it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
index 97a7bfdee466..5074ee33a891 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_lte.pass.cpp
@@ -15,10 +15,13 @@
// requires HasLess<Iter2, Iter1>
// bool
// operator<=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,17 @@ int main()
test(s, s, true);
test(s, s+1, true);
test(s+1, s, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert( (it1 <= it2), "");
+ static_assert( (it1 <= it3), "");
+ static_assert(!(it2 <= it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
index 9e4b9e37202c..8e6c827fdcd6 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.comp/op_neq.pass.cpp
@@ -15,10 +15,13 @@
// requires HasEqualTo<Iter1, Iter2>
// bool
// operator!=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -43,4 +46,17 @@ int main()
test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true);
test(s, s, false);
test(s, s+1, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p + 5);
+ constexpr MI it3 = std::make_move_iterator(p);
+ static_assert( (it1 != it2), "");
+ static_assert(!(it1 != it3), "");
+ static_assert( (it2 != it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
index 8c73a7d5c93c..36d3651949bd 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/convert.pass.cpp
@@ -14,10 +14,13 @@
// template <class U>
// requires HasConstructor<Iter, const U&>
// move_iterator(const move_iterator<U> &u);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It, class U>
@@ -41,4 +44,13 @@ int main()
test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
test<Base*>(&d);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const Derived *p = nullptr;
+ constexpr std::move_iterator<const Derived *> it1 = std::make_move_iterator(p);
+ constexpr std::move_iterator<const Base *> it2(it1);
+ static_assert(it2.base() == p);
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
index 782cb6020326..ba1406ada288 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
@@ -12,9 +12,12 @@
// move_iterator
// move_iterator();
+//
+// constexpr in C++17
#include <iterator>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -31,4 +34,10 @@ int main()
test<bidirectional_iterator<char*> >();
test<random_access_iterator<char*> >();
test<char*>();
+
+#if TEST_STD_VER > 14
+ {
+ constexpr std::move_iterator<const char *> it;
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
index 4a4a06018377..09a534b66c46 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
@@ -12,10 +12,13 @@
// move_iterator
// explicit move_iterator(Iter i);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,12 @@ int main()
test(bidirectional_iterator<char*>(s));
test(random_access_iterator<char*>(s));
test(s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr std::move_iterator<const char *> it(p);
+ static_assert(it.base() == p);
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
index 26fab5be7931..f5f921a777eb 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/post.pass.cpp
@@ -12,10 +12,13 @@
// move_iterator
// move_iterator operator--(int);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s));
test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s));
test(s+1, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr MI it3 = std::make_move_iterator(p+1) --;
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
index 700b3b637749..c434b3082e5a 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.decr/pre.pass.cpp
@@ -12,10 +12,13 @@
// move_iterator
// move_iterator& operator--();
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
test(bidirectional_iterator<char*>(s+1), bidirectional_iterator<char*>(s));
test(random_access_iterator<char*>(s+1), random_access_iterator<char*>(s));
test(s+1, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr MI it3 = -- std::make_move_iterator(p+1);
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
index e7c13b579622..4ff511c132eb 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/post.pass.cpp
@@ -12,10 +12,13 @@
// move_iterator
// move_iterator operator++(int);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -36,4 +39,17 @@ int main()
test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));
test(s, s+1);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr MI it3 = std::make_move_iterator(p) ++;
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
index f27c737277d9..e5d5704293f4 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.incr/pre.pass.cpp
@@ -12,10 +12,13 @@
// move_iterator
// move_iterator& operator++();
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -36,4 +39,17 @@ int main()
test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1));
test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1));
test(s, s+1);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr MI it3 = ++ std::make_move_iterator(p);
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
index 8d507b822cd2..bf7a8e33ee54 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.index/difference_type.pass.cpp
@@ -13,13 +13,14 @@
// requires RandomAccessIterator<Iter>
// unspecified operator[](difference_type n) const;
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -33,26 +34,35 @@ test(It i, typename std::iterator_traits<It>::difference_type n,
assert(rr == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
struct do_nothing
{
void operator()(void*) const {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
- char s[] = "1234567890";
- test(random_access_iterator<char*>(s+5), 4, '0');
- test(s+5, 4, '0');
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- int i[5];
- typedef std::unique_ptr<int, do_nothing> Ptr;
- Ptr p[5];
- for (unsigned j = 0; j < 5; ++j)
- p[j].reset(i+j);
- test(p, 3, Ptr(i+3));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ char s[] = "1234567890";
+ test(random_access_iterator<char*>(s+5), 4, '0');
+ test(s+5, 4, '0');
+ }
+#if TEST_STD_VER >= 11
+ {
+ int i[5];
+ typedef std::unique_ptr<int, do_nothing> Ptr;
+ Ptr p[5];
+ for (unsigned j = 0; j < 5; ++j)
+ p[j].reset(i+j);
+ test(p, 3, Ptr(i+3));
+ }
+#endif
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ static_assert(it1[0] == '1', "");
+ static_assert(it1[5] == '6', "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
index b0c00e3fbf86..ef87014cd2da 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.ref/op_arrow.pass.cpp
@@ -12,10 +12,14 @@
// move_iterator
// pointer operator->() const;
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
+
template <class It>
void
test(It i)
@@ -28,4 +32,15 @@ int main()
{
char s[] = "123";
test(s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(it1.operator->() == p, "");
+ static_assert(it2.operator->() == p + 1, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
index 6de708baa327..4c5d816b8c2d 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp
@@ -12,12 +12,14 @@
// move_iterator
// reference operator*() const;
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
+
+#include "test_macros.h"
class A
{
@@ -40,22 +42,33 @@ test(It i, typename std::iterator_traits<It>::value_type x)
assert(x2 == x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
struct do_nothing
{
void operator()(void*) const {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
- A a;
- test(&a, A());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- int i;
- std::unique_ptr<int, do_nothing> p(&i);
- test(&p, std::unique_ptr<int, do_nothing>(&i));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ A a;
+ test(&a, A());
+ }
+#if TEST_STD_VER >= 11
+ {
+ int i;
+ std::unique_ptr<int, do_nothing> p(&i);
+ test(&p, std::unique_ptr<int, do_nothing>(&i));
+ }
+#endif
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::move_iterator<const char *> MI;
+ constexpr MI it1 = std::make_move_iterator(p);
+ constexpr MI it2 = std::make_move_iterator(p+1);
+ static_assert(*it1 == p[0], "");
+ static_assert(*it2 == p[1], "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
index 449f7e809db4..30a95c36706c 100644
--- a/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
@@ -15,10 +15,13 @@
// requires HasAssign<Iter, const U&>
// move_iterator&
// operator=(const move_iterator<U>& u);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It, class U>
@@ -44,4 +47,14 @@ int main()
test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
test<Base*>(&d);
+#if TEST_STD_VER > 14
+ {
+ using BaseIter = std::move_iterator<const Base *>;
+ using DerivedIter = std::move_iterator<const Derived *>;
+ constexpr const Derived *p = nullptr;
+ constexpr DerivedIter it1 = std::make_move_iterator(p);
+ constexpr BaseIter it2 = (BaseIter{nullptr} = it1);
+ static_assert(it2.base() == p, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
index 72a767d17114..855dbd7ba316 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
@@ -11,10 +11,13 @@
// reverse_iterator
-// reverse_iterator();
+// constexpr reverse_iterator();
+//
+// constexpr in c++17
#include <iterator>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -30,4 +33,10 @@ int main()
test<random_access_iterator<char*> >();
test<char*>();
test<const char*>();
+
+#if TEST_STD_VER > 14
+ {
+ constexpr std::reverse_iterator<const char *> it;
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
index ea213c0dcf0d..9bded7c5a429 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
@@ -11,11 +11,14 @@
// reverse_iterator
-// explicit reverse_iterator(Iter x);
+// explicit constexpr reverse_iterator(Iter x);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -32,4 +35,12 @@ int main()
test(bidirectional_iterator<const char*>(s));
test(random_access_iterator<const char*>(s));
test(s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr std::reverse_iterator<const char *> it(p);
+ static_assert(it.base() == p);
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
index 280e7d59ae86..2c15743db506 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
@@ -13,11 +13,14 @@
// template <class U>
// requires HasConstructor<Iter, const U&>
-// reverse_iterator(const reverse_iterator<U> &u);
+// constexpr reverse_iterator(const reverse_iterator<U> &u);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It, class U>
@@ -39,4 +42,13 @@ int main()
test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
test<Base*>(&d);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const Derived *p = nullptr;
+ constexpr std::reverse_iterator<const Derived *> it1 = std::make_reverse_iterator(p);
+ constexpr std::reverse_iterator<const Base *> it2(it1);
+ static_assert(it2.base() == p);
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
index 7ec287e5cd37..cd155988b11b 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
@@ -12,12 +12,16 @@
// reverse_iterator
-// template <class Iterator> reverse_iterator<Iterator>
+// template <class Iterator>
+// constexpr reverse_iterator<Iterator>
// make_reverse_iterator(Iterator i);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -35,5 +39,13 @@ int main()
random_access_iterator<const char*>e(s+10);
while ( b != e )
test ( b++ );
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr auto it1 = std::make_reverse_iterator(p);
+ static_assert(it1.base() == p, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
index 29da57e3b5af..f5162a7c5dc3 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
@@ -13,12 +13,15 @@
// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
// requires HasEqualTo<Iter1, Iter2>
-// bool
+// constexpr bool
// operator!=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,16 @@ int main()
test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
test(s, s, false);
test(s, s+1, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert(!(it1 != it2), "");
+ static_assert( (it1 != it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
index bd936060c4d4..6a2ab2797cab 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
@@ -11,11 +11,14 @@
// reverse_iterator
-// reverse_iterator operator++(int);
+// constexpr reverse_iterator operator++(int);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
test(s+1, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr RI it3 = std::make_reverse_iterator(p+1) ++;
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
index f68a612fae6b..510242244444 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
@@ -11,11 +11,14 @@
// reverse_iterator
-// reverse_iterator& operator++();
+// constexpr reverse_iterator& operator++();
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,18 @@ int main()
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
test(s+1, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr RI it3 = ++ std::make_reverse_iterator(p+1);
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ static_assert(*(++std::make_reverse_iterator(p+2)) == '1', "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
index 39129d6b64d8..0c9682f45c1c 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
@@ -12,11 +12,14 @@
// reverse_iterator
// requires RandomAccessIterator<Iter>
-// reverse_iterator operator+(difference_type n) const;
+// constexpr reverse_iterator operator+(difference_type n) const;
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -33,4 +36,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p + 5);
+ constexpr RI it3 = it2 + 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp
index ac97aaf8c203..67ad1ae888ec 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp
@@ -12,11 +12,14 @@
// reverse_iterator
// requires RandomAccessIterator<Iter>
-// reverse_iterator& operator+=(difference_type n);
+// constexpr reverse_iterator& operator+=(difference_type n);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,13 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr auto it1 = std::make_reverse_iterator(p);
+ constexpr auto it2 = std::make_reverse_iterator(p+5) += 5;
+ static_assert(it1 == it2, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp
index c3126e8c21ff..5a06ea5ad14f 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp
@@ -11,11 +11,14 @@
// reverse_iterator
-// reverse_iterator operator--(int);
+// constexpr reverse_iterator operator--(int);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
test(s+1, s+2);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr RI it3 = std::make_reverse_iterator(p) --;
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp
index f9361cf9c72c..3265624765e0 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp
@@ -11,11 +11,14 @@
// reverse_iterator
-// reverse_iterator& operator--();
+// constexpr reverse_iterator& operator--();
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,18 @@ int main()
test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s+2));
test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s+2));
test(s+1, s+2);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p+1);
+ static_assert(it1 != it2, "");
+ constexpr RI it3 = -- std::make_reverse_iterator(p);
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ static_assert(*(--std::make_reverse_iterator(p)) == '1', "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
index 79d477976fb7..9148cc117ca0 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
@@ -12,11 +12,14 @@
// reverse_iterator
// requires RandomAccessIterator<Iter>
-// reverse_iterator operator-(difference_type n) const;
+// constexpr reverse_iterator operator-(difference_type n) const;
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -33,4 +36,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
test(s+5, 5, s+10);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p + 5);
+ constexpr RI it3 = it1 - 5;
+ static_assert(it1 != it2, "");
+ static_assert(it1 != it3, "");
+ static_assert(it2 == it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp
index 93addf99dc61..3bed189dc6ab 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp
@@ -12,11 +12,14 @@
// reverse_iterator
// requires RandomAccessIterator<Iter>
-// reverse_iterator& operator-=(difference_type n);
+// constexpr reverse_iterator& operator-=(difference_type n);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,13 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10));
test(s+5, 5, s+10);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ constexpr auto it1 = std::make_reverse_iterator(p+5);
+ constexpr auto it2 = std::make_reverse_iterator(p) -= 5;
+ static_assert(it1 == it2, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
index 7a7759843eea..4e727564ab72 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
@@ -11,7 +11,9 @@
// reverse_iterator
-// reference operator*() const;
+// constexpr reference operator*() const;
+//
+// constexpr in c++17
// Be sure to respect LWG 198:
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
@@ -21,6 +23,8 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -44,4 +48,15 @@ int main()
{
A a;
test(&a+1, A());
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p+1);
+ constexpr RI it2 = std::make_reverse_iterator(p+2);
+ static_assert(*it1 == p[0], "");
+ static_assert(*it2 == p[1], "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
index 92573f9a9242..78f6fc4cb26a 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
@@ -13,12 +13,15 @@
// template <class U>
// requires HasAssign<Iter, const U&>
-// reverse_iterator&
+// constexpr reverse_iterator&
// operator=(const reverse_iterator<U>& u);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It, class U>
@@ -42,4 +45,15 @@ int main()
test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
test<Base*>(&d);
+
+#if TEST_STD_VER > 14
+ {
+ using BaseIter = std::reverse_iterator<const Base *>;
+ using DerivedIter = std::reverse_iterator<const Derived *>;
+ constexpr const Derived *p = nullptr;
+ constexpr DerivedIter it1 = std::make_reverse_iterator(p);
+ constexpr BaseIter it2 = (BaseIter{nullptr} = it1);
+ static_assert(it2.base() == p, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
index 3da4b951df1e..70c9e198519c 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
@@ -13,12 +13,15 @@
// template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
// requires HasEqualTo<Iter1, Iter2>
-// bool
+// constexpr bool
// operator==(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,17 @@ int main()
test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), false);
test(s, s, true);
test(s, s+1, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert( (it1 == it2), "");
+ static_assert(!(it1 == it3), "");
+ }
+#endif
+
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
index 437bb6f9f7ef..73e49027b0f5 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
@@ -13,13 +13,16 @@
// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
// requires HasMinus<Iter2, Iter1>
-// auto operator-(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y)
+// constexpr auto operator-(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y)
// -> decltype(y.base() - x.base());
+//
+// constexpr in c++17
#include <iterator>
#include <cstddef>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It1, class It2>
@@ -40,4 +43,15 @@ int main()
test(s, s, 0);
test(s, s+1, 1);
test(s+1, s, -1);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p+1);
+ static_assert( it1 - it2 == 1, "");
+ static_assert( it2 - it1 == -1, "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
index afbb334ebfd5..b6adcf40ede4 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
@@ -13,12 +13,15 @@
// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
// requires HasGreater<Iter1, Iter2>
-// bool
+// constexpr bool
// operator>(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,16 @@ int main()
test(s, s, false);
test(s, s+1, true);
test(s+1, s, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert(!(it1 > it2), "");
+ static_assert( (it1 > it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
index c6e79aff126f..dc917b29f907 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
@@ -13,12 +13,15 @@
// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
// requires HasGreater<Iter1, Iter2>
-// bool
+// constexpr bool
// operator>=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,16 @@ int main()
test(s, s, true);
test(s, s+1, true);
test(s+1, s, false);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert( (it1 >= it2), "");
+ static_assert( (it1 >= it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
index 16f4a072855a..4596d6f38b66 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opindex/difference_type.pass.cpp
@@ -17,6 +17,7 @@
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -35,4 +36,14 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 4, '1');
test(s+5, 4, '1');
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p + 5);
+ static_assert(it1[0] == '5', "");
+ static_assert(it1[4] == '1', "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
index 2b389b853a5a..668f7d839754 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
@@ -13,12 +13,15 @@
// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
// requires HasGreater<Iter1, Iter2>
-// bool
+// constexpr bool
// operator<(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,16 @@ int main()
test(s, s, false);
test(s, s+1, false);
test(s+1, s, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert(!(it1 < it2), "");
+ static_assert(!(it1 < it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
index 6c4f05cdf656..5201bc43db2c 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
@@ -13,12 +13,15 @@
// template <RandomAccessIterator Iter1, RandomAccessIterator Iter2>
// requires HasGreater<Iter1, Iter2>
-// bool
+// constexpr bool
// operator<=(const reverse_iterator<Iter1>& x, const reverse_iterator<Iter2>& y);
+//
+// constexpr in c++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -39,4 +42,16 @@ int main()
test(s, s, true);
test(s, s+1, false);
test(s+1, s, true);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p);
+ constexpr RI it3 = std::make_reverse_iterator(p+1);
+ static_assert( (it1 <= it2), "");
+ static_assert(!(it1 <= it3), "");
+ }
+#endif
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
index 404e8fbf19bf..7b829ff6a5ab 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
@@ -11,7 +11,9 @@
// reverse_iterator
-// pointer operator->() const;
+// constexpr pointer operator->() const;
+//
+// constexpr in C++17
// Be sure to respect LWG 198:
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
@@ -23,6 +25,8 @@
#include <list>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -59,6 +63,20 @@ public:
B *operator&() { return nullptr; }
};
+class C
+{
+ int data_;
+public:
+ TEST_CONSTEXPR C() : data_(1) {}
+
+ TEST_CONSTEXPR int get() const {return data_;}
+
+ friend TEST_CONSTEXPR bool operator==(const C& x, const C& y)
+ {return x.data_ == y.data_;}
+};
+
+TEST_CONSTEXPR C gC;
+
int main()
{
A a;
@@ -86,4 +104,16 @@ int main()
assert ( ri == l.rend ());
}
}
+
+#if TEST_STD_VER > 14
+ {
+ typedef std::reverse_iterator<const C *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(&gC+1);
+
+ static_assert(it1->get() == gC.get(), "");
+ }
+#endif
+ {
+ ((void)gC);
+ }
}
diff --git a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
index 74747cb1f0f7..00f739d09a52 100644
--- a/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
+++ b/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
@@ -12,12 +12,15 @@
// reverse_iterator
// template <RandomAccessIterator Iterator>
-// reverse_iterator<Iter>
+// constexpr reverse_iterator<Iter>
// operator+(Iter::difference_type n, const reverse_iterator<Iter>& x);
+//
+// constexpr in C++17
#include <iterator>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class It>
@@ -34,4 +37,17 @@ int main()
const char* s = "1234567890";
test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+ {
+ constexpr const char *p = "123456789";
+ typedef std::reverse_iterator<const char *> RI;
+ constexpr RI it1 = std::make_reverse_iterator(p);
+ constexpr RI it2 = std::make_reverse_iterator(p + 5);
+ constexpr RI it3 = 5 + it2;
+ static_assert(it1 != it2, "");
+ static_assert(it1 == it3, "");
+ static_assert(it2 != it3, "");
+ }
+#endif
}
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp
index 0d70c7fc9ed3..7f807b63e3ce 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp
@@ -12,11 +12,15 @@
// class istream_iterator
// istream_iterator(const istream_iterator& x);
+// C++17 says: If is_trivially_copy_constructible_v<T> is true, then
+// this constructor shall beis a trivial copy constructor.
#include <iterator>
#include <sstream>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
index c1924e4b9272..32dc62817bc4 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
@@ -7,17 +7,41 @@
//
//===----------------------------------------------------------------------===//
+// Usage of is_trivially_constructible is broken with these compilers.
+// See https://llvm.org/bugs/show_bug.cgi?id=31016
+// XFAIL: clang-3.7, apple-clang-7, apple-clang-7.0
+
// <iterator>
// class istream_iterator
// constexpr istream_iterator();
+// C++17 says: If is_trivially_default_constructible_v<T> is true, then this
+// constructor shall beis a constexpr constructor.
#include <iterator>
#include <cassert>
+#include <string>
#include "test_macros.h"
+struct S { S(); }; // not constexpr
+
+#if TEST_STD_VER > 14
+template <typename T, bool isTrivial = std::is_trivially_default_constructible_v<T>>
+struct test_trivial {
+void operator ()() const {
+ constexpr std::istream_iterator<T> it;
+ }
+};
+
+template <typename T>
+struct test_trivial<T, false> {
+void operator ()() const {}
+};
+#endif
+
+
int main()
{
{
@@ -29,4 +53,11 @@ int main()
#endif
}
+#if TEST_STD_VER > 14
+ test_trivial<int>()();
+ test_trivial<char>()();
+ test_trivial<double>()();
+ test_trivial<S>()();
+ test_trivial<std::string>()();
+#endif
}
diff --git a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
index 1250e364d35e..b1bf75b11958 100644
--- a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
+++ b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp
@@ -23,9 +23,18 @@
// typedef basic_istream<charT,traits> istream_type;
// ...
//
+// Before C++17, we have:
// If T is a literal type, then the default constructor shall be a constexpr constructor.
// If T is a literal type, then this constructor shall be a trivial copy constructor.
// If T is a literal type, then this destructor shall be a trivial destructor.
+// C++17 says:
+// If is_trivially_default_constructible_v<T> is true, then
+// this constructor (the default ctor) shall beis a constexpr constructor.
+// If is_trivially_copy_constructible_v<T> is true, then
+// this constructor (the copy ctor) shall beis a trivial copy constructor.
+// If is_trivially_destructible_v<T> is true, then this
+// destructor shall beis a trivial destructor.
+// Testing the C++17 ctors for this are in the ctor tests.
#include <iterator>
#include <type_traits>
@@ -33,7 +42,7 @@
int main()
{
- typedef std::istream_iterator<double> I1;
+ typedef std::istream_iterator<double> I1; // double is trivially destructible
static_assert((std::is_convertible<I1,
std::iterator<std::input_iterator_tag, double, std::ptrdiff_t,
const double*, const double&> >::value), "");
@@ -43,7 +52,7 @@ int main()
static_assert( std::is_trivially_copy_constructible<I1>::value, "");
static_assert( std::is_trivially_destructible<I1>::value, "");
- typedef std::istream_iterator<unsigned, wchar_t> I2;
+ typedef std::istream_iterator<unsigned, wchar_t> I2; // unsigned is trivially destructible
static_assert((std::is_convertible<I2,
std::iterator<std::input_iterator_tag, unsigned, std::ptrdiff_t,
const unsigned*, const unsigned&> >::value), "");
@@ -53,7 +62,7 @@ int main()
static_assert( std::is_trivially_copy_constructible<I2>::value, "");
static_assert( std::is_trivially_destructible<I2>::value, "");
- typedef std::istream_iterator<std::string> I3;
+ typedef std::istream_iterator<std::string> I3; // string is NOT trivially destructible
static_assert(!std::is_trivially_copy_constructible<I3>::value, "");
static_assert(!std::is_trivially_destructible<I3>::value, "");
}
diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
index 2005d303fb3b..0137664312de 100644
--- a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
+++ b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_equal/equal.pass.cpp
@@ -26,26 +26,37 @@ int main()
std::istreambuf_iterator<char> i2(inf2);
std::istreambuf_iterator<char> i3;
std::istreambuf_iterator<char> i4;
+ std::istreambuf_iterator<char> i5(nullptr);
assert( i1.equal(i1));
assert( i1.equal(i2));
assert(!i1.equal(i3));
assert(!i1.equal(i4));
+ assert(!i1.equal(i5));
assert( i2.equal(i1));
assert( i2.equal(i2));
assert(!i2.equal(i3));
assert(!i2.equal(i4));
+ assert(!i2.equal(i5));
assert(!i3.equal(i1));
assert(!i3.equal(i2));
assert( i3.equal(i3));
assert( i3.equal(i4));
+ assert( i3.equal(i5));
assert(!i4.equal(i1));
assert(!i4.equal(i2));
assert( i4.equal(i3));
assert( i4.equal(i4));
+ assert( i4.equal(i5));
+
+ assert(!i5.equal(i1));
+ assert(!i5.equal(i2));
+ assert( i5.equal(i3));
+ assert( i5.equal(i4));
+ assert( i5.equal(i5));
}
{
std::wistringstream inf1(L"abc");
@@ -54,25 +65,36 @@ int main()
std::istreambuf_iterator<wchar_t> i2(inf2);
std::istreambuf_iterator<wchar_t> i3;
std::istreambuf_iterator<wchar_t> i4;
+ std::istreambuf_iterator<wchar_t> i5(nullptr);
assert( i1.equal(i1));
assert( i1.equal(i2));
assert(!i1.equal(i3));
assert(!i1.equal(i4));
+ assert(!i1.equal(i5));
assert( i2.equal(i1));
assert( i2.equal(i2));
assert(!i2.equal(i3));
assert(!i2.equal(i4));
+ assert(!i2.equal(i5));
assert(!i3.equal(i1));
assert(!i3.equal(i2));
assert( i3.equal(i3));
assert( i3.equal(i4));
+ assert( i3.equal(i5));
assert(!i4.equal(i1));
assert(!i4.equal(i2));
assert( i4.equal(i3));
assert( i4.equal(i4));
+ assert( i4.equal(i5));
+
+ assert(!i5.equal(i1));
+ assert(!i5.equal(i2));
+ assert( i5.equal(i3));
+ assert( i5.equal(i4));
+ assert( i5.equal(i5));
}
}
diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
index 5e8536423d8b..81e5f3439fe6 100644
--- a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
+++ b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op!=/not_equal.pass.cpp
@@ -28,26 +28,37 @@ int main()
std::istreambuf_iterator<char> i2(inf2);
std::istreambuf_iterator<char> i3;
std::istreambuf_iterator<char> i4;
+ std::istreambuf_iterator<char> i5(nullptr);
assert(!(i1 != i1));
assert(!(i1 != i2));
assert( (i1 != i3));
assert( (i1 != i4));
+ assert( (i1 != i5));
assert(!(i2 != i1));
assert(!(i2 != i2));
assert( (i2 != i3));
assert( (i2 != i4));
+ assert( (i2 != i5));
assert( (i3 != i1));
assert( (i3 != i2));
assert(!(i3 != i3));
assert(!(i3 != i4));
+ assert(!(i3 != i5));
assert( (i4 != i1));
assert( (i4 != i2));
assert(!(i4 != i3));
assert(!(i4 != i4));
+ assert(!(i4 != i5));
+
+ assert( (i5 != i1));
+ assert( (i5 != i2));
+ assert(!(i5 != i3));
+ assert(!(i5 != i4));
+ assert(!(i5 != i5));
}
{
std::wistringstream inf1(L"abc");
@@ -56,25 +67,36 @@ int main()
std::istreambuf_iterator<wchar_t> i2(inf2);
std::istreambuf_iterator<wchar_t> i3;
std::istreambuf_iterator<wchar_t> i4;
+ std::istreambuf_iterator<wchar_t> i5(nullptr);
assert(!(i1 != i1));
assert(!(i1 != i2));
assert( (i1 != i3));
assert( (i1 != i4));
+ assert( (i1 != i5));
assert(!(i2 != i1));
assert(!(i2 != i2));
assert( (i2 != i3));
assert( (i2 != i4));
+ assert( (i2 != i5));
assert( (i3 != i1));
assert( (i3 != i2));
assert(!(i3 != i3));
assert(!(i3 != i4));
+ assert(!(i3 != i5));
assert( (i4 != i1));
assert( (i4 != i2));
assert(!(i4 != i3));
assert(!(i4 != i4));
+ assert(!(i4 != i5));
+
+ assert( (i5 != i1));
+ assert( (i5 != i2));
+ assert(!(i5 != i3));
+ assert(!(i5 != i4));
+ assert(!(i5 != i5));
}
}
diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp
index 919576920ef5..65a78cb104a8 100644
--- a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp
+++ b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op==/equal.pass.cpp
@@ -28,26 +28,37 @@ int main()
std::istreambuf_iterator<char> i2(inf2);
std::istreambuf_iterator<char> i3;
std::istreambuf_iterator<char> i4;
+ std::istreambuf_iterator<char> i5(nullptr);
assert( (i1 == i1));
assert( (i1 == i2));
assert(!(i1 == i3));
assert(!(i1 == i4));
+ assert(!(i1 == i5));
assert( (i2 == i1));
assert( (i2 == i2));
assert(!(i2 == i3));
assert(!(i2 == i4));
+ assert(!(i2 == i5));
assert(!(i3 == i1));
assert(!(i3 == i2));
assert( (i3 == i3));
assert( (i3 == i4));
+ assert( (i3 == i5));
assert(!(i4 == i1));
assert(!(i4 == i2));
assert( (i4 == i3));
assert( (i4 == i4));
+ assert( (i4 == i5));
+
+ assert(!(i5 == i1));
+ assert(!(i5 == i2));
+ assert( (i5 == i3));
+ assert( (i5 == i4));
+ assert( (i5 == i5));
}
{
std::wistringstream inf1(L"abc");
@@ -56,25 +67,36 @@ int main()
std::istreambuf_iterator<wchar_t> i2(inf2);
std::istreambuf_iterator<wchar_t> i3;
std::istreambuf_iterator<wchar_t> i4;
+ std::istreambuf_iterator<wchar_t> i5(nullptr);
assert( (i1 == i1));
assert( (i1 == i2));
assert(!(i1 == i3));
assert(!(i1 == i4));
+ assert(!(i1 == i5));
assert( (i2 == i1));
assert( (i2 == i2));
assert(!(i2 == i3));
assert(!(i2 == i4));
+ assert(!(i2 == i5));
assert(!(i3 == i1));
assert(!(i3 == i2));
assert( (i3 == i3));
assert( (i3 == i4));
+ assert( (i3 == i5));
assert(!(i4 == i1));
assert(!(i4 == i2));
assert( (i4 == i3));
assert( (i4 == i4));
+ assert( (i4 == i5));
+
+ assert(!(i5 == i1));
+ assert(!(i5 == i2));
+ assert( (i5 == i3));
+ assert( (i5 == i4));
+ assert( (i5 == i5));
}
}
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp
index 88624581df9a..c1f3e55759a0 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/copy.pass.cpp
@@ -23,4 +23,5 @@ int main()
std::ostream_iterator<int> i(outf);
std::ostream_iterator<int> j = i;
assert(outf.good());
+ ((void)j);
}
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
index 932ef25b784c..0baefb5ee766 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
@@ -21,6 +21,10 @@
#pragma clang diagnostic ignored "-Wliteral-conversion"
#endif
+#ifdef _MSC_VER
+#pragma warning(disable: 4244) // conversion from 'X' to 'Y', possible loss of data
+#endif
+
int main()
{
{
diff --git a/test/std/language.support/support.dynamic/align_val_t.pass.cpp b/test/std/language.support/support.dynamic/align_val_t.pass.cpp
new file mode 100644
index 000000000000..0a19de919f7f
--- /dev/null
+++ b/test/std/language.support/support.dynamic/align_val_t.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// enum class align_val_t : size_t {}
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include <new>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ static_assert(std::is_enum<std::align_val_t>::value, "");
+ static_assert(std::is_same<std::underlying_type<std::align_val_t>::type, std::size_t>::value, "");
+ static_assert(!std::is_constructible<std::align_val_t, std::size_t>::value, "");
+ static_assert(!std::is_constructible<std::size_t, std::align_val_t>::value, "");
+ }
+ {
+ constexpr auto a = std::align_val_t(0);
+ constexpr auto b = std::align_val_t(32);
+ constexpr auto c = std::align_val_t(-1);
+ static_assert(a != b, "");
+ static_assert(a == std::align_val_t(0), "");
+ static_assert(b == std::align_val_t(32), "");
+ static_assert(static_cast<std::size_t>(c) == (std::size_t)-1, "");
+ }
+} \ No newline at end of file
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
new file mode 100644
index 000000000000..c88e5b06e675
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test aligned operator delete replacement.
+
+// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
+
+// Older Clang versions do not support this
+// XFAIL: clang-3, apple-clang
+
+// None of the current GCC compilers support this.
+// XFAIL: gcc
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int unsized_delete_called = 0;
+int unsized_delete_nothrow_called = 0;
+int aligned_delete_called = 0;
+
+void reset() {
+ unsized_delete_called = 0;
+ unsized_delete_nothrow_called = 0;
+ aligned_delete_called = 0;
+}
+
+void operator delete(void* p) TEST_NOEXCEPT
+{
+ ++unsized_delete_called;
+ std::free(p);
+}
+
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
+{
+ ++unsized_delete_nothrow_called;
+ std::free(p);
+}
+
+void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT
+{
+ ++aligned_delete_called;
+ std::free(p);
+}
+
+struct alignas(OverAligned) A {};
+struct alignas(std::max_align_t) B {};
+
+B* volatile b; // Escape the memory
+A* volatile a;
+
+int main()
+{
+ reset();
+ {
+ b = new B[2];
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+
+ delete [] b;
+ assert(1 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+ }
+ reset();
+ {
+ a = new A[2];
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+
+ delete [] a;
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(1 == aligned_delete_called);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
new file mode 100644
index 000000000000..55c26fa5c4a7
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: sanitizer-new-delete
+
+// FIXME change this to XFAIL.
+// UNSUPPORTED: no-aligned-allocation
+
+// test operator new
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <cstdint>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+ ++new_handler_called;
+ std::set_new_handler(0);
+}
+
+int A_constructed = 0;
+
+struct alignas(OverAligned) A
+{
+ A() { ++A_constructed;}
+ ~A() { --A_constructed;}
+};
+
+void test_throw_max_size() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ std::set_new_handler(new_handler);
+ try
+ {
+ void* vp = operator new[] (std::numeric_limits<std::size_t>::max(),
+ static_cast<std::align_val_t>(32));
+ ((void)vp);
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(new_handler_called == 1);
+ }
+ catch (...)
+ {
+ assert(false);
+ }
+#endif
+}
+
+int main()
+{
+ {
+ A* ap = new A[2];
+ assert(ap);
+ assert(reinterpret_cast<std::uintptr_t>(ap) % OverAligned == 0);
+ assert(A_constructed == 2);
+ delete [] ap;
+ assert(A_constructed == 0);
+ }
+ {
+ test_throw_max_size();
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
new file mode 100644
index 000000000000..28da3093f398
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: sanitizer-new-delete
+
+// FIXME turn this into an XFAIL
+// UNSUPPORTED: no-aligned-allocation
+
+// test operator new (nothrow)
+
+#include <new>
+#include <cstddef>
+#include <cstdint>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+ ++new_handler_called;
+ std::set_new_handler(0);
+}
+
+int A_constructed = 0;
+
+struct alignas(OverAligned) A
+{
+ A() { ++A_constructed; }
+ ~A() { --A_constructed; }
+};
+
+void test_max_alloc() {
+ std::set_new_handler(new_handler);
+ auto do_test = []() {
+ void* vp = operator new [](std::numeric_limits<std::size_t>::max(),
+ std::align_val_t(OverAligned),
+ std::nothrow);
+ assert(new_handler_called == 1);
+ assert(vp == 0);
+ };
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ do_test();
+ }
+ catch (...)
+ {
+ assert(false);
+ }
+#else
+ do_test();
+#endif
+}
+
+int main()
+{
+ {
+ A* ap = new(std::nothrow) A[3];
+ assert(ap);
+ assert(reinterpret_cast<std::uintptr_t>(ap) % OverAligned == 0);
+ assert(A_constructed == 3);
+ delete [] ap;
+ assert(!A_constructed);
+ }
+ {
+ test_max_alloc();
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
new file mode 100644
index 000000000000..03e490e8ed85
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: sanitizer-new-delete
+
+// XFAIL: no-aligned-allocation
+
+// test operator new nothrow by replacing only operator new
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int A_constructed = 0;
+
+struct alignas(OverAligned) A
+{
+ A() {++A_constructed;}
+ ~A() {--A_constructed;}
+};
+
+int B_constructed = 0;
+
+struct B {
+ std::max_align_t member;
+ B() { ++B_constructed; }
+ ~B() { --B_constructed; }
+};
+
+int new_called = 0;
+alignas(OverAligned) char Buff[OverAligned * 3];
+
+void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
+{
+ assert(!new_called);
+ assert(s <= sizeof(Buff));
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ ++new_called;
+ return Buff;
+}
+
+void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT
+{
+ assert(p == Buff);
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ assert(new_called);
+ --new_called;
+}
+
+int main()
+{
+ {
+ A* ap = new (std::nothrow) A[2];
+ assert(ap);
+ assert(A_constructed == 2);
+ assert(new_called);
+ delete [] ap;
+ assert(A_constructed == 0);
+ assert(!new_called);
+ }
+ {
+ B* bp = new (std::nothrow) B[2];
+ assert(bp);
+ assert(B_constructed == 2);
+ assert(!new_called);
+ delete [] bp;
+ assert(!new_called);
+ assert(!B_constructed);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
new file mode 100644
index 000000000000..131deb340d2f
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: sanitizer-new-delete
+
+// XFAIL: no-aligned-allocation
+
+// test operator new replacement
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cstdint>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int A_constructed = 0;
+
+struct alignas(OverAligned) A {
+ A() { ++A_constructed;}
+ ~A() { --A_constructed;}
+};
+
+
+int B_constructed = 0;
+
+struct alignas(std::max_align_t) B
+{
+ std::max_align_t member;
+ B() { ++B_constructed;}
+ ~B() { --B_constructed;}
+};
+
+int new_called = 0;
+
+alignas(OverAligned) char DummyData[OverAligned * 4];
+
+void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
+{
+ assert(new_called == 0); // We already allocated
+ assert(s <= sizeof(DummyData));
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ ++new_called;
+ return DummyData;
+}
+
+void operator delete[](void* p, std::align_val_t) TEST_NOEXCEPT
+{
+ assert(new_called == 1);
+ --new_called;
+ assert(p == DummyData);
+}
+
+
+int main()
+{
+ {
+ A* ap = new A[3];
+ assert(ap);
+ assert(A_constructed == 3);
+ assert(new_called);
+ delete [] ap;
+ assert(!A_constructed);
+ assert(!new_called);
+ }
+ {
+ B* bp = new B[3];
+ assert(bp);
+ assert(B_constructed == 3);
+ assert(!new_called);
+ delete [] bp;
+ assert(!new_called);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
index 55a3200a13b7..dd4ff46bceb9 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test operator new[]
// NOTE: asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete
@@ -18,6 +17,8 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_handler_called = 0;
void new_handler()
@@ -36,6 +37,7 @@ struct A
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
std::set_new_handler(new_handler);
try
{
@@ -51,6 +53,7 @@ int main()
{
assert(false);
}
+#endif
A* ap = new A[3];
assert(ap);
assert(A_constructed == 3);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
index 9531b1c37480..2f51b1990436 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test operator new [] (nothrow)
// NOTE: asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete
@@ -18,6 +17,8 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_handler_called = 0;
void new_handler()
@@ -37,16 +38,20 @@ struct A
int main()
{
std::set_new_handler(new_handler);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
void*volatile vp = operator new [] (std::numeric_limits<std::size_t>::max(), std::nothrow);
assert(new_handler_called == 1);
assert(vp == 0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (...)
{
assert(false);
}
+#endif
A* ap = new(std::nothrow) A[3];
assert(ap);
assert(A_constructed == 3);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
index 5887bb0bdf30..53e26c99f92e 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
@@ -11,19 +11,17 @@
// UNSUPPORTED: sanitizer-new-delete
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
-
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_called = 0;
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
++new_called;
void* ret = std::malloc(s);
@@ -31,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
--new_called;
std::free(p);
@@ -45,9 +43,11 @@ struct A
~A() {--A_constructed;}
};
+A* volatile ap;
+
int main()
{
- A* ap = new (std::nothrow) A[3];
+ ap = new (std::nothrow) A[3];
assert(ap);
assert(A_constructed == 3);
assert(new_called);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
index 1e78ea8fe267..b0820b14f410 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
@@ -11,9 +11,6 @@
// UNSUPPORTED: sanitizer-new-delete
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
#include <new>
#include <cstddef>
@@ -21,9 +18,11 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
volatile int new_called = 0;
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
++new_called;
void* ret = std::malloc(s);
@@ -31,7 +30,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
--new_called;
std::free(p);
@@ -45,9 +44,11 @@ struct A
~A() {--A_constructed;}
};
+A* volatile ap;
+
int main()
{
- A* ap = new A[3];
+ ap = new A[3];
assert(ap);
assert(A_constructed == 3);
assert(new_called == 1);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
index 0f7840ca9ef8..3e41b24d292f 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp
@@ -20,23 +20,25 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete[](void* p) throw()
+void operator delete[](void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete[](void* p, const std::nothrow_t&) throw()
+void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete[](void* p, std::size_t) throw()
+void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index 0e2cc6d8da4e..fb715805083f 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -25,23 +25,25 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete[](void* p) throw()
+void operator delete[](void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete[](void* p, const std::nothrow_t&) throw()
+void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete[](void* p, std::size_t) throw()
+void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp
index 6d24aec35ef8..ff55ec74e3cd 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp
@@ -18,16 +18,18 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int delete_called = 0;
int delete_nothrow_called = 0;
-void operator delete[](void* p) throw()
+void operator delete[](void* p) TEST_NOEXCEPT
{
++delete_called;
std::free(p);
}
-void operator delete[](void* p, const std::nothrow_t&) throw()
+void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++delete_nothrow_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
index 7dd510b4dac8..5b93540eac57 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
@@ -33,23 +33,25 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete[](void* p) throw()
+void operator delete[](void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete[](void* p, const std::nothrow_t&) throw()
+void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete[](void* p, std::size_t) throw()
+void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
new file mode 100644
index 000000000000..a5d4df34a85d
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test aligned operator delete replacement.
+
+// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
+
+// Older Clang versions do not support this
+// XFAIL: clang-3, apple-clang
+
+// None of the current GCC compilers support this.
+// XFAIL: gcc
+
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int unsized_delete_called = 0;
+int unsized_delete_nothrow_called = 0;
+int aligned_delete_called = 0;
+
+void reset() {
+ unsized_delete_called = 0;
+ unsized_delete_nothrow_called = 0;
+ aligned_delete_called = 0;
+}
+
+void operator delete(void* p) TEST_NOEXCEPT
+{
+ ++unsized_delete_called;
+ std::free(p);
+}
+
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
+{
+ ++unsized_delete_nothrow_called;
+ std::free(p);
+}
+
+void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT
+{
+ ++aligned_delete_called;
+ std::free(p);
+}
+
+struct alignas(OverAligned) A {};
+struct alignas(std::max_align_t) B {};
+
+B* volatile bp;
+A* volatile ap;
+
+int main()
+{
+ reset();
+ {
+ bp = new B;
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+
+ delete bp;
+ assert(1 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+ }
+ reset();
+ {
+ ap = new A;
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(0 == aligned_delete_called);
+
+ delete ap;
+ assert(0 == unsized_delete_called);
+ assert(0 == unsized_delete_nothrow_called);
+ assert(1 == aligned_delete_called);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
index 892842a1b9f4..26f7bc392c79 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
-
// test operator new
// asan and msan will not call the new handler.
@@ -19,6 +17,8 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_handler_called = 0;
void new_handler()
@@ -37,6 +37,7 @@ struct A
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
std::set_new_handler(new_handler);
try
{
@@ -52,6 +53,7 @@ int main()
{
assert(false);
}
+#endif
A* ap = new A;
assert(ap);
assert(A_constructed);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
new file mode 100644
index 000000000000..fefae51dac93
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: sanitizer-new-delete
+
+// FIXME turn this into an XFAIL
+// UNSUPPORTED: no-aligned-allocation
+
+// test operator new
+
+#include <new>
+#include <cstddef>
+#include <cassert>
+#include <cstdint>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+ ++new_handler_called;
+ std::set_new_handler(0);
+}
+
+bool A_constructed = false;
+
+struct alignas(OverAligned) A
+{
+ A() {A_constructed = true;}
+ ~A() {A_constructed = false;}
+};
+
+void test_throw_max_size() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ std::set_new_handler(new_handler);
+ try
+ {
+ void* vp = operator new (std::numeric_limits<std::size_t>::max(),
+ static_cast<std::align_val_t>(32));
+ ((void)vp);
+ assert(false);
+ }
+ catch (std::bad_alloc&)
+ {
+ assert(new_handler_called == 1);
+ }
+ catch (...)
+ {
+ assert(false);
+ }
+#endif
+}
+
+int main()
+{
+ {
+ A* ap = new A;
+ assert(ap);
+ assert(reinterpret_cast<std::uintptr_t>(ap) % OverAligned == 0);
+ assert(A_constructed);
+ delete ap;
+ assert(!A_constructed);
+ }
+ {
+ test_throw_max_size();
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
new file mode 100644
index 000000000000..ca8503e8854d
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: sanitizer-new-delete
+
+// FIXME turn this into an XFAIL
+// UNSUPPORTED: no-aligned-allocation
+
+// test operator new (nothrow)
+
+#include <new>
+#include <cstddef>
+#include <cstdint>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+int new_handler_called = 0;
+
+void new_handler()
+{
+ ++new_handler_called;
+ std::set_new_handler(0);
+}
+
+bool A_constructed = false;
+
+struct alignas(OverAligned) A
+{
+ A() {A_constructed = true;}
+ ~A() {A_constructed = false;}
+};
+
+void test_max_alloc() {
+ std::set_new_handler(new_handler);
+ auto do_test = []() {
+ void* vp = operator new (std::numeric_limits<std::size_t>::max(),
+ std::align_val_t(OverAligned),
+ std::nothrow);
+ assert(new_handler_called == 1);
+ assert(vp == 0);
+ };
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ do_test();
+ }
+ catch (...)
+ {
+ assert(false);
+ }
+#else
+ do_test();
+#endif
+}
+
+int main()
+{
+ {
+ A* ap = new(std::nothrow) A;
+ assert(ap);
+ assert(reinterpret_cast<std::uintptr_t>(ap) % OverAligned == 0);
+ assert(A_constructed);
+ delete ap;
+ assert(!A_constructed);
+ }
+ {
+ test_max_alloc();
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
new file mode 100644
index 000000000000..9f64c9730166
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: sanitizer-new-delete
+
+// XFAIL: no-aligned-allocation
+
+// test operator new nothrow by replacing only operator new
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+bool A_constructed = false;
+
+struct alignas(OverAligned) A
+{
+ A() {A_constructed = true;}
+ ~A() {A_constructed = false;}
+};
+
+bool B_constructed = false;
+
+struct B {
+ std::max_align_t member;
+ B() { B_constructed = true; }
+ ~B() { B_constructed = false; }
+};
+
+int new_called = 0;
+alignas(OverAligned) char Buff[OverAligned * 2];
+
+void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
+{
+ assert(!new_called);
+ assert(s <= sizeof(Buff));
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ ++new_called;
+ return Buff;
+}
+
+void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
+{
+ assert(p == Buff);
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ assert(new_called);
+ --new_called;
+}
+
+
+int main()
+{
+ {
+ A* ap = new (std::nothrow) A;
+ assert(ap);
+ assert(A_constructed);
+ assert(new_called);
+ delete ap;
+ assert(!A_constructed);
+ assert(!new_called);
+ }
+ {
+ B* bp = new (std::nothrow) B;
+ assert(bp);
+ assert(B_constructed);
+ assert(!new_called);
+ delete bp;
+ assert(!new_called);
+ assert(!B_constructed);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
new file mode 100644
index 000000000000..df3e4c1560a9
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: sanitizer-new-delete
+
+// XFAIL: no-aligned-allocation
+
+// test operator new replacement
+
+#include <new>
+#include <cstddef>
+#include <cstdlib>
+#include <cstdint>
+#include <cassert>
+#include <limits>
+
+#include "test_macros.h"
+
+constexpr auto OverAligned = alignof(std::max_align_t) * 2;
+
+bool A_constructed = false;
+
+struct alignas(OverAligned) A {
+ A() {A_constructed = true;}
+ ~A() {A_constructed = false;}
+};
+
+
+bool B_constructed = false;
+
+struct alignas(std::max_align_t) B
+{
+ std::max_align_t member;
+ B() {B_constructed = true;}
+ ~B() {B_constructed = false;}
+};
+
+int new_called = 0;
+
+alignas(OverAligned) char DummyData[OverAligned];
+
+void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
+{
+ assert(new_called == 0); // We already allocated
+ assert(s <= sizeof(DummyData));
+ assert(static_cast<std::size_t>(a) == OverAligned);
+ ++new_called;
+ return DummyData;
+}
+
+void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT
+{
+ assert(new_called == 1);
+ --new_called;
+ assert(p == DummyData);
+}
+
+
+int main()
+{
+ {
+ A* ap = new A;
+ assert(ap);
+ assert(A_constructed);
+ assert(new_called);
+ delete ap;
+ assert(!A_constructed);
+ assert(!new_called);
+ }
+ {
+ B* bp = new B;
+ assert(bp);
+ assert(B_constructed);
+ assert(!new_called);
+ delete bp;
+ assert(!new_called);
+ }
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
index c2f5830495d2..757e8ae18a47 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test operator new (nothrow)
// asan and msan will not call the new handler.
@@ -18,6 +17,8 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_handler_called = 0;
void new_handler()
@@ -37,16 +38,20 @@ struct A
int main()
{
std::set_new_handler(new_handler);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
void* vp = operator new (std::numeric_limits<std::size_t>::max(), std::nothrow);
assert(new_handler_called == 1);
assert(vp == 0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (...)
{
assert(false);
}
+#endif
A* ap = new(std::nothrow) A;
assert(ap);
assert(A_constructed);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
index eb8319bac2f7..dbc64bace332 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
@@ -11,18 +11,17 @@
// UNSUPPORTED: sanitizer-new-delete
-// TODO Investigate why UBSAN prevents nothrow new from calling our replacement.
-// XFAIL: ubsan
-
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_called = 0;
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
++new_called;
void* ret = std::malloc(s);
@@ -30,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
--new_called;
std::free(p);
@@ -44,9 +43,11 @@ struct A
~A() {A_constructed = false;}
};
+A* volatile ap;
+
int main()
{
- A* ap = new (std::nothrow) A;
+ ap = new (std::nothrow) A;
assert(ap);
assert(A_constructed);
assert(new_called);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
index 6056ed7bb0b3..ad15b49483d0 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
@@ -17,9 +17,11 @@
#include <cassert>
#include <limits>
+#include "test_macros.h"
+
int new_called = 0;
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
++new_called;
void* ret = std::malloc(s);
@@ -27,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
--new_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
index e4064e2ab510..7369c362fce2 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp
@@ -20,23 +20,25 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete(void* p, const std::nothrow_t&) throw()
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete(void* p, std::size_t) throw()
+void operator delete(void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index 5d9ddd4f0526..6c91f5ceda86 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -25,23 +25,25 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete(void* p, const std::nothrow_t&) throw()
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete(void* p, std::size_t) throw()
+void operator delete(void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
index f656d1cd712a..cb093f3637ce 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp
@@ -13,33 +13,33 @@
// UNSUPPORTED: sanitizer-new-delete
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
-
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int delete_called = 0;
int delete_nothrow_called = 0;
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
++delete_called;
std::free(p);
}
-void operator delete(void* p, const std::nothrow_t&) throw()
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++delete_nothrow_called;
std::free(p);
}
+int* volatile x;
+
int main()
{
- int *x = new int(42);
+ x = new int(42);
assert(0 == delete_called);
assert(0 == delete_nothrow_called);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
index 24d33e210f57..1b6de2367e10 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
@@ -14,9 +14,6 @@
// UNSUPPORTED: sanitizer-new-delete
-// TODO Investigate why UBSAN prevents new from calling our replacement.
-// XFAIL: ubsan
-
// NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation.
// REQUIRES: fsized-deallocation
@@ -36,31 +33,35 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
-void operator delete(void* p, const std::nothrow_t&) throw()
+void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
-void operator delete(void* p, std::size_t) throw()
+void operator delete(void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
}
+int* volatile x;
+
int main()
{
- int *x = new int(42);
+ x = new int(42);
assert(0 == sized_delete_called);
assert(0 == unsized_delete_called);
assert(0 == unsized_delete_nothrow_called);
diff --git a/test/std/language.support/support.exception/except.nested/assign.pass.cpp b/test/std/language.support/support.exception/except.nested/assign.pass.cpp
index a5508d1436fa..6338c8aaa26e 100644
--- a/test/std/language.support/support.exception/except.nested/assign.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/assign.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
@@ -17,6 +16,8 @@
#include <exception>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -34,6 +35,7 @@ int main()
e = e0;
assert(e.nested_ptr() == nullptr);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -57,4 +59,5 @@ int main()
}
}
}
+#endif
}
diff --git a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
index f9f293300e62..4cbdbb2ec892 100644
--- a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
@@ -17,6 +16,8 @@
#include <exception>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -33,6 +34,7 @@ int main()
std::nested_exception e = e0;
assert(e.nested_ptr() == nullptr);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -55,4 +57,5 @@ int main()
}
}
}
+#endif
}
diff --git a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
index 67766aa2c461..18ca9968ff56 100644
--- a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
@@ -17,6 +16,8 @@
#include <exception>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
@@ -32,6 +33,7 @@ int main()
std::nested_exception e;
assert(e.nested_ptr() == nullptr);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -53,4 +55,5 @@ int main()
}
}
}
+#endif
}
diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
index 4ee95fdf3001..57d193a411cc 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// class nested_exception;
@@ -18,12 +18,14 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
class A
{
int data_;
public:
explicit A(int data) : data_(data) {}
- virtual ~A() _NOEXCEPT {}
+ virtual ~A() TEST_NOEXCEPT {}
friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;}
};
diff --git a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
index 13c1dfe59311..d511a72f9f57 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
index c14cb69bdea3..a86d8bcbe201 100644
--- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
index 7bf1df457dbe..661f789fefd7 100644
--- a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// exception_ptr current_exception();
diff --git a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
index 6e4c0a98b09f..36feda7304bc 100644
--- a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// template<class E> exception_ptr make_exception_ptr(E e);
diff --git a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
index c28c901bdd73..565166cbdf76 100644
--- a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <exception>
// void rethrow_exception [[noreturn]] (exception_ptr p);
diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
index 573d85bd242c..a4353be4f4cc 100644
--- a/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
+++ b/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// test uncaught_exception
#include <exception>
diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
index b35ad7313bcc..b92671588027 100644
--- a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
+++ b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// test uncaught_exceptions
#include <exception>
diff --git a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
index 2f0720639c66..e51ef7bd9230 100644
--- a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
+++ b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
@@ -15,6 +15,9 @@
#include <initializer_list>
#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -25,14 +28,14 @@ struct A
const int* b = il.begin();
const int* e = il.end();
assert(il.size() == 3);
- assert(e - b == il.size());
+ assert(static_cast<std::size_t>(e - b) == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
struct B
{
constexpr B(std::initializer_list<int> il)
@@ -40,14 +43,14 @@ struct B
const int* b = il.begin();
const int* e = il.end();
assert(il.size() == 3);
- assert(e - b == il.size());
+ assert(static_cast<std::size_t>(e - b) == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -56,7 +59,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
A test1 = {3, 2, 1};
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr B test2 = {3, 2, 1};
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
}
diff --git a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp
index 7822a62206a1..e091834340aa 100644
--- a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp
+++ b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp
@@ -14,6 +14,8 @@
#include <initializer_list>
#include <cassert>
+#include "test_macros.h"
+
struct A {};
int main()
@@ -22,8 +24,8 @@ int main()
std::initializer_list<A> il;
assert(il.size() == 0);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr std::initializer_list<A> il2;
static_assert(il2.size() == 0, "");
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
}
diff --git a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
index 5fcd28f9156c..938025d385fa 100644
--- a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
+++ b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
@@ -13,6 +13,9 @@
#include <initializer_list>
#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -23,14 +26,14 @@ struct A
const int* b = begin(il);
const int* e = end(il);
assert(il.size() == 3);
- assert(e - b == il.size());
+ assert(static_cast<std::size_t>(e - b) == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
struct B
{
constexpr B(std::initializer_list<int> il)
@@ -38,14 +41,14 @@ struct B
const int* b = begin(il);
const int* e = end(il);
assert(il.size() == 3);
- assert(e - b == il.size());
+ assert(static_cast<std::size_t>(e - b) == il.size());
assert(*b++ == 3);
assert(*b++ == 2);
assert(*b++ == 1);
}
};
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
int main()
@@ -53,7 +56,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
A test1 = {3, 2, 1};
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr B test2 = {3, 2, 1};
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
}
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
index a2ccca333cc6..033ecdc31af0 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
@@ -50,7 +50,7 @@ int main()
test<__int128_t>(0);
test<__uint128_t>(0);
#endif
- test<float>(1./zero);
+ test<float>(1.f/zero);
test<double>(1./zero);
test<long double>(1./zero);
}
diff --git a/test/std/language.support/support.runtime/cstdlib.pass.cpp b/test/std/language.support/support.runtime/cstdlib.pass.cpp
index d8f88cf58d9d..60f7d954db54 100644
--- a/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -96,11 +96,9 @@ int main()
wchar_t* pw = 0;
const wchar_t* pwc = 0;
char* pc = 0;
-#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::mblen("",0)), int>::value), "");
static_assert((std::is_same<decltype(std::mbtowc(pw,"",0)), int>::value), "");
static_assert((std::is_same<decltype(std::wctomb(pc,L' ')), int>::value), "");
-#endif
static_assert((std::is_same<decltype(std::mbstowcs(pw,"",0)), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::wcstombs(pc,pwc,0)), std::size_t>::value), "");
}
diff --git a/test/std/language.support/support.types/nullptr_t.pass.cpp b/test/std/language.support/support.types/nullptr_t.pass.cpp
index ca5170f649ed..2d0ed7410590 100644
--- a/test/std/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/std/language.support/support.types/nullptr_t.pass.cpp
@@ -11,6 +11,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
// typedef decltype(nullptr) nullptr_t;
struct A
@@ -34,22 +36,20 @@ void test_conversions()
}
}
+template <class T> struct Voider { typedef void type; };
+template <class T, class = void> struct has_less : std::false_type {};
+
+template <class T> struct has_less<T,
+ typename Voider<decltype(std::declval<T>() < nullptr)>::type> : std::true_type {};
+
template <class T>
void test_comparisons()
{
T p = nullptr;
assert(p == nullptr);
- assert(p <= nullptr);
- assert(p >= nullptr);
assert(!(p != nullptr));
- assert(!(p < nullptr));
- assert(!(p > nullptr));
assert(nullptr == p);
- assert(nullptr <= p);
- assert(nullptr >= p);
assert(!(nullptr != p));
- assert(!(nullptr < p));
- assert(!(nullptr > p));
}
#if defined(__clang__)
@@ -89,6 +89,15 @@ int main()
test_conversions<int A::*>();
}
{
+#ifdef _LIBCPP_HAS_NO_NULLPTR
+ static_assert(!has_less<std::nullptr_t>::value, "");
+ // FIXME: our c++03 nullptr emulation still allows for comparisons
+ // with other pointer types by way of the conversion operator.
+ //static_assert(!has_less<void*>::value, "");
+#else
+ // TODO Enable this assertion when all compilers implement core DR 583.
+ // static_assert(!has_less<std::nullptr_t>::value, "");
+#endif
test_comparisons<std::nullptr_t>();
test_comparisons<void*>();
test_comparisons<A*>();
diff --git a/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp b/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
index 13945f8ee7ce..fd0b177c8064 100644
--- a/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
+++ b/test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
@@ -29,6 +29,7 @@ int main()
{
assert(std::has_facet<std::collate<char> >(l));
const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::collate<char>::id;
}
@@ -39,6 +40,7 @@ int main()
{
assert(std::has_facet<std::collate<wchar_t> >(l));
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::collate<wchar_t>::id;
}
diff --git a/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp b/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
index f58ec30ef061..be223ce79489 100644
--- a/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
@@ -28,6 +28,7 @@ int main()
{
assert(std::has_facet<std::ctype<char> >(l));
const std::ctype<char>& f = std::use_facet<std::ctype<char> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::ctype<char>::id;
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
index 8f9d1e6cd1f0..f645b32f2691 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
@@ -36,5 +36,5 @@ int main()
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
- assert(to[i] == from[i]);
+ assert(to[i] == static_cast<char32_t>(from[i]));
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
index 4e0f600097a0..05a90d33d318 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
@@ -40,6 +40,6 @@ int main()
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
- assert(to[i] == from[i]);
+ assert(static_cast<char32_t>(to[i]) == from[i]);
}
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
index a4ff61bcff65..0412f6fa5d42 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include <cassert>
+#include <cstddef>
typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
@@ -35,8 +36,8 @@ int main()
F::result r = f.in(mbs, from.data(), from.data() + from.size(), from_next,
&to[0], &to[0] + to.size(), to_next);
assert(r == F::ok);
- assert(from_next - from.data() == from.size());
- assert(to_next - to.data() == expected.size());
- assert(to_next - to.data() == expected.size());
+ assert(static_cast<std::size_t>(from_next - from.data()) == from.size());
+ assert(static_cast<std::size_t>(to_next - to.data()) == expected.size());
+ assert(static_cast<std::size_t>(to_next - to.data()) == expected.size());
assert(to == expected);
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
index 6f025e3ff094..d7bcb2908d72 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include <cassert>
+#include <cstddef>
typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
@@ -35,8 +36,8 @@ int main()
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
to.data(), to.data() + to.size(), to_next);
assert(r == F::ok);
- assert(from_next - from.data() == from.size());
- assert(to_next - to.data() == from.size());
+ assert(static_cast<std::size_t>(from_next - from.data()) == from.size());
+ assert(static_cast<std::size_t>(to_next - to.data()) == from.size());
assert(to.data() == std::string("some text"));
}
{
@@ -49,8 +50,8 @@ int main()
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
to.data(), to.data() + to.size(), to_next);
assert(r == F::ok);
- assert(from_next - from.data() == from.size());
- assert(to_next - to.data() == from.size());
+ assert(static_cast<std::size_t>(from_next - from.data()) == from.size());
+ assert(static_cast<std::size_t>(to_next - to.data()) == from.size());
assert(memcmp(to.data(), "some\0text", from.size()) == 0);
}
{
@@ -62,8 +63,8 @@ int main()
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
to.data(), to.data() + to.size()-1, to_next);
assert(r == F::partial);
- assert(from_next - from.data() == to.size()-1);
- assert(to_next - to.data() == to.size()-1);
+ assert(static_cast<std::size_t>(from_next - from.data()) == to.size()-1);
+ assert(static_cast<std::size_t>(to_next - to.data()) == to.size()-1);
assert(to.data() == std::string("some te"));
}
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
index 5e2c44ff971c..892e89391e49 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
@@ -36,5 +36,6 @@ int main()
std::locale l = std::locale::classic();
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
+ ((void)f); // Prevent unused warning
(void)F::id;
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp
index 9d512bd9d130..2b4a686cf3ef 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char16_t.pass.cpp
@@ -27,7 +27,6 @@
int main()
{
-//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef std::codecvt<char16_t, char, std::mbstate_t> F;
static_assert((std::is_base_of<std::locale::facet, F>::value), "");
static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
@@ -38,5 +37,5 @@ int main()
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
(void)F::id;
-//#endif
+ ((void)f);
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp
index 25f2b3d8df58..c76fea9af9f5 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char32_t.pass.cpp
@@ -27,7 +27,6 @@
int main()
{
-//#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef std::codecvt<char32_t, char, std::mbstate_t> F;
static_assert((std::is_base_of<std::locale::facet, F>::value), "");
static_assert((std::is_base_of<std::codecvt_base, F>::value), "");
@@ -38,5 +37,5 @@ int main()
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
(void)F::id;
-//#endif
+ ((void)f);
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
index 8b6868ec60d3..bfec2339feaa 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
@@ -36,5 +36,6 @@ int main()
std::locale l = std::locale::classic();
assert(std::has_facet<F>(l));
const F& f = std::use_facet<F>(l);
+ ((void)f); // Prevent unused warning
(void)F::id;
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
index 741f47f4380c..4488e9c3f73b 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
@@ -17,7 +17,6 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
-// XFAIL: linux
#include <locale>
#include <cassert>
@@ -27,10 +26,11 @@
int main()
{
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
assert(f.tolower(' ') == ' ');
assert(f.tolower('A') == 'a');
@@ -38,15 +38,15 @@ int main()
assert(f.tolower('.') == '.');
assert(f.tolower('a') == 'a');
assert(f.tolower('1') == '1');
- assert(f.tolower('\xDA') == '\xFA');
assert(f.tolower('\xFA') == '\xFA');
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
assert(f.tolower(' ') == ' ');
assert(f.tolower('A') == 'a');
@@ -59,10 +59,11 @@ int main()
}
}
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
assert(f.tolower(L' ') == L' ');
assert(f.tolower(L'A') == L'a');
@@ -75,10 +76,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
assert(f.tolower(L' ') == L' ');
assert(f.tolower(L'A') == L'a');
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
index bf1cb64b22c0..0c224e342fa9 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
@@ -17,7 +17,6 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
-// XFAIL: linux
#include <locale>
#include <string>
@@ -28,14 +27,15 @@
int main()
{
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
- std::string in("\xDA A\x07.a1");
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
+ std::string in("c A\x07.a1");
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
- assert(in[0] == '\xFA');
+ assert(in[0] == 'c');
assert(in[1] == ' ');
assert(in[2] == 'a');
assert(in[3] == '\x07');
@@ -45,10 +45,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
std::string in("\xDA A\x07.a1");
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
@@ -62,10 +63,11 @@ int main()
}
}
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
std::wstring in(L"\xDA A\x07.a1");
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
@@ -79,10 +81,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
std::wstring in(L"\xDA A\x07.a1");
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
index 3044ba1897fc..0985de5007d6 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
@@ -17,7 +17,7 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
-// XFAIL: linux
+
#include <locale>
#include <cassert>
@@ -27,10 +27,11 @@
int main()
{
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
assert(f.toupper(' ') == ' ');
assert(f.toupper('A') == 'A');
@@ -39,14 +40,15 @@ int main()
assert(f.toupper('a') == 'A');
assert(f.toupper('1') == '1');
assert(f.toupper('\xDA') == '\xDA');
- assert(f.toupper('\xFA') == '\xDA');
+ assert(f.toupper('c') == 'C');
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
assert(f.toupper(' ') == ' ');
assert(f.toupper('A') == 'A');
@@ -59,10 +61,11 @@ int main()
}
}
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
assert(f.toupper(L' ') == L' ');
assert(f.toupper(L'A') == L'A');
@@ -75,10 +78,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
assert(f.toupper(L' ') == L' ');
assert(f.toupper(L'A') == L'A');
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
index be6ba4c3e908..ba047754916d 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
@@ -17,7 +17,6 @@
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
-// XFAIL: linux
#include <locale>
#include <string>
@@ -28,14 +27,15 @@
int main()
{
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
- std::string in("\xFA A\x07.a1");
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
+ std::string in("c A\x07.a1");
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
- assert(in[0] == '\xDA');
+ assert(in[0] == 'C');
assert(in[1] == ' ');
assert(in[2] == 'A');
assert(in[3] == '\x07');
@@ -45,10 +45,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<char> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<char> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
std::string in("\xFA A\x07.a1");
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
@@ -62,10 +63,11 @@ int main()
}
}
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
std::wstring in(L"\xFA A\x07.a1");
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
@@ -79,14 +81,15 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
- std::wstring in(L"\xFA A\x07.a1");
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
+ std::wstring in(L"\u00FA A\x07.a1");
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
- assert(in[0] == L'\xFA');
+ assert(in[0] == L'\u00FA');
assert(in[1] == L' ');
assert(in[2] == L'A');
assert(in[3] == L'\x07');
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
index e5c49defa11f..8f51d12d7c75 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
@@ -17,7 +17,6 @@
// I doubt this test is portable
-// XFAIL: linux
#include <locale>
#include <cassert>
@@ -28,10 +27,11 @@
int main()
{
{
- std::locale l(LOCALE_en_US_UTF_8);
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ const F& f = std::use_facet<F>(ll);
assert(f.widen(' ') == L' ');
assert(f.widen('A') == L'A');
@@ -43,10 +43,11 @@ int main()
}
}
{
- std::locale l("C");
+ std::locale l;
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
assert(f.widen(' ') == L' ');
assert(f.widen('A') == L'A');
@@ -54,7 +55,11 @@ int main()
assert(f.widen('.') == L'.');
assert(f.widen('a') == L'a');
assert(f.widen('1') == L'1');
- assert(f.widen(char(-5)) == wchar_t(251));
+#ifdef __APPLE__
+ assert(f.widen(char(-5)) == L'\u00fb');
+#else
+ assert(f.widen(char(-5)) == wchar_t(-1));
+#endif
}
}
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
index c16974a2414a..7a382c4dfa2c 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
@@ -17,8 +17,6 @@
// I doubt this test is portable
-// XFAIL: linux
-
#include <locale>
#include <string>
#include <vector>
@@ -31,8 +29,9 @@ int main()
{
std::locale l(LOCALE_en_US_UTF_8);
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F(LOCALE_en_US_UTF_8));
+ F const& f = std::use_facet<F>(ll);
std::string in(" A\x07.a1\x85");
std::vector<wchar_t> v(in.size());
@@ -49,8 +48,9 @@ int main()
{
std::locale l("C");
{
- typedef std::ctype<wchar_t> F;
- const F& f = std::use_facet<F>(l);
+ typedef std::ctype_byname<wchar_t> F;
+ std::locale ll(l, new F("C"));
+ const F& f = std::use_facet<F>(ll);
std::string in(" A\x07.a1\x85");
std::vector<wchar_t> v(in.size());
@@ -61,7 +61,11 @@ int main()
assert(v[3] == L'.');
assert(v[4] == L'a');
assert(v[5] == L'1');
- assert(v[6] == wchar_t(133));
+#ifdef __APPLE__
+ assert(v[6] == L'\x85');
+#else
+ assert(v[6] == wchar_t(-1));
+#endif
}
}
}
diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
index 7ad36afee669..ae356606053e 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
@@ -28,6 +28,7 @@ int main()
{
assert(std::has_facet<std::ctype<wchar_t> >(l));
const std::ctype<wchar_t>& f = std::use_facet<std::ctype<wchar_t> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::ctype<wchar_t>::id;
}
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
index 6d23d6361f85..8490b708b6cf 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
@@ -24,6 +24,7 @@
#include <limits>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
class Fnf
@@ -113,7 +114,14 @@ int main()
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
+ // GLIBC <= 2.23 uses currency_symbol="<U0440><U0443><U0431>"
+ // GLIBC >= 2.24 uses currency_symbol="<U20BD>"
+ // See also: http://www.fileformat.info/info/unicode/char/20bd/index.htm
+#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
+ assert(f.curr_symbol() == " \u20BD");
+#else
assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
+#endif
}
{
Fnt f(LOCALE_ru_RU_UTF_8, 1);
@@ -121,8 +129,13 @@ int main()
}
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
+#if defined(TEST_GLIBC_PREREQ) && TEST_GLIBC_PREREQ(2, 24)
+ assert(f.curr_symbol() == L" \u20BD");
+#else
assert(f.curr_symbol() == L" \x440\x443\x431");
+#endif
}
+
{
Fwt f(LOCALE_ru_RU_UTF_8, 1);
assert(f.curr_symbol() == L" RUB");
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
index 8270377f3ab9..4051d451fcb6 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
@@ -12,9 +12,6 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// Russia uses ',' for the decimal separator. GLIBC returns '.'
-// XFAIL: linux
-
// <locale>
// class moneypunct_byname<charT, International>
@@ -25,6 +22,7 @@
#include <limits>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
class Fnf
@@ -111,22 +109,29 @@ int main()
Fwt f(LOCALE_fr_FR_UTF_8, 1);
assert(f.decimal_point() == L',');
}
-
+// GLIBC 2.23 uses '.' as the decimal point while other C libraries use ','
+#ifndef TEST_HAS_GLIBC
+ const char sep = ',';
+ const wchar_t wsep = L',';
+#else
+ const char sep = '.';
+ const wchar_t wsep = L'.';
+#endif
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.decimal_point() == ',');
+ assert(f.decimal_point() == sep);
}
{
Fnt f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.decimal_point() == ',');
+ assert(f.decimal_point() == sep);
}
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.decimal_point() == L',');
+ assert(f.decimal_point() == wsep);
}
{
Fwt f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.decimal_point() == L',');
+ assert(f.decimal_point() == wsep);
}
{
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
index a8782832de5c..aa585a436e6e 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
@@ -18,16 +18,11 @@
// charT thousands_sep() const;
-// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
-// and U002E as mon_decimal_point.
-// TODO: U00A0 should be investigated.
-// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
-// XFAIL: linux-gnu
-
#include <locale>
#include <limits>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
class Fnf
@@ -114,22 +109,34 @@ int main()
Fwt f(LOCALE_fr_FR_UTF_8, 1);
assert(f.thousands_sep() == L' ');
}
-
+// The below tests work around GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: Fix thousands_sep for 'char'.
+// related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+#ifndef TEST_HAS_GLIBC
+ const char sep = ' ';
+ const wchar_t wsep = L' ';
+#else
+ // FIXME libc++ specifically works around \u00A0 by translating it into
+ // a regular space.
+ const char sep = ' ';
+ const wchar_t wsep = L'\u00A0';
+#endif
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.thousands_sep() == ' ');
+ assert(f.thousands_sep() == sep);
}
{
Fnt f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.thousands_sep() == ' ');
+ assert(f.thousands_sep() == sep);
}
{
Fwf f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.thousands_sep() == L' ');
+ assert(f.thousands_sep() == wsep);
}
{
Fwt f(LOCALE_ru_RU_UTF_8, 1);
- assert(f.thousands_sep() == L' ');
+ assert(f.thousands_sep() == wsep);
}
{
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
index 4085f08c7420..1a0a7663ddc8 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
@@ -47,7 +47,6 @@ int main()
std::ios ios(0);
long v = 0;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0");
@@ -56,7 +55,6 @@ int main()
std::ios ios(0);
long v = 1;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1");
@@ -65,7 +63,6 @@ int main()
std::ios ios(0);
long v = -1;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "-1");
@@ -74,7 +71,6 @@ int main()
std::ios ios(0);
long v = -1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "-1000");
@@ -83,7 +79,6 @@ int main()
std::ios ios(0);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1000");
@@ -93,7 +88,6 @@ int main()
showpos(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "+1000");
@@ -103,7 +97,6 @@ int main()
oct(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1750");
@@ -114,7 +107,6 @@ int main()
showbase(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "01750");
@@ -124,7 +116,6 @@ int main()
hex(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "3e8");
@@ -135,7 +126,6 @@ int main()
showbase(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x3e8");
@@ -147,7 +137,6 @@ int main()
uppercase(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0X3E8");
@@ -160,7 +149,6 @@ int main()
uppercase(ios);
long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0X3E_8");
@@ -172,7 +160,6 @@ int main()
showbase(ios);
long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x7f_fff_ff_f");
@@ -183,7 +170,6 @@ int main()
oct(ios);
long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "123_46_7");
@@ -195,7 +181,6 @@ int main()
showbase(ios);
long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0_123_46_7");
@@ -209,7 +194,6 @@ int main()
ios.width(15);
long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "*****0_123_46_7");
@@ -223,7 +207,6 @@ int main()
ios.width(15);
long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0_123_46_7*****");
@@ -237,7 +220,6 @@ int main()
ios.width(15);
long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "*****0_123_46_7");
@@ -252,7 +234,6 @@ int main()
ios.width(15);
long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "**0x7f_fff_ff_f");
@@ -266,7 +247,6 @@ int main()
ios.width(15);
long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x7f_fff_ff_f**");
@@ -280,7 +260,6 @@ int main()
ios.width(15);
long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x**7f_fff_ff_f");
@@ -294,7 +273,6 @@ int main()
right(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "***+1_00_0");
@@ -308,7 +286,6 @@ int main()
left(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "+1_00_0***");
@@ -322,7 +299,6 @@ int main()
internal(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "+***1_00_0");
@@ -336,7 +312,6 @@ int main()
showpos(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "***-1_00_0");
@@ -349,7 +324,6 @@ int main()
left(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "-1_00_0***");
@@ -362,7 +336,6 @@ int main()
internal(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "-***1_00_0");
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index cf9339341abb..cdd163980efd 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -26226,25 +26226,25 @@ int main()
std::locale lg(lc, new my_numpunct);
const my_facet f(1);
{
- long double v = -INFINITY;
+ long double v = -INFINITY; ((void)v);
}
{
- long double v = std::nan("");
+ long double v = std::nan(""); ((void)v);
}
{
- long double v = +0.;
+ long double v = +0.; ((void)v);
}
{
- long double v = -INFINITY;
+ long double v = -INFINITY; ((void)v);
}
{
- long double v = std::nan("");
+ long double v = std::nan(""); ((void)v);
}
{
- long double v = -INFINITY;
+ long double v = -INFINITY; ((void)v);
}
{
- long double v = std::nan("");
+ long double v = std::nan(""); ((void)v);
}
}
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
index f7a577fb8a9e..cfa6382a49bd 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
@@ -47,7 +47,6 @@ int main()
std::ios ios(0);
unsigned long v = 0;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0");
@@ -56,25 +55,22 @@ int main()
std::ios ios(0);
unsigned long v = 1;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1");
}
{
std::ios ios(0);
- unsigned long v = -1;
+ unsigned long v = static_cast<unsigned long>(-1);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == (sizeof(unsigned long) == 4 ? "4294967295" : "18446744073709551615"));
}
{
std::ios ios(0);
- unsigned long v = -1000;
+ unsigned long v = static_cast<unsigned long>(-1000);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == (sizeof(unsigned long) == 4 ? "4294966296" : "18446744073709550616"));
@@ -83,7 +79,6 @@ int main()
std::ios ios(0);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1000");
@@ -93,7 +88,6 @@ int main()
showpos(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1000");
@@ -103,7 +97,6 @@ int main()
oct(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1750");
@@ -114,7 +107,6 @@ int main()
showbase(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "01750");
@@ -124,7 +116,6 @@ int main()
hex(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "3e8");
@@ -135,7 +126,6 @@ int main()
showbase(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x3e8");
@@ -147,7 +137,6 @@ int main()
uppercase(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0X3E8");
@@ -160,7 +149,6 @@ int main()
uppercase(ios);
unsigned long v = 1000;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0X3E_8");
@@ -172,7 +160,6 @@ int main()
showbase(ios);
unsigned long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x7f_fff_ff_f");
@@ -183,7 +170,6 @@ int main()
oct(ios);
unsigned long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "123_46_7");
@@ -195,7 +181,6 @@ int main()
showbase(ios);
unsigned long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0_123_46_7");
@@ -209,7 +194,6 @@ int main()
ios.width(15);
unsigned long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "*****0_123_46_7");
@@ -223,7 +207,6 @@ int main()
ios.width(15);
unsigned long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0_123_46_7*****");
@@ -237,7 +220,6 @@ int main()
ios.width(15);
unsigned long v = 0123467;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "*****0_123_46_7");
@@ -252,7 +234,6 @@ int main()
ios.width(15);
unsigned long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "**0x7f_fff_ff_f");
@@ -266,7 +247,6 @@ int main()
ios.width(15);
unsigned long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x7f_fff_ff_f**");
@@ -280,7 +260,6 @@ int main()
ios.width(15);
unsigned long v = 2147483647;
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "0x**7f_fff_ff_f");
@@ -294,7 +273,6 @@ int main()
right(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "****1_00_0");
@@ -308,7 +286,6 @@ int main()
left(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "1_00_0****");
@@ -322,7 +299,6 @@ int main()
internal(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == "****1_00_0");
@@ -331,12 +307,11 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long v = -1000;
+ unsigned long v = static_cast<unsigned long>(-1000);
right(ios);
showpos(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
@@ -346,11 +321,10 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long v = -1000;
+ unsigned long v = static_cast<unsigned long>(-1000);
left(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
@@ -360,11 +334,10 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long v = -1000;
+ unsigned long v = static_cast<unsigned long>(-1000);
internal(ios);
ios.width(10);
char str[50];
- std::ios_base::iostate err = ios.goodbit;
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
assert(ex == (sizeof(unsigned long) == 4 ? "4_294_966_29_6"
diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp
index debbd5e0ee6c..eaf670972bae 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long_long.pass.cpp
@@ -61,15 +61,15 @@ int main()
}
{
std::ios ios(0);
- unsigned long long v = -1;
+ unsigned long long v = static_cast<unsigned long long>(-1);
char str[50];
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == (sizeof(unsigned long long) == 4 ? "4294967295" : "18446744073709551615"));
+ assert(ex == "18446744073709551615");
}
{
std::ios ios(0);
- unsigned long long v = -1000;
+ unsigned long long v = static_cast<unsigned long long>(-1000);
char str[50];
output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
@@ -307,7 +307,7 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long long v = -1000;
+ unsigned long long v = static_cast<unsigned long long>(-1000);
right(ios);
showpos(ios);
ios.width(10);
@@ -320,7 +320,7 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long long v = -1000;
+ unsigned long long v = static_cast<unsigned long long>(-1000);
left(ios);
ios.width(10);
char str[50];
@@ -332,7 +332,7 @@ int main()
{
std::ios ios(0);
ios.imbue(std::locale(std::locale::classic(), new my_numpunct));
- unsigned long long v = -1000;
+ unsigned long long v = static_cast<unsigned long long>(-1000);
internal(ios);
ios.width(10);
char str[50];
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp
index fe00876251cb..86e64e6222b3 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_long.pass.cpp
@@ -100,6 +100,7 @@ int main()
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
- assert(v == 0x8000000000000000LL);
+ const long long expect = 0x8000000000000000LL;
+ assert(v == expect);
}
}
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp
index 2d10569796c9..0665bf2ac1c0 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_int.pass.cpp
@@ -45,7 +45,7 @@ int main()
{
const my_facet f(1);
std::ios ios(0);
- unsigned int v = -1;
+ unsigned int v = static_cast<unsigned int>(-1);
{
const char str[] = "0";
std::ios_base::iostate err = ios.goodbit;
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp
index 50f0ff5ee5da..03fa3d777852 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long.pass.cpp
@@ -45,7 +45,7 @@ int main()
{
const my_facet f(1);
std::ios ios(0);
- unsigned long v = -1;
+ unsigned long v = static_cast<unsigned long>(-1);
{
const char str[] = "0";
std::ios_base::iostate err = ios.goodbit;
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp
index 31fbb2a2c819..dcf4bf1990b7 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_long_long.pass.cpp
@@ -45,7 +45,7 @@ int main()
{
const my_facet f(1);
std::ios ios(0);
- unsigned long long v = -1;
+ unsigned long long v = static_cast<unsigned long long>(-1);
{
const char str[] = "0";
std::ios_base::iostate err = ios.goodbit;
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp
index 822b83e0ff93..283c8e63db4f 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_unsigned_short.pass.cpp
@@ -45,7 +45,7 @@ int main()
{
const my_facet f(1);
std::ios ios(0);
- unsigned short v = -1;
+ unsigned short v = static_cast<unsigned short>(-1);
{
const char str[] = "0";
std::ios_base::iostate err = ios.goodbit;
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
index 28bc3aa89f9c..9045ecbe5935 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
@@ -21,6 +21,7 @@
int main()
{
std::time_base::dateorder d = std::time_base::no_order;
+ ((void)d); // Prevent unused warning
assert(std::time_base::no_order == 0);
assert(std::time_base::dmy == 1);
assert(std::time_base::mdy == 2);
diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
index d5112a9508b7..f3df52a21b89 100644
--- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
@@ -16,12 +16,10 @@
// string grouping() const;
-// TODO: investigation needed
-// XFAIL: linux-gnu
-
#include <locale>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
@@ -54,15 +52,20 @@ int main()
}
{
std::locale l(LOCALE_fr_FR_UTF_8);
+#if defined(TEST_HAS_GLIBC)
+ const char* const group = "\3";
+#else
+ const char* const group = "\x7f";
+#endif
{
typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
- assert(np.grouping() == "\x7F");
+ assert(np.grouping() == group);
}
{
typedef wchar_t C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
- assert(np.grouping() == "\x7F");
+ assert(np.grouping() == group);
}
}
}
diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
index b1bd03ff7364..38cbcfda4f05 100644
--- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
+++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
@@ -16,12 +16,11 @@
// char_type thousands_sep() const;
-// TODO: investigation needed
-// XFAIL: linux-gnu
#include <locale>
#include <cassert>
+#include "test_macros.h"
#include "platform_support.h" // locale name macros
int main()
@@ -54,15 +53,22 @@ int main()
}
{
std::locale l(LOCALE_fr_FR_UTF_8);
+#if defined(TEST_HAS_GLIBC)
+ const char sep = ' ';
+ const wchar_t wsep = L' ';
+#else
+ const char sep = ',';
+ const wchar_t wsep = L',';
+#endif
{
typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
- assert(np.thousands_sep() == ',');
+ assert(np.thousands_sep() == sep);
}
{
typedef wchar_t C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
- assert(np.thousands_sep() == L',');
+ assert(np.thousands_sep() == wsep);
}
}
}
diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
index bbdf3254de21..967a4f4b25ba 100644
--- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
+++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
@@ -28,6 +28,7 @@ int main()
{
assert(std::has_facet<std::numpunct<char> >(l));
const std::numpunct<char>& f = std::use_facet<std::numpunct<char> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::numpunct<char>::id;
}
@@ -38,6 +39,7 @@ int main()
{
assert(std::has_facet<std::numpunct<wchar_t> >(l));
const std::numpunct<wchar_t>& f = std::use_facet<std::numpunct<wchar_t> >(l);
+ ((void)f); // Prevent unused warning
{
(void)std::numpunct<wchar_t>::id;
}
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
index 5f57df12f022..6f0994a00679 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
@@ -19,12 +19,13 @@
#include <sstream>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
int main()
{
typedef std::wbuffer_convert<std::codecvt_utf8<wchar_t> > B;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_convertible<std::streambuf*, B>::value, "");
static_assert( std::is_constructible<B, std::streambuf*>::value, "");
#endif
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
index 6abf5cee328e..aba76df0b9c7 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/state.pass.cpp
@@ -24,5 +24,6 @@ int main()
{
B b;
std::mbstate_t s = b.state();
+ ((void)s);
}
}
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
index 9099b5e38fcc..b56b72fb050c 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_codecvt.pass.cpp
@@ -17,6 +17,8 @@
#include <codecvt>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -30,7 +32,7 @@ int main()
typedef std::wstring_convert<Codecvt> Myconv;
Myconv myconv(new Codecvt);
assert(myconv.converted() == 0);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_convertible<Codecvt*, Myconv>::value, "");
static_assert( std::is_constructible<Myconv, Codecvt*>::value, "");
#endif
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
index 5a58b06cc2d7..70204c2fb99a 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
@@ -19,14 +18,17 @@
#include <codecvt>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::codecvt_utf8<wchar_t> Codecvt;
typedef std::wstring_convert<Codecvt> Myconv;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_convertible<std::string, Myconv>::value, "");
static_assert( std::is_constructible<Myconv, std::string>::value, "");
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
Myconv myconv;
try
@@ -46,10 +48,12 @@ int main()
{
}
}
+#endif
{
Myconv myconv("byte error");
std::string bs = myconv.to_bytes(L"\xDA83");
assert(bs == "byte error");
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
myconv.from_bytes('\xA5');
@@ -58,6 +62,7 @@ int main()
catch (const std::range_error&)
{
}
+#endif
}
{
Myconv myconv("byte error", L"wide error");
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
index 08dfa2558be1..a7a816b37f9d 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/state.pass.cpp
@@ -22,4 +22,5 @@ int main()
typedef std::wstring_convert<Codecvt> Myconv;
Myconv myconv;
std::mbstate_t s = myconv.state();
+ ((void)s);
}
diff --git a/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp b/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
index 303fd790566c..2dba4b68e91f 100644
--- a/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
+++ b/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> const Facet& use_facet(const locale& loc);
@@ -15,6 +14,8 @@
#include <locale>
#include <cassert>
+#include "test_macros.h"
+
int facet_count = 0;
struct my_facet
@@ -32,14 +33,17 @@ std::locale::id my_facet::id;
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
const my_facet& f = std::use_facet<my_facet>(std::locale());
+ ((void)f); // Prevent unused warning
assert(false);
}
catch (std::bad_cast&)
{
}
+#endif
const my_facet* fp = 0;
{
std::locale loc(std::locale(), new my_facet);
diff --git a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
index c7021df8f577..aef2ea93d667 100644
--- a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
@@ -22,6 +21,8 @@
#include "count_new.hpp"
#include "platform_support.h" // locale name macros
+#include "test_macros.h"
+
void check(const std::locale& loc)
{
@@ -70,6 +71,7 @@ int main()
check(loc3);
assert(!(loc == loc3));
assert(loc != loc3);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::locale((const char*)0);
@@ -86,6 +88,7 @@ int main()
catch (std::runtime_error&)
{
}
+#endif
std::locale ok("");
}
assert(globalMemCounter.checkOutstandingNewEq(0));
diff --git a/test/std/localization/locales/locale/locale.members/combine.pass.cpp b/test/std/localization/locales/locale/locale.members/combine.pass.cpp
index 26a760f773a5..a9919f6a8c67 100644
--- a/test/std/localization/locales/locale/locale.members/combine.pass.cpp
+++ b/test/std/localization/locales/locale/locale.members/combine.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> locale combine(const locale& other) const;
@@ -18,6 +17,8 @@
#include "count_new.hpp"
+#include "test_macros.h"
+
void check(const std::locale& loc)
{
assert(std::has_facet<std::collate<char> >(loc));
@@ -78,6 +79,7 @@ int main()
}
assert(globalMemCounter.checkOutstandingNewEq(0));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
{
std::locale loc;
@@ -93,4 +95,5 @@ int main()
}
assert(globalMemCounter.checkOutstandingNewEq(0));
}
+#endif
}
diff --git a/test/std/numerics/c.math/ctgmath.pass.cpp b/test/std/numerics/c.math/ctgmath.pass.cpp
index 278217e04840..9e10690e3cac 100644
--- a/test/std/numerics/c.math/ctgmath.pass.cpp
+++ b/test/std/numerics/c.math/ctgmath.pass.cpp
@@ -11,12 +11,9 @@
#include <ctgmath>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
std::complex<double> cd;
double x = std::sin(0);
+ ((void)x); // Prevent unused warning
}
diff --git a/test/std/numerics/c.math/tgmath_h.pass.cpp b/test/std/numerics/c.math/tgmath_h.pass.cpp
index 23143c7140a6..65fc54ebda51 100644
--- a/test/std/numerics/c.math/tgmath_h.pass.cpp
+++ b/test/std/numerics/c.math/tgmath_h.pass.cpp
@@ -11,10 +11,6 @@
#include <tgmath.h>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
}
diff --git a/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp b/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
index 21aaa669fd43..4b89414686ba 100644
--- a/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
+++ b/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
@@ -11,10 +11,6 @@
#include <ccomplex>
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION not defined
-#endif
-
int main()
{
std::complex<double> d;
diff --git a/test/std/numerics/complex.number/cmplx.over/UDT_is_rejected.fail.cpp b/test/std/numerics/complex.number/cmplx.over/UDT_is_rejected.fail.cpp
new file mode 100644
index 000000000000..6a3ae48d7bbf
--- /dev/null
+++ b/test/std/numerics/complex.number/cmplx.over/UDT_is_rejected.fail.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// Test that UDT's convertible to an integral or floating point type do not
+// participate in overload resolution.
+
+#include <complex>
+#include <type_traits>
+#include <cassert>
+
+template <class IntT>
+struct UDT {
+ operator IntT() const { return 1; }
+};
+
+UDT<float> ft;
+UDT<double> dt;
+UDT<long double> ldt;
+UDT<int> it;
+UDT<unsigned long> uit;
+
+int main()
+{
+ {
+ std::real(ft); // expected-error {{no matching function}}
+ std::real(dt); // expected-error {{no matching function}}
+ std::real(ldt); // expected-error {{no matching function}}
+ std::real(it); // expected-error {{no matching function}}
+ std::real(uit); // expected-error {{no matching function}}
+ }
+ {
+ std::imag(ft); // expected-error {{no matching function}}
+ std::imag(dt); // expected-error {{no matching function}}
+ std::imag(ldt); // expected-error {{no matching function}}
+ std::imag(it); // expected-error {{no matching function}}
+ std::imag(uit); // expected-error {{no matching function}}
+ }
+ {
+ std::arg(ft); // expected-error {{no matching function}}
+ std::arg(dt); // expected-error {{no matching function}}
+ std::arg(ldt); // expected-error {{no matching function}}
+ std::arg(it); // expected-error {{no matching function}}
+ std::arg(uit); // expected-error {{no matching function}}
+ }
+ {
+ std::norm(ft); // expected-error {{no matching function}}
+ std::norm(dt); // expected-error {{no matching function}}
+ std::norm(ldt); // expected-error {{no matching function}}
+ std::norm(it); // expected-error {{no matching function}}
+ std::norm(uit); // expected-error {{no matching function}}
+ }
+ {
+ std::conj(ft); // expected-error {{no matching function}}
+ std::conj(dt); // expected-error {{no matching function}}
+ std::conj(ldt); // expected-error {{no matching function}}
+ std::conj(it); // expected-error {{no matching function}}
+ std::conj(uit); // expected-error {{no matching function}}
+ }
+ {
+ std::proj(ft); // expected-error {{no matching function}}
+ std::proj(dt); // expected-error {{no matching function}}
+ std::proj(ldt); // expected-error {{no matching function}}
+ std::proj(it); // expected-error {{no matching function}}
+ std::proj(uit); // expected-error {{no matching function}}
+ }
+}
diff --git a/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp b/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
index 978c6255ac38..c649157a8c34 100644
--- a/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
@@ -24,7 +24,7 @@ void
test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::arg(x)), double>::value), "");
- assert(std::arg(x) == arg(std::complex<double>(x, 0)));
+ assert(std::arg(x) == arg(std::complex<double>(static_cast<double>(x), 0)));
}
template <class T>
diff --git a/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp b/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
index 7decea877fbd..b5cffe9c14a4 100644
--- a/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/imag.pass.cpp
@@ -17,6 +17,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
#include "../cases.h"
template <class T, int x>
@@ -25,7 +26,7 @@ test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::imag(T(x))), double>::value), "");
assert(std::imag(x) == 0);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr T val {x};
static_assert(std::imag(val) == 0, "");
constexpr std::complex<T> t{val, val};
@@ -39,7 +40,7 @@ test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::imag(T(x))), T>::value), "");
assert(std::imag(x) == 0);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr T val {x};
static_assert(std::imag(val) == 0, "");
constexpr std::complex<T> t{val, val};
diff --git a/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp b/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
index badd5c0cc85f..e847a9413e3e 100644
--- a/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
@@ -24,7 +24,7 @@ void
test(T x, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::norm(x)), double>::value), "");
- assert(std::norm(x) == norm(std::complex<double>(x, 0)));
+ assert(std::norm(x) == norm(std::complex<double>(static_cast<double>(x), 0)));
}
template <class T>
diff --git a/test/std/numerics/complex.number/cmplx.over/real.pass.cpp b/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
index 491b35890c0c..07ae3ab7a3bd 100644
--- a/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
+++ b/test/std/numerics/complex.number/cmplx.over/real.pass.cpp
@@ -17,6 +17,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
#include "../cases.h"
template <class T, int x>
@@ -25,7 +26,7 @@ test(typename std::enable_if<std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::real(T(x))), double>::value), "");
assert(std::real(x) == x);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr T val {x};
static_assert(std::real(val) == val, "");
constexpr std::complex<T> t{val, val};
@@ -39,7 +40,7 @@ test(typename std::enable_if<!std::is_integral<T>::value>::type* = 0)
{
static_assert((std::is_same<decltype(std::real(T(x))), T>::value), "");
assert(std::real(x) == x);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr T val {x};
static_assert(std::real(val) == val, "");
constexpr std::complex<T> t{val, val};
diff --git a/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp b/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp
index 7ead855f5c76..8d55fcdb441e 100644
--- a/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp
+++ b/test/std/numerics/complex.number/complex.members/real_imag.pass.cpp
@@ -15,11 +15,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
constexpr std::complex<T> c1;
static_assert(c1.real() == 0, "");
static_assert(c1.imag() == 0, "");
diff --git a/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp
index 970f021f8e63..59243c7c67a5 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_equals_complex.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::complex<T> lhs(1.5, 2.5);
constexpr std::complex<T> rhs(1.5, -2.5);
diff --git a/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp
index 3c8b772bcaa5..cd6972b9d0c2 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_equals_scalar.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::complex<T> lhs(1.5, 2.5);
constexpr T rhs(-2.5);
diff --git a/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp
index ee138c1ecbcd..9c8ffe0b0169 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::complex<T> lhs(1.5, 2.5);
constexpr std::complex<T> rhs(1.5, -2.5);
diff --git a/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp b/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp
index efb1c0e872db..deb26e2d9990 100644
--- a/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/complex_not_equals_scalar.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::complex<T> lhs(1.5, 2.5);
constexpr T rhs(-2.5);
diff --git a/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp
index 0cd903541fe3..777d7d614e37 100644
--- a/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/scalar_equals_complex.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T lhs(-2.5);
constexpr std::complex<T> rhs(1.5, 2.5);
diff --git a/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp b/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp
index 7d6003cb891b..6bfffb849626 100644
--- a/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/scalar_not_equals_complex.pass.cpp
@@ -16,11 +16,13 @@
#include <complex>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_constexpr()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T lhs(-2.5);
constexpr std::complex<T> rhs(1.5, 2.5);
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
index e09163a7057d..03ed727cab8c 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cos.pass.cpp
@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
index 0fd9cf79bcbf..a2c55390f2a8 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/cosh.pass.cpp
@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
index 58286904ae25..8eb72006a1a5 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/log10.pass.cpp
@@ -34,7 +34,6 @@ test()
void test_edges()
{
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
index 157246947cfe..0d039a159e4f 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_complex.pass.cpp
@@ -36,7 +36,6 @@ test()
void test_edges()
{
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
index 0752ea59f554..36a2962218dc 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_complex_scalar.pass.cpp
@@ -36,7 +36,6 @@ test()
void test_edges()
{
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
index aedeec8caacc..74a3857e9325 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/pow_scalar_complex.pass.cpp
@@ -36,7 +36,6 @@ test()
void test_edges()
{
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
index e1b98ecd0677..7ae59980b09d 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sin.pass.cpp
@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
index 20f2e71b140a..491f3fac5738 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/sinh.pass.cpp
@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
index 041a7814d033..9f09ab5827de 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp
@@ -36,7 +36,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
index 9a2276a8b753..8fa419c2179d 100644
--- a/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
+++ b/test/std/numerics/complex.number/complex.transcendentals/tanh.pass.cpp
@@ -35,7 +35,6 @@ test()
void test_edges()
{
typedef std::complex<double> C;
- const double pi = std::atan2(+0., -0.);
const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
for (unsigned i = 0; i < N; ++i)
{
diff --git a/test/std/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp b/test/std/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
index 72275e01e1be..60b94ab5fc94 100644
--- a/test/std/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
+++ b/test/std/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
@@ -45,7 +45,6 @@ int main()
// Test return value of assignment.
{
int a1[] = {0, 1, 2};
- int a2[] = {3, 4, 3};
std::valarray<int> v1(a1, 3);
std::slice_array<int> s1 = v1[std::slice(1, 1, 1)];
std::slice_array<int> s2 = v1[std::slice(0, 1, 1)];
diff --git a/test/std/numerics/numarray/template.valarray/valarray.access/access.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.access/access.pass.cpp
index 7bf164aafc20..2e3b83ec7d73 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.access/access.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.access/access.pass.cpp
@@ -23,11 +23,11 @@ int main()
T a[] = {5, 4, 3, 2, 1};
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i] == a[i]);
v[i] = i;
- assert(v[i] == i);
+ assert(v[i] == static_cast<int>(i));
}
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.access/const_access.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.access/const_access.pass.cpp
index b9736eedd73b..8d5630516c06 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.access/const_access.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.access/const_access.pass.cpp
@@ -23,7 +23,7 @@ int main()
T a[] = {5, 4, 3, 2, 1};
const unsigned N = sizeof(a)/sizeof(a[0]);
const std::valarray<T> v(a, N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i] == a[i]);
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp
index 2fc42ada85be..3803489c3038 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.assign/copy_assign.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v2;
v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v[i]);
}
{
@@ -37,7 +38,7 @@ int main()
std::valarray<T> v2;
v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v[i]);
}
{
@@ -48,10 +49,10 @@ int main()
std::valarray<T> v2(a, N-2);
v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v2[i][j] == v[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp
index 571f56acd575..7a671a73eee6 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v2;
v2 = {1, 2, 3, 4, 5};
assert(v2.size() == N);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -36,7 +37,7 @@ int main()
std::valarray<T> v2;
v2 = {1, 2.5, 3, 4.25, 5};
assert(v2.size() == N);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -46,10 +47,10 @@ int main()
std::valarray<T> v2(a, N-2);
v2 = {T(1), T(2), T(3), T(4), T(5)};
assert(v2.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
- for (int j = 0; j < a[i].size(); ++j)
+ for (std::size_t j = 0; j < a[i].size(); ++j)
assert(v2[i][j] == a[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp
index d4f750652e28..d34ff1c64d83 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -40,7 +41,7 @@ int main()
v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -52,10 +53,10 @@ int main()
v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
- for (int j = 0; j < a[i].size(); ++j)
+ for (std::size_t j = 0; j < a[i].size(); ++j)
assert(v2[i][j] == a[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/value_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/value_assign.pass.cpp
index b9d67f86a212..cf1d34a117bb 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.assign/value_assign.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.assign/value_assign.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
v = 7;
assert(v.size() == N);
- for (int i = 0; i < v.size(); ++i)
+ for (std::size_t i = 0; i < v.size(); ++i)
assert(v[i] == 7);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp
index 5b1c1b9911b4..9ceae5f2df97 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/and_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 &= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/and_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/and_value.pass.cpp
index 2106a13e2c35..2d74a33379ce 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/and_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/and_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 &= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp
index 3992d0aa43da..914e632d53fe 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v3 /= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_value.pass.cpp
index 7bd1cc84df6c..58ea7f18bcd1 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/divide_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v2 /= 6;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp
index e3d308abacc1..2cc2cce564f4 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v3 -= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_value.pass.cpp
index 27ea8c2c0366..49d7c7f5b54d 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/minus_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 -= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp
index 1754a5575eb5..3bbff99430af 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v2 %= v1;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v2[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_value.pass.cpp
index 794a0b629268..d372d88a4cfb 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/modulo_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 %= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp
index 0d70b4e715da..4a1be1916f8a 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/or_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 |= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/or_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/or_value.pass.cpp
index 4030907ff3e7..bab99bca0f39 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/or_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/or_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 |= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp
index fdf999c2a044..5f6047f65f4a 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 += v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_value.pass.cpp
index 23d6d9d05229..0b5e88edaeed 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/plus_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 += 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp
index ad44e3887eca..962648118662 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 <<= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_value.pass.cpp
index 366407a95c6f..05fa3b94c6bc 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_left_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 <<= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp
index f7df16b843ca..7161d27e60d7 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v3 >>= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_value.pass.cpp
index 7c568b14cbea..726ac9b8f90b 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/shift_right_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v2 >>= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp
index d3cf1eb88641..02c0cc59e74e 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/times_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 *= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/times_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/times_value.pass.cpp
index aea9806bc0d0..1740e449d11b 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/times_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/times_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 *= 6;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp
index a10bd7e0a000..452b581e0b2e 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,7 +31,7 @@ int main()
v1 ^= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v3[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_value.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_value.pass.cpp
index 327952f7b3aa..6951653b46b6 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_value.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cassign/xor_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,7 +28,7 @@ int main()
std::valarray<T> v2(a2, N);
v1 ^= 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/copy.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/copy.pass.cpp
index 04ac2cdf1b90..6ebff7256498 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cons/copy.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cons/copy.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v[i]);
}
{
@@ -35,7 +36,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v[i]);
}
{
@@ -45,10 +46,10 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v2[i][j] == v[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp
index 1ab460f1b9d5..4dfbe11bde9c 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp
@@ -25,7 +25,7 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v = {1, 2, 3, 4, 5};
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
@@ -34,7 +34,7 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v = {1, 2, 3, 4, 5};
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp
index 6ac8773fa4e2..a9692618e75f 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp
@@ -16,6 +16,7 @@
#include <valarray>
#include <utility>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -39,7 +40,7 @@ int main()
std::valarray<T> v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a[i]);
}
{
@@ -50,10 +51,10 @@ int main()
std::valarray<T> v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
- for (int j = 0; j < v2[i].size(); ++j)
+ for (std::size_t j = 0; j < v2[i].size(); ++j)
assert(v2[i][j] == a[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/pointer_size.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/pointer_size.pass.cpp
index 3d3649ee40ac..f98230f47dd9 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.cons/pointer_size.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.cons/pointer_size.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -24,7 +25,7 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
@@ -33,7 +34,7 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
@@ -42,10 +43,10 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i].size() == a[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v[i][j] == a[i][j]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.members/resize.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.members/resize.pass.cpp
index 176d958aab92..9a527c2509b4 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.members/resize.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.members/resize.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,17 +26,17 @@ int main()
std::valarray<T> v1(a1, N1);
v1.resize(8);
assert(v1.size() == 8);
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == 0);
v1.resize(0);
assert(v1.size() == 0);
v1.resize(80);
assert(v1.size() == 80);
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == 0);
v1.resize(40);
assert(v1.size() == 40);
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == 0);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.members/swap.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.members/swap.pass.cpp
index a90a80936376..b2b55fdc3c43 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.members/swap.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.members/swap.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -30,33 +31,31 @@ int main()
std::valarray<T> v2_save = v2;
v1.swap(v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
T a1[] = {1, 2, 3, 4, 5};
const unsigned N1 = sizeof(a1)/sizeof(a1[0]);
- const unsigned N2 = 0;
std::valarray<T> v1(a1, N1);
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
std::valarray<T> v2_save = v2;
v1.swap(v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
T a2[] = {6, 7, 8, 9, 10, 11, 12};
- const unsigned N1 = 0;
const unsigned N2 = sizeof(a2)/sizeof(a2[0]);
std::valarray<T> v1;
std::valarray<T> v2(a2, N2);
@@ -64,26 +63,24 @@ int main()
std::valarray<T> v2_save = v2;
v1.swap(v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
- const unsigned N1 = 0;
- const unsigned N2 = 0;
std::valarray<T> v1;
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
std::valarray<T> v2_save = v2;
v1.swap(v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp
index c1d240cb6798..5b2501f7e357 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.unary/bit_not.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = ~v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == ~v[i]);
}
{
@@ -35,10 +36,10 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = ~v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v2[i][j] == ~v[i][j]);
}
}
@@ -49,7 +50,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = ~(v + v);
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == ~(2*v[i]));
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp
index 25674bb44d92..f4a83427cd2b 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.unary/negate.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = -v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == -v[i]);
}
{
@@ -35,7 +36,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = -v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == -v[i]);
}
{
@@ -45,10 +46,10 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = -v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v2[i][j] == -v[i][j]);
}
}
@@ -59,7 +60,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = -(v + v);
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == -2*v[i]);
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
index 306ea0c18470..844b3d2100b3 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.unary/not.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<bool> v2 = !v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == !v[i]);
}
{
@@ -35,7 +36,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<bool> v2 = !(v + v);
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == !(2 * v[i]));
}
}
diff --git a/test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp
index 4bcdaf095ff5..8df0494552d3 100644
--- a/test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp
+++ b/test/std/numerics/numarray/template.valarray/valarray.unary/plus.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -25,7 +26,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = +v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == +v[i]);
}
{
@@ -35,7 +36,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = +v;
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == +v[i]);
}
{
@@ -45,10 +46,10 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = +v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
- for (int j = 0; j < v[i].size(); ++j)
+ for (std::size_t j = 0; j < v[i].size(); ++j)
assert(v2[i][j] == +v[i][j]);
}
}
@@ -59,7 +60,7 @@ int main()
std::valarray<T> v(a, N);
std::valarray<T> v2 = +(v + v);
assert(v2.size() == v.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == +2*v[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp
index 9214e61fb4da..724b86841162 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 & v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp
index 0976a88dcb81..360ffe5ebf84 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 & 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp
index e3dd180b2181..7de81179d9f4 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/and_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 & v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp
index ff250afd2a1a..cb02459cd911 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 / v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp
index ffbebab1e1ae..0b692aa35a2d 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 / 6;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp
index 1a7f2f07c83a..c6c339b2a445 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/divide_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 / v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp
index 1f0354e8ac63..ddea683ceae2 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 - v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp
index 382cab8eae6e..b5fc58a9f5e1 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 - 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp
index 7f00aba84884..1780eda20d58 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/minus_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 - v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp
index 0a9cf3884c08..58b78a322091 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 % v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp
index 12c4c2453702..083fdabd8aa4 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 % 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp
index 1d73887217e1..55801ca69dad 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/modulo_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 % v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp
index a23ea4f58b8c..adea116c9f94 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 | v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp
index f617c27ae7fc..3f526b8f6619 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 | 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp
index 8903f438aaf1..246a48532df0 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/or_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 | v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp
index 1167772aff6a..82ebebaa7b17 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 + v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp
index b1b4e6931c0c..68c7528215e5 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 + 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp
index df22853488e9..723ec62d8363 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/plus_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 + v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp
index 42a7c419a3a3..31d50eeb8185 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 << v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp
index 753ba38f357f..646b55ed3374 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 << 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp
index 640ce1a47b32..5ddce6fd499f 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_left_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 << v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp
index 8e6358d62060..b6c4c115038b 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 >> v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp
index 0c0ba54463e1..abc7726dee92 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 >> 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp
index ad5418af0267..956ec055c47e 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/shift_right_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 40 >> v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp
index 69a3bffc3e77..23cbdbe922cb 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 * v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp
index c4fb410de768..cf87f0094cd0 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 * 6;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp
index f5d877783ded..23b078e2d1ab 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/times_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 6 * v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp
index 71b505b0cbe8..e550d0c7fe37 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -29,7 +30,7 @@ int main()
std::valarray<T> v3 = v1 ^ v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp
index 8dbe6843cd24..d7d5aa497ab4 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_valarray_value.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = v1 ^ 3;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp
index face0635dfb4..3e83ff9ae176 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.binary/xor_value_valarray.pass.cpp
@@ -15,6 +15,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,7 +27,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v2 = 3 ^ v1;
assert(v1.size() == v2.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == a2[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp
index af2a1b3ed792..003ed3d2cfba 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 && v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp
index f34fe9642574..59f2999a2a1d 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 && 5;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
{
@@ -39,7 +40,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 && 0;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp
index c323d13ff42d..9be01bfcdd8f 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/and_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 5 && v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
{
@@ -39,7 +40,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 0 && v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp
index 6222e91595dd..78dabed3a46b 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 == v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp
index dca65055b2a0..31c040bfe530 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 == 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp
index 532219e2e858..89d627de5e7a 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/equal_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 == v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp
index 75e62693baef..f4a5e18e839d 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 >= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp
index 020706dfa2ef..f0ea1e9f1e5f 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 >= 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp
index faf2003adb7f..99b97d55cce2 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_equal_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 >= v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp
index 3276085f37dc..bdfd191e4170 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 > v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp
index 1ab774cdfb48..a6cef86721df 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 > 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp
index c5012d6fc0e5..712e39681e6f 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/greater_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 > v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp
index ceb6658833eb..8ba8394fac12 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 <= v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp
index 4a391a3f3799..242ce8a42c2e 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 <= 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp
index cf34e18b92c0..1b9ea4dccf56 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_equal_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 <= v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp
index 0fa99488b791..5a5408537e8d 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 < v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp
index 7a47c900a8f8..50b074a1b619 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 < 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp
index 4d6cbadcc8b5..248037d44ab3 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/less_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 < v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp
index c9675a9ce3e7..a4404d14a084 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 != v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp
index 9daa7289b715..45df48f944c0 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 != 2;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp
index 37439aabcb28..8545464470e7 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/not_equal_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 2 != v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp
index 9a2f84e8f7da..1f2a7da9667c 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -31,7 +32,7 @@ int main()
std::valarray<bool> v3 = v1 || v2;
assert(v1.size() == v2.size());
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp
index 789df5badf04..426c0558bee4 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_valarray_value.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 || 5;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
{
@@ -39,7 +40,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<bool> v3 = v1 || 0;
assert(v1.size() == v3.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp
index d66905960274..3bf0fe79da96 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.comparison/or_value_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 5 || v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
{
@@ -39,7 +40,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<bool> v3 = 0 || v2;
assert(v2.size() == v3.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp
index 84f73945c401..cb1807bf3809 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.special/swap.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -32,33 +33,31 @@ int main()
std::valarray<T> v2_save = v2;
swap(v1, v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
T a1[] = {1, 2, 3, 4, 5};
const unsigned N1 = sizeof(a1)/sizeof(a1[0]);
- const unsigned N2 = 0;
std::valarray<T> v1(a1, N1);
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
std::valarray<T> v2_save = v2;
swap(v1, v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
T a2[] = {6, 7, 8, 9, 10, 11, 12};
- const unsigned N1 = 0;
const unsigned N2 = sizeof(a2)/sizeof(a2[0]);
std::valarray<T> v1;
std::valarray<T> v2(a2, N2);
@@ -66,26 +65,24 @@ int main()
std::valarray<T> v2_save = v2;
swap(v1, v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
{
typedef int T;
- const unsigned N1 = 0;
- const unsigned N2 = 0;
std::valarray<T> v1;
std::valarray<T> v2;
std::valarray<T> v1_save = v1;
std::valarray<T> v2_save = v2;
swap(v1, v2);
assert(v1.size() == v2_save.size());
- for (int i = 0; i < v1.size(); ++i)
+ for (std::size_t i = 0; i < v1.size(); ++i)
assert(v1[i] == v2_save[i]);
assert(v2.size() == v1_save.size());
- for (int i = 0; i < v2.size(); ++i)
+ for (std::size_t i = 0; i < v2.size(); ++i)
assert(v2[i] == v1_save[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp
index 7d112a61140e..9af8b1a9365c 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/abs_valarray.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -28,7 +29,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = abs(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(v3[i] == a3[i]);
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp
index ef2451d76457..2814e2ed1b00 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/acos_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = acos(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp
index 11c7c68d664a..f2f873cc6169 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/asin_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = asin(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp
index b860413805b8..d5ae07be3634 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -47,7 +48,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<T> v3 = atan2(v1, v2);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp
index 94ffebf79d8d..8345f950dead 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_valarray_value.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = atan2(v1, .75);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp
index 360e70ee7cdd..f28a69a174da 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan2_value_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = atan2(.75, v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp
index e66118b1d6de..78740a2b8fe2 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/atan_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = atan(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp
index baeb0d067008..eb5b9a3073d5 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cos_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = cos(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp
index 02a547a54404..f8075d31b7e3 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/cosh_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = cosh(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp
index dce9c5546f78..741e1abba8dd 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/exp_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = exp(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp
index 2b9908198476..a2cfe6846c2d 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log10_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = log10(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp
index 2c51cd6ed405..d3795f97f19a 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/log_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = log(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp
index 37ca74292aad..d0f8bdb7c482 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -47,7 +48,7 @@ int main()
std::valarray<T> v2(a2, N);
std::valarray<T> v3 = pow(v1, v2);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp
index 290ddc6f63da..22017237bfa8 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_valarray_value.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = pow(v1, 2.0);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp
index f52990b4be7d..e34f664c2bcf 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/pow_value_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = pow(2.0, v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp
index f05bd058fd72..30b30caf9713 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sin_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = sin(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp
index 73dca833bf24..6fbb4f0635f3 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sinh_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = sinh(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp
index 193dcd21fd1e..e577a83ad6be 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/sqrt_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = sqrt(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
index 021dbc4d7754..9db12a351fbf 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tan_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = tan(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
index 4cc58c321af1..dfcd53106cf5 100644
--- a/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
+++ b/test/std/numerics/numarray/valarray.nonmembers/valarray.transcend/tanh_valarray.pass.cpp
@@ -18,6 +18,7 @@
#include <valarray>
#include <cassert>
#include <sstream>
+#include <cstddef>
bool is_about(double x, double y, int p)
{
@@ -45,7 +46,7 @@ int main()
std::valarray<T> v1(a1, N);
std::valarray<T> v3 = tanh(v1);
assert(v3.size() == v1.size());
- for (int i = 0; i < v3.size(); ++i)
+ for (std::size_t i = 0; i < v3.size(); ++i)
assert(is_about(v3[i], a3[i], 10));
}
}
diff --git a/test/std/numerics/numarray/valarray.range/end_const.pass.cpp b/test/std/numerics/numarray/valarray.range/end_const.pass.cpp
index 7363508943bb..4d0015343e95 100644
--- a/test/std/numerics/numarray/valarray.range/end_const.pass.cpp
+++ b/test/std/numerics/numarray/valarray.range/end_const.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -26,6 +27,6 @@ int main()
const unsigned N = sizeof(a)/sizeof(a[0]);
const std::valarray<T> v(a, N);
assert(v[v.size()-1] == 5);
- assert(end(v) - begin(v) == v.size());
+ assert(static_cast<std::size_t>(end(v) - begin(v)) == v.size());
}
}
diff --git a/test/std/numerics/numarray/valarray.range/end_non_const.pass.cpp b/test/std/numerics/numarray/valarray.range/end_non_const.pass.cpp
index f095f5cc35ee..012434e8a6e6 100644
--- a/test/std/numerics/numarray/valarray.range/end_non_const.pass.cpp
+++ b/test/std/numerics/numarray/valarray.range/end_non_const.pass.cpp
@@ -17,6 +17,7 @@
#include <valarray>
#include <cassert>
+#include <cstddef>
int main()
{
@@ -27,6 +28,6 @@ int main()
std::valarray<T> v(a, N);
*(end(v) - 1) = 10;
assert(v[v.size()-1] == 10);
- assert(end(v) - begin(v) == v.size());
+ assert(static_cast<std::size_t>(end(v) - begin(v)) == v.size());
}
}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp
new file mode 100644
index 000000000000..7a8a60835f83
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd(false, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp
new file mode 100644
index 000000000000..909d7cbfc4f4
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd(2, true);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp
new file mode 100644
index 000000000000..75a1bc128761
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd<volatile bool, int>(false, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp
new file mode 100644
index 000000000000..406b498508a9
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd<int, const bool>(2, true);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
new file mode 100644
index 000000000000..9354a4eb0287
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd(2.0, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
new file mode 100644
index 000000000000..fa1b7da4811a
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::gcd(4, 6.0);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
new file mode 100644
index 000000000000..af065b84d1bb
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
@@ -0,0 +1,132 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <numeric>
+#include <cassert>
+#include <cstdlib> // for rand()
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 1},
+ {0, 1, 1},
+ {1, 1, 1},
+ {2, 3, 1},
+ {2, 4, 2},
+ {36, 17, 1},
+ {36, 18, 18}
+};
+
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::gcd(in1, in2))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::gcd(in2, in1))>::value), "" );
+ return out == std::gcd(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp
new file mode 100644
index 000000000000..1492c25adfc8
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm(false, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp
new file mode 100644
index 000000000000..de891f3ee654
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm(2, true);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp
new file mode 100644
index 000000000000..d2a7f52e572a
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm<volatile bool, int>(false, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp
new file mode 100644
index 000000000000..88ca68bf08a9
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm<int, const bool>(2, true);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
new file mode 100644
index 000000000000..082631dc038e
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm(2.0, 4);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
new file mode 100644
index 000000000000..8ab68a4e6992
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n)
+
+// Remarks: If either M or N is not an integer type,
+// or if either is (a possibly cv-qualified) bool, the program is ill-formed.
+
+#include <numeric>
+
+
+int main()
+{
+ std::lcm(4, 6.0);
+}
diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
new file mode 100644
index 000000000000..cd03d99ebf13
--- /dev/null
+++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <numeric>
+
+// template<class _M, class _N>
+// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n)
+
+#include <numeric>
+#include <cassert>
+#include <cstdlib>
+#include <iostream>
+
+constexpr struct {
+ int x;
+ int y;
+ int expect;
+} Cases[] = {
+ {0, 0, 0},
+ {1, 0, 0},
+ {0, 1, 0},
+ {1, 1, 1},
+ {2, 3, 6},
+ {2, 4, 4},
+ {3, 17, 51},
+ {36, 18, 36}
+};
+
+template <typename Input1, typename Input2, typename Output>
+constexpr bool test0(Input1 in1, Input2 in2, Output out)
+{
+ static_assert((std::is_same<Output, decltype(std::lcm(Input1(0), Input2(0)))>::value), "" );
+ static_assert((std::is_same<Output, decltype(std::lcm(Input2(0), Input1(0)))>::value), "" );
+ return out == std::lcm(in1, in2) ? true : (std::abort(), false);
+}
+
+
+template <typename Input1, typename Input2 = Input1>
+constexpr bool do_test(int = 0)
+{
+ using S1 = typename std::make_signed<Input1>::type;
+ using S2 = typename std::make_signed<Input2>::type;
+ using U1 = typename std::make_unsigned<Input1>::type;
+ using U2 = typename std::make_unsigned<Input2>::type;
+ bool accumulate = true;
+ for (auto TC : Cases) {
+ { // Test with two signed types
+ using Output = std::common_type_t<S1, S2>;
+ accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
+ accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
+ }
+ { // test with two unsigned types
+ using Output = std::common_type_t<U1, U2>;
+ accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S1, U2>;
+ accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
+ }
+ { // Test with mixed signs
+ using Output = std::common_type_t<S2, U1>;
+ accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
+ accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
+ accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
+ }
+ }
+ return accumulate;
+}
+
+int main()
+{
+ auto non_cce = std::rand(); // a value that can't possibly be constexpr
+
+ static_assert(do_test<signed char>(), "");
+ static_assert(do_test<short>(), "");
+ static_assert(do_test<int>(), "");
+ static_assert(do_test<long>(), "");
+ static_assert(do_test<long long>(), "");
+
+ assert(do_test<signed char>(non_cce));
+ assert(do_test<short>(non_cce));
+ assert(do_test<int>(non_cce));
+ assert(do_test<long>(non_cce));
+ assert(do_test<long long>(non_cce));
+
+ static_assert(do_test< int8_t>(), "");
+ static_assert(do_test<int16_t>(), "");
+ static_assert(do_test<int32_t>(), "");
+ static_assert(do_test<int64_t>(), "");
+
+ assert(do_test< int8_t>(non_cce));
+ assert(do_test<int16_t>(non_cce));
+ assert(do_test<int32_t>(non_cce));
+ assert(do_test<int64_t>(non_cce));
+
+ static_assert(do_test<signed char, int>(), "");
+ static_assert(do_test<int, signed char>(), "");
+ static_assert(do_test<short, int>(), "");
+ static_assert(do_test<int, short>(), "");
+ static_assert(do_test<int, long>(), "");
+ static_assert(do_test<long, int>(), "");
+ static_assert(do_test<int, long long>(), "");
+ static_assert(do_test<long long, int>(), "");
+
+ assert((do_test<signed char, int>(non_cce)));
+ assert((do_test<int, signed char>(non_cce)));
+ assert((do_test<short, int>(non_cce)));
+ assert((do_test<int, short>(non_cce)));
+ assert((do_test<int, long>(non_cce)));
+ assert((do_test<long, int>(non_cce)));
+ assert((do_test<int, long long>(non_cce)));
+ assert((do_test<long long, int>(non_cce)));
+}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
index 53e4c29affc4..f819f48b1975 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp
@@ -35,8 +35,13 @@ test1()
typedef std::ranlux24 E;
static_assert((E::block_size == 223), "");
static_assert((E::used_block == 23), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFF), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFF));
+#endif
where(E::block_size);
where(E::used_block);
}
@@ -47,8 +52,13 @@ test2()
typedef std::ranlux48 E;
static_assert((E::block_size == 389), "");
static_assert((E::used_block == 11), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFFFFFFull), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFFFFFFull));
+#endif
where(E::block_size);
where(E::used_block);
}
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
index 1c2b2a80c59b..a5893ead732d 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/eval.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
template <class UIntType, UIntType Min, UIntType Max>
class rand1
{
@@ -30,14 +32,14 @@ private:
static_assert(Min < Max, "rand1 invalid parameters");
public:
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION)
// Workaround for lack of constexpr in C++03
static const result_type _Min = Min;
static const result_type _Max = Max;
#endif
- static _LIBCPP_CONSTEXPR result_type min() {return Min;}
- static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+ static TEST_CONSTEXPR result_type min() {return Min;}
+ static TEST_CONSTEXPR result_type max() {return Max;}
explicit rand1(result_type sd = Min) : x_(sd)
{
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp
index 78040ad987d1..9ae955478017 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/result_type.pass.cpp
@@ -19,6 +19,8 @@
#include <random>
#include <type_traits>
+#include "test_macros.h"
+
template <class UIntType, UIntType Min, UIntType Max>
class rand1
{
@@ -32,14 +34,14 @@ private:
static_assert(Min < Max, "rand1 invalid parameters");
public:
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION)
// Workaround for lack of constexpr in C++03
static const result_type _Min = Min;
static const result_type _Max = Max;
#endif
- static _LIBCPP_CONSTEXPR result_type min() {return Min;}
- static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+ static TEST_CONSTEXPR result_type min() {return Min;}
+ static TEST_CONSTEXPR result_type max() {return Max;}
explicit rand1(result_type sd = Min) : x_(sd)
{
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
index 20ca7d5510bf..187a71edcd7e 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp
@@ -28,16 +28,26 @@ void
test1()
{
typedef std::independent_bits_engine<std::ranlux24, 32, unsigned> E;
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFF)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFF), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFF));
+#endif
}
void
test2()
{
typedef std::independent_bits_engine<std::ranlux48, 64, unsigned long long> E;
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFFFFFFFFFFull)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFFFFFFFFFFull));
+#endif
}
int main()
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp
index c218c17dde69..d2a5292e1323 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/eval.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
template <class UIntType, UIntType Min, UIntType Max>
class rand1
{
@@ -30,14 +32,14 @@ private:
static_assert(Min < Max, "rand1 invalid parameters");
public:
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION)
// Workaround for lack of constexpr in C++03
static const result_type _Min = Min;
static const result_type _Max = Max;
#endif
- static _LIBCPP_CONSTEXPR result_type min() {return Min;}
- static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+ static TEST_CONSTEXPR result_type min() {return Min;}
+ static TEST_CONSTEXPR result_type max() {return Max;}
explicit rand1(result_type sd = Min) : x_(sd)
{
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp
index 3271d933cb27..a6f1eadb0884 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/result_type.pass.cpp
@@ -19,6 +19,8 @@
#include <random>
#include <type_traits>
+#include "test_macros.h"
+
template <class UIntType, UIntType Min, UIntType Max>
class rand1
{
@@ -32,14 +34,14 @@ private:
static_assert(Min < Max, "rand1 invalid parameters");
public:
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER < 11 && defined(_LIBCPP_VERSION)
// Workaround for lack of constexpr in C++03
static const result_type _Min = Min;
static const result_type _Max = Max;
#endif
- static _LIBCPP_CONSTEXPR result_type min() {return Min;}
- static _LIBCPP_CONSTEXPR result_type max() {return Max;}
+ static TEST_CONSTEXPR result_type min() {return Min;}
+ static TEST_CONSTEXPR result_type max() {return Max;}
explicit rand1(result_type sd = Min) : x_(sd)
{
diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
index eb42d644d301..be5b4a9786af 100644
--- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
+++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp
@@ -33,8 +33,13 @@ test1()
{
typedef std::knuth_b E;
static_assert(E::table_size == 256, "");
- /*static_*/assert((E::min() == 1)/*, ""*/);
- /*static_*/assert((E::max() == 2147483646)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 1), "");
+ static_assert((E::max() == 2147483646), "");
+#else
+ assert((E::min() == 1));
+ assert((E::max() == 2147483646));
+#endif
where(E::table_size);
}
diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp
index 8c45bb19a0a6..730576844a0b 100644
--- a/test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <random>
// class random_device;
@@ -44,11 +43,15 @@ void check_random_device_valid(const std::string &token) {
}
void check_random_device_invalid(const std::string &token) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
try {
std::random_device r(token);
LIBCPP_ASSERT(false);
} catch (const std::system_error&) {
}
+#else
+ ((void)token);
+#endif
}
diff --git a/test/std/numerics/rand/rand.device/entropy.pass.cpp b/test/std/numerics/rand/rand.device/entropy.pass.cpp
index f01e5653391f..141a84a6d9bd 100644
--- a/test/std/numerics/rand/rand.device/entropy.pass.cpp
+++ b/test/std/numerics/rand/rand.device/entropy.pass.cpp
@@ -20,4 +20,5 @@ int main()
{
std::random_device r;
double e = r.entropy();
+ ((void)e); // Prevent unused warning
}
diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp
index eabcc201e068..890f4caa31a7 100644
--- a/test/std/numerics/rand/rand.device/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <random>
// class random_device;
@@ -24,8 +23,10 @@ int main()
{
std::random_device r;
std::random_device::result_type e = r();
+ ((void)e); // Prevent unused warning
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::random_device r("/dev/null");
@@ -35,4 +36,5 @@ int main()
catch (const std::system_error&)
{
}
+#endif
}
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
index b267c2477e91..0118ae0bf7d1 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval.pass.cpp
@@ -17,6 +17,7 @@
#include <numeric>
#include <vector>
#include <cassert>
+#include <cstddef>
template <class T>
inline
@@ -42,7 +43,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -78,7 +79,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
index f96df82304f0..0cdb0b77a617 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bernoulli/eval_param.pass.cpp
@@ -17,6 +17,7 @@
#include <numeric>
#include <vector>
#include <cassert>
+#include <cstddef>
template <class T>
inline
@@ -44,7 +45,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -82,7 +83,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
index 88004ba4a741..de5b153e0d13 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -49,7 +49,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -92,7 +92,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -178,7 +178,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -187,7 +187,7 @@ test4()
kurtosis += d2 * d2;
}
var /= u.size();
- double dev = std::sqrt(var);
+ //double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -227,7 +227,7 @@ test5()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -236,7 +236,7 @@ test5()
kurtosis += d2 * d2;
}
var /= u.size();
- double dev = std::sqrt(var);
+// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -276,7 +276,7 @@ test6()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -319,7 +319,7 @@ test7()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -352,8 +352,12 @@ test8()
std::binomial_distribution<> dist1(5, 0.1);
std::binomial_distribution<unsigned> dist2(5, 0.1);
- for(int i = 0; i < N; ++i)
- assert(dist1(gen1) == dist2(gen2));
+ for(int i = 0; i < N; ++i) {
+ int r1 = dist1(gen1);
+ unsigned r2 = dist2(gen2);
+ assert(r1 >= 0);
+ assert(static_cast<unsigned>(r1) == r2);
+ }
}
void
@@ -376,7 +380,7 @@ test9()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -385,7 +389,7 @@ test9()
kurtosis += d2 * d2;
}
var /= u.size();
- double dev = std::sqrt(var);
+// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -425,7 +429,7 @@ test10()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -434,7 +438,7 @@ test10()
kurtosis += d2 * d2;
}
var /= u.size();
- double dev = std::sqrt(var);
+// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
@@ -474,7 +478,7 @@ test11()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -483,7 +487,7 @@ test11()
kurtosis += d2 * d2;
}
var /= u.size();
- double dev = std::sqrt(var);
+// double dev = std::sqrt(var);
// In this case:
// skew computes to 0./0. == nan
// kurtosis computes to 0./0. == nan
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
index 092a69778513..5ce0cb412cb2 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval_param.pass.cpp
@@ -51,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -93,7 +93,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
index 4e9f9d3c044d..6e6072a4faf9 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval.pass.cpp
@@ -49,7 +49,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -92,7 +92,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -178,7 +178,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -221,7 +221,7 @@ test5()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -264,7 +264,7 @@ test6()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
index c451f0130904..254c347b3d25 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.geo/eval_param.pass.cpp
@@ -51,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -93,7 +93,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
index 929e6e7e6c3b..17503364e030 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
@@ -49,7 +49,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -92,7 +92,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -178,7 +178,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -193,8 +193,8 @@ test4()
kurtosis -= 3;
double x_mean = d.k() * (1 - d.p()) / d.p();
double x_var = x_mean / d.p();
- double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
- double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
+// double x_skew = (2 - d.p()) / std::sqrt(d.k() * (1 - d.p()));
+// double x_kurtosis = 6. / d.k() + sqr(d.p()) / (d.k() * (1 - d.p()));
assert(mean == x_mean);
assert(var == x_var);
}
@@ -219,7 +219,7 @@ test5()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -262,7 +262,7 @@ test6()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
index 2710061a1a05..6467dbf5754d 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin/eval_param.pass.cpp
@@ -51,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -93,7 +93,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
index f6bc3c73993c..3b54790aee0a 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -89,7 +90,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -129,7 +130,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
index fd52a0488979..dbc2d09dfd97 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval_param.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -50,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -91,7 +92,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -132,7 +133,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
index 091bbb9bb452..4da7f2e70e9b 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp
@@ -34,7 +34,7 @@ double
I(double x, unsigned a, unsigned b)
{
double r = 0;
- for (int j = a; j <= a+b-1; ++j)
+ for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
std::pow(1-x, a+b-1-j);
return r;
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
index 774137154e09..74025b701504 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval_param.pass.cpp
@@ -34,7 +34,7 @@ double
I(double x, unsigned a, unsigned b)
{
double r = 0;
- for (int j = a; j <= a+b-1; ++j)
+ for (int j = a; static_cast<unsigned>(j) <= a+b-1; ++j)
r += fac(a+b-1)/(fac(j) * fac(a + b - 1 - j)) * std::pow(x, j) *
std::pow(1-x, a+b-1-j);
return r;
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
index 2ad6784cd878..cfaddb73f0b8 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval.pass.cpp
@@ -49,7 +49,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -94,7 +94,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -139,7 +139,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -184,7 +184,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -229,7 +229,7 @@ test5()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
index 8f397fcab096..35596a0d7df5 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.lognormal/eval_param.pass.cpp
@@ -50,7 +50,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -96,7 +96,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -142,7 +142,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -188,7 +188,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -234,7 +234,7 @@ test5()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
index 69f786397711..e1084d3ef03d 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -45,7 +46,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
index af9c547cb7f9..8527052c7182 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -46,7 +47,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
index 9210e8a8d350..b207eece67d0 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval.pass.cpp
@@ -45,7 +45,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -81,7 +81,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -117,7 +117,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
index 93053f0a36b7..983a2d243744 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.t/eval_param.pass.cpp
@@ -46,7 +46,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -83,7 +83,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -120,7 +120,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
index 42965b0e6ab2..223d6f4d2216 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -89,7 +90,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -129,7 +130,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
index e7de18fdb434..465f5a70a655 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval_param.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -50,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
index 3f1b331889e5..3999cbeccbb7 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval.pass.cpp
@@ -48,7 +48,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -90,7 +90,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -132,7 +132,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -174,7 +174,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
index 21bf774228f8..b69a04cc1755 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.extreme/eval_param.pass.cpp
@@ -49,7 +49,7 @@ test1()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -92,7 +92,7 @@ test2()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -135,7 +135,7 @@ test3()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -178,7 +178,7 @@ test4()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
index 7c23630ed1e1..d0ac16298e42 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval.pass.cpp
@@ -49,7 +49,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -89,7 +89,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -129,7 +129,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
index 54a89b6b3f40..12167c54f737 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.gamma/eval_param.pass.cpp
@@ -50,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -91,7 +91,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -132,7 +132,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
index a475624a58a8..12fcfa354fd3 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp
@@ -48,7 +48,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -87,7 +87,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -126,7 +126,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
index d24fbd9f9cf5..caa56eaab4ad 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.poisson/eval_param.pass.cpp
@@ -50,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -91,7 +91,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -132,7 +132,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
index cfec8c0d81e1..10337907b964 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -93,7 +94,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -137,7 +138,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
index a19654dbd575..e13507672553 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval_param.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -50,7 +51,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -95,7 +96,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -140,7 +141,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
index 3111912ec29c..14a59621fa5d 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval.pass.cpp
@@ -51,10 +51,10 @@ test1()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -114,10 +114,10 @@ test2()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -177,10 +177,10 @@ test3()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -240,10 +240,10 @@ test4()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -303,10 +303,10 @@ test5()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -366,10 +366,10 @@ test6()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -429,10 +429,10 @@ test7()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -492,10 +492,10 @@ test8()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -555,10 +555,10 @@ test9()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -618,10 +618,10 @@ test10()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
@@ -681,10 +681,10 @@ test11()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
index ffd53c05d37e..b374c5ec22de 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/eval_param.pass.cpp
@@ -22,6 +22,7 @@
#include <iterator>
#include <numeric>
#include <cassert>
+#include <cstddef>
template <class T>
inline
@@ -53,10 +54,10 @@ int main()
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
index 03da9b8960e4..7da4b9bfb1e5 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -53,7 +53,7 @@ test1()
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -67,16 +67,16 @@ test1()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
@@ -106,7 +106,7 @@ test2()
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -120,16 +120,16 @@ test2()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
@@ -157,9 +157,9 @@ test3()
double p[] = {1, 0, 0, 0};
const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
D d(b, b+Np+1, p);
- const int N = 1000000;
+ const size_t N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -173,16 +173,16 @@ test3()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
@@ -212,7 +212,7 @@ test4()
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -226,16 +226,16 @@ test4()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
@@ -243,7 +243,7 @@ test4()
a = 0;
for (int j = 0; j < k; ++j)
a += areas[j];
- assert(k < Np);
+ assert(k < static_cast<int>(Np));
m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
bk = b[k];
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
@@ -266,7 +266,7 @@ test5()
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -280,17 +280,17 @@ test5()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
assert(i < Np);
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
@@ -298,7 +298,7 @@ test5()
a = 0;
for (int j = 0; j < k; ++j)
a += areas[j];
- assert(k < Np);
+ assert(k < static_cast<int>(Np));
m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
bk = b[k];
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
@@ -321,7 +321,7 @@ test6()
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
@@ -335,16 +335,16 @@ test6()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
index 8054a69fed87..f455dcff900e 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -50,9 +50,9 @@ int main()
const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
D d;
P pa(b, b+Np+1, p);
- const int N = 1000000;
+ const size_t N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g, pa);
assert(10 <= v && v < 17);
@@ -66,16 +66,16 @@ int main()
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
index 2abc9d4c6dd5..1be34f615712 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -90,7 +91,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -131,7 +132,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -172,7 +173,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -213,7 +214,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -254,7 +255,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -295,7 +296,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -336,7 +337,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -377,7 +378,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
@@ -429,7 +430,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
index 849f25107fa8..bb5a59d4f5b8 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/eval_param.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
index e000363f3215..621fdc1bfe8c 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -89,7 +90,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -129,7 +130,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -169,7 +170,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -209,7 +210,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -249,7 +250,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -289,7 +290,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -329,7 +330,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -369,7 +370,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -409,7 +410,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
@@ -449,7 +450,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
index d351f0caed71..8a06220630fa 100644
--- a/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
+++ b/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.real/eval_param.pass.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <vector>
#include <numeric>
+#include <cstddef>
template <class T>
inline
@@ -49,7 +50,7 @@ int main()
D::result_type var = 0;
D::result_type skew = 0;
D::result_type kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (std::size_t i = 0; i < u.size(); ++i)
{
D::result_type dbl = (u[i] - mean);
D::result_type d2 = sqr(dbl);
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
index 8c09f4fd0109..d96ccf9de7f5 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
@@ -37,7 +37,7 @@ test()
test1<T, 0, 0, 0>();
test1<T, 0, 1, 2>();
test1<T, 1, 1, 2>();
- const T M(~0);
+ const T M(static_cast<T>(-1));
test1<T, 0, 0, M>();
test1<T, 0, M-2, M>();
test1<T, 0, M-1, M>();
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
index 4b2b20da13ab..b38e8f583f23 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
@@ -37,7 +37,7 @@ test()
test1<T, 0, 0, 0>();
test1<T, 0, 1, 2>();
test1<T, 1, 1, 2>();
- const T M(~0);
+ const T M(static_cast<T>(-1));
test1<T, 0, 0, M>();
test1<T, 0, M-2, M>();
test1<T, 0, M-1, M>();
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
index 6c4a7f434f12..734b4209984a 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
@@ -36,7 +36,7 @@ test()
test1<T, 0, 0, 0>();
test1<T, 0, 1, 2>();
test1<T, 1, 1, 2>();
- const T M(~0);
+ const T M(static_cast<T>(-1));
test1<T, 0, 0, M>();
test1<T, 0, M-2, M>();
test1<T, 0, M-1, M>();
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
index 1afbe75efa58..8156d63f08da 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
@@ -21,7 +21,7 @@ template <class T>
void
test1()
{
- for (int s = 0; s < 20; ++s)
+ for (T s = 0; s < 20; ++s)
{
typedef std::linear_congruential_engine<T, 2, 3, 7> E;
E e1(s);
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
index 857a478a5579..cd496fdbc5e0 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
@@ -37,8 +37,27 @@ test1()
static_assert((LCE::multiplier == a), "");
static_assert((LCE::increment == c), "");
static_assert((LCE::modulus == m), "");
- /*static_*/assert((LCE::min() == (c == 0u ? 1u: 0u))/*, ""*/);
- /*static_*/assert((LCE::max() == result_type(m - 1u))/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((LCE::min() == (c == 0u ? 1u: 0u)), "");
+#else
+ assert((LCE::min() == (c == 0u ? 1u: 0u)));
+#endif
+
+#ifdef _MSC_VER
+ #pragma warning(push)
+ #pragma warning(disable: 4310) // cast truncates constant value
+#endif // _MSC_VER
+
+#if TEST_STD_VER >= 11
+ static_assert((LCE::max() == result_type(m - 1u)), "");
+#else
+ assert((LCE::max() == result_type(m - 1u)));
+#endif
+
+#ifdef _MSC_VER
+ #pragma warning(pop)
+#endif // _MSC_VER
+
static_assert((LCE::default_seed == 1), "");
where(LCE::multiplier);
where(LCE::increment);
@@ -53,7 +72,7 @@ test()
test1<T, 0, 0, 0>();
test1<T, 0, 1, 2>();
test1<T, 1, 1, 2>();
- const T M(~0);
+ const T M(static_cast<T>(-1));
test1<T, 0, 0, M>();
test1<T, 0, M-2, M>();
test1<T, 0, M-1, M>();
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
index 331d3c51119f..3a16d62d728d 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp
@@ -60,8 +60,13 @@ test1()
static_assert((E::tempering_c == 0xefc60000), "");
static_assert((E::tempering_l == 18), "");
static_assert((E::initialization_multiplier == 1812433253), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFF)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFF), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFF));
+#endif
static_assert((E::default_seed == 5489u), "");
where(E::word_size);
where(E::state_size);
@@ -96,8 +101,13 @@ test2()
static_assert((E::tempering_c == 0xfff7eee000000000ull), "");
static_assert((E::tempering_l == 43), "");
static_assert((E::initialization_multiplier == 6364136223846793005ull), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFFFFFFFFFFull)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFFFFFFFFFFull), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFFFFFFFFFFull));
+#endif
static_assert((E::default_seed == 5489u), "");
where(E::word_size);
where(E::state_size);
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
index 75716a43deae..b3f12e72383b 100644
--- a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
+++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp
@@ -38,8 +38,13 @@ test1()
static_assert((E::word_size == 24), "");
static_assert((E::short_lag == 10), "");
static_assert((E::long_lag == 24), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFF)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFF), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFF));
+#endif
static_assert((E::default_seed == 19780503u), "");
where(E::word_size);
where(E::short_lag);
@@ -54,8 +59,13 @@ test2()
static_assert((E::word_size == 48), "");
static_assert((E::short_lag == 5), "");
static_assert((E::long_lag == 12), "");
- /*static_*/assert((E::min() == 0)/*, ""*/);
- /*static_*/assert((E::max() == 0xFFFFFFFFFFFFull)/*, ""*/);
+#if TEST_STD_VER >= 11
+ static_assert((E::min() == 0), "");
+ static_assert((E::max() == 0xFFFFFFFFFFFFull), "");
+#else
+ assert((E::min() == 0));
+ assert((E::max() == 0xFFFFFFFFFFFFull));
+#endif
static_assert((E::default_seed == 19780503u), "");
where(E::word_size);
where(E::short_lag);
diff --git a/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
index 426586007c1a..c6d24e6334d9 100644
--- a/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
+++ b/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
@@ -14,9 +14,11 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
std::default_random_engine e;
e.discard(9999);
- assert(e() == 399268537u);
+ LIBCPP_ASSERT(e() == 399268537u);
}
diff --git a/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/test/std/re/re.alg/re.alg.match/awk.pass.cpp
index a32b2ca0ae32..f866929795db 100644
--- a/test/std/re/re.alg/re.alg.match/awk.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/awk.pass.cpp
@@ -617,11 +617,12 @@ int main()
}
std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
*/ {
+ /*
std::cmatch m;
const char s[] = "m";
- /* assert(std::regex_match(s, m,*/ std::regex("[a[=M=]z]"/*,
- std::regex_constants::awk*/);//));
-/* assert(m.size() == 1);
+ assert(std::regex_match(s, m, std::regex("[a[=M=]z]",
+ std::regex_constants::awk);
+ assert(m.size() == 1);
assert(!m.prefix().matched);
assert(m.prefix().first == s);
assert(m.prefix().second == m[0].first);
diff --git a/test/std/re/re.alg/re.alg.match/basic.pass.cpp b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
index 901bf90e6386..cb23cfa15d24 100644
--- a/test/std/re/re.alg/re.alg.match/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
@@ -387,7 +387,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 2);
@@ -405,7 +405,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -430,7 +430,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -525,7 +525,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -548,7 +548,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -578,7 +578,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -594,7 +594,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -610,7 +610,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -634,7 +634,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -650,7 +650,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -941,7 +941,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -956,7 +956,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -971,7 +971,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1004,7 +1004,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1019,7 +1019,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1034,7 +1034,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1055,7 +1055,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 2);
@@ -1073,7 +1073,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -1098,7 +1098,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -1193,7 +1193,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1216,7 +1216,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1246,7 +1246,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1262,7 +1262,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1278,7 +1278,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1302,7 +1302,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1318,7 +1318,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
index a4568f60167c..ae42b46668b0 100644
--- a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
@@ -266,7 +266,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -281,7 +281,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -296,7 +296,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -329,7 +329,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -344,7 +344,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -359,7 +359,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -371,16 +371,37 @@ int main()
}
{
std::cmatch m;
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2273
const char s[] = "tournament";
- assert(!std::regex_match(s, m, std::regex("tour|to|tournament")));
- assert(m.size() == 0);
+ assert(std::regex_match(s, m, std::regex("tour|to|tournament")));
+ assert(m.size() == 1);
+ assert(!m.prefix().matched);
+ assert(m.prefix().first == s);
+ assert(m.prefix().second == m[0].first);
+ assert(!m.suffix().matched);
+ assert(m.suffix().first == m[0].second);
+ assert(m.suffix().second == m[0].second);
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
+ assert(m.position(0) == 0);
+ assert(m.str(0) == s);
}
{
std::cmatch m;
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2273
const char s[] = "tournamenttotour";
- assert(!std::regex_match(s, m, std::regex("(tour|to|tournament)+",
- std::regex_constants::nosubs)));
- assert(m.size() == 0);
+ assert(
+ std::regex_match(s, m, std::regex("(tour|to|tournament)+",
+ std::regex_constants::nosubs)));
+ assert(m.size() == 1);
+ assert(!m.prefix().matched);
+ assert(m.prefix().first == s);
+ assert(m.prefix().second == m[0].first);
+ assert(!m.suffix().matched);
+ assert(m.suffix().first == m[0].second);
+ assert(m.suffix().second == m[0].second);
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
+ assert(m.position(0) == 0);
+ assert(m.str(0) == s);
}
{
std::cmatch m;
@@ -393,7 +414,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -417,7 +438,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -495,7 +516,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -516,7 +537,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -543,7 +564,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -558,7 +579,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -573,7 +594,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -595,7 +616,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -611,7 +632,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -690,7 +711,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<char>::length(s));
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -931,7 +952,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -946,7 +967,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -961,7 +982,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -994,7 +1015,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1009,7 +1030,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1024,7 +1045,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1036,16 +1057,37 @@ int main()
}
{
std::wcmatch m;
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2273
const wchar_t s[] = L"tournament";
- assert(!std::regex_match(s, m, std::wregex(L"tour|to|tournament")));
- assert(m.size() == 0);
+ assert(std::regex_match(s, m, std::wregex(L"tour|to|tournament")));
+ assert(m.size() == 1);
+ assert(!m.prefix().matched);
+ assert(m.prefix().first == s);
+ assert(m.prefix().second == m[0].first);
+ assert(!m.suffix().matched);
+ assert(m.suffix().first == m[0].second);
+ assert(m.suffix().second == m[0].second);
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
+ assert(m.position(0) == 0);
+ assert(m.str(0) == s);
}
{
std::wcmatch m;
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2273
const wchar_t s[] = L"tournamenttotour";
- assert(!std::regex_match(s, m, std::wregex(L"(tour|to|tournament)+",
- std::regex_constants::nosubs)));
- assert(m.size() == 0);
+ assert(
+ std::regex_match(s, m, std::wregex(L"(tour|to|tournament)+",
+ std::regex_constants::nosubs)));
+ assert(m.size() == 1);
+ assert(!m.prefix().matched);
+ assert(m.prefix().first == s);
+ assert(m.prefix().second == m[0].first);
+ assert(!m.suffix().matched);
+ assert(m.suffix().first == m[0].second);
+ assert(m.suffix().second == m[0].second);
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
+ assert(m.position(0) == 0);
+ assert(m.str(0) == s);
}
{
std::wcmatch m;
@@ -1058,7 +1100,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -1082,7 +1124,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1160,7 +1202,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1181,7 +1223,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1208,7 +1250,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1223,7 +1265,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1238,7 +1280,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1260,7 +1302,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1276,7 +1318,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1343,7 +1385,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<wchar_t>::length(s));
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.match/extended.pass.cpp b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
index 5e08d0ac5fdb..aac03839a05d 100644
--- a/test/std/re/re.alg/re.alg.match/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
@@ -267,7 +267,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -282,7 +282,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -297,7 +297,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -330,7 +330,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -345,7 +345,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -360,7 +360,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -382,7 +382,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -398,7 +398,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -414,7 +414,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -438,7 +438,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -523,7 +523,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -546,7 +546,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -576,7 +576,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -592,7 +592,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -608,7 +608,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -632,7 +632,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -648,7 +648,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -933,7 +933,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -948,7 +948,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -963,7 +963,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -996,7 +996,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1011,7 +1011,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1026,7 +1026,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1048,7 +1048,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1064,7 +1064,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1080,7 +1080,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -1104,7 +1104,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1189,7 +1189,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1212,7 +1212,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1242,7 +1242,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1258,7 +1258,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1274,7 +1274,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1298,7 +1298,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1314,7 +1314,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.search/awk.pass.cpp b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
index 05d1f59e147a..be0c74e9c779 100644
--- a/test/std/re/re.alg/re.alg.search/awk.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
@@ -330,7 +330,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -345,7 +345,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -360,7 +360,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -393,7 +393,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -408,7 +408,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -423,7 +423,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -445,7 +445,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -461,7 +461,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -477,7 +477,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -501,7 +501,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -595,7 +595,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -618,7 +618,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -648,7 +648,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -664,7 +664,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -680,7 +680,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -704,7 +704,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -720,7 +720,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -797,7 +797,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<char>::length(s));
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1101,7 +1101,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1116,7 +1116,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1131,7 +1131,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1164,7 +1164,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1179,7 +1179,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1194,7 +1194,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1216,7 +1216,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1232,7 +1232,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1248,7 +1248,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -1272,7 +1272,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1366,7 +1366,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1389,7 +1389,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1419,7 +1419,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1435,7 +1435,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1451,7 +1451,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1475,7 +1475,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1491,7 +1491,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1568,7 +1568,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<wchar_t>::length(s));
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.search/basic.pass.cpp b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
index f5157f563755..11982a26d003 100644
--- a/test/std/re/re.alg/re.alg.search/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
@@ -450,7 +450,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 2);
@@ -468,7 +468,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -493,7 +493,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -597,7 +597,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -620,7 +620,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -650,7 +650,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -666,7 +666,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -682,7 +682,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -706,7 +706,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -722,7 +722,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1094,7 +1094,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1109,7 +1109,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1124,7 +1124,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1157,7 +1157,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1172,7 +1172,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1187,7 +1187,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1208,7 +1208,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 2);
@@ -1226,7 +1226,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -1251,7 +1251,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 3);
@@ -1355,7 +1355,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1378,7 +1378,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1408,7 +1408,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1424,7 +1424,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1440,7 +1440,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1464,7 +1464,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1480,7 +1480,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
index d6a3da6ea076..c41019542a55 100644
--- a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
@@ -329,7 +329,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -344,7 +344,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -359,7 +359,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -392,7 +392,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -407,7 +407,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -422,7 +422,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -474,7 +474,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -498,7 +498,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -585,7 +585,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -606,7 +606,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -633,7 +633,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -648,7 +648,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -663,7 +663,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -685,7 +685,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -701,7 +701,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -804,7 +804,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<char>::length(s));
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1108,7 +1108,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1123,7 +1123,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1138,7 +1138,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1171,7 +1171,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1186,7 +1186,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1201,7 +1201,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1253,7 +1253,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -1277,7 +1277,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1364,7 +1364,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1385,7 +1385,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1412,7 +1412,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1427,7 +1427,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1442,7 +1442,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1464,7 +1464,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1480,7 +1480,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1583,7 +1583,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == s + std::char_traits<wchar_t>::length(s));
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.search/extended.pass.cpp b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
index 88af3b908815..4a2e6647e079 100644
--- a/test/std/re/re.alg/re.alg.search/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
@@ -330,7 +330,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -345,7 +345,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -360,7 +360,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -393,7 +393,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -408,7 +408,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -423,7 +423,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -445,7 +445,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -461,7 +461,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -477,7 +477,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -501,7 +501,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -595,7 +595,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -618,7 +618,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -648,7 +648,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -664,7 +664,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -680,7 +680,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -704,7 +704,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -720,7 +720,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<char>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<char>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1086,7 +1086,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1101,7 +1101,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1116,7 +1116,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1149,7 +1149,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1164,7 +1164,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1179,7 +1179,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1201,7 +1201,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1217,7 +1217,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1233,7 +1233,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
assert(m.length(1) == 4);
@@ -1257,7 +1257,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1351,7 +1351,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1374,7 +1374,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1404,7 +1404,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1420,7 +1420,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1436,7 +1436,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1460,7 +1460,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
@@ -1476,7 +1476,7 @@ int main()
assert(!m.suffix().matched);
assert(m.suffix().first == m[0].second);
assert(m.suffix().second == m[0].second);
- assert(m.length(0) == std::char_traits<wchar_t>::length(s));
+ assert(m.length(0) >= 0 && static_cast<size_t>(m.length(0)) == std::char_traits<wchar_t>::length(s));
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
diff --git a/test/std/re/re.alg/re.alg.search/grep.pass.cpp b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
index 136f9958c9b2..fa4e675c78f0 100644
--- a/test/std/re/re.alg/re.alg.search/grep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <regex>
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
@@ -25,6 +24,7 @@
extern "C" void LLVMFuzzerTestOneInput(const char *data)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
size_t size = strlen(data);
if (size > 0)
{
@@ -37,6 +37,9 @@ extern "C" void LLVMFuzzerTestOneInput(const char *data)
}
catch (std::regex_error &) {}
}
+#else
+ ((void)data);
+#endif
}
diff --git a/test/std/re/re.const/re.matchflag/match_not_null.pass.cpp b/test/std/re/re.const/re.matchflag/match_not_null.pass.cpp
new file mode 100644
index 000000000000..41963fbb2ce2
--- /dev/null
+++ b/test/std/re/re.const/re.matchflag/match_not_null.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// match_not_null:
+// The regular expression shall not match an empty sequence.
+
+#include "test_macros.h"
+#include <cassert>
+#include <regex>
+
+int main()
+{
+ // When match_not_null is on, the regex engine should reject empty matches and
+ // move on to try other solutions.
+ std::cmatch m;
+ assert(!std::regex_search("a", m, std::regex("b*"),
+ std::regex_constants::match_not_null));
+ assert(std::regex_search("aa", m, std::regex("a*?"),
+ std::regex_constants::match_not_null));
+ assert(m[0].length() == 1);
+ assert(!std::regex_search("a", m, std::regex("b*", std::regex::extended),
+ std::regex_constants::match_not_null));
+ assert(!std::regex_search(
+ "a", m,
+ std::regex("b*", std::regex::extended | std::regex_constants::nosubs),
+ std::regex_constants::match_not_null));
+
+ assert(!std::regex_match("", m, std::regex("a*"),
+ std::regex_constants::match_not_null));
+ assert(!std::regex_match("", m, std::regex("a*", std::regex::extended),
+ std::regex_constants::match_not_null));
+ assert(!std::regex_match(
+ "", m,
+ std::regex("a*", std::regex::extended | std::regex_constants::nosubs),
+ std::regex_constants::match_not_null));
+
+ return 0;
+}
diff --git a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
index 97208c68c8d6..12b23a9fa13d 100644
--- a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <regex>
// template <class charT, class traits = regex_traits<charT>> class basic_regex;
@@ -27,6 +26,7 @@ int main()
assert(r2.mark_count() == 2);
assert(std::regex_search("ab", r2));
+#ifndef TEST_HAS_NO_EXCEPTIONS
bool caught = false;
try { r2.assign("(def", std::regex::extended); }
catch(std::regex_error &) { caught = true; }
@@ -34,4 +34,5 @@ int main()
assert(r2.flags() == std::regex::ECMAScript);
assert(r2.mark_count() == 2);
assert(std::regex_search("ab", r2));
+#endif
}
diff --git a/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
new file mode 100644
index 000000000000..aca4d674d9f9
--- /dev/null
+++ b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-no-exceptions
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ST, class SA>
+// basic_regex(const basic_string<charT, ST, SA>& s);
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+
+static bool error_badbackref_thrown(const char *pat)
+{
+ bool result = false;
+ try {
+ std::regex re(pat);
+ } catch (const std::regex_error &ex) {
+ result = (ex.code() == std::regex_constants::error_backref);
+ }
+ return result;
+}
+
+int main()
+{
+ assert(error_badbackref_thrown("\\1abc")); // no references
+ assert(error_badbackref_thrown("ab(c)\\2def")); // only one reference
+
+// this should NOT throw, because we only should look at the '1'
+// See https://llvm.org/bugs/show_bug.cgi?id=31387
+ {
+ const char *pat1 = "a(b)c\\1234";
+ std::regex re(pat1, pat1 + 7); // extra chars after the end.
+ }
+}
diff --git a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
index 3c7e9f5e33c7..93b21ec9e9f6 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <regex>
// template <class charT, class traits = regex_traits<charT>> class basic_regex;
diff --git a/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
index 0692a59542f6..0f30a8b2082b 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <regex>
// template <class charT, class traits = regex_traits<charT>> class basic_regex;
diff --git a/test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp b/test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
new file mode 100644
index 000000000000..90a091a21c2a
--- /dev/null
+++ b/test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include <regex>
+#include <cassert>
+
+template <class CharT>
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+ std::basic_regex<CharT> r(p, len);
+ assert(r.flags() == std::regex_constants::ECMAScript);
+ assert(r.mark_count() == mc);
+}
+
+int main()
+{
+ test("\\(a\\)", 5, 0);
+ test("\\(a[bc]\\)", 9, 0);
+ test("\\(a\\([bc]\\)\\)", 13, 0);
+ test("(a([bc]))", 9, 2);
+
+ test("(\0)(b)(c)(d)", 12, 4);
+ test("(\0)(b)(c)(d)", 9, 3);
+ test("(\0)(b)(c)(d)", 3, 1);
+ test("(\0)(b)(c)(d)", 0, 0);
+}
diff --git a/test/std/re/re.regex/types.pass.cpp b/test/std/re/re.regex/types.pass.cpp
index 5c0a5920d201..2e48b4e841ca 100644
--- a/test/std/re/re.regex/types.pass.cpp
+++ b/test/std/re/re.regex/types.pass.cpp
@@ -15,6 +15,8 @@
// public:
// // types:
// typedef charT value_type;
+// typedef traits traits_type;
+// typedef typename traits::string_type string_type;
// typedef regex_constants::syntax_option_type flag_type;
// typedef typename traits::locale_type locale_type;
@@ -25,11 +27,15 @@
int main()
{
static_assert((std::is_same<std::basic_regex<char>::value_type, char>::value), "");
+ static_assert((std::is_same<std::basic_regex<char>::traits_type, std::regex_traits<char> >::value), "");
+ static_assert((std::is_same<std::basic_regex<char>::string_type, std::basic_string<char> >::value), "");
static_assert((std::is_same<std::basic_regex<char>::flag_type,
std::regex_constants::syntax_option_type>::value), "");
static_assert((std::is_same<std::basic_regex<char>::locale_type, std::locale>::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::value_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::basic_regex<wchar_t>::traits_type, std::regex_traits<wchar_t> >::value), "");
+ static_assert((std::is_same<std::basic_regex<wchar_t>::string_type, std::basic_string<wchar_t> >::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::flag_type,
std::regex_constants::syntax_option_type>::value), "");
static_assert((std::is_same<std::basic_regex<wchar_t>::locale_type, std::locale>::value), "");
diff --git a/test/std/re/re.results/re.results.acc/begin_end.pass.cpp b/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
index a5ed051265cc..85b5134266dc 100644
--- a/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/begin_end.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
void
@@ -28,7 +29,7 @@ test()
std::match_results<const char*>::const_iterator i = m.begin();
std::match_results<const char*>::const_iterator e = m.end();
- assert(e - i == m.size());
+ assert(static_cast<std::size_t>(e - i) == m.size());
for (int j = 0; i != e; ++i, ++j)
assert(*i == m[j]);
}
diff --git a/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp b/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
index 67ec606e9060..16ba38c61041 100644
--- a/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
+++ b/test/std/re/re.results/re.results.acc/cbegin_cend.pass.cpp
@@ -16,6 +16,7 @@
#include <regex>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
void
@@ -28,7 +29,7 @@ test()
std::match_results<const char*>::const_iterator i = m.cbegin();
std::match_results<const char*>::const_iterator e = m.cend();
- assert(e - i == m.size());
+ assert(static_cast<std::size_t>(e - i) == m.size());
for (int j = 0; i != e; ++i, ++j)
assert(*i == m[j]);
}
diff --git a/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp b/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
index be05afd4cf88..1634c5a39f34 100644
--- a/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/compare_string_type.pass.cpp
@@ -24,7 +24,6 @@ int main()
typedef std::sub_match<const CharT*> SM;
typedef SM::string_type string;
SM sm = SM();
- SM sm2 = SM();
assert(sm.compare(string()) == 0);
const CharT s[] = {'1', '2', '3', 0};
sm.first = s;
@@ -38,7 +37,6 @@ int main()
typedef std::sub_match<const CharT*> SM;
typedef SM::string_type string;
SM sm = SM();
- SM sm2 = SM();
assert(sm.compare(string()) == 0);
const CharT s[] = {'1', '2', '3', 0};
sm.first = s;
diff --git a/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp b/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
index 097a3918ed13..5e2ea8fb5322 100644
--- a/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
+++ b/test/std/re/re.submatch/re.submatch.members/compare_value_type_ptr.pass.cpp
@@ -23,7 +23,6 @@ int main()
typedef char CharT;
typedef std::sub_match<const CharT*> SM;
SM sm = SM();
- SM sm2 = SM();
assert(sm.compare("") == 0);
const CharT s[] = {'1', '2', '3', 0};
sm.first = s;
@@ -36,7 +35,6 @@ int main()
typedef wchar_t CharT;
typedef std::sub_match<const CharT*> SM;
SM sm = SM();
- SM sm2 = SM();
assert(sm.compare(L"") == 0);
const CharT s[] = {'1', '2', '3', 0};
sm.first = s;
diff --git a/test/std/re/re.traits/value.pass.cpp b/test/std/re/re.traits/value.pass.cpp
index dfed66c35c46..3a25f35df653 100644
--- a/test/std/re/re.traits/value.pass.cpp
+++ b/test/std/re/re.traits/value.pass.cpp
@@ -82,15 +82,15 @@ int main()
}
for (wchar_t c = '0'; c < '8'; ++c)
{
- assert(t.value(c, 8) == c - '0');
- assert(t.value(c, 10) == c - '0');
- assert(t.value(c, 16) == c - '0');
+ assert(t.value(c, 8) == static_cast<int>(c - '0'));
+ assert(t.value(c, 10) == static_cast<int>(c - '0'));
+ assert(t.value(c, 16) == static_cast<int>(c - '0'));
}
for (wchar_t c = '8'; c < ':'; ++c)
{
assert(t.value(c, 8) == -1);
- assert(t.value(c, 10) == c - '0');
- assert(t.value(c, 16) == c - '0');
+ assert(t.value(c, 10) == static_cast<int>(c - '0'));
+ assert(t.value(c, 16) == static_cast<int>(c - '0'));
}
for (wchar_t c = ':'; c < 'A'; ++c)
{
@@ -102,7 +102,7 @@ int main()
{
assert(t.value(c, 8) == -1);
assert(t.value(c, 10) == -1);
- assert(t.value(c, 16) == c - 'A' +10);
+ assert(t.value(c, 16) == static_cast<int>(c - 'A' +10));
}
for (wchar_t c = 'G'; c < 'a'; ++c)
{
@@ -114,9 +114,9 @@ int main()
{
assert(t.value(c, 8) == -1);
assert(t.value(c, 10) == -1);
- assert(t.value(c, 16) == c - 'a' +10);
+ assert(t.value(c, 16) == static_cast<int>(c - 'a' +10));
}
- for (int c = 'g'; c < 0xFFFF; ++c)
+ for (wchar_t c = 'g'; c < 0xFFFF; ++c)
{
assert(t.value(c, 8) == -1);
assert(t.value(c, 10) == -1);
diff --git a/test/std/strings/basic.string/string.access/at.pass.cpp b/test/std/strings/basic.string/string.access/at.pass.cpp
index 8dc0c57cb7b4..891648930e3c 100644
--- a/test/std/strings/basic.string/string.access/at.pass.cpp
+++ b/test/std/strings/basic.string/string.access/at.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// const_reference at(size_type pos) const;
@@ -19,21 +18,41 @@
#include "min_allocator.h"
+#include "test_macros.h"
+
template <class S>
void
test(S s, typename S::size_type pos)
{
- try
+ const S& cs = s;
+ if (pos < s.size())
{
- const S& cs = s;
assert(s.at(pos) == s[pos]);
assert(cs.at(pos) == cs[pos]);
- assert(pos < cs.size());
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos >= s.size());
+ try
+ {
+ s.at(pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos >= s.size());
+ }
+ try
+ {
+ cs.at(pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos >= s.size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.access/index.pass.cpp b/test/std/strings/basic.string/string.access/index.pass.cpp
index b45a399320ba..f4053dff19e5 100644
--- a/test/std/strings/basic.string/string.access/index.pass.cpp
+++ b/test/std/strings/basic.string/string.access/index.pass.cpp
@@ -29,7 +29,7 @@ int main()
const S& cs = s;
for (S::size_type i = 0; i < cs.size(); ++i)
{
- assert(s[i] == '0' + i);
+ assert(s[i] == static_cast<char>('0' + i));
assert(cs[i] == s[i]);
}
assert(cs[cs.size()] == '\0');
@@ -43,7 +43,7 @@ int main()
const S& cs = s;
for (S::size_type i = 0; i < cs.size(); ++i)
{
- assert(s[i] == '0' + i);
+ assert(s[i] == static_cast<char>('0' + i));
assert(cs[i] == s[i]);
}
assert(cs[cs.size()] == '\0');
diff --git a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
index 4b09c096792c..79fbd2e96322 100644
--- a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// size_type capacity() const;
@@ -18,21 +17,27 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#include "test_macros.h"
+
template <class S>
void
test(S s)
{
S::allocator_type::throw_after = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
while (s.size() < s.capacity())
s.push_back(typename S::value_type());
assert(s.size() == s.capacity());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (...)
{
assert(false);
}
+#endif
S::allocator_type::throw_after = INT_MAX;
}
diff --git a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
index fca14ddca561..a8f8126f7e6b 100644
--- a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <string>
// size_type max_size() const;
diff --git a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
index e92a0e1054f6..59267f245d82 100644
--- a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <string>
// size_type max_size() const;
diff --git a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index b2c254d1fb25..7210152ea3cb 100644
--- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// void reserve(size_type res_arg=0);
@@ -37,19 +36,29 @@ void
test(S s, typename S::size_type res_arg)
{
typename S::size_type old_cap = s.capacity();
+ ((void)old_cap); // Prevent unused warning
S s0 = s;
- try
+ if (res_arg <= s.max_size())
{
s.reserve(res_arg);
- assert(res_arg <= s.max_size());
assert(s == s0);
assert(s.capacity() >= res_arg);
assert(s.capacity() >= s.size());
}
- catch (std::length_error&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(res_arg > s.max_size());
+ try
+ {
+ s.reserve(res_arg);
+ assert(false);
+ }
+ catch (std::length_error&)
+ {
+ assert(res_arg > s.max_size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
index 558941599578..78200d50cb3e 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// void resize(size_type n);
@@ -23,17 +22,26 @@ template <class S>
void
test(S s, typename S::size_type n, S expected)
{
- try
+ if (n <= s.max_size())
{
s.resize(n);
LIBCPP_ASSERT(s.__invariants());
- assert(n <= s.max_size());
assert(s == expected);
}
- catch (std::length_error&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(n > s.max_size());
+ try
+ {
+ s.resize(n);
+ assert(false);
+ }
+ catch (std::length_error&)
+ {
+ assert(n > s.max_size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index 79f972b2fee3..288eb325252b 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// void resize(size_type n, charT c);
@@ -23,17 +22,26 @@ template <class S>
void
test(S s, typename S::size_type n, typename S::value_type c, S expected)
{
- try
+ if (n <= s.max_size())
{
s.resize(n, c);
LIBCPP_ASSERT(s.__invariants());
- assert(n <= s.max_size());
assert(s == expected);
}
- catch (std::length_error&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(n > s.max_size());
+ try
+ {
+ s.resize(n, c);
+ assert(false);
+ }
+ catch (std::length_error&)
+ {
+ assert(n > s.max_size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
new file mode 100644
index 000000000000..312e4d27fef1
--- /dev/null
+++ b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp
@@ -0,0 +1,186 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class _Tp>
+// basic_string(const _Tp& __t, size_type __pos, size_type __n,
+// const allocator_type& __a = allocator_type());
+//
+// Mostly we're testing string_view here
+
+#include <string>
+#include <string_view>
+#include <stdexcept>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV sv, unsigned pos, unsigned n)
+{
+ typedef typename S::traits_type T;
+ typedef typename S::allocator_type A;
+ if (pos <= sv.size())
+ {
+ S s2(sv, pos, n);
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(pos <= sv.size());
+ unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == A());
+ assert(s2.capacity() >= s2.size());
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ S s2(sv, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a)
+{
+ typedef typename S::traits_type T;
+ typedef typename S::allocator_type A;
+ if (pos <= sv.size())
+ {
+ S s2(sv, pos, n, a);
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(pos <= sv.size());
+ unsigned rlen = std::min<unsigned>(sv.size() - pos, n);
+ assert(s2.size() == rlen);
+ assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0);
+ assert(s2.get_allocator() == a);
+ assert(s2.capacity() >= s2.size());
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ S s2(sv, pos, n, a);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+int main()
+{
+
+ {
+ typedef test_allocator<char> A;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ typedef std::basic_string <char, std::char_traits<char>, A> S;
+
+ test<S,SV>(SV(), 0, 0);
+ test<S,SV>(SV(), 0, 1);
+ test<S,SV>(SV(), 1, 0);
+ test<S,SV>(SV(), 1, 1);
+ test<S,SV>(SV(), 1, 2);
+ test<S,SV>(SV("1"), 0, 0);
+ test<S,SV>(SV("1"), 0, 1);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 0);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 1);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 10);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 100);
+
+ test<S,SV>(SV(), 0, 0, A(4));
+ test<S,SV>(SV(), 0, 1, A(4));
+ test<S,SV>(SV(), 1, 0, A(4));
+ test<S,SV>(SV(), 1, 1, A(4));
+ test<S,SV>(SV(), 1, 2, A(4));
+ test<S,SV>(SV("1"), 0, 0, A(6));
+ test<S,SV>(SV("1"), 0, 1, A(6));
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 0, A(8));
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 1, A(8));
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 10, A(8));
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 100, A(8));
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ typedef min_allocator<char> A;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ typedef std::basic_string <char, std::char_traits<char>, A> S;
+
+ test<S,SV>(SV(), 0, 0);
+ test<S,SV>(SV(), 0, 1);
+ test<S,SV>(SV(), 1, 0);
+ test<S,SV>(SV(), 1, 1);
+ test<S,SV>(SV(), 1, 2);
+ test<S,SV>(SV("1"), 0, 0);
+ test<S,SV>(SV("1"), 0, 1);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 0);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 1);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 10);
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 100);
+
+ test<S,SV>(SV(), 0, 0, A());
+ test<S,SV>(SV(), 0, 1, A());
+ test<S,SV>(SV(), 1, 0, A());
+ test<S,SV>(SV(), 1, 1, A());
+ test<S,SV>(SV(), 1, 2, A());
+ test<S,SV>(SV("1"), 0, 0, A());
+ test<S,SV>(SV("1"), 0, 1, A());
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 0, A());
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 1, A());
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 10, A());
+ test<S,SV>(SV("1234567890123456789012345678901234567890123456789012345678901234567890"), 50, 100, A());
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ S s = "ABCD";
+ SV sv = "EFGH";
+ char arr[] = "IJKL";
+
+ S s1("CDEF", 4); // calls ctor(const char *, len)
+ assert(s1 == "CDEF");
+
+ S s2("QRST", 0, 3); // calls ctor(string("QRST", pos, len)
+ assert(s2 == "QRS");
+
+ S s3(sv, 0, std::string::npos); // calls ctor(T, pos, npos)
+ assert(s3 == sv);
+
+ S s4(sv, 0, 3); // calls ctor(T, pos, len)
+ assert(s4 == "EFG");
+
+ S s5(arr, 0, 2); // calls ctor(const char *, len)
+ assert(s5 == "IJ");
+
+ S s6(arr, 0); // calls ctor(const char *, len)
+ assert(s6 == "");
+
+ S s7(s.data(), 2); // calls ctor(const char *, len)
+ assert(s7 == "AB");
+ }
+}
diff --git a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
index c4ac1f1a47bb..0c6362d96863 100644
--- a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp
@@ -16,6 +16,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -26,6 +27,11 @@ struct some_alloc
~some_alloc() noexcept(false);
};
+// Test that it's possible to take the address of basic_string's destructors
+// by creating globals which will register their destructors with cxa_atexit.
+std::string s;
+std::wstring ws;
+
int main()
{
{
@@ -38,6 +44,6 @@ int main()
}
{
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
- static_assert(!std::is_nothrow_destructible<C>::value, "");
+ LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible<C>::value, "");
}
}
diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
index cb0792ab23b3..1b10224cd9e7 100644
--- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
@@ -16,6 +16,7 @@
#include <string>
#include <iterator>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_allocator.h"
@@ -32,7 +33,7 @@ test(It first, It last)
typedef typename S::allocator_type A;
S s2(first, last);
LIBCPP_ASSERT(s2.__invariants());
- assert(s2.size() == std::distance(first, last));
+ assert(s2.size() == static_cast<std::size_t>(std::distance(first, last)));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
assert(s2[i] == *it);
@@ -49,7 +50,7 @@ test(It first, It last, const A& a)
typedef typename S::traits_type T;
S s2(first, last, a);
LIBCPP_ASSERT(s2.__invariants());
- assert(s2.size() == std::distance(first, last));
+ assert(s2.size() == static_cast<std::size_t>(std::distance(first, last)));
unsigned i = 0;
for (It it = first; it != last; ++it, ++i)
assert(s2[i] == *it);
diff --git a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
index b678247fb241..f56780095b7f 100644
--- a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <stdexcept>
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_allocator.h"
@@ -27,7 +28,7 @@ test(const charT* s)
typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
- unsigned n = T::length(s);
+ std::size_t n = T::length(s);
S s2(s);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
@@ -42,7 +43,7 @@ test(const charT* s, const A& a)
{
typedef std::basic_string<charT, std::char_traits<charT>, A> S;
typedef typename S::traits_type T;
- unsigned n = T::length(s);
+ std::size_t n = T::length(s);
S s2(s, a);
LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == n);
diff --git a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
index 60d41b1d35be..60443e9f358d 100644
--- a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
@@ -15,6 +15,7 @@
#include <stdexcept>
#include <algorithm>
#include <cassert>
+#include <cstddef>
#include "test_macros.h"
#include "test_allocator.h"
@@ -61,8 +62,8 @@ test(Tp n, Tp c)
typedef typename S::allocator_type A;
S s2(n, c);
LIBCPP_ASSERT(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
+ assert(s2.size() == static_cast<std::size_t>(n));
+ for (int i = 0; i < n; ++i)
assert(s2[i] == c);
assert(s2.get_allocator() == A());
assert(s2.capacity() >= s2.size());
@@ -77,8 +78,8 @@ test(Tp n, Tp c, const A& a)
typedef typename S::traits_type T;
S s2(n, c, a);
LIBCPP_ASSERT(s2.__invariants());
- assert(s2.size() == n);
- for (unsigned i = 0; i < n; ++i)
+ assert(s2.size() == static_cast<std::size_t>(n));
+ for (int i = 0; i < n; ++i)
assert(s2[i] == c);
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
@@ -102,8 +103,8 @@ int main()
test(100, 'a');
test(100, 'a', A(2));
- test(100, 65);
- test(100, 65, A(3));
+ test(static_cast<char>(100), static_cast<char>(65));
+ test(static_cast<char>(100), static_cast<char>(65), A(3));
}
#if TEST_STD_VER >= 11
{
@@ -122,8 +123,8 @@ int main()
test(100, 'a');
test(100, 'a', A());
- test(100, 65);
- test(100, 65, A());
+ test(static_cast<char>(100), static_cast<char>(65));
+ test(static_cast<char>(100), static_cast<char>(65), A());
}
#endif
}
diff --git a/test/std/strings/basic.string/string.cons/string_view.fail.cpp b/test/std/strings/basic.string/string.cons/string_view.fail.cpp
new file mode 100644
index 000000000000..70459b2dcfb4
--- /dev/null
+++ b/test/std/strings/basic.string/string.cons/string_view.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// explicit basic_string(basic_string_view<CharT, traits> sv, const Allocator& a = Allocator());
+
+#include <string>
+#include <string_view>
+
+void foo ( const string &s ) {}
+
+int main()
+{
+ std::string_view sv = "ABCDE";
+ foo(sv); // requires implicit conversion from string_view to string
+}
diff --git a/test/std/strings/basic.string/string.cons/string_view.pass.cpp b/test/std/strings/basic.string/string.cons/string_view.pass.cpp
new file mode 100644
index 000000000000..d0e1a1699a22
--- /dev/null
+++ b/test/std/strings/basic.string/string.cons/string_view.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// explicit basic_string(basic_string_view<CharT, traits> sv, const Allocator& a = Allocator());
+
+#include <string>
+#include <string_view>
+#include <stdexcept>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class charT>
+void
+test(std::basic_string_view<charT> sv)
+{
+ typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
+ typedef typename S::traits_type T;
+ typedef typename S::allocator_type A;
+ S s2(sv);
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(s2.size() == sv.size());
+ assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
+ assert(s2.get_allocator() == A());
+ assert(s2.capacity() >= s2.size());
+}
+
+template <class charT, class A>
+void
+test(std::basic_string_view<charT> sv, const A& a)
+{
+ typedef std::basic_string<charT, std::char_traits<charT>, A> S;
+ typedef typename S::traits_type T;
+ S s2(sv, a);
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(s2.size() == sv.size());
+ assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
+ assert(s2.get_allocator() == a);
+ assert(s2.capacity() >= s2.size());
+}
+
+int main()
+{
+ {
+ typedef test_allocator<char> A;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+
+ test(SV(""));
+ test(SV(""), A(2));
+
+ test(SV("1"));
+ test(SV("1") ,A(2));
+
+ test(SV("1234567980"));
+ test(SV("1234567980"), A(2));
+
+ test(SV("123456798012345679801234567980123456798012345679801234567980"));
+ test(SV("123456798012345679801234567980123456798012345679801234567980"), A(2));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef min_allocator<char> A;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+
+ test(SV(""));
+ test(SV(""), A());
+
+ test(SV("1"));
+ test(SV("1") ,A());
+
+ test(SV("1234567980"));
+ test(SV("1234567980"), A());
+
+ test(SV("123456798012345679801234567980123456798012345679801234567980"));
+ test(SV("123456798012345679801234567980123456798012345679801234567980"), A());
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.cons/substr.pass.cpp b/test/std/strings/basic.string/string.cons/substr.pass.cpp
index a10239bb3414..4fd974273de9 100644
--- a/test/std/strings/basic.string/string.cons/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/substr.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string(const basic_string<charT,traits,Allocator>& str,
@@ -35,21 +34,31 @@ test(S str, unsigned pos)
{
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
- try
+
+ if (pos <= str.size())
{
S s2(str, pos);
LIBCPP_ASSERT(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = str.size() - pos;
+ typename S::size_type rlen = str.size() - pos;
assert(s2.size() == rlen);
assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
assert(s2.get_allocator() == A());
assert(s2.capacity() >= s2.size());
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ S s2(str, pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
template <class S>
@@ -58,21 +67,30 @@ test(S str, unsigned pos, unsigned n)
{
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
- try
+ if (pos <= str.size())
{
S s2(str, pos, n);
LIBCPP_ASSERT(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = std::min<unsigned>(str.size() - pos, n);
+ typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
assert(s2.size() == rlen);
assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
assert(s2.get_allocator() == A());
assert(s2.capacity() >= s2.size());
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ S s2(str, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
template <class S>
@@ -81,24 +99,35 @@ test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a)
{
typedef typename S::traits_type T;
typedef typename S::allocator_type A;
- try
+
+ if (pos <= str.size())
{
S s2(str, pos, n, a);
LIBCPP_ASSERT(s2.__invariants());
- assert(pos <= str.size());
- unsigned rlen = std::min<unsigned>(str.size() - pos, n);
+ typename S::size_type rlen = std::min<typename S::size_type>(str.size() - pos, n);
assert(s2.size() == rlen);
assert(T::compare(s2.data(), str.data() + pos, rlen) == 0);
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ S s2(str, pos, n, a);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
#if TEST_STD_VER >= 11
+#ifndef TEST_HAS_NO_EXCEPTIONS
void test2583()
{ // LWG #2583
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char> > StringA;
@@ -111,6 +140,7 @@ void test2583()
assert(false);
}
#endif
+#endif
int main()
{
@@ -192,6 +222,8 @@ int main()
test(S("1234567890123456789012345678901234567890123456789012345678901234567890", A()), 50, 100, A());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
test2583();
#endif
+#endif
}
diff --git a/test/std/strings/basic.string/string.iterators/end.pass.cpp b/test/std/strings/basic.string/string.iterators/end.pass.cpp
index abd0c2d853dc..3ad60269b3a9 100644
--- a/test/std/strings/basic.string/string.iterators/end.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/end.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -29,8 +30,8 @@ test(S s)
assert(e == s.begin());
assert(ce == cs.begin());
}
- assert(e - s.begin() == s.size());
- assert(ce - cs.begin() == cs.size());
+ assert(static_cast<std::size_t>(e - s.begin()) == s.size());
+ assert(static_cast<std::size_t>(ce - cs.begin()) == cs.size());
}
int main()
diff --git a/test/std/strings/basic.string/string.iterators/rend.pass.cpp b/test/std/strings/basic.string/string.iterators/rend.pass.cpp
index c8c2d9ccadca..93c47e6bb398 100644
--- a/test/std/strings/basic.string/string.iterators/rend.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/rend.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include <cstddef>
#include "min_allocator.h"
@@ -29,8 +30,8 @@ test(S s)
assert(e == s.rbegin());
assert(ce == cs.rbegin());
}
- assert(e - s.rbegin() == s.size());
- assert(ce - cs.rbegin() == cs.size());
+ assert(static_cast<std::size_t>(e - s.rbegin()) == s.size());
+ assert(static_cast<std::size_t>(ce - cs.rbegin()) == cs.size());
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
new file mode 100644
index 000000000000..fcd18b7f05be
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
@@ -0,0 +1,200 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template <class T>
+// basic_string& append(const T& t, size_type pos, size_type n=npos); // C++17
+
+#include <string>
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
+{
+ if (pos <= sv.size())
+ {
+ s.append(sv, pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.append(sv, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test_npos(S s, SV sv, typename S::size_type pos, S expected)
+{
+ if (pos <= sv.size())
+ {
+ s.append(sv, pos);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.append(sv, pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(), SV(), 0, 0, S());
+ test(S(), SV(), 1, 0, S());
+ test(S(), SV("12345"), 0, 3, S("123"));
+ test(S(), SV("12345"), 1, 4, S("2345"));
+ test(S(), SV("12345"), 3, 15, S("45"));
+ test(S(), SV("12345"), 5, 15, S(""));
+ test(S(), SV("12345"), 6, 15, S("not happening"));
+ test(S(), SV("12345678901234567890"), 0, 0, S());
+ test(S(), SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(), SV("12345678901234567890"), 2, 3, S("345"));
+ test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
+ test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
+
+ test(S("12345"), SV(), 0, 0, S("12345"));
+ test(S("12345"), SV("12345"), 2, 2, S("1234534"));
+ test(S("12345"), SV("1234567890"), 0, 100, S("123451234567890"));
+
+ test(S("12345678901234567890"), SV(), 0, 0, S("12345678901234567890"));
+ test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234"));
+ test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
+ S("123456789012345678906789012345"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ test(S(), SV(), 0, 0, S());
+ test(S(), SV(), 1, 0, S());
+ test(S(), SV("12345"), 0, 3, S("123"));
+ test(S(), SV("12345"), 1, 4, S("2345"));
+ test(S(), SV("12345"), 3, 15, S("45"));
+ test(S(), SV("12345"), 5, 15, S(""));
+ test(S(), SV("12345"), 6, 15, S("not happening"));
+ test(S(), SV("12345678901234567890"), 0, 0, S());
+ test(S(), SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(), SV("12345678901234567890"), 2, 3, S("345"));
+ test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
+ test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
+
+ test(S("12345"), SV(), 0, 0, S("12345"));
+ test(S("12345"), SV("12345"), 2, 2, S("1234534"));
+ test(S("12345"), SV("1234567890"), 0, 100, S("123451234567890"));
+
+ test(S("12345678901234567890"), SV(), 0, 0, S("12345678901234567890"));
+ test(S("12345678901234567890"), SV("12345"), 1, 3, S("12345678901234567890234"));
+ test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
+ S("123456789012345678906789012345"));
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test_npos(S(), SV(), 0, S());
+ test_npos(S(), SV(), 1, S());
+ test_npos(S(), SV("12345"), 0, S("12345"));
+ test_npos(S(), SV("12345"), 1, S("2345"));
+ test_npos(S(), SV("12345"), 3, S("45"));
+ test_npos(S(), SV("12345"), 5, S(""));
+ test_npos(S(), SV("12345"), 6, S("not happening"));
+ }
+
+ {
+ std::string s;
+ std::string_view sv = "EFGH";
+ char arr[] = "IJKL";
+
+ s.append("CDEF", 0); // calls append(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.append("QRST", 0, std::string::npos); // calls append(string("QRST"), pos, npos)
+ assert(s == "QRST");
+ s.clear();
+
+ s.append(sv, 0); // calls append(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.append(sv, 0, std::string::npos); // calls append(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.append(arr, 0); // calls append(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.append(arr, 0, std::string::npos); // calls append(string("IJKL"), pos, npos)
+ assert(s == "IJKL");
+ s.clear();
+
+ s.append(arr, 0); // calls append(const char *, len)
+ assert(s == "");
+ s.clear();
+ }
+
+ {
+ std::string s = "ABCD";
+ std::string_view sv = s;
+ s.append(sv);
+ assert(s == "ABCDABCD");
+
+ sv = s;
+ s.append(sv, 0, std::string::npos);
+ assert(s == "ABCDABCDABCDABCD");
+
+ sv = s;
+ s.append(sv, sv.size());
+ assert(s == "ABCDABCDABCDABCD");
+ }
+
+ {
+ std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ std::string_view sv = s;
+ s.append(sv);
+ assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+ sv = s;
+ s.append(sv, 0, std::string::npos);
+ assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ }
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index 55fc63d06214..dac8860f9a64 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -178,4 +178,30 @@ int main()
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
#endif
+
+ { // test appending to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.append(s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
+
+ { // test appending a different type
+ typedef std::string S;
+ const uint8_t p[] = "ABCD";
+
+ S s;
+ s.append(p, p + 4);
+ assert(s == "ABCD");
+ }
+
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
index 7c45068a53e1..eb552ca83928 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp
@@ -61,4 +61,20 @@ int main()
S("1234567890123456789012345678901234567890"));
}
#endif
+
+ { // test appending to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.append(s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
index 6c594ebac3be..fc80d7cccce6 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp
@@ -70,4 +70,20 @@ int main()
S("1234567890123456789012345678901234567890"));
}
#endif
+
+ { // test appending to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.append(s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.append(s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index 9e8158c3e43e..588c15ab8d6a 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -25,34 +24,52 @@ template <class S>
void
test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
{
- try
+ if (pos <= str.size())
{
s.append(str, pos, n);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ s.append(str, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
template <class S>
void
test_npos(S s, S str, typename S::size_type pos, S expected)
{
- try
+ if (pos <= str.size())
{
s.append(str, pos);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ s.append(str, pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
new file mode 100644
index 000000000000..2d85b15fa373
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_append/string_view.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// basic_string<charT,traits,Allocator>&
+// append(basic_string_view<charT,traits> sv);
+
+#include <string>
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, SV sv, S expected)
+{
+ s.append(sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(), SV(), S());
+ test(S(), SV("12345"), S("12345"));
+ test(S(), SV("1234567890"), S("1234567890"));
+ test(S(), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345"), SV(), S("12345"));
+ test(S("12345"), SV("12345"), S("1234512345"));
+ test(S("12345"), SV("1234567890"), S("123451234567890"));
+ test(S("12345"), SV("12345678901234567890"), S("1234512345678901234567890"));
+
+ test(S("1234567890"), SV(), S("1234567890"));
+ test(S("1234567890"), SV("12345"), S("123456789012345"));
+ test(S("1234567890"), SV("1234567890"), S("12345678901234567890"));
+ test(S("1234567890"), SV("12345678901234567890"), S("123456789012345678901234567890"));
+
+ test(S("12345678901234567890"), SV(), S("12345678901234567890"));
+ test(S("12345678901234567890"), SV("12345"), S("1234567890123456789012345"));
+ test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
+ test(S("12345678901234567890"), SV("12345678901234567890"),
+ S("1234567890123456789012345678901234567890"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ test(S(), SV(), S());
+ test(S(), SV("12345"), S("12345"));
+ test(S(), SV("1234567890"), S("1234567890"));
+ test(S(), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345"), SV(), S("12345"));
+ test(S("12345"), SV("12345"), S("1234512345"));
+ test(S("12345"), SV("1234567890"), S("123451234567890"));
+ test(S("12345"), SV("12345678901234567890"), S("1234512345678901234567890"));
+
+ test(S("1234567890"), SV(), S("1234567890"));
+ test(S("1234567890"), SV("12345"), S("123456789012345"));
+ test(S("1234567890"), SV("1234567890"), S("12345678901234567890"));
+ test(S("1234567890"), SV("12345678901234567890"), S("123456789012345678901234567890"));
+
+ test(S("12345678901234567890"), SV(), S("12345678901234567890"));
+ test(S("12345678901234567890"), SV("12345"), S("1234567890123456789012345"));
+ test(S("12345678901234567890"), SV("1234567890"), S("123456789012345678901234567890"));
+ test(S("12345678901234567890"), SV("12345678901234567890"),
+ S("1234567890123456789012345678901234567890"));
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
new file mode 100644
index 000000000000..bf51d816e86e
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
@@ -0,0 +1,195 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template <class T>
+// basic_string& assign(const T& t, size_type pos, size_type n=npos); // C++17
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, SV sv, typename S::size_type pos, typename S::size_type n, S expected)
+{
+ if (pos <= sv.size())
+ {
+ s.assign(sv, pos, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.assign(sv, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test_npos(S s, SV sv, typename S::size_type pos, S expected)
+{
+ if (pos <= sv.size())
+ {
+ s.assign(sv, pos);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.assign(sv, pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > sv.size());
+ }
+ }
+#endif
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(), SV(), 0, 0, S());
+ test(S(), SV(), 1, 0, S());
+ test(S(), SV("12345"), 0, 3, S("123"));
+ test(S(), SV("12345"), 1, 4, S("2345"));
+ test(S(), SV("12345"), 3, 15, S("45"));
+ test(S(), SV("12345"), 5, 15, S(""));
+ test(S(), SV("12345"), 6, 15, S("not happening"));
+ test(S(), SV("12345678901234567890"), 0, 0, S());
+ test(S(), SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(), SV("12345678901234567890"), 2, 3, S("345"));
+ test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
+ test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
+
+ test(S("12345"), SV(), 0, 0, S());
+ test(S("12345"), SV("12345"), 2, 2, S("34"));
+ test(S("12345"), SV("1234567890"), 0, 100, S("1234567890"));
+
+ test(S("12345678901234567890"), SV(), 0, 0, S());
+ test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
+ test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
+ S("6789012345"));
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ test(S(), SV(), 0, 0, S());
+ test(S(), SV(), 1, 0, S());
+ test(S(), SV("12345"), 0, 3, S("123"));
+ test(S(), SV("12345"), 1, 4, S("2345"));
+ test(S(), SV("12345"), 3, 15, S("45"));
+ test(S(), SV("12345"), 5, 15, S(""));
+ test(S(), SV("12345"), 6, 15, S("not happening"));
+ test(S(), SV("12345678901234567890"), 0, 0, S());
+ test(S(), SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(), SV("12345678901234567890"), 2, 3, S("345"));
+ test(S(), SV("12345678901234567890"), 12, 13, S("34567890"));
+ test(S(), SV("12345678901234567890"), 21, 13, S("not happening"));
+
+ test(S("12345"), SV(), 0, 0, S());
+ test(S("12345"), SV("12345"), 2, 2, S("34"));
+ test(S("12345"), SV("1234567890"), 0, 100, S("1234567890"));
+
+ test(S("12345678901234567890"), SV(), 0, 0, S());
+ test(S("12345678901234567890"), SV("12345"), 1, 3, S("234"));
+ test(S("12345678901234567890"), SV("12345678901234567890"), 5, 10,
+ S("6789012345"));
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test_npos(S(), SV(), 0, S());
+ test_npos(S(), SV(), 1, S());
+ test_npos(S(), SV("12345"), 0, S("12345"));
+ test_npos(S(), SV("12345"), 1, S("2345"));
+ test_npos(S(), SV("12345"), 3, S("45"));
+ test_npos(S(), SV("12345"), 5, S(""));
+ test_npos(S(), SV("12345"), 6, S("not happening"));
+ }
+
+ {
+ std::string s = "ABCD";
+ std::string_view sv = "EFGH";
+ char arr[] = "IJKL";
+
+ s.assign("CDEF", 0); // calls assign(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.assign("QRST", 0, std::string::npos); // calls assign(string("QRST", pos, len)
+ assert(s == "QRST");
+ s.clear();
+
+ s.assign(sv, 0); // calls assign(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.assign(arr, 0); // calls assign(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.assign(arr, 0, std::string::npos); // calls assign(string("IJKL"), pos, npos)
+ assert(s == "IJKL");
+ s.clear();
+
+ s.assign(arr, 0); // calls assign(const char *, len)
+ assert(s == "");
+ s.clear();
+ }
+
+ {
+ std::string s = "ABCD";
+ std::string_view sv = s;
+ s.assign(sv);
+ assert(s == "ABCD");
+
+ sv = s;
+ s.assign(sv, 0, std::string::npos);
+ assert(s == "ABCD");
+ }
+
+ {
+ std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ std::string_view sv = s;
+ s.assign(sv);
+ assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+ sv = s;
+ s.assign(sv, 0, std::string::npos);
+ assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ }
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index e6a57519f34b..e5312e6db6ce 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -179,4 +179,30 @@ int main()
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
#endif
+
+ { // test assigning to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.assign(s_short.begin(), s_short.end());
+ assert(s_short == "123/");
+ s_short.assign(s_short.begin() + 2, s_short.end());
+ assert(s_short == "3/");
+
+ s_long.assign(s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
+
+ s_long.assign(s_long.begin() + 30, s_long.end());
+ assert(s_long == "nsectetur/");
+ }
+
+ { // test assigning a different type
+ typedef std::string S;
+ const uint8_t p[] = "ABCD";
+
+ S s;
+ s.assign(p, p + 4);
+ assert(s == "ABCD");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
index 386dee6d5808..b0876b388d83 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/pointer.pass.cpp
@@ -61,4 +61,18 @@ int main()
S("12345678901234567890"));
}
#endif
+
+ { // test assignment to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.assign(s_short.c_str());
+ assert(s_short == "123/");
+ s_short.assign(s_short.c_str() + 2);
+ assert(s_short == "3/");
+
+ s_long.assign(s_long.c_str() + 30);
+ assert(s_long == "nsectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
index 0eeb9266f40f..97a9990f5180 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/pointer_size.pass.cpp
@@ -70,4 +70,20 @@ int main()
S("12345678901234567890"));
}
#endif
+ { // test assign to self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.assign(s_short.data(), s_short.size());
+ assert(s_short == "123/");
+ s_short.assign(s_short.data() + 2, s_short.size() - 2);
+ assert(s_short == "3/");
+
+ s_long.assign(s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/");
+
+ s_long.assign(s_long.data() + 2, 8 );
+ assert(s_long == "rem ipsu");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
index d9d3cb422ae5..2ad37f311de5 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -25,34 +24,52 @@ template <class S>
void
test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected)
{
- try
+ if (pos <= str.size())
{
s.assign(str, pos, n);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ s.assign(str, pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
template <class S>
void
test_npos(S s, S str, typename S::size_type pos, S expected)
{
- try
+ if (pos <= str.size())
{
s.assign(str, pos);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ s.assign(str, pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
new file mode 100644
index 000000000000..e56b094a36e9
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string_view.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// basic_string<charT,traits,Allocator>&
+// assign(basic_string_view<charT,traits> sv);
+
+#include <string>
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, SV sv, S expected)
+{
+ s.assign(sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+}
+
+template <class S, class SV>
+void
+testAlloc(S s, SV sv, const typename S::allocator_type& a)
+{
+ s.assign(sv);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == sv);
+ assert(s.get_allocator() == a);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(), SV(), S());
+ test(S(), SV("12345"), S("12345"));
+ test(S(), SV("1234567890"), S("1234567890"));
+ test(S(), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345"), SV(), S());
+ test(S("12345"), SV("12345"), S("12345"));
+ test(S("12345"), SV("1234567890"), S("1234567890"));
+ test(S("12345"), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("1234567890"), SV(), S());
+ test(S("1234567890"), SV("12345"), S("12345"));
+ test(S("1234567890"), SV("1234567890"), S("1234567890"));
+ test(S("1234567890"), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345678901234567890"), SV(), S());
+ test(S("12345678901234567890"), SV("12345"), S("12345"));
+ test(S("12345678901234567890"), SV("1234567890"), S("1234567890"));
+ test(S("12345678901234567890"), SV("12345678901234567890"),
+ S("12345678901234567890"));
+
+ testAlloc(S(), SV(), std::allocator<char>());
+ testAlloc(S(), SV("12345"), std::allocator<char>());
+ testAlloc(S(), SV("1234567890"), std::allocator<char>());
+ testAlloc(S(), SV("12345678901234567890"), std::allocator<char>());
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char> > SV;
+ test(S(), SV(), S());
+ test(S(), SV("12345"), S("12345"));
+ test(S(), SV("1234567890"), S("1234567890"));
+ test(S(), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345"), SV(), S());
+ test(S("12345"), SV("12345"), S("12345"));
+ test(S("12345"), SV("1234567890"), S("1234567890"));
+ test(S("12345"), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("1234567890"), SV(), S());
+ test(S("1234567890"), SV("12345"), S("12345"));
+ test(S("1234567890"), SV("1234567890"), S("1234567890"));
+ test(S("1234567890"), SV("12345678901234567890"), S("12345678901234567890"));
+
+ test(S("12345678901234567890"), SV(), S());
+ test(S("12345678901234567890"), SV("12345"), S("12345"));
+ test(S("12345678901234567890"), SV("1234567890"), S("1234567890"));
+ test(S("12345678901234567890"), SV("12345678901234567890"),
+ S("12345678901234567890"));
+
+ testAlloc(S(), SV(), min_allocator<char>());
+ testAlloc(S(), SV("12345"), min_allocator<char>());
+ testAlloc(S(), SV("1234567890"), min_allocator<char>());
+ testAlloc(S(), SV("12345678901234567890"), min_allocator<char>());
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index b66877652837..664d2049be99 100644
--- a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// size_type copy(charT* s, size_type n, size_type pos = 0) const;
@@ -25,20 +24,30 @@ void
test(S str, typename S::value_type* s, typename S::size_type n,
typename S::size_type pos)
{
- try
+ const S& cs = str;
+ if (pos <= cs.size())
{
- const S& cs = str;
typename S::size_type r = cs.copy(s, n, pos);
- assert(pos <= cs.size());
typename S::size_type rlen = std::min(n, cs.size() - pos);
assert(r == rlen);
for (r = 0; r < rlen; ++r)
assert(S::traits_type::eq(cs[pos+r], s[r]));
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > str.size());
+ try
+ {
+ typename S::size_type r = cs.copy(s, n, pos);
+ ((void)r); // Prevent unused warning
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > str.size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
index 5db97ec2cf5f..eb6be202a350 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -24,40 +23,58 @@ template <class S>
void
test(S s, typename S::size_type pos, typename S::size_type n, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.erase(pos, n);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.erase(pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
void
test(S s, typename S::size_type pos, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.erase(pos);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.erase(pos);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
index bbae39419da4..e5ce8e51e1d6 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
@@ -169,4 +169,29 @@ int main()
assert(false);
}
#endif
+
+ { // test inserting into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.insert(s_long.begin(), s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
+
+ { // test assigning a different type
+ typedef std::string S;
+ const uint8_t p[] = "ABCD";
+
+ S s;
+ s.insert(s.begin(), p, p + 4);
+ assert(s == "ABCD");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
new file mode 100644
index 000000000000..e9476f48f358
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
@@ -0,0 +1,1842 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template <class T>
+// basic_string& assign(size_type pos1, const T& t, size_type pos2, size_type n=npos); // C++17
+//
+// Mostly we're testing string_view here
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2,
+ typename S::size_type n, S expected)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= sv.size())
+ {
+ s.insert(pos1, sv, pos2, n);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.insert(pos1, sv, pos2, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > sv.size());
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test_npos(S s, typename S::size_type pos1, SV sv, typename S::size_type pos2, S expected)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= sv.size())
+ {
+ s.insert(pos1, sv, pos2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.insert(pos1, sv, pos2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > sv.size());
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+
+template <class S, class SV>
+void test0()
+{
+ test(S(""), 0, SV(""), 0, 0, S(""));
+ test(S(""), 0, SV(""), 0, 1, S(""));
+ test(S(""), 0, SV(""), 1, 0, S("can't happen"));
+ test(S(""), 0, SV("12345"), 0, 0, S(""));
+ test(S(""), 0, SV("12345"), 0, 1, S("1"));
+ test(S(""), 0, SV("12345"), 0, 2, S("12"));
+ test(S(""), 0, SV("12345"), 0, 4, S("1234"));
+ test(S(""), 0, SV("12345"), 0, 5, S("12345"));
+ test(S(""), 0, SV("12345"), 0, 6, S("12345"));
+ test(S(""), 0, SV("12345"), 1, 0, S(""));
+ test(S(""), 0, SV("12345"), 1, 1, S("2"));
+ test(S(""), 0, SV("12345"), 1, 2, S("23"));
+ test(S(""), 0, SV("12345"), 1, 3, S("234"));
+ test(S(""), 0, SV("12345"), 1, 4, S("2345"));
+ test(S(""), 0, SV("12345"), 1, 5, S("2345"));
+ test(S(""), 0, SV("12345"), 2, 0, S(""));
+ test(S(""), 0, SV("12345"), 2, 1, S("3"));
+ test(S(""), 0, SV("12345"), 2, 2, S("34"));
+ test(S(""), 0, SV("12345"), 2, 3, S("345"));
+ test(S(""), 0, SV("12345"), 2, 4, S("345"));
+ test(S(""), 0, SV("12345"), 4, 0, S(""));
+ test(S(""), 0, SV("12345"), 4, 1, S("5"));
+ test(S(""), 0, SV("12345"), 4, 2, S("5"));
+ test(S(""), 0, SV("12345"), 5, 0, S(""));
+ test(S(""), 0, SV("12345"), 5, 1, S(""));
+ test(S(""), 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S(""), 0, SV("1234567890"), 0, 0, S(""));
+ test(S(""), 0, SV("1234567890"), 0, 1, S("1"));
+ test(S(""), 0, SV("1234567890"), 0, 5, S("12345"));
+ test(S(""), 0, SV("1234567890"), 0, 9, S("123456789"));
+ test(S(""), 0, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S(""), 0, SV("1234567890"), 1, 0, S(""));
+ test(S(""), 0, SV("1234567890"), 1, 1, S("2"));
+ test(S(""), 0, SV("1234567890"), 1, 4, S("2345"));
+ test(S(""), 0, SV("1234567890"), 1, 8, S("23456789"));
+ test(S(""), 0, SV("1234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, SV("1234567890"), 1, 10, S("234567890"));
+ test(S(""), 0, SV("1234567890"), 5, 0, S(""));
+ test(S(""), 0, SV("1234567890"), 5, 1, S("6"));
+ test(S(""), 0, SV("1234567890"), 5, 2, S("67"));
+ test(S(""), 0, SV("1234567890"), 5, 4, S("6789"));
+ test(S(""), 0, SV("1234567890"), 5, 5, S("67890"));
+ test(S(""), 0, SV("1234567890"), 5, 6, S("67890"));
+ test(S(""), 0, SV("1234567890"), 9, 0, S(""));
+ test(S(""), 0, SV("1234567890"), 9, 1, S("0"));
+ test(S(""), 0, SV("1234567890"), 9, 2, S("0"));
+ test(S(""), 0, SV("1234567890"), 10, 0, S(""));
+ test(S(""), 0, SV("1234567890"), 10, 1, S(""));
+ test(S(""), 0, SV("1234567890"), 11, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test1()
+{
+ test(S(""), 0, SV("12345678901234567890"), 0, 0, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S(""), 0, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S(""), 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 1, 0, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(""), 0, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S(""), 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 10, 0, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S(""), 0, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S(""), 0, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S(""), 0, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S(""), 0, SV("12345678901234567890"), 19, 0, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S(""), 0, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S(""), 0, SV("12345678901234567890"), 20, 0, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 20, 1, S(""));
+ test(S(""), 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S(""), 1, SV(""), 0, 0, S("can't happen"));
+ test(S(""), 1, SV(""), 0, 1, S("can't happen"));
+ test(S(""), 1, SV(""), 1, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 1, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 2, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 4, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 5, S("can't happen"));
+ test(S(""), 1, SV("12345"), 0, 6, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 1, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 2, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 3, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 4, S("can't happen"));
+ test(S(""), 1, SV("12345"), 1, 5, S("can't happen"));
+ test(S(""), 1, SV("12345"), 2, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 2, 1, S("can't happen"));
+ test(S(""), 1, SV("12345"), 2, 2, S("can't happen"));
+ test(S(""), 1, SV("12345"), 2, 3, S("can't happen"));
+ test(S(""), 1, SV("12345"), 2, 4, S("can't happen"));
+ test(S(""), 1, SV("12345"), 4, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 4, 1, S("can't happen"));
+ test(S(""), 1, SV("12345"), 4, 2, S("can't happen"));
+ test(S(""), 1, SV("12345"), 5, 0, S("can't happen"));
+ test(S(""), 1, SV("12345"), 5, 1, S("can't happen"));
+ test(S(""), 1, SV("12345"), 6, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test2()
+{
+ test(S(""), 1, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S(""), 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S(""), 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 0, SV(""), 0, 1, S("abcde"));
+}
+
+template <class S, class SV>
+void test3()
+{
+ test(S("abcde"), 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 0, 1, S("1abcde"));
+ test(S("abcde"), 0, SV("12345"), 0, 2, S("12abcde"));
+ test(S("abcde"), 0, SV("12345"), 0, 4, S("1234abcde"));
+ test(S("abcde"), 0, SV("12345"), 0, 5, S("12345abcde"));
+ test(S("abcde"), 0, SV("12345"), 0, 6, S("12345abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 2, S("23abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 3, S("234abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 4, S("2345abcde"));
+ test(S("abcde"), 0, SV("12345"), 1, 5, S("2345abcde"));
+ test(S("abcde"), 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 2, 1, S("3abcde"));
+ test(S("abcde"), 0, SV("12345"), 2, 2, S("34abcde"));
+ test(S("abcde"), 0, SV("12345"), 2, 3, S("345abcde"));
+ test(S("abcde"), 0, SV("12345"), 2, 4, S("345abcde"));
+ test(S("abcde"), 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 4, 1, S("5abcde"));
+ test(S("abcde"), 0, SV("12345"), 4, 2, S("5abcde"));
+ test(S("abcde"), 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 1, S("1abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 5, S("12345abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 9, S("123456789abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 0, 11, S("1234567890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 4, S("2345abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 8, S("23456789abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 9, S("234567890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 1, 10, S("234567890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 1, S("6abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 2, S("67abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 4, S("6789abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 5, S("67890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 5, 6, S("67890abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 9, 1, S("0abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 9, 2, S("0abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 1, S("1abcde"));
+}
+
+template <class S, class SV>
+void test4()
+{
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 9, S("234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 1, S("1abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 5, S("12345abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 9, S("123456789abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 10, 11, S("1234567890abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 19, 1, S("0abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 19, 2, S("0abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 1, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 0, 1, S("a1bcde"));
+ test(S("abcde"), 1, SV("12345"), 0, 2, S("a12bcde"));
+ test(S("abcde"), 1, SV("12345"), 0, 4, S("a1234bcde"));
+ test(S("abcde"), 1, SV("12345"), 0, 5, S("a12345bcde"));
+ test(S("abcde"), 1, SV("12345"), 0, 6, S("a12345bcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 1, S("a2bcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 2, S("a23bcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 3, S("a234bcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 4, S("a2345bcde"));
+ test(S("abcde"), 1, SV("12345"), 1, 5, S("a2345bcde"));
+ test(S("abcde"), 1, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 2, 1, S("a3bcde"));
+ test(S("abcde"), 1, SV("12345"), 2, 2, S("a34bcde"));
+ test(S("abcde"), 1, SV("12345"), 2, 3, S("a345bcde"));
+ test(S("abcde"), 1, SV("12345"), 2, 4, S("a345bcde"));
+ test(S("abcde"), 1, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 4, 1, S("a5bcde"));
+ test(S("abcde"), 1, SV("12345"), 4, 2, S("a5bcde"));
+ test(S("abcde"), 1, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 0, 1, S("a1bcde"));
+}
+
+template <class S, class SV>
+void test5()
+{
+ test(S("abcde"), 1, SV("1234567890"), 0, 5, S("a12345bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 0, 9, S("a123456789bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 0, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 0, 11, S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 1, S("a2bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 4, S("a2345bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 8, S("a23456789bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 9, S("a234567890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 1, 10, S("a234567890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 1, S("a6bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 2, S("a67bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 4, S("a6789bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 5, S("a67890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 5, 6, S("a67890bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 9, 1, S("a0bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 9, 2, S("a0bcde"));
+ test(S("abcde"), 1, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 1, S("a1bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 1, S("a2bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 9, S("a234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 1, S("a1bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 5, S("a12345bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 9, S("a123456789bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 10, 11, S("a1234567890bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 19, 1, S("a0bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 19, 2, S("a0bcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 2, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, SV("12345"), 0, 0, S("abcde"));
+}
+
+template <class S, class SV>
+void test6()
+{
+ test(S("abcde"), 2, SV("12345"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, SV("12345"), 0, 2, S("ab12cde"));
+ test(S("abcde"), 2, SV("12345"), 0, 4, S("ab1234cde"));
+ test(S("abcde"), 2, SV("12345"), 0, 5, S("ab12345cde"));
+ test(S("abcde"), 2, SV("12345"), 0, 6, S("ab12345cde"));
+ test(S("abcde"), 2, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, SV("12345"), 1, 2, S("ab23cde"));
+ test(S("abcde"), 2, SV("12345"), 1, 3, S("ab234cde"));
+ test(S("abcde"), 2, SV("12345"), 1, 4, S("ab2345cde"));
+ test(S("abcde"), 2, SV("12345"), 1, 5, S("ab2345cde"));
+ test(S("abcde"), 2, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345"), 2, 1, S("ab3cde"));
+ test(S("abcde"), 2, SV("12345"), 2, 2, S("ab34cde"));
+ test(S("abcde"), 2, SV("12345"), 2, 3, S("ab345cde"));
+ test(S("abcde"), 2, SV("12345"), 2, 4, S("ab345cde"));
+ test(S("abcde"), 2, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345"), 4, 1, S("ab5cde"));
+ test(S("abcde"), 2, SV("12345"), 4, 2, S("ab5cde"));
+ test(S("abcde"), 2, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 5, S("ab12345cde"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 9, S("ab123456789cde"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 0, 11, S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 4, S("ab2345cde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 8, S("ab23456789cde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 9, S("ab234567890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 1, 10, S("ab234567890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 1, S("ab6cde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 2, S("ab67cde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 4, S("ab6789cde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 5, S("ab67890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 5, 6, S("ab67890cde"));
+ test(S("abcde"), 2, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 9, 1, S("ab0cde"));
+ test(S("abcde"), 2, SV("1234567890"), 9, 2, S("ab0cde"));
+ test(S("abcde"), 2, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
+}
+
+template <class S, class SV>
+void test7()
+{
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 9, S("ab234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 18, S("ab234567890123456789cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 1, S("ab1cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 5, S("ab12345cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 9, S("ab123456789cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 10, 11, S("ab1234567890cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 19, 1, S("ab0cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 19, 2, S("ab0cde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 4, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 4, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 4, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, SV("12345"), 0, 2, S("abcd12e"));
+ test(S("abcde"), 4, SV("12345"), 0, 4, S("abcd1234e"));
+ test(S("abcde"), 4, SV("12345"), 0, 5, S("abcd12345e"));
+ test(S("abcde"), 4, SV("12345"), 0, 6, S("abcd12345e"));
+ test(S("abcde"), 4, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, SV("12345"), 1, 2, S("abcd23e"));
+ test(S("abcde"), 4, SV("12345"), 1, 3, S("abcd234e"));
+ test(S("abcde"), 4, SV("12345"), 1, 4, S("abcd2345e"));
+ test(S("abcde"), 4, SV("12345"), 1, 5, S("abcd2345e"));
+ test(S("abcde"), 4, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 2, 1, S("abcd3e"));
+ test(S("abcde"), 4, SV("12345"), 2, 2, S("abcd34e"));
+ test(S("abcde"), 4, SV("12345"), 2, 3, S("abcd345e"));
+ test(S("abcde"), 4, SV("12345"), 2, 4, S("abcd345e"));
+ test(S("abcde"), 4, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 4, 1, S("abcd5e"));
+ test(S("abcde"), 4, SV("12345"), 4, 2, S("abcd5e"));
+ test(S("abcde"), 4, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 4, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, SV("1234567890"), 0, 5, S("abcd12345e"));
+ test(S("abcde"), 4, SV("1234567890"), 0, 9, S("abcd123456789e"));
+}
+
+template <class S, class SV>
+void test8()
+{
+ test(S("abcde"), 4, SV("1234567890"), 0, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("1234567890"), 0, 11, S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 4, S("abcd2345e"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 8, S("abcd23456789e"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 9, S("abcd234567890e"));
+ test(S("abcde"), 4, SV("1234567890"), 1, 10, S("abcd234567890e"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 1, S("abcd6e"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 2, S("abcd67e"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 4, S("abcd6789e"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 5, S("abcd67890e"));
+ test(S("abcde"), 4, SV("1234567890"), 5, 6, S("abcd67890e"));
+ test(S("abcde"), 4, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 9, 1, S("abcd0e"));
+ test(S("abcde"), 4, SV("1234567890"), 9, 2, S("abcd0e"));
+ test(S("abcde"), 4, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 9, S("abcd234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 1, S("abcd1e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 5, S("abcd12345e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 9, S("abcd123456789e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 10, 11, S("abcd1234567890e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 19, 1, S("abcd0e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 19, 2, S("abcd0e"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 5, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 5, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 5, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, SV("12345"), 0, 2, S("abcde12"));
+}
+
+template <class S, class SV>
+void test9()
+{
+ test(S("abcde"), 5, SV("12345"), 0, 4, S("abcde1234"));
+ test(S("abcde"), 5, SV("12345"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, SV("12345"), 0, 6, S("abcde12345"));
+ test(S("abcde"), 5, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, SV("12345"), 1, 2, S("abcde23"));
+ test(S("abcde"), 5, SV("12345"), 1, 3, S("abcde234"));
+ test(S("abcde"), 5, SV("12345"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, SV("12345"), 1, 5, S("abcde2345"));
+ test(S("abcde"), 5, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 2, 1, S("abcde3"));
+ test(S("abcde"), 5, SV("12345"), 2, 2, S("abcde34"));
+ test(S("abcde"), 5, SV("12345"), 2, 3, S("abcde345"));
+ test(S("abcde"), 5, SV("12345"), 2, 4, S("abcde345"));
+ test(S("abcde"), 5, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 4, 1, S("abcde5"));
+ test(S("abcde"), 5, SV("12345"), 4, 2, S("abcde5"));
+ test(S("abcde"), 5, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 9, S("abcde123456789"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, SV("1234567890"), 0, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 8, S("abcde23456789"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, SV("1234567890"), 1, 10, S("abcde234567890"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 1, S("abcde6"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 2, S("abcde67"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 4, S("abcde6789"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 5, S("abcde67890"));
+ test(S("abcde"), 5, SV("1234567890"), 5, 6, S("abcde67890"));
+ test(S("abcde"), 5, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 9, 1, S("abcde0"));
+ test(S("abcde"), 5, SV("1234567890"), 9, 2, S("abcde0"));
+ test(S("abcde"), 5, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
+}
+
+template <class S, class SV>
+void test10()
+{
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 1, S("abcde1"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 5, S("abcde12345"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 19, 1, S("abcde0"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 19, 2, S("abcde0"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 6, SV(""), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, SV(""), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 0, 11, S("can't happen"));
+}
+
+template <class S, class SV>
+void test11()
+{
+ test(S("abcde"), 6, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcde"), 6, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 0, 2, S("12abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 0, 4, S("1234abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 0, 5, S("12345abcdefghij"));
+}
+
+template <class S, class SV>
+void test12()
+{
+ test(S("abcdefghij"), 0, SV("12345"), 0, 6, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 1, S("2abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 2, S("23abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 3, S("234abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 4, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 1, 5, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 2, 1, S("3abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 2, 2, S("34abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 2, 3, S("345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 2, 4, S("345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 4, 1, S("5abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 4, 2, S("5abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 5, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 9, S("123456789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 0, 11, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 1, S("2abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 4, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 8, S("23456789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 9, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 1, 10, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 1, S("6abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 2, S("67abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 4, S("6789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 5, S("67890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 5, 6, S("67890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 9, 1, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 9, 2, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 1, S("2abcdefghij"));
+}
+
+template <class S, class SV>
+void test13()
+{
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 19, 1, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 19, 2, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 2, S("a12bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 4, S("a1234bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 0, 6, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 1, S("a2bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 2, S("a23bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 3, S("a234bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 4, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 1, 5, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 2, 1, S("a3bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 2, 2, S("a34bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 2, 3, S("a345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 2, 4, S("a345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 4, 1, S("a5bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 4, 2, S("a5bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 9, S("a123456789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 0, 11, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 1, S("a2bcdefghij"));
+}
+
+template <class S, class SV>
+void test14()
+{
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 4, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 8, S("a23456789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 9, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 1, 10, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 1, S("a6bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 2, S("a67bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 4, S("a6789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 5, S("a67890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 5, 6, S("a67890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 9, 1, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 9, 2, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 1, S("a2bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 19, 1, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 19, 2, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 2, S("abcde12fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 4, S("abcde1234fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 0, 6, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 1, 0, S("abcdefghij"));
+}
+
+template <class S, class SV>
+void test15()
+{
+ test(S("abcdefghij"), 5, SV("12345"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 1, 2, S("abcde23fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 1, 3, S("abcde234fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 1, 4, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 1, 5, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 2, 1, S("abcde3fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 2, 2, S("abcde34fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 2, 3, S("abcde345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 2, 4, S("abcde345fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 4, 1, S("abcde5fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 4, 2, S("abcde5fghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 9, S("abcde123456789fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 0, 11, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 4, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 8, S("abcde23456789fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 9, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 1, 10, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 1, S("abcde6fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 2, S("abcde67fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 4, S("abcde6789fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 5, S("abcde67890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 5, 6, S("abcde67890fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 9, 1, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 9, 2, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
+}
+
+template <class S, class SV>
+void test16()
+{
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 9, S("abcde123456789fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 10, 11, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 19, 1, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 19, 2, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 2, S("abcdefghi12j"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 4, S("abcdefghi1234j"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 0, 6, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 2, S("abcdefghi23j"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 3, S("abcdefghi234j"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 4, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 1, 5, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 2, 1, S("abcdefghi3j"));
+ test(S("abcdefghij"), 9, SV("12345"), 2, 2, S("abcdefghi34j"));
+ test(S("abcdefghij"), 9, SV("12345"), 2, 3, S("abcdefghi345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 2, 4, S("abcdefghi345j"));
+ test(S("abcdefghij"), 9, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 4, 1, S("abcdefghi5j"));
+ test(S("abcdefghij"), 9, SV("12345"), 4, 2, S("abcdefghi5j"));
+ test(S("abcdefghij"), 9, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 9, S("abcdefghi123456789j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 0, 11, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 4, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 8, S("abcdefghi23456789j"));
+}
+
+template <class S, class SV>
+void test17()
+{
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 9, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 1, 10, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 1, S("abcdefghi6j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 2, S("abcdefghi67j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 4, S("abcdefghi6789j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 5, S("abcdefghi67890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 5, 6, S("abcdefghi67890j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 9, 1, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 9, 2, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 19, 1, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 19, 2, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 2, S("abcdefghij12"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 4, S("abcdefghij1234"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("12345"), 0, 6, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, SV("12345"), 1, 2, S("abcdefghij23"));
+}
+
+template <class S, class SV>
+void test18()
+{
+ test(S("abcdefghij"), 10, SV("12345"), 1, 3, S("abcdefghij234"));
+ test(S("abcdefghij"), 10, SV("12345"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, SV("12345"), 1, 5, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 2, 1, S("abcdefghij3"));
+ test(S("abcdefghij"), 10, SV("12345"), 2, 2, S("abcdefghij34"));
+ test(S("abcdefghij"), 10, SV("12345"), 2, 3, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, SV("12345"), 2, 4, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 4, 1, S("abcdefghij5"));
+ test(S("abcdefghij"), 10, SV("12345"), 4, 2, S("abcdefghij5"));
+ test(S("abcdefghij"), 10, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 1, S("abcdefghij6"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 2, S("abcdefghij67"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 4, S("abcdefghij6789"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 5, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 5, 6, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 9, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 9, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
+}
+
+template <class S, class SV>
+void test19()
+{
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV(""), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV(""), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 1, 10, S("can't happen"));
+}
+
+template <class S, class SV>
+void test20()
+{
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 2, S("12abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 4, S("1234abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 0, 6, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test21()
+{
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 1, S("3abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 2, S("34abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 3, S("345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 2, 4, S("345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 4, 1, S("5abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 4, 2, S("5abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 9, S("123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 0, 11, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 4, S("2345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 8, S("23456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 1, 10, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 1, S("6abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 2, S("67abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 4, S("6789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 5, S("67890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 5, 6, S("67890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 9, 1, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 9, 2, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test22()
+{
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 19, 1, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 19, 2, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 2, S("a12bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 4, S("a1234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 0, 6, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 2, S("a23bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 3, S("a234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 4, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 1, 5, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 2, 1, S("a3bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 2, 2, S("a34bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 2, 3, S("a345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 2, 4, S("a345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 4, 1, S("a5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 4, 2, S("a5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 9, S("a123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 0, 11, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 4, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 8, S("a23456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test23()
+{
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 5, S("a67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 5, 6, S("a67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 9, 1, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 9, 2, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 19, 1, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 19, 2, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 2, S("abcdefghij12klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 4, S("abcdefghij1234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, 6, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test24()
+{
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 3, S("abcdefghij345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 2, 4, S("abcdefghij345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 4, 1, S("abcdefghij5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 4, 2, S("abcdefghij5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 9, S("abcdefghij123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 0, 11, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 4, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 8, S("abcdefghij23456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 1, 10, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 1, S("abcdefghij6klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 2, S("abcdefghij67klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 4, S("abcdefghij6789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 5, S("abcdefghij67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 5, 6, S("abcdefghij67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 9, 1, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 9, 2, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
+}
+
+template <class S, class SV>
+void test25()
+{
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 19, 1, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 19, 2, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
+}
+
+template <class S, class SV>
+void test26()
+{
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
+}
+
+template <class S, class SV>
+void test27()
+{
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
+}
+
+template <class S, class SV>
+void test28()
+{
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV(""), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV(""), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 5, 6, S("can't happen"));
+}
+
+template <class S, class SV>
+void test29()
+{
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, SV("12345678901234567890"), 21, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test30()
+{
+ test_npos(S(""), 0, SV("12345678901234567890"), 0, S("12345678901234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 1, S( "2345678901234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 2, S( "345678901234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 3, S( "45678901234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 5, S( "678901234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 10, S( "1234567890"));
+ test_npos(S(""), 0, SV("12345678901234567890"), 21, S("can't happen"));
+ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 0, S("abcdefghij12345klmnopqrst"));
+ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 1, S("abcdefghij2345klmnopqrst"));
+ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 3, S("abcdefghij45klmnopqrst"));
+ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 5, S("abcdefghijklmnopqrst"));
+ test_npos(S("abcdefghijklmnopqrst"), 10, SV("12345"), 6, S("can't happen"));
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ S s;
+ SV sv = "EFGH";
+ char arr[] = "IJKL";
+
+ s.insert(0, "CDEF", 0); // calls insert(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.insert(0, "QRST", 0, std::string::npos); // calls insert(string("QRST"), pos, npos)
+ assert(s == "QRST");
+ s.clear();
+
+ s.insert(0, sv, 0); // calls insert(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.insert(0, sv, 0, std::string::npos); // calls insert(T, pos, npos)
+ assert(s == sv);
+ s.clear();
+
+ s.insert(0, arr, 0); // calls insert(const char *, len)
+ assert(s == "");
+ s.clear();
+
+ s.insert(0, arr, 0, std::string::npos); // calls insert(string("IJKL"), pos, npos)
+ assert(s == "IJKL");
+ s.clear();
+
+ s.insert(0, arr, 0); // calls insert(const char *, len)
+ assert(s == "");
+ s.clear();
+ }
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
index faab5bd92672..e49f57a7f9ad 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -24,20 +23,29 @@ template <class S>
void
test(S s, typename S::size_type pos, const typename S::value_type* str, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.insert(pos, str);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.insert(pos, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
int main()
@@ -210,4 +218,20 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen"));
}
#endif
+
+ { // test inserting into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(0, s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.insert(0, s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
index 30d3df9f259f..a42a60ddcdb4 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -25,20 +24,29 @@ void
test(S s, typename S::size_type pos, const typename S::value_type* str,
typename S::size_type n, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.insert(pos, str, n);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.insert(pos, str, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
int main()
@@ -691,4 +699,20 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
}
#endif
+
+ { // test inserting into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.insert(0, s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.insert(0, s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
index 04ea1d376940..a769604c6ff9 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -25,20 +24,29 @@ void
test(S s, typename S::size_type pos, typename S::size_type n,
typename S::value_type str, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.insert(pos, n, str);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.insert(pos, n, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
index 1945871b99ac..e7c5ecdc9c1b 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -24,20 +23,29 @@ template <class S>
void
test(S s, typename S::size_type pos, S str, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.insert(pos, str);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.insert(pos, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
index 32485db478d8..67ba7ec108f1 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -27,40 +26,58 @@ void
test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
typename S::size_type n, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos1 <= old_size && pos2 <= str.size())
{
s.insert(pos1, str, pos2, n);
LIBCPP_ASSERT(s.__invariants());
- assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > old_size || pos2 > str.size());
- assert(s == s0);
+ try
+ {
+ s.insert(pos1, str, pos2, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > str.size());
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
void
test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos1 <= old_size && pos2 <= str.size())
{
s.insert(pos1, str, pos2);
LIBCPP_ASSERT(s.__invariants());
- assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > old_size || pos2 > str.size());
- assert(s == s0);
+ try
+ {
+ s.insert(pos1, str, pos2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > str.size());
+ assert(s == s0);
+ }
}
+#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
index cc37e79c7932..e456d395220b 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
@@ -1007,4 +1007,34 @@ int main()
test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
#endif
+
+ { // test replacing into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.begin(), s_short.end());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.begin(), s_long.end());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
+
+ { // test assigning a different type
+ typedef std::string S;
+ const uint8_t pc[] = "ABCD";
+ uint8_t p[] = "EFGH";
+
+ S s;
+ s.replace(s.begin(), s.end(), pc, pc + 4);
+ assert(s == "ABCD");
+
+ s.clear();
+ s.replace(s.begin(), s.end(), p, p + 4);
+ assert(s == "EFGH");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
index 730fc1a501cf..f642d3a4f921 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer.pass.cpp
@@ -282,4 +282,20 @@ int main()
test2<S>();
}
#endif
+
+ { // test replacing into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.c_str());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.c_str());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
index 4a910e499819..695036807223 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_pointer_size.pass.cpp
@@ -972,4 +972,20 @@ int main()
test8<S>();
}
#endif
+
+ { // test replacing into self
+ typedef std::string S;
+ S s_short = "123/";
+ S s_long = "Lorem ipsum dolor sit amet, consectetur/";
+
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/");
+ s_short.replace(s_short.begin(), s_short.begin(), s_short.data(), s_short.size());
+ assert(s_short == "123/123/123/123/123/123/123/123/");
+
+ s_long.replace(s_long.begin(), s_long.begin(), s_long.data(), s_long.size());
+ assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
+ }
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
new file mode 100644
index 000000000000..840b7614f482
--- /dev/null
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
@@ -0,0 +1,6022 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template <class T>
+// basic_string& replace(size_type pos1, size_type n1, const T& t,
+// size_type pos2, size_type n=npos);
+//
+// Mostly we're testing string_view here
+
+#include <string>
+#include <stdexcept>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(S s, typename S::size_type pos1, typename S::size_type n1,
+ SV sv, typename S::size_type pos2, typename S::size_type n2,
+ S expected)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= sv.size())
+ {
+ s.replace(pos1, n1, sv, pos2, n2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = std::min(n2, sv.size() - pos2);
+ assert(s.size() == old_size - xlen + rlen);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.replace(pos1, n1, sv, pos2, n2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > sv.size());
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
+ SV sv, typename S::size_type pos2,
+ S expected)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ const typename S::size_type old_size = s.size();
+ S s0 = s;
+ if (pos1 <= old_size && pos2 <= sv.size())
+ {
+ s.replace(pos1, n1, sv, pos2);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+ typename S::size_type xlen = std::min(n1, old_size - pos1);
+ typename S::size_type rlen = std::min(S::npos, sv.size() - pos2);
+ assert(s.size() == old_size - xlen + rlen);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.replace(pos1, n1, sv, pos2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > sv.size());
+ assert(s == s0);
+ }
+ }
+#endif
+}
+
+
+template <class S, class SV>
+void test0()
+{
+ test(S(""), 0, 0, SV(""), 0, 0, S(""));
+ test(S(""), 0, 0, SV(""), 0, 1, S(""));
+ test(S(""), 0, 0, SV(""), 1, 0, S("can't happen"));
+ test(S(""), 0, 0, SV("12345"), 0, 0, S(""));
+ test(S(""), 0, 0, SV("12345"), 0, 1, S("1"));
+ test(S(""), 0, 0, SV("12345"), 0, 2, S("12"));
+ test(S(""), 0, 0, SV("12345"), 0, 4, S("1234"));
+ test(S(""), 0, 0, SV("12345"), 0, 5, S("12345"));
+ test(S(""), 0, 0, SV("12345"), 0, 6, S("12345"));
+ test(S(""), 0, 0, SV("12345"), 1, 0, S(""));
+ test(S(""), 0, 0, SV("12345"), 1, 1, S("2"));
+ test(S(""), 0, 0, SV("12345"), 1, 2, S("23"));
+ test(S(""), 0, 0, SV("12345"), 1, 3, S("234"));
+ test(S(""), 0, 0, SV("12345"), 1, 4, S("2345"));
+ test(S(""), 0, 0, SV("12345"), 1, 5, S("2345"));
+ test(S(""), 0, 0, SV("12345"), 2, 0, S(""));
+ test(S(""), 0, 0, SV("12345"), 2, 1, S("3"));
+ test(S(""), 0, 0, SV("12345"), 2, 2, S("34"));
+ test(S(""), 0, 0, SV("12345"), 2, 3, S("345"));
+ test(S(""), 0, 0, SV("12345"), 2, 4, S("345"));
+ test(S(""), 0, 0, SV("12345"), 4, 0, S(""));
+ test(S(""), 0, 0, SV("12345"), 4, 1, S("5"));
+ test(S(""), 0, 0, SV("12345"), 4, 2, S("5"));
+ test(S(""), 0, 0, SV("12345"), 5, 0, S(""));
+ test(S(""), 0, 0, SV("12345"), 5, 1, S(""));
+ test(S(""), 0, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S(""), 0, 0, SV("1234567890"), 0, 0, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 0, 1, S("1"));
+ test(S(""), 0, 0, SV("1234567890"), 0, 5, S("12345"));
+ test(S(""), 0, 0, SV("1234567890"), 0, 9, S("123456789"));
+ test(S(""), 0, 0, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, 0, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S(""), 0, 0, SV("1234567890"), 1, 0, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 1, 1, S("2"));
+ test(S(""), 0, 0, SV("1234567890"), 1, 4, S("2345"));
+ test(S(""), 0, 0, SV("1234567890"), 1, 8, S("23456789"));
+ test(S(""), 0, 0, SV("1234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, 0, SV("1234567890"), 1, 10, S("234567890"));
+ test(S(""), 0, 0, SV("1234567890"), 5, 0, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 5, 1, S("6"));
+ test(S(""), 0, 0, SV("1234567890"), 5, 2, S("67"));
+ test(S(""), 0, 0, SV("1234567890"), 5, 4, S("6789"));
+ test(S(""), 0, 0, SV("1234567890"), 5, 5, S("67890"));
+ test(S(""), 0, 0, SV("1234567890"), 5, 6, S("67890"));
+ test(S(""), 0, 0, SV("1234567890"), 9, 0, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 9, 1, S("0"));
+ test(S(""), 0, 0, SV("1234567890"), 9, 2, S("0"));
+ test(S(""), 0, 0, SV("1234567890"), 10, 0, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 10, 1, S(""));
+ test(S(""), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 0, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 0, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 0, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 19, 0, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S(""), 0, 0, SV("12345678901234567890"), 20, 0, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 20, 1, S(""));
+ test(S(""), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S(""), 0, 1, SV(""), 0, 0, S(""));
+ test(S(""), 0, 1, SV(""), 0, 1, S(""));
+ test(S(""), 0, 1, SV(""), 1, 0, S("can't happen"));
+ test(S(""), 0, 1, SV("12345"), 0, 0, S(""));
+ test(S(""), 0, 1, SV("12345"), 0, 1, S("1"));
+ test(S(""), 0, 1, SV("12345"), 0, 2, S("12"));
+ test(S(""), 0, 1, SV("12345"), 0, 4, S("1234"));
+ test(S(""), 0, 1, SV("12345"), 0, 5, S("12345"));
+ test(S(""), 0, 1, SV("12345"), 0, 6, S("12345"));
+ test(S(""), 0, 1, SV("12345"), 1, 0, S(""));
+ test(S(""), 0, 1, SV("12345"), 1, 1, S("2"));
+ test(S(""), 0, 1, SV("12345"), 1, 2, S("23"));
+ test(S(""), 0, 1, SV("12345"), 1, 3, S("234"));
+ test(S(""), 0, 1, SV("12345"), 1, 4, S("2345"));
+ test(S(""), 0, 1, SV("12345"), 1, 5, S("2345"));
+ test(S(""), 0, 1, SV("12345"), 2, 0, S(""));
+ test(S(""), 0, 1, SV("12345"), 2, 1, S("3"));
+ test(S(""), 0, 1, SV("12345"), 2, 2, S("34"));
+ test(S(""), 0, 1, SV("12345"), 2, 3, S("345"));
+ test(S(""), 0, 1, SV("12345"), 2, 4, S("345"));
+ test(S(""), 0, 1, SV("12345"), 4, 0, S(""));
+ test(S(""), 0, 1, SV("12345"), 4, 1, S("5"));
+ test(S(""), 0, 1, SV("12345"), 4, 2, S("5"));
+ test(S(""), 0, 1, SV("12345"), 5, 0, S(""));
+ test(S(""), 0, 1, SV("12345"), 5, 1, S(""));
+ test(S(""), 0, 1, SV("12345"), 6, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test1()
+{
+ test(S(""), 0, 1, SV("1234567890"), 0, 0, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 0, 1, S("1"));
+ test(S(""), 0, 1, SV("1234567890"), 0, 5, S("12345"));
+ test(S(""), 0, 1, SV("1234567890"), 0, 9, S("123456789"));
+ test(S(""), 0, 1, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, 1, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S(""), 0, 1, SV("1234567890"), 1, 0, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 1, 1, S("2"));
+ test(S(""), 0, 1, SV("1234567890"), 1, 4, S("2345"));
+ test(S(""), 0, 1, SV("1234567890"), 1, 8, S("23456789"));
+ test(S(""), 0, 1, SV("1234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, 1, SV("1234567890"), 1, 10, S("234567890"));
+ test(S(""), 0, 1, SV("1234567890"), 5, 0, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 5, 1, S("6"));
+ test(S(""), 0, 1, SV("1234567890"), 5, 2, S("67"));
+ test(S(""), 0, 1, SV("1234567890"), 5, 4, S("6789"));
+ test(S(""), 0, 1, SV("1234567890"), 5, 5, S("67890"));
+ test(S(""), 0, 1, SV("1234567890"), 5, 6, S("67890"));
+ test(S(""), 0, 1, SV("1234567890"), 9, 0, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 9, 1, S("0"));
+ test(S(""), 0, 1, SV("1234567890"), 9, 2, S("0"));
+ test(S(""), 0, 1, SV("1234567890"), 10, 0, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 10, 1, S(""));
+ test(S(""), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 0, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 0, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 0, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 19, 0, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S(""), 0, 1, SV("12345678901234567890"), 20, 0, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 20, 1, S(""));
+ test(S(""), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S(""), 1, 0, SV(""), 0, 0, S("can't happen"));
+ test(S(""), 1, 0, SV(""), 0, 1, S("can't happen"));
+ test(S(""), 1, 0, SV(""), 1, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 4, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 5, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 0, 6, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 3, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 4, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 1, 5, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 2, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 2, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 2, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 2, 3, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 2, 4, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 4, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 4, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 4, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 5, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 5, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
+}
+
+template <class S, class SV>
+void test2()
+{
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S(""), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 0, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 1, S("1abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 2, S("12abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 4, S("1234abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 5, S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 0, 6, S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 2, S("23abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 3, S("234abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 4, S("2345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 1, 5, S("2345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 2, 1, S("3abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 2, 2, S("34abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 2, 3, S("345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 2, 4, S("345abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 4, 1, S("5abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 4, 2, S("5abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 1, S("1abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 5, S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 4, S("2345abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 1, S("6abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 2, S("67abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 4, S("6789abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 5, S("67890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 5, 6, S("67890abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 9, 1, S("0abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 9, 2, S("0abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 1, SV(""), 0, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV(""), 0, 1, S("bcde"));
+ test(S("abcde"), 0, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 1, SV("12345"), 0, 0, S("bcde"));
+}
+
+template <class S, class SV>
+void test3()
+{
+ test(S("abcde"), 0, 1, SV("12345"), 0, 1, S("1bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 0, 2, S("12bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 0, 4, S("1234bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 0, 5, S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 0, 6, S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 1, S("2bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 2, S("23bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 3, S("234bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 4, S("2345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 1, 5, S("2345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 2, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 2, 1, S("3bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 2, 2, S("34bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 2, 3, S("345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 2, 4, S("345bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 4, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 4, 1, S("5bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 4, 2, S("5bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 5, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 5, 1, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 1, S("1bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 5, S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 1, S("2bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 4, S("2345bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 1, S("6bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 2, S("67bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 4, S("6789bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 5, S("67890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 5, 6, S("67890bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 9, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 9, 1, S("0bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 9, 2, S("0bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 10, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 10, 1, S("bcde"));
+ test(S("abcde"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcde"));
+ test(S("abcde"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 2, SV(""), 0, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV(""), 0, 1, S("cde"));
+ test(S("abcde"), 0, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 1, S("1cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 2, S("12cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 4, S("1234cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 5, S("12345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 0, 6, S("12345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 1, S("2cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 2, S("23cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 3, S("234cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 4, S("2345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 1, 5, S("2345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 2, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 2, 1, S("3cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 2, 2, S("34cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 2, 3, S("345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 2, 4, S("345cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 4, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 4, 1, S("5cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 4, 2, S("5cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 5, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 5, 1, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 1, S("1cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 5, S("12345cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 9, S("123456789cde"));
+}
+
+template <class S, class SV>
+void test4()
+{
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 10, S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 0, 11, S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 1, S("2cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 4, S("2345cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 8, S("23456789cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 9, S("234567890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 1, 10, S("234567890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 1, S("6cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 2, S("67cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 4, S("6789cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 5, S("67890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 5, 6, S("67890cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 9, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 9, 1, S("0cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 9, 2, S("0cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 10, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 10, 1, S("cde"));
+ test(S("abcde"), 0, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 1, S("1cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 10, S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 19, S("1234567890123456789cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 20, S("12345678901234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 21, S("12345678901234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 1, S("2cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 9, S("234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 18, S("234567890123456789cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 19, S("2345678901234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 20, S("2345678901234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 1, S("1cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 5, S("12345cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 9, S("123456789cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 10, S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 11, S("1234567890cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 1, S("0cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 2, S("0cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 20, 0, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 20, 1, S("cde"));
+ test(S("abcde"), 0, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 4, SV(""), 0, 0, S("e"));
+ test(S("abcde"), 0, 4, SV(""), 0, 1, S("e"));
+ test(S("abcde"), 0, 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 1, S("1e"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 2, S("12e"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 4, S("1234e"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 5, S("12345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 0, 6, S("12345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 1, S("2e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 2, S("23e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 3, S("234e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 4, S("2345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 1, 5, S("2345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 2, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 2, 1, S("3e"));
+ test(S("abcde"), 0, 4, SV("12345"), 2, 2, S("34e"));
+ test(S("abcde"), 0, 4, SV("12345"), 2, 3, S("345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 2, 4, S("345e"));
+ test(S("abcde"), 0, 4, SV("12345"), 4, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 4, 1, S("5e"));
+ test(S("abcde"), 0, 4, SV("12345"), 4, 2, S("5e"));
+ test(S("abcde"), 0, 4, SV("12345"), 5, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 5, 1, S("e"));
+ test(S("abcde"), 0, 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 1, S("1e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 5, S("12345e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 9, S("123456789e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 10, S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 0, 11, S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 1, S("2e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 4, S("2345e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 8, S("23456789e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 9, S("234567890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 1, 10, S("234567890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 1, S("6e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 2, S("67e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 4, S("6789e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 5, S("67890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 5, 6, S("67890e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 9, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 9, 1, S("0e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 9, 2, S("0e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 10, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 10, 1, S("e"));
+ test(S("abcde"), 0, 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 1, S("1e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 10, S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 19, S("1234567890123456789e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 20, S("12345678901234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 21, S("12345678901234567890e"));
+}
+
+template <class S, class SV>
+void test5()
+{
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 1, S("2e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 9, S("234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 18, S("234567890123456789e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 19, S("2345678901234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 20, S("2345678901234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 1, S("1e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 5, S("12345e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 9, S("123456789e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 10, S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 11, S("1234567890e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 1, S("0e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 2, S("0e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 20, 0, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 20, 1, S("e"));
+ test(S("abcde"), 0, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 5, SV(""), 0, 0, S(""));
+ test(S("abcde"), 0, 5, SV(""), 0, 1, S(""));
+ test(S("abcde"), 0, 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 1, S("1"));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 2, S("12"));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 4, S("1234"));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 5, S("12345"));
+ test(S("abcde"), 0, 5, SV("12345"), 0, 6, S("12345"));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 1, S("2"));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 2, S("23"));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 3, S("234"));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 4, S("2345"));
+ test(S("abcde"), 0, 5, SV("12345"), 1, 5, S("2345"));
+ test(S("abcde"), 0, 5, SV("12345"), 2, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 2, 1, S("3"));
+ test(S("abcde"), 0, 5, SV("12345"), 2, 2, S("34"));
+ test(S("abcde"), 0, 5, SV("12345"), 2, 3, S("345"));
+ test(S("abcde"), 0, 5, SV("12345"), 2, 4, S("345"));
+ test(S("abcde"), 0, 5, SV("12345"), 4, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 4, 1, S("5"));
+ test(S("abcde"), 0, 5, SV("12345"), 4, 2, S("5"));
+ test(S("abcde"), 0, 5, SV("12345"), 5, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 5, 1, S(""));
+ test(S("abcde"), 0, 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 0, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 9, S("123456789"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 0, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 0, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 9, 0, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcde"), 0, 5, SV("1234567890"), 10, 0, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 10, 1, S(""));
+ test(S("abcde"), 0, 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcde"), 0, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 0, 6, SV(""), 0, 0, S(""));
+ test(S("abcde"), 0, 6, SV(""), 0, 1, S(""));
+ test(S("abcde"), 0, 6, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 0, 6, SV("12345"), 0, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 0, 1, S("1"));
+ test(S("abcde"), 0, 6, SV("12345"), 0, 2, S("12"));
+ test(S("abcde"), 0, 6, SV("12345"), 0, 4, S("1234"));
+ test(S("abcde"), 0, 6, SV("12345"), 0, 5, S("12345"));
+}
+
+template <class S, class SV>
+void test6()
+{
+ test(S("abcde"), 0, 6, SV("12345"), 0, 6, S("12345"));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 1, S("2"));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 2, S("23"));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 3, S("234"));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 4, S("2345"));
+ test(S("abcde"), 0, 6, SV("12345"), 1, 5, S("2345"));
+ test(S("abcde"), 0, 6, SV("12345"), 2, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 2, 1, S("3"));
+ test(S("abcde"), 0, 6, SV("12345"), 2, 2, S("34"));
+ test(S("abcde"), 0, 6, SV("12345"), 2, 3, S("345"));
+ test(S("abcde"), 0, 6, SV("12345"), 2, 4, S("345"));
+ test(S("abcde"), 0, 6, SV("12345"), 4, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 4, 1, S("5"));
+ test(S("abcde"), 0, 6, SV("12345"), 4, 2, S("5"));
+ test(S("abcde"), 0, 6, SV("12345"), 5, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 5, 1, S(""));
+ test(S("abcde"), 0, 6, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 0, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 9, S("123456789"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 0, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 0, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 9, 0, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcde"), 0, 6, SV("1234567890"), 10, 0, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 10, 1, S(""));
+ test(S("abcde"), 0, 6, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcde"), 0, 6, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 1, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 1, S("a1bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 2, S("a12bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 4, S("a1234bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 5, S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 0, 6, S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 1, S("a2bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 2, S("a23bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 3, S("a234bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 4, S("a2345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 1, 5, S("a2345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 2, 1, S("a3bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 2, 2, S("a34bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 2, 3, S("a345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 2, 4, S("a345bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 4, 1, S("a5bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 4, 2, S("a5bcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 1, S("a1bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 1, S("a2bcde"));
+}
+
+template <class S, class SV>
+void test7()
+{
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 1, S("a6bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 2, S("a67bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 9, 1, S("a0bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 9, 2, S("a0bcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 1, SV(""), 0, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV(""), 0, 1, S("acde"));
+ test(S("abcde"), 1, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 1, S("a1cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 2, S("a12cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 4, S("a1234cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 5, S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 0, 6, S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 1, S("a2cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 2, S("a23cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 3, S("a234cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 4, S("a2345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 1, 5, S("a2345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 2, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 2, 1, S("a3cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 2, 2, S("a34cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 2, 3, S("a345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 2, 4, S("a345cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 4, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 4, 1, S("a5cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 4, 2, S("a5cde"));
+ test(S("abcde"), 1, 1, SV("12345"), 5, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 5, 1, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 1, S("a1cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 5, S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 1, S("a2cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 4, S("a2345cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 1, S("a6cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 2, S("a67cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 4, S("a6789cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 5, S("a67890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 5, 6, S("a67890cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 9, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 9, 1, S("a0cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 9, 2, S("a0cde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 10, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 10, 1, S("acde"));
+ test(S("abcde"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cde"));
+}
+
+template <class S, class SV>
+void test8()
+{
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 20, 0, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 20, 1, S("acde"));
+ test(S("abcde"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 2, SV(""), 0, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV(""), 0, 1, S("ade"));
+ test(S("abcde"), 1, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 1, S("a1de"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 2, S("a12de"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 4, S("a1234de"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 5, S("a12345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 0, 6, S("a12345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 1, S("a2de"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 2, S("a23de"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 3, S("a234de"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 4, S("a2345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 1, 5, S("a2345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 2, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 2, 1, S("a3de"));
+ test(S("abcde"), 1, 2, SV("12345"), 2, 2, S("a34de"));
+ test(S("abcde"), 1, 2, SV("12345"), 2, 3, S("a345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 2, 4, S("a345de"));
+ test(S("abcde"), 1, 2, SV("12345"), 4, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 4, 1, S("a5de"));
+ test(S("abcde"), 1, 2, SV("12345"), 4, 2, S("a5de"));
+ test(S("abcde"), 1, 2, SV("12345"), 5, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 5, 1, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 1, S("a1de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 5, S("a12345de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 9, S("a123456789de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 10, S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 0, 11, S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 1, S("a2de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 4, S("a2345de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 8, S("a23456789de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 9, S("a234567890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 1, 10, S("a234567890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 1, S("a6de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 2, S("a67de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 4, S("a6789de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 5, S("a67890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 5, 6, S("a67890de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 9, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 9, 1, S("a0de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 9, 2, S("a0de"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 10, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 10, 1, S("ade"));
+ test(S("abcde"), 1, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 1, S("a1de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 10, S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 19, S("a1234567890123456789de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 20, S("a12345678901234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 21, S("a12345678901234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 1, S("a2de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 9, S("a234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 18, S("a234567890123456789de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 19, S("a2345678901234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 20, S("a2345678901234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 1, S("a1de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 5, S("a12345de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 9, S("a123456789de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 10, S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 11, S("a1234567890de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 1, S("a0de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 2, S("a0de"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 20, 0, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 20, 1, S("ade"));
+ test(S("abcde"), 1, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 3, SV(""), 0, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV(""), 0, 1, S("ae"));
+ test(S("abcde"), 1, 3, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 1, S("a1e"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 2, S("a12e"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 4, S("a1234e"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 5, S("a12345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 0, 6, S("a12345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 1, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 1, 1, S("a2e"));
+ test(S("abcde"), 1, 3, SV("12345"), 1, 2, S("a23e"));
+}
+
+template <class S, class SV>
+void test9()
+{
+ test(S("abcde"), 1, 3, SV("12345"), 1, 3, S("a234e"));
+ test(S("abcde"), 1, 3, SV("12345"), 1, 4, S("a2345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 1, 5, S("a2345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 2, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 2, 1, S("a3e"));
+ test(S("abcde"), 1, 3, SV("12345"), 2, 2, S("a34e"));
+ test(S("abcde"), 1, 3, SV("12345"), 2, 3, S("a345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 2, 4, S("a345e"));
+ test(S("abcde"), 1, 3, SV("12345"), 4, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 4, 1, S("a5e"));
+ test(S("abcde"), 1, 3, SV("12345"), 4, 2, S("a5e"));
+ test(S("abcde"), 1, 3, SV("12345"), 5, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 5, 1, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 1, S("a1e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 5, S("a12345e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 9, S("a123456789e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 10, S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 0, 11, S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 1, S("a2e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 4, S("a2345e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 8, S("a23456789e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 9, S("a234567890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 1, 10, S("a234567890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 1, S("a6e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 2, S("a67e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 4, S("a6789e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 5, S("a67890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 5, 6, S("a67890e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 9, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 9, 1, S("a0e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 9, 2, S("a0e"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 10, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 10, 1, S("ae"));
+ test(S("abcde"), 1, 3, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 1, S("a1e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 10, S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 19, S("a1234567890123456789e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 20, S("a12345678901234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 21, S("a12345678901234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 1, S("a2e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 9, S("a234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 18, S("a234567890123456789e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 19, S("a2345678901234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 20, S("a2345678901234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 1, S("a1e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 5, S("a12345e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 9, S("a123456789e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 10, S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 11, S("a1234567890e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 1, S("a0e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 2, S("a0e"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 20, 0, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 20, 1, S("ae"));
+ test(S("abcde"), 1, 3, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 4, SV(""), 0, 0, S("a"));
+ test(S("abcde"), 1, 4, SV(""), 0, 1, S("a"));
+ test(S("abcde"), 1, 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 2, S("a12"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcde"), 1, 4, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 2, S("a23"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 3, S("a234"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcde"), 1, 4, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcde"), 1, 4, SV("12345"), 2, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 2, 1, S("a3"));
+ test(S("abcde"), 1, 4, SV("12345"), 2, 2, S("a34"));
+ test(S("abcde"), 1, 4, SV("12345"), 2, 3, S("a345"));
+ test(S("abcde"), 1, 4, SV("12345"), 2, 4, S("a345"));
+ test(S("abcde"), 1, 4, SV("12345"), 4, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 4, 1, S("a5"));
+ test(S("abcde"), 1, 4, SV("12345"), 4, 2, S("a5"));
+ test(S("abcde"), 1, 4, SV("12345"), 5, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 5, 1, S("a"));
+ test(S("abcde"), 1, 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 8, S("a23456789"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 1, 10, S("a234567890"));
+}
+
+template <class S, class SV>
+void test10()
+{
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcde"), 1, 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 1, S("a1"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcde"), 1, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 1, 5, SV(""), 0, 0, S("a"));
+ test(S("abcde"), 1, 5, SV(""), 0, 1, S("a"));
+ test(S("abcde"), 1, 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 2, S("a12"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcde"), 1, 5, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 2, S("a23"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 3, S("a234"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcde"), 1, 5, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcde"), 1, 5, SV("12345"), 2, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 2, 1, S("a3"));
+ test(S("abcde"), 1, 5, SV("12345"), 2, 2, S("a34"));
+ test(S("abcde"), 1, 5, SV("12345"), 2, 3, S("a345"));
+ test(S("abcde"), 1, 5, SV("12345"), 2, 4, S("a345"));
+ test(S("abcde"), 1, 5, SV("12345"), 4, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 4, 1, S("a5"));
+ test(S("abcde"), 1, 5, SV("12345"), 4, 2, S("a5"));
+ test(S("abcde"), 1, 5, SV("12345"), 5, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 5, 1, S("a"));
+ test(S("abcde"), 1, 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 8, S("a23456789"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 1, 10, S("a234567890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcde"), 1, 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 1, S("a1"));
+}
+
+template <class S, class SV>
+void test11()
+{
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcde"), 1, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 2, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 2, S("ab12cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 4, S("ab1234cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 5, S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 0, 6, S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 2, S("ab23cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 3, S("ab234cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 4, S("ab2345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 1, 5, S("ab2345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 2, 1, S("ab3cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 2, 2, S("ab34cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 2, 3, S("ab345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 2, 4, S("ab345cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 4, 1, S("ab5cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 4, 2, S("ab5cde"));
+ test(S("abcde"), 2, 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 5, S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 9, S("ab123456789cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 0, 11, S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 4, S("ab2345cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 8, S("ab23456789cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 9, S("ab234567890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 1, 10, S("ab234567890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 1, S("ab6cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 2, S("ab67cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 4, S("ab6789cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 5, S("ab67890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 5, 6, S("ab67890cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 9, 1, S("ab0cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 9, 2, S("ab0cde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 2, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 1, S("ab1cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 1, S("ab2cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 9, S("ab234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 18, S("ab234567890123456789cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 1, S("ab1cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 5, S("ab12345cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 9, S("ab123456789cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 10, S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 11, S("ab1234567890cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 1, S("ab0cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 2, S("ab0cde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 2, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, 1, SV(""), 0, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV(""), 0, 1, S("abde"));
+ test(S("abcde"), 2, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 1, S("ab1de"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 2, S("ab12de"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 4, S("ab1234de"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 5, S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 0, 6, S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 1, S("ab2de"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 2, S("ab23de"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 3, S("ab234de"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 4, S("ab2345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 1, 5, S("ab2345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 2, 0, S("abde"));
+}
+
+template <class S, class SV>
+void test12()
+{
+ test(S("abcde"), 2, 1, SV("12345"), 2, 1, S("ab3de"));
+ test(S("abcde"), 2, 1, SV("12345"), 2, 2, S("ab34de"));
+ test(S("abcde"), 2, 1, SV("12345"), 2, 3, S("ab345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 2, 4, S("ab345de"));
+ test(S("abcde"), 2, 1, SV("12345"), 4, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), 4, 1, S("ab5de"));
+ test(S("abcde"), 2, 1, SV("12345"), 4, 2, S("ab5de"));
+ test(S("abcde"), 2, 1, SV("12345"), 5, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), 5, 1, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 1, S("ab1de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 5, S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 9, S("ab123456789de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 10, S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 0, 11, S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 1, S("ab2de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 4, S("ab2345de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 8, S("ab23456789de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 9, S("ab234567890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 1, 10, S("ab234567890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 1, S("ab6de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 2, S("ab67de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 4, S("ab6789de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 5, S("ab67890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 5, 6, S("ab67890de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 9, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 9, 1, S("ab0de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 9, 2, S("ab0de"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 10, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 10, 1, S("abde"));
+ test(S("abcde"), 2, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 1, S("ab1de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 10, S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 1, S("ab2de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 9, S("ab234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 18, S("ab234567890123456789de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 1, S("ab1de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 5, S("ab12345de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 9, S("ab123456789de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 10, S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 11, S("ab1234567890de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 1, S("ab0de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 2, S("ab0de"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 20, 0, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 20, 1, S("abde"));
+ test(S("abcde"), 2, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, 2, SV(""), 0, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV(""), 0, 1, S("abe"));
+ test(S("abcde"), 2, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 1, S("ab1e"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 2, S("ab12e"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 4, S("ab1234e"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 5, S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 0, 6, S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 1, S("ab2e"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 2, S("ab23e"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 3, S("ab234e"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 4, S("ab2345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 1, 5, S("ab2345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 2, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 2, 1, S("ab3e"));
+ test(S("abcde"), 2, 2, SV("12345"), 2, 2, S("ab34e"));
+ test(S("abcde"), 2, 2, SV("12345"), 2, 3, S("ab345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 2, 4, S("ab345e"));
+ test(S("abcde"), 2, 2, SV("12345"), 4, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 4, 1, S("ab5e"));
+ test(S("abcde"), 2, 2, SV("12345"), 4, 2, S("ab5e"));
+ test(S("abcde"), 2, 2, SV("12345"), 5, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 5, 1, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 1, S("ab1e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 5, S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 9, S("ab123456789e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 10, S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 0, 11, S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 1, S("ab2e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 4, S("ab2345e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 8, S("ab23456789e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 9, S("ab234567890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 1, 10, S("ab234567890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 1, S("ab6e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 2, S("ab67e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 4, S("ab6789e"));
+}
+
+template <class S, class SV>
+void test13()
+{
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 5, S("ab67890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 5, 6, S("ab67890e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 9, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 9, 1, S("ab0e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 9, 2, S("ab0e"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 10, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 10, 1, S("abe"));
+ test(S("abcde"), 2, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 1, S("ab1e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 10, S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 1, S("ab2e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 9, S("ab234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 18, S("ab234567890123456789e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 1, S("ab1e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 5, S("ab12345e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 9, S("ab123456789e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 10, S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 11, S("ab1234567890e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 1, S("ab0e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 2, S("ab0e"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 20, 0, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 20, 1, S("abe"));
+ test(S("abcde"), 2, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, 3, SV(""), 0, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV(""), 0, 1, S("ab"));
+ test(S("abcde"), 2, 3, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 2, S("ab12"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 4, S("ab1234"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 5, S("ab12345"));
+ test(S("abcde"), 2, 3, SV("12345"), 0, 6, S("ab12345"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 2, S("ab23"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 3, S("ab234"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 4, S("ab2345"));
+ test(S("abcde"), 2, 3, SV("12345"), 1, 5, S("ab2345"));
+ test(S("abcde"), 2, 3, SV("12345"), 2, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 2, 1, S("ab3"));
+ test(S("abcde"), 2, 3, SV("12345"), 2, 2, S("ab34"));
+ test(S("abcde"), 2, 3, SV("12345"), 2, 3, S("ab345"));
+ test(S("abcde"), 2, 3, SV("12345"), 2, 4, S("ab345"));
+ test(S("abcde"), 2, 3, SV("12345"), 4, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 4, 1, S("ab5"));
+ test(S("abcde"), 2, 3, SV("12345"), 4, 2, S("ab5"));
+ test(S("abcde"), 2, 3, SV("12345"), 5, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 5, 1, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 5, S("ab12345"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 9, S("ab123456789"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 0, 11, S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 4, S("ab2345"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 8, S("ab23456789"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 9, S("ab234567890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 1, 10, S("ab234567890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 1, S("ab6"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 2, S("ab67"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 4, S("ab6789"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 5, S("ab67890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 5, 6, S("ab67890"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 9, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 9, 1, S("ab0"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 9, 2, S("ab0"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 10, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 10, 1, S("ab"));
+ test(S("abcde"), 2, 3, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 9, S("ab234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 18, S("ab234567890123456789"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 1, S("ab1"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 5, S("ab12345"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 9, S("ab123456789"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 11, S("ab1234567890"));
+}
+
+template <class S, class SV>
+void test14()
+{
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 1, S("ab0"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 2, S("ab0"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 20, 0, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 20, 1, S("ab"));
+ test(S("abcde"), 2, 3, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 2, 4, SV(""), 0, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV(""), 0, 1, S("ab"));
+ test(S("abcde"), 2, 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 2, S("ab12"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 4, S("ab1234"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 5, S("ab12345"));
+ test(S("abcde"), 2, 4, SV("12345"), 0, 6, S("ab12345"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 2, S("ab23"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 3, S("ab234"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 4, S("ab2345"));
+ test(S("abcde"), 2, 4, SV("12345"), 1, 5, S("ab2345"));
+ test(S("abcde"), 2, 4, SV("12345"), 2, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 2, 1, S("ab3"));
+ test(S("abcde"), 2, 4, SV("12345"), 2, 2, S("ab34"));
+ test(S("abcde"), 2, 4, SV("12345"), 2, 3, S("ab345"));
+ test(S("abcde"), 2, 4, SV("12345"), 2, 4, S("ab345"));
+ test(S("abcde"), 2, 4, SV("12345"), 4, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 4, 1, S("ab5"));
+ test(S("abcde"), 2, 4, SV("12345"), 4, 2, S("ab5"));
+ test(S("abcde"), 2, 4, SV("12345"), 5, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 5, 1, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 5, S("ab12345"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 9, S("ab123456789"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 0, 11, S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 4, S("ab2345"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 8, S("ab23456789"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 9, S("ab234567890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 1, 10, S("ab234567890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 1, S("ab6"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 2, S("ab67"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 4, S("ab6789"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 5, S("ab67890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 5, 6, S("ab67890"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 9, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 9, 1, S("ab0"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 9, 2, S("ab0"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 10, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 10, 1, S("ab"));
+ test(S("abcde"), 2, 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 1, S("ab1"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 1, S("ab2"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 9, S("ab234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 18, S("ab234567890123456789"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 1, S("ab1"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 5, S("ab12345"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 9, S("ab123456789"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 10, S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 11, S("ab1234567890"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 1, S("ab0"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 2, S("ab0"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 20, 0, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 20, 1, S("ab"));
+ test(S("abcde"), 2, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 4, 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 4, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 2, S("abcd12e"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 4, S("abcd1234e"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 5, S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("12345"), 0, 6, S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 2, S("abcd23e"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 3, S("abcd234e"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 4, S("abcd2345e"));
+ test(S("abcde"), 4, 0, SV("12345"), 1, 5, S("abcd2345e"));
+ test(S("abcde"), 4, 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 2, 1, S("abcd3e"));
+ test(S("abcde"), 4, 0, SV("12345"), 2, 2, S("abcd34e"));
+ test(S("abcde"), 4, 0, SV("12345"), 2, 3, S("abcd345e"));
+ test(S("abcde"), 4, 0, SV("12345"), 2, 4, S("abcd345e"));
+}
+
+template <class S, class SV>
+void test15()
+{
+ test(S("abcde"), 4, 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 4, 1, S("abcd5e"));
+ test(S("abcde"), 4, 0, SV("12345"), 4, 2, S("abcd5e"));
+ test(S("abcde"), 4, 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 5, S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 9, S("abcd123456789e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 0, 11, S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 4, S("abcd2345e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 8, S("abcd23456789e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 9, S("abcd234567890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 1, 10, S("abcd234567890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 1, S("abcd6e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 2, S("abcd67e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 4, S("abcd6789e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 5, S("abcd67890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 5, 6, S("abcd67890e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 9, 1, S("abcd0e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 9, 2, S("abcd0e"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 4, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 1, S("abcd1e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 1, S("abcd2e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 9, S("abcd234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 1, S("abcd1e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 5, S("abcd12345e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 9, S("abcd123456789e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 10, S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 11, S("abcd1234567890e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 1, S("abcd0e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 2, S("abcd0e"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 4, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 4, 1, SV(""), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV(""), 0, 1, S("abcd"));
+ test(S("abcde"), 4, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 2, S("abcd12"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 4, S("abcd1234"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 5, S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("12345"), 0, 6, S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 2, S("abcd23"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 3, S("abcd234"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 4, S("abcd2345"));
+ test(S("abcde"), 4, 1, SV("12345"), 1, 5, S("abcd2345"));
+ test(S("abcde"), 4, 1, SV("12345"), 2, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 2, 1, S("abcd3"));
+ test(S("abcde"), 4, 1, SV("12345"), 2, 2, S("abcd34"));
+ test(S("abcde"), 4, 1, SV("12345"), 2, 3, S("abcd345"));
+ test(S("abcde"), 4, 1, SV("12345"), 2, 4, S("abcd345"));
+ test(S("abcde"), 4, 1, SV("12345"), 4, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 4, 1, S("abcd5"));
+ test(S("abcde"), 4, 1, SV("12345"), 4, 2, S("abcd5"));
+ test(S("abcde"), 4, 1, SV("12345"), 5, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 5, 1, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 5, S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 9, S("abcd123456789"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 0, 11, S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 4, S("abcd2345"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 8, S("abcd23456789"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 9, S("abcd234567890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 1, 10, S("abcd234567890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 1, S("abcd6"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 2, S("abcd67"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 4, S("abcd6789"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 5, S("abcd67890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 5, 6, S("abcd67890"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 9, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 9, 1, S("abcd0"));
+}
+
+template <class S, class SV>
+void test16()
+{
+ test(S("abcde"), 4, 1, SV("1234567890"), 9, 2, S("abcd0"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 10, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 10, 1, S("abcd"));
+ test(S("abcde"), 4, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 9, S("abcd234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 1, S("abcd1"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 5, S("abcd12345"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 9, S("abcd123456789"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 11, S("abcd1234567890"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 1, S("abcd0"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 2, S("abcd0"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 20, 0, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 20, 1, S("abcd"));
+ test(S("abcde"), 4, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 4, 2, SV(""), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV(""), 0, 1, S("abcd"));
+ test(S("abcde"), 4, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 2, S("abcd12"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 4, S("abcd1234"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 5, S("abcd12345"));
+ test(S("abcde"), 4, 2, SV("12345"), 0, 6, S("abcd12345"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 2, S("abcd23"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 3, S("abcd234"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 4, S("abcd2345"));
+ test(S("abcde"), 4, 2, SV("12345"), 1, 5, S("abcd2345"));
+ test(S("abcde"), 4, 2, SV("12345"), 2, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 2, 1, S("abcd3"));
+ test(S("abcde"), 4, 2, SV("12345"), 2, 2, S("abcd34"));
+ test(S("abcde"), 4, 2, SV("12345"), 2, 3, S("abcd345"));
+ test(S("abcde"), 4, 2, SV("12345"), 2, 4, S("abcd345"));
+ test(S("abcde"), 4, 2, SV("12345"), 4, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 4, 1, S("abcd5"));
+ test(S("abcde"), 4, 2, SV("12345"), 4, 2, S("abcd5"));
+ test(S("abcde"), 4, 2, SV("12345"), 5, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 5, 1, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 5, S("abcd12345"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 9, S("abcd123456789"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 0, 11, S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 4, S("abcd2345"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 8, S("abcd23456789"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 9, S("abcd234567890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 1, 10, S("abcd234567890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 1, S("abcd6"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 2, S("abcd67"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 4, S("abcd6789"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 5, S("abcd67890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 5, 6, S("abcd67890"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 9, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 9, 1, S("abcd0"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 9, 2, S("abcd0"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 10, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 10, 1, S("abcd"));
+ test(S("abcde"), 4, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 1, S("abcd1"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 1, S("abcd2"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 9, S("abcd234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 1, S("abcd1"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 5, S("abcd12345"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 9, S("abcd123456789"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 10, S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 11, S("abcd1234567890"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 0, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 1, S("abcd0"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 2, S("abcd0"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 0, S("abcd"));
+}
+
+template <class S, class SV>
+void test17()
+{
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 1, S("abcd"));
+ test(S("abcde"), 4, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 5, 0, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 5, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 2, S("abcde12"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 4, S("abcde1234"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("12345"), 0, 6, S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 2, S("abcde23"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 3, S("abcde234"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, 0, SV("12345"), 1, 5, S("abcde2345"));
+ test(S("abcde"), 5, 0, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 2, 1, S("abcde3"));
+ test(S("abcde"), 5, 0, SV("12345"), 2, 2, S("abcde34"));
+ test(S("abcde"), 5, 0, SV("12345"), 2, 3, S("abcde345"));
+ test(S("abcde"), 5, 0, SV("12345"), 2, 4, S("abcde345"));
+ test(S("abcde"), 5, 0, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 4, 1, S("abcde5"));
+ test(S("abcde"), 5, 0, SV("12345"), 4, 2, S("abcde5"));
+ test(S("abcde"), 5, 0, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 9, S("abcde123456789"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 0, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 8, S("abcde23456789"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 1, 10, S("abcde234567890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 1, S("abcde6"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 2, S("abcde67"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 4, S("abcde6789"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 5, S("abcde67890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 5, 6, S("abcde67890"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 9, 1, S("abcde0"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 9, 2, S("abcde0"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 5, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 1, S("abcde1"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 5, S("abcde12345"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 1, S("abcde0"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 2, S("abcde0"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 5, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 5, 1, SV(""), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV(""), 0, 1, S("abcde"));
+ test(S("abcde"), 5, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 2, S("abcde12"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 4, S("abcde1234"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, 1, SV("12345"), 0, 6, S("abcde12345"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 2, S("abcde23"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 3, S("abcde234"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, 1, SV("12345"), 1, 5, S("abcde2345"));
+ test(S("abcde"), 5, 1, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), 2, 1, S("abcde3"));
+ test(S("abcde"), 5, 1, SV("12345"), 2, 2, S("abcde34"));
+ test(S("abcde"), 5, 1, SV("12345"), 2, 3, S("abcde345"));
+ test(S("abcde"), 5, 1, SV("12345"), 2, 4, S("abcde345"));
+ test(S("abcde"), 5, 1, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), 4, 1, S("abcde5"));
+ test(S("abcde"), 5, 1, SV("12345"), 4, 2, S("abcde5"));
+ test(S("abcde"), 5, 1, SV("12345"), 5, 0, S("abcde"));
+}
+
+template <class S, class SV>
+void test18()
+{
+ test(S("abcde"), 5, 1, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 5, S("abcde12345"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 9, S("abcde123456789"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 0, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 4, S("abcde2345"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 8, S("abcde23456789"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 1, 10, S("abcde234567890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 1, S("abcde6"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 2, S("abcde67"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 4, S("abcde6789"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 5, S("abcde67890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 5, 6, S("abcde67890"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 9, 1, S("abcde0"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 9, 2, S("abcde0"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcde"), 5, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 1, S("abcde1"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 1, S("abcde2"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 1, S("abcde1"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 5, S("abcde12345"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 1, S("abcde0"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 2, S("abcde0"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcde"), 5, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV(""), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV(""), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("1234567890"), 11, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test19()
+{
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcde"), 6, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 2, S("12abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 4, S("1234abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 5, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 0, 6, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 1, S("2abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 2, S("23abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 3, S("234abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 4, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 1, 5, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 2, 1, S("3abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 2, 2, S("34abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 2, 3, S("345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 2, 4, S("345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 4, 1, S("5abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 4, 2, S("5abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 5, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 1, S("2abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 4, S("2345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 1, S("6abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 2, S("67abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 4, S("6789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 5, S("67890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 6, S("67890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 1, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 2, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 1, SV(""), 0, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV(""), 0, 1, S("bcdefghij"));
+}
+
+template <class S, class SV>
+void test20()
+{
+ test(S("abcdefghij"), 0, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 1, S("1bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 2, S("12bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 4, S("1234bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 5, S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 0, 6, S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 1, S("2bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 2, S("23bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 3, S("234bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 4, S("2345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 1, 5, S("2345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 2, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 2, 1, S("3bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 2, 2, S("34bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 2, 3, S("345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 2, 4, S("345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 4, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 4, 1, S("5bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 4, 2, S("5bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 5, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 5, 1, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 1, S("1bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 5, S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 1, S("2bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 4, S("2345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 1, S("6bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 2, S("67bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 4, S("6789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 5, S("67890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 6, S("67890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 1, S("0bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 2, S("0bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 10, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 10, 1, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcdefghij"));
+ test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 5, SV(""), 0, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV(""), 0, 1, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 1, S("1fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 2, S("12fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 4, S("1234fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 5, S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 0, 6, S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 1, S("2fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 2, S("23fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 3, S("234fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 4, S("2345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 1, 5, S("2345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 2, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 2, 1, S("3fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 2, 2, S("34fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 2, 3, S("345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 2, 4, S("345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 4, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 4, 1, S("5fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 4, 2, S("5fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 5, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 5, 1, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 1, S("1fghij"));
+}
+
+template <class S, class SV>
+void test21()
+{
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 5, S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 9, S("123456789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 10, S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 11, S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 1, S("2fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 4, S("2345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 8, S("23456789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 9, S("234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 10, S("234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 1, S("6fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 2, S("67fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 4, S("6789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 5, S("67890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 6, S("67890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 1, S("0fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 2, S("0fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 10, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 10, 1, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 1, S("1fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 10, S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 19, S("1234567890123456789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 20, S("12345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 21, S("12345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 1, S("2fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 9, S("234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 18, S("234567890123456789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 19, S("2345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 20, S("2345678901234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 1, S("1fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 5, S("12345fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 9, S("123456789fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 10, S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 11, S("1234567890fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 1, S("0fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 2, S("0fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 20, 0, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 20, 1, S("fghij"));
+ test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 9, SV(""), 0, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV(""), 0, 1, S("j"));
+ test(S("abcdefghij"), 0, 9, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 1, S("1j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 2, S("12j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 4, S("1234j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 5, S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 0, 6, S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 1, S("2j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 2, S("23j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 3, S("234j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 4, S("2345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 1, 5, S("2345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 2, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 2, 1, S("3j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 2, 2, S("34j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 2, 3, S("345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 2, 4, S("345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 4, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 4, 1, S("5j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 4, 2, S("5j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 5, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 5, 1, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 1, S("1j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 5, S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 9, S("123456789j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 10, S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 11, S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 1, S("2j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 4, S("2345j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 8, S("23456789j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 9, S("234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 10, S("234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 1, S("6j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 2, S("67j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 4, S("6789j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 5, S("67890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 6, S("67890j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 1, S("0j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 2, S("0j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 10, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 10, 1, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 1, S("1j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 10, S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 19, S("1234567890123456789j"));
+}
+
+template <class S, class SV>
+void test22()
+{
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 20, S("12345678901234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 21, S("12345678901234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 1, S("2j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 9, S("234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 18, S("234567890123456789j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 19, S("2345678901234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 20, S("2345678901234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 1, S("1j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 5, S("12345j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 9, S("123456789j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 10, S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 11, S("1234567890j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 1, S("0j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 2, S("0j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 20, 0, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 20, 1, S("j"));
+ test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 10, SV(""), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV(""), 0, 1, S(""));
+ test(S("abcdefghij"), 0, 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 2, S("12"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 4, S("1234"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 5, S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 0, 6, S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 2, S("23"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 3, S("234"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 4, S("2345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 1, 5, S("2345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 2, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 2, 1, S("3"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 2, 2, S("34"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 2, 3, S("345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 2, 4, S("345"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 4, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 4, 1, S("5"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 4, 2, S("5"));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 5, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 5, 1, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 9, S("123456789"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 10, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 10, 1, S(""));
+ test(S("abcdefghij"), 0, 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 11, SV(""), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV(""), 0, 1, S(""));
+ test(S("abcdefghij"), 0, 11, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 2, S("12"));
+}
+
+template <class S, class SV>
+void test23()
+{
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 4, S("1234"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 5, S("12345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 0, 6, S("12345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 2, S("23"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 3, S("234"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 4, S("2345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 1, 5, S("2345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 2, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 2, 1, S("3"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 2, 2, S("34"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 2, 3, S("345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 2, 4, S("345"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 4, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 4, 1, S("5"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 4, 2, S("5"));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 5, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 5, 1, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 9, S("123456789"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 10, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 10, 1, S(""));
+ test(S("abcdefghij"), 0, 11, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 2, S("a12bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 4, S("a1234bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 0, 6, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 1, S("a2bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 2, S("a23bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 3, S("a234bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 4, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 1, 5, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 2, 1, S("a3bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 2, 2, S("a34bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 2, 3, S("a345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 2, 4, S("a345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 4, 1, S("a5bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 4, 2, S("a5bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcdefghij"));
+}
+
+template <class S, class SV>
+void test24()
+{
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 1, S("a2bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 1, S("a6bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 2, S("a67bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 1, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 2, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 1, SV(""), 0, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV(""), 0, 1, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 1, S("a1cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 2, S("a12cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 4, S("a1234cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 5, S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 0, 6, S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 1, S("a2cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 2, S("a23cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 3, S("a234cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 4, S("a2345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 1, 5, S("a2345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 2, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 2, 1, S("a3cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 2, 2, S("a34cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 2, 3, S("a345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 2, 4, S("a345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 4, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 4, 1, S("a5cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 4, 2, S("a5cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 5, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 5, 1, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 1, S("a1cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 5, S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 1, S("a2cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 4, S("a2345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 1, S("a6cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 2, S("a67cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 4, S("a6789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 5, S("a67890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 6, S("a67890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 1, S("a0cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 2, S("a0cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 10, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 10, 1, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cdefghij"));
+}
+
+template <class S, class SV>
+void test25()
+{
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 20, 0, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 20, 1, S("acdefghij"));
+ test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 4, SV(""), 0, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV(""), 0, 1, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 1, S("a1fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 2, S("a12fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 4, S("a1234fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 5, S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 0, 6, S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 1, S("a2fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 2, S("a23fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 3, S("a234fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 4, S("a2345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 1, 5, S("a2345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 2, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 2, 1, S("a3fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 2, 2, S("a34fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 2, 3, S("a345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 2, 4, S("a345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 4, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 4, 1, S("a5fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 4, 2, S("a5fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 5, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 5, 1, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 1, S("a1fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 5, S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 9, S("a123456789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 10, S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 11, S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 1, S("a2fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 4, S("a2345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 8, S("a23456789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 9, S("a234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 10, S("a234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 1, S("a6fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 2, S("a67fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 4, S("a6789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 5, S("a67890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 6, S("a67890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 1, S("a0fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 2, S("a0fghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 10, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 10, 1, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 1, S("a1fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 10, S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 19, S("a1234567890123456789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 20, S("a12345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 21, S("a12345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 1, S("a2fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 9, S("a234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 18, S("a234567890123456789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 19, S("a2345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 20, S("a2345678901234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 1, S("a1fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 5, S("a12345fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 9, S("a123456789fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 10, S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 11, S("a1234567890fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 1, S("a0fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 2, S("a0fghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 20, 0, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 20, 1, S("afghij"));
+ test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 8, SV(""), 0, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV(""), 0, 1, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 1, S("a1j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 2, S("a12j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 4, S("a1234j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 5, S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 0, 6, S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 0, S("aj"));
+}
+
+template <class S, class SV>
+void test26()
+{
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 1, S("a2j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 2, S("a23j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 3, S("a234j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 4, S("a2345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 1, 5, S("a2345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 2, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 2, 1, S("a3j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 2, 2, S("a34j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 2, 3, S("a345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 2, 4, S("a345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 4, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 4, 1, S("a5j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 4, 2, S("a5j"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 5, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 5, 1, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 1, S("a1j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 5, S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 9, S("a123456789j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 10, S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 11, S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 1, S("a2j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 4, S("a2345j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 8, S("a23456789j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 9, S("a234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 10, S("a234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 1, S("a6j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 2, S("a67j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 4, S("a6789j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 5, S("a67890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 6, S("a67890j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 1, S("a0j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 2, S("a0j"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 10, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 10, 1, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 1, S("a1j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 10, S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 19, S("a1234567890123456789j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 20, S("a12345678901234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 21, S("a12345678901234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 1, S("a2j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 9, S("a234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 18, S("a234567890123456789j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 19, S("a2345678901234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 20, S("a2345678901234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 1, S("a1j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 5, S("a12345j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 9, S("a123456789j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 10, S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 11, S("a1234567890j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 1, S("a0j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 2, S("a0j"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 20, 0, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 20, 1, S("aj"));
+ test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 9, SV(""), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV(""), 0, 1, S("a"));
+ test(S("abcdefghij"), 1, 9, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 2, S("a12"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 2, S("a23"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 3, S("a234"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 2, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 2, 1, S("a3"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 2, 2, S("a34"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 2, 3, S("a345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 2, 4, S("a345"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 4, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 4, 1, S("a5"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 4, 2, S("a5"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 5, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 5, 1, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 8, S("a23456789"));
+}
+
+template <class S, class SV>
+void test27()
+{
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 10, S("a234567890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 1, S("a1"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 10, SV(""), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV(""), 0, 1, S("a"));
+ test(S("abcdefghij"), 1, 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 2, S("a12"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 2, S("a23"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 3, S("a234"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 2, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 2, 1, S("a3"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 2, 2, S("a34"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 2, 3, S("a345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 2, 4, S("a345"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 4, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 4, 1, S("a5"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 4, 2, S("a5"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 5, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 5, 1, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 8, S("a23456789"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 10, S("a234567890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+}
+
+template <class S, class SV>
+void test28()
+{
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 1, S("a1"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 2, S("abcde12fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 4, S("abcde1234fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 0, 6, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 2, S("abcde23fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 3, S("abcde234fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 4, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 1, 5, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 2, 1, S("abcde3fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 2, 2, S("abcde34fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 2, 3, S("abcde345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 2, 4, S("abcde345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 4, 1, S("abcde5fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 4, 2, S("abcde5fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 9, S("abcde123456789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 11, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 4, S("abcde2345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 8, S("abcde23456789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 9, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 10, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 1, S("abcde6fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 2, S("abcde67fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 4, S("abcde6789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 5, S("abcde67890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 6, S("abcde67890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 1, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 2, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 1, S("abcde2fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 1, S("abcde1fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 5, S("abcde12345fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 9, S("abcde123456789fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 10, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 11, S("abcde1234567890fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 1, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 2, S("abcde0fghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 1, SV(""), 0, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV(""), 0, 1, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 1, S("abcde1ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 2, S("abcde12ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 4, S("abcde1234ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 5, S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 0, 6, S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 1, S("abcde2ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 2, S("abcde23ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 3, S("abcde234ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 4, S("abcde2345ghij"));
+}
+
+template <class S, class SV>
+void test29()
+{
+ test(S("abcdefghij"), 5, 1, SV("12345"), 1, 5, S("abcde2345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 2, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 2, 1, S("abcde3ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 2, 2, S("abcde34ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 2, 3, S("abcde345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 2, 4, S("abcde345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 4, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 4, 1, S("abcde5ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 4, 2, S("abcde5ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 5, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 5, 1, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 1, S("abcde1ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 5, S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 9, S("abcde123456789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 10, S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 11, S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 1, S("abcde2ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 4, S("abcde2345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 8, S("abcde23456789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 9, S("abcde234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 10, S("abcde234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 1, S("abcde6ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 2, S("abcde67ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 4, S("abcde6789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 5, S("abcde67890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 6, S("abcde67890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 1, S("abcde0ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 2, S("abcde0ghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 10, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 10, 1, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 1, S("abcde1ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 10, S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 1, S("abcde2ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 9, S("abcde234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 1, S("abcde1ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 5, S("abcde12345ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 9, S("abcde123456789ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 10, S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 11, S("abcde1234567890ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 1, S("abcde0ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 2, S("abcde0ghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 20, 0, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 20, 1, S("abcdeghij"));
+ test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 2, SV(""), 0, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV(""), 0, 1, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 1, S("abcde1hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 2, S("abcde12hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 4, S("abcde1234hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 5, S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 0, 6, S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 1, S("abcde2hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 2, S("abcde23hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 3, S("abcde234hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 4, S("abcde2345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 1, 5, S("abcde2345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 2, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 2, 1, S("abcde3hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 2, 2, S("abcde34hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 2, 3, S("abcde345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 2, 4, S("abcde345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 4, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 4, 1, S("abcde5hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 4, 2, S("abcde5hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 5, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 5, 1, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 1, S("abcde1hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 5, S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 9, S("abcde123456789hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 10, S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 11, S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 1, S("abcde2hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 4, S("abcde2345hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 8, S("abcde23456789hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 9, S("abcde234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 10, S("abcde234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 1, S("abcde6hij"));
+}
+
+template <class S, class SV>
+void test30()
+{
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 2, S("abcde67hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 4, S("abcde6789hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 5, S("abcde67890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 6, S("abcde67890hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 1, S("abcde0hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 2, S("abcde0hij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 10, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 10, 1, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 1, S("abcde1hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 10, S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 1, S("abcde2hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 9, S("abcde234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 1, S("abcde1hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 5, S("abcde12345hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 9, S("abcde123456789hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 10, S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 11, S("abcde1234567890hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 1, S("abcde0hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 2, S("abcde0hij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 20, 0, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 20, 1, S("abcdehij"));
+ test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 4, SV(""), 0, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV(""), 0, 1, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 1, S("abcde1j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 2, S("abcde12j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 4, S("abcde1234j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 5, S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 0, 6, S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 1, S("abcde2j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 2, S("abcde23j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 3, S("abcde234j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 4, S("abcde2345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 1, 5, S("abcde2345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 2, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 2, 1, S("abcde3j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 2, 2, S("abcde34j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 2, 3, S("abcde345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 2, 4, S("abcde345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 4, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 4, 1, S("abcde5j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 4, 2, S("abcde5j"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 5, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 5, 1, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 1, S("abcde1j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 5, S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 9, S("abcde123456789j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 10, S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 11, S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 1, S("abcde2j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 4, S("abcde2345j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 8, S("abcde23456789j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 9, S("abcde234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 10, S("abcde234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 1, S("abcde6j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 2, S("abcde67j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 4, S("abcde6789j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 5, S("abcde67890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 6, S("abcde67890j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 1, S("abcde0j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 2, S("abcde0j"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 10, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 10, 1, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 1, S("abcde1j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 10, S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 1, S("abcde2j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 9, S("abcde234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 1, S("abcde1j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 5, S("abcde12345j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 9, S("abcde123456789j"));
+}
+
+template <class S, class SV>
+void test31()
+{
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 10, S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 11, S("abcde1234567890j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 1, S("abcde0j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 2, S("abcde0j"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 20, 0, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 20, 1, S("abcdej"));
+ test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 5, SV(""), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV(""), 0, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 2, S("abcde12"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 4, S("abcde1234"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 0, 6, S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 2, S("abcde23"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 3, S("abcde234"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 4, S("abcde2345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 1, 5, S("abcde2345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 2, 1, S("abcde3"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 2, 2, S("abcde34"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 2, 3, S("abcde345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 2, 4, S("abcde345"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 4, 1, S("abcde5"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 4, 2, S("abcde5"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 9, S("abcde123456789"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 11, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 4, S("abcde2345"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 8, S("abcde23456789"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 10, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 1, S("abcde6"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 2, S("abcde67"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 4, S("abcde6789"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 5, S("abcde67890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 6, S("abcde67890"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 1, S("abcde0"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 2, S("abcde0"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 1, S("abcde0"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 2, S("abcde0"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 6, SV(""), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV(""), 0, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 2, S("abcde12"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 4, S("abcde1234"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 0, 6, S("abcde12345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 2, S("abcde23"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 3, S("abcde234"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 4, S("abcde2345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 1, 5, S("abcde2345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 1, S("abcde3"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 2, S("abcde34"));
+}
+
+template <class S, class SV>
+void test32()
+{
+ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 3, S("abcde345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 2, 4, S("abcde345"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 4, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 4, 1, S("abcde5"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 4, 2, S("abcde5"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 5, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 5, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 9, S("abcde123456789"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 11, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 4, S("abcde2345"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 8, S("abcde23456789"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 10, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 1, S("abcde6"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 2, S("abcde67"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 4, S("abcde6789"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 5, S("abcde67890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 6, S("abcde67890"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 1, S("abcde0"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 2, S("abcde0"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 10, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 10, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 1, S("abcde2"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 1, S("abcde1"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 5, S("abcde12345"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 1, S("abcde0"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 2, S("abcde0"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 20, 0, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 20, 1, S("abcde"));
+ test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 2, S("abcdefghi12j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 4, S("abcdefghi1234j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 0, 6, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 2, S("abcdefghi23j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 3, S("abcdefghi234j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 4, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 1, 5, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 2, 1, S("abcdefghi3j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 2, 2, S("abcdefghi34j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 2, 3, S("abcdefghi345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 2, 4, S("abcdefghi345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 4, 1, S("abcdefghi5j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 4, 2, S("abcdefghi5j"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 9, S("abcdefghi123456789j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 11, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 4, S("abcdefghi2345j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 8, S("abcdefghi23456789j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 9, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 10, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 1, S("abcdefghi6j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 2, S("abcdefghi67j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 4, S("abcdefghi6789j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 5, S("abcdefghi67890j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 6, S("abcdefghi67890j"));
+}
+
+template <class S, class SV>
+void test33()
+{
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 1, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 2, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 1, S("abcdefghi2j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 1, S("abcdefghi1j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 5, S("abcdefghi12345j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 1, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 2, S("abcdefghi0j"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 1, SV(""), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV(""), 0, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 2, S("abcdefghi12"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 4, S("abcdefghi1234"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 0, 6, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 2, S("abcdefghi23"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 3, S("abcdefghi234"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 4, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 1, 5, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 2, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 2, 1, S("abcdefghi3"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 2, 2, S("abcdefghi34"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 2, 3, S("abcdefghi345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 2, 4, S("abcdefghi345"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 4, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 4, 1, S("abcdefghi5"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 4, 2, S("abcdefghi5"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 5, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 5, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 9, S("abcdefghi123456789"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 11, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 4, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 8, S("abcdefghi23456789"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 9, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 10, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 1, S("abcdefghi6"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 2, S("abcdefghi67"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 4, S("abcdefghi6789"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 5, S("abcdefghi67890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 6, S("abcdefghi67890"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 1, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 2, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 10, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 10, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 1, S("abcdefghi0"));
+}
+
+template <class S, class SV>
+void test34()
+{
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 2, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 2, SV(""), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV(""), 0, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 2, S("abcdefghi12"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 4, S("abcdefghi1234"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 0, 6, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 2, S("abcdefghi23"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 3, S("abcdefghi234"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 4, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 1, 5, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 2, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 2, 1, S("abcdefghi3"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 2, 2, S("abcdefghi34"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 2, 3, S("abcdefghi345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 2, 4, S("abcdefghi345"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 4, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 4, 1, S("abcdefghi5"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 4, 2, S("abcdefghi5"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 5, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 5, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 9, S("abcdefghi123456789"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 11, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 4, S("abcdefghi2345"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 8, S("abcdefghi23456789"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 9, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 10, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 1, S("abcdefghi6"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 2, S("abcdefghi67"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 4, S("abcdefghi6789"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 5, S("abcdefghi67890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 6, S("abcdefghi67890"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 1, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 2, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 10, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 10, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 1, S("abcdefghi2"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 1, S("abcdefghi1"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 5, S("abcdefghi12345"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 1, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 2, S("abcdefghi0"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 20, 0, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 20, 1, S("abcdefghi"));
+ test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 0, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 2, S("abcdefghij12"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 4, S("abcdefghij1234"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 0, 6, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 2, S("abcdefghij23"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 3, S("abcdefghij234"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 1, 5, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 1, S("abcdefghij3"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 2, S("abcdefghij34"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 3, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 2, 4, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 4, 1, S("abcdefghij5"));
+}
+
+template <class S, class SV>
+void test35()
+{
+ test(S("abcdefghij"), 10, 0, SV("12345"), 4, 2, S("abcdefghij5"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 1, S("abcdefghij6"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 2, S("abcdefghij67"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 4, S("abcdefghij6789"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 5, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 6, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 1, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 2, S("abcdefghij12"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 4, S("abcdefghij1234"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 0, 6, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 2, S("abcdefghij23"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 3, S("abcdefghij234"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 1, 5, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 2, 1, S("abcdefghij3"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 2, 2, S("abcdefghij34"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 2, 3, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 2, 4, S("abcdefghij345"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 4, 1, S("abcdefghij5"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 4, 2, S("abcdefghij5"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 1, S("abcdefghij6"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 2, S("abcdefghij67"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 4, S("abcdefghij6789"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 5, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 6, S("abcdefghij67890"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 0, S("abcdefghij"));
+}
+
+template <class S, class SV>
+void test36()
+{
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV(""), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV(""), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test37()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 2, S("12abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 4, S("1234abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 6, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 1, S("3abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 2, S("34abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 3, S("345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 4, S("345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 1, S("5abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 2, S("5abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 4, S("2345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 1, S("6abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 2, S("67abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 4, S("6789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 5, S("67890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 6, S("67890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 1, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 2, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 1, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 1, S("1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 2, S("12bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 4, S("1234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 5, S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 6, S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 1, S("2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 2, S("23bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 3, S("234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 4, S("2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 5, S("2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 1, S("3bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 2, S("34bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 3, S("345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 4, S("345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 1, S("5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 2, S("5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 1, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test38()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 5, S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 4, S("2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 1, S("6bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 2, S("67bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 4, S("6789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 5, S("67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 6, S("67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 1, S("0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 2, S("0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 10, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 10, 1, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 1, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 1, S("1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 2, S("12klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 4, S("1234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 5, S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 6, S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 1, S("2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 2, S("23klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 3, S("234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 4, S("2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 5, S("2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 1, S("3klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 2, S("34klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 3, S("345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 4, S("345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 1, S("5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 2, S("5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 5, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 5, 1, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 1, S("1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 5, S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 9, S("123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 10, S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 11, S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 1, S("2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 4, S("2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 8, S("23456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 9, S("234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 10, S("234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 1, S("6klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 2, S("67klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 4, S("6789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 5, S("67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 6, S("67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 1, S("0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 2, S("0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 10, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 10, 1, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 1, S("1klmnopqrst"));
+}
+
+template <class S, class SV>
+void test39()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 10, S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 20, S("12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 21, S("12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 1, S("2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 9, S("234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 18, S("234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 19, S("2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 20, S("2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 1, S("1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 5, S("12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 9, S("123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 10, S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 11, S("1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 1, S("0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 2, S("0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 20, 0, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 20, 1, S("klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 1, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 1, S("1t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 2, S("12t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 4, S("1234t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 5, S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 6, S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 1, S("2t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 2, S("23t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 3, S("234t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 4, S("2345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 5, S("2345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 1, S("3t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 2, S("34t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 3, S("345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 4, S("345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 1, S("5t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 2, S("5t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 5, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 5, 1, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 1, S("1t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 5, S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 9, S("123456789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 10, S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 11, S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 1, S("2t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 4, S("2345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 8, S("23456789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 9, S("234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 10, S("234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 1, S("6t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 2, S("67t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 4, S("6789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 5, S("67890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 6, S("67890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 1, S("0t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 2, S("0t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 10, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 10, 1, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 1, S("1t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 10, S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 19, S("1234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 20, S("12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 21, S("12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 1, S("2t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 9, S("234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 18, S("234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 19, S("2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 20, S("2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 1, S("1t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 5, S("12345t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 9, S("123456789t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 10, S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 11, S("1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 1, S("0t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 2, S("0t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 20, 0, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 20, 1, S("t"));
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 0, S(""));
+}
+
+template <class S, class SV>
+void test40()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 2, S("12"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 4, S("1234"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 6, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 2, S("23"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 3, S("234"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 4, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 5, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 1, S("3"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 2, S("34"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 3, S("345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 4, S("345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 1, S("5"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 2, S("5"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 5, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 5, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 9, S("123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 10, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 10, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 2, S("12"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 4, S("1234"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 6, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 2, S("23"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 3, S("234"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 4, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 5, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 1, S("3"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 2, S("34"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 3, S("345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 4, S("345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 1, S("5"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 2, S("5"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 5, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 5, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 9, S("123456789"));
+}
+
+template <class S, class SV>
+void test41()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 11, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 4, S("2345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 8, S("23456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 10, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 1, S("6"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 2, S("67"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 4, S("6789"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 5, S("67890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 6, S("67890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 1, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 2, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 10, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 10, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 1, S("2"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 9, S("234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 1, S("1"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 5, S("12345"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 9, S("123456789"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 10, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 11, S("1234567890"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 1, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 2, S("0"));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 20, 0, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 20, 1, S(""));
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 2, S("a12bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 4, S("a1234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 6, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 2, S("a23bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 3, S("a234bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 4, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 5, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 1, S("a3bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 2, S("a34bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 3, S("a345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 4, S("a345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 1, S("a5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 2, S("a5bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 1, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 2, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test42()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 1, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 1, S("a1cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 2, S("a12cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 4, S("a1234cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 5, S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 6, S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 1, S("a2cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 2, S("a23cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 3, S("a234cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 4, S("a2345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 5, S("a2345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 1, S("a3cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 2, S("a34cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 3, S("a345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 4, S("a345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 1, S("a5cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 2, S("a5cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 5, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 5, 1, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 5, S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 4, S("a2345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 1, S("a6cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 2, S("a67cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 4, S("a6789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 5, S("a67890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 6, S("a67890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 1, S("a0cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 2, S("a0cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 10, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 10, 1, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 20, 0, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 20, 1, S("acdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 1, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 1, S("a1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 2, S("a12klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 4, S("a1234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 5, S("a12345klmnopqrst"));
+}
+
+template <class S, class SV>
+void test43()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 6, S("a12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 1, S("a2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 2, S("a23klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 3, S("a234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 4, S("a2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 5, S("a2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 1, S("a3klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 2, S("a34klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 3, S("a345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 4, S("a345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 1, S("a5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 2, S("a5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 5, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 5, 1, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 1, S("a1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 5, S("a12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 9, S("a123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 10, S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 11, S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 1, S("a2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 4, S("a2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 8, S("a23456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 9, S("a234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 10, S("a234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 1, S("a6klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 2, S("a67klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 4, S("a6789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 5, S("a67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 6, S("a67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 1, S("a0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 2, S("a0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 10, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 10, 1, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 1, S("a1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 10, S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 19, S("a1234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 20, S("a12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 21, S("a12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 1, S("a2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 9, S("a234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 18, S("a234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 19, S("a2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 20, S("a2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 1, S("a1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 5, S("a12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 9, S("a123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 10, S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 11, S("a1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 1, S("a0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 2, S("a0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 20, 0, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 20, 1, S("aklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 1, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 1, S("a1t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 2, S("a12t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 4, S("a1234t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 5, S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 6, S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 1, S("a2t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 2, S("a23t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 3, S("a234t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 4, S("a2345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 5, S("a2345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 1, S("a3t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 2, S("a34t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 3, S("a345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 4, S("a345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 1, S("a5t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 2, S("a5t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 5, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 5, 1, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 1, S("a1t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 5, S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 9, S("a123456789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 10, S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 11, S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 1, S("a2t"));
+}
+
+template <class S, class SV>
+void test44()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 4, S("a2345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 8, S("a23456789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 9, S("a234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 10, S("a234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 1, S("a6t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 2, S("a67t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 4, S("a6789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 5, S("a67890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 6, S("a67890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 1, S("a0t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 2, S("a0t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 10, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 10, 1, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 1, S("a1t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 10, S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 19, S("a1234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 20, S("a12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 21, S("a12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 1, S("a2t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 9, S("a234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 18, S("a234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 19, S("a2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 20, S("a2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 1, S("a1t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 5, S("a12345t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 9, S("a123456789t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 10, S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 11, S("a1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 1, S("a0t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 2, S("a0t"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 20, 0, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 20, 1, S("at"));
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 2, S("a12"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 2, S("a23"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 3, S("a234"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 1, S("a3"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 2, S("a34"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 3, S("a345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 4, S("a345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 1, S("a5"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 2, S("a5"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 5, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 5, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 8, S("a23456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 10, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+}
+
+template <class S, class SV>
+void test45()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 2, S("a12"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 4, S("a1234"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 6, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 2, S("a23"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 3, S("a234"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 4, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 5, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 1, S("a3"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 2, S("a34"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 3, S("a345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 4, S("a345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 1, S("a5"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 2, S("a5"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 5, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 5, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 9, S("a123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 11, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 4, S("a2345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 8, S("a23456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 10, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 1, S("a6"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 2, S("a67"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 4, S("a6789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 5, S("a67890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 6, S("a67890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 1, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 2, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 10, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 10, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 1, S("a2"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 9, S("a234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 1, S("a1"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 5, S("a12345"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 9, S("a123456789"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 10, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 11, S("a1234567890"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 1, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 2, S("a0"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 20, 0, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 20, 1, S("a"));
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 2, S("abcdefghij12klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 4, S("abcdefghij1234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 6, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
+}
+
+template <class S, class SV>
+void test46()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 3, S("abcdefghij345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 4, S("abcdefghij345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 1, S("abcdefghij5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 2, S("abcdefghij5klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 9, S("abcdefghij123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 11, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 4, S("abcdefghij2345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 8, S("abcdefghij23456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 10, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 1, S("abcdefghij6klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 2, S("abcdefghij67klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 4, S("abcdefghij6789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 5, S("abcdefghij67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 6, S("abcdefghij67890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 1, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 2, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 1, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 2, S("abcdefghij0klmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 1, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 1, S("abcdefghij1lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 2, S("abcdefghij12lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 4, S("abcdefghij1234lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 5, S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 6, S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 1, S("abcdefghij2lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 2, S("abcdefghij23lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 3, S("abcdefghij234lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 4, S("abcdefghij2345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 5, S("abcdefghij2345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 1, S("abcdefghij3lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 2, S("abcdefghij34lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 3, S("abcdefghij345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 4, S("abcdefghij345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 1, S("abcdefghij5lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 2, S("abcdefghij5lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 5, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 5, 1, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 5, S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 9, S("abcdefghij123456789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 11, S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 4, S("abcdefghij2345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst"));
+}
+
+template <class S, class SV>
+void test47()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 1, S("abcdefghij6lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 2, S("abcdefghij67lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 4, S("abcdefghij6789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 5, S("abcdefghij67890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 6, S("abcdefghij67890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 1, S("abcdefghij0lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 2, S("abcdefghij0lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 10, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 10, 1, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 1, S("abcdefghij1lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 5, S("abcdefghij12345lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 1, S("abcdefghij0lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 2, S("abcdefghij0lmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijlmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 1, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 1, S("abcdefghij1pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 2, S("abcdefghij12pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 4, S("abcdefghij1234pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 5, S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 6, S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 1, S("abcdefghij2pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 2, S("abcdefghij23pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 3, S("abcdefghij234pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 4, S("abcdefghij2345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 5, S("abcdefghij2345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 1, S("abcdefghij3pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 2, S("abcdefghij34pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 3, S("abcdefghij345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 4, S("abcdefghij345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 1, S("abcdefghij5pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 2, S("abcdefghij5pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 5, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 5, 1, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 1, S("abcdefghij1pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 5, S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 9, S("abcdefghij123456789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 11, S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 1, S("abcdefghij2pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 4, S("abcdefghij2345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 8, S("abcdefghij23456789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 9, S("abcdefghij234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 10, S("abcdefghij234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 1, S("abcdefghij6pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 2, S("abcdefghij67pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 4, S("abcdefghij6789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 5, S("abcdefghij67890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 6, S("abcdefghij67890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 1, S("abcdefghij0pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 2, S("abcdefghij0pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 10, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 10, 1, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 1, S("abcdefghij1pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 1, S("abcdefghij2pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 1, S("abcdefghij1pqrst"));
+}
+
+template <class S, class SV>
+void test48()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 1, S("abcdefghij0pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 2, S("abcdefghij0pqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 20, 0, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 20, 1, S("abcdefghijpqrst"));
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 1, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 1, S("abcdefghij1t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 2, S("abcdefghij12t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 4, S("abcdefghij1234t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 5, S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 6, S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 1, S("abcdefghij2t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 2, S("abcdefghij23t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 3, S("abcdefghij234t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 4, S("abcdefghij2345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 5, S("abcdefghij2345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 1, S("abcdefghij3t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 2, S("abcdefghij34t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 3, S("abcdefghij345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 4, S("abcdefghij345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 1, S("abcdefghij5t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 2, S("abcdefghij5t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 5, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 5, 1, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 1, S("abcdefghij1t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 5, S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 9, S("abcdefghij123456789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 10, S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 11, S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 1, S("abcdefghij2t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 4, S("abcdefghij2345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 8, S("abcdefghij23456789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 9, S("abcdefghij234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 10, S("abcdefghij234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 1, S("abcdefghij6t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 2, S("abcdefghij67t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 4, S("abcdefghij6789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 5, S("abcdefghij67890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 6, S("abcdefghij67890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 1, S("abcdefghij0t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 2, S("abcdefghij0t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 10, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 10, 1, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 1, S("abcdefghij1t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 1, S("abcdefghij2t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 1, S("abcdefghij1t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 5, S("abcdefghij12345t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 1, S("abcdefghij0t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 2, S("abcdefghij0t"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 20, 0, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 20, 1, S("abcdefghijt"));
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 2, S("abcdefghij12"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 4, S("abcdefghij1234"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 6, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 2, S("abcdefghij23"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 3, S("abcdefghij234"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 5, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 0, S("abcdefghij"));
+}
+
+template <class S, class SV>
+void test49()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 1, S("abcdefghij3"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 2, S("abcdefghij34"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 3, S("abcdefghij345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 4, S("abcdefghij345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 1, S("abcdefghij5"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 2, S("abcdefghij5"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 1, S("abcdefghij6"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 2, S("abcdefghij67"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 4, S("abcdefghij6789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 5, S("abcdefghij67890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 6, S("abcdefghij67890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 1, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 2, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 2, S("abcdefghij12"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 4, S("abcdefghij1234"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 6, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 2, S("abcdefghij23"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 3, S("abcdefghij234"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 5, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 1, S("abcdefghij3"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 2, S("abcdefghij34"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 3, S("abcdefghij345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 4, S("abcdefghij345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 1, S("abcdefghij5"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 2, S("abcdefghij5"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 5, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 4, S("abcdefghij2345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 1, S("abcdefghij6"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 2, S("abcdefghij67"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 4, S("abcdefghij6789"));
+}
+
+template <class S, class SV>
+void test50()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 5, S("abcdefghij67890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 6, S("abcdefghij67890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 1, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 2, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 10, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
+}
+
+template <class S, class SV>
+void test51()
+{
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0t"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 5, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 5, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
+}
+
+template <class S, class SV>
+void test52()
+{
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 5, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 5, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
+}
+
+template <class S, class SV>
+void test53()
+{
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
+}
+
+template <class S, class SV>
+void test54()
+{
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 6, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 3, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 3, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 5, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 5, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 6, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 11, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 8, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 4, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 6, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 11, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
+}
+
+template <class S, class SV>
+void test55()
+{
+ test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, S("abcdefghi1234567890"));
+ test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, S("abcdefghi0"));
+ test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, S("abcdefghi"));
+ test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, S("abcdefghi"));
+ test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 21, S("can't happen"));
+ test_npos(S("abcdefghij"), 9, 2, SV(""), 0, S("abcdefghi"));
+ test_npos(S("abcdefghij"), 9, 2, SV(""), 1, S("can't happen"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 0, S("abcdefghi12345"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 1, S("abcdefghi2345"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 2, S("abcdefghi345"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 4, S("abcdefghi5"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 5, S("abcdefghi"));
+ test_npos(S("abcdefghij"), 9, 2, SV("12345"), 6, S("can't happen"));
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ test31<S, SV>();
+ test32<S, SV>();
+ test33<S, SV>();
+ test34<S, SV>();
+ test35<S, SV>();
+ test36<S, SV>();
+ test37<S, SV>();
+ test38<S, SV>();
+ test39<S, SV>();
+ test40<S, SV>();
+ test41<S, SV>();
+ test42<S, SV>();
+ test43<S, SV>();
+ test44<S, SV>();
+ test45<S, SV>();
+ test46<S, SV>();
+ test47<S, SV>();
+ test48<S, SV>();
+ test49<S, SV>();
+ test50<S, SV>();
+ test51<S, SV>();
+ test52<S, SV>();
+ test53<S, SV>();
+ test54<S, SV>();
+ test55<S, SV>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ test31<S, SV>();
+ test32<S, SV>();
+ test33<S, SV>();
+ test34<S, SV>();
+ test35<S, SV>();
+ test36<S, SV>();
+ test37<S, SV>();
+ test38<S, SV>();
+ test39<S, SV>();
+ test40<S, SV>();
+ test41<S, SV>();
+ test42<S, SV>();
+ test43<S, SV>();
+ test44<S, SV>();
+ test45<S, SV>();
+ test46<S, SV>();
+ test47<S, SV>();
+ test48<S, SV>();
+ test49<S, SV>();
+ test50<S, SV>();
+ test51<S, SV>();
+ test52<S, SV>();
+ test53<S, SV>();
+ test54<S, SV>();
+ test55<S, SV>();
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ S s0 = "ABCD";
+ S s;
+ SV sv = "EFGH";
+ char arr[] = "IJKL";
+
+ s = s0;
+ s.replace(0, 4, "CDEF", 0); // calls replace(pos1, n1, const char *, len)
+ assert(s == "");
+
+ s = s0;
+ s.replace(0, 4, "QRST", 0, std::string::npos); // calls replace(pos1, n1, string("QRST"), pos, npos)
+ assert(s == "QRST");
+
+ s = s0;
+ s.replace(0, 4, sv, 0); // calls replace(pos1, n1, T, pos, npos)
+ assert(s == sv);
+
+ s = s0;
+ s.replace(0, 4, sv, 0, std::string::npos); // calls replace(pos1, n1, T, pos, npos)
+ assert(s == sv);
+
+ s = s0;
+ s.replace(0, 4, arr, 0); // calls replace(pos1, n1, const char *, len)
+ assert(s == "");
+
+ s = s0;
+ s.replace(0, 4, arr, 0, std::string::npos); // calls replace(pos1, n1, string("IJKL"), pos, npos)
+ assert(s == "IJKL");
+ }
+}
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index 3beb074c0fd3..d09c9c2efd62 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -26,23 +25,32 @@ void
test(S s, typename S::size_type pos, typename S::size_type n1,
const typename S::value_type* str, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.replace(pos, n1, str);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
typename S::size_type rlen = S::traits_type::length(str);
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.replace(pos, n1, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index d961e9e8f76f..5c751285cb06 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -27,23 +26,32 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
const typename S::value_type* str, typename S::size_type n2,
S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.replace(pos, n1, str, n2);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.replace(pos, n1, str, n2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index d4696fba8a83..75745dab61f6 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -27,23 +26,32 @@ test(S s, typename S::size_type pos, typename S::size_type n1,
typename S::size_type n2, typename S::value_type c,
S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos <= old_size)
{
s.replace(pos, n1, n2, c);
LIBCPP_ASSERT(s.__invariants());
- assert(pos <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos);
typename S::size_type rlen = n2;
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > old_size);
- assert(s == s0);
+ try
+ {
+ s.replace(pos, n1, n2, c);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index 1be45d8a6624..612e1e200c90 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -25,23 +24,32 @@ template <class S>
void
test(S s, typename S::size_type pos1, typename S::size_type n1, S str, S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos1 <= old_size)
{
s.replace(pos1, n1, str);
LIBCPP_ASSERT(s.__invariants());
- assert(pos1 <= old_size);
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
typename S::size_type rlen = str.size();
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > old_size);
- assert(s == s0);
+ try
+ {
+ s.replace(pos1, n1, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size);
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index 3f4bf450d858..b49b6f987b01 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -29,23 +28,32 @@ test(S s, typename S::size_type pos1, typename S::size_type n1,
S str, typename S::size_type pos2, typename S::size_type n2,
S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos1 <= old_size && pos2 <= str.size())
{
s.replace(pos1, n1, str, pos2, n2);
LIBCPP_ASSERT(s.__invariants());
- assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
typename S::size_type rlen = std::min(n2, str.size() - pos2);
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > old_size || pos2 > str.size());
- assert(s == s0);
+ try
+ {
+ s.replace(pos1, n1, str, pos2, n2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > str.size());
+ assert(s == s0);
+ }
}
+#endif
}
template <class S>
@@ -54,23 +62,32 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
S str, typename S::size_type pos2,
S expected)
{
- typename S::size_type old_size = s.size();
+ const typename S::size_type old_size = s.size();
S s0 = s;
- try
+ if (pos1 <= old_size && pos2 <= str.size())
{
s.replace(pos1, n1, str, pos2);
LIBCPP_ASSERT(s.__invariants());
- assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
typename S::size_type xlen = std::min(n1, old_size - pos1);
typename S::size_type rlen = std::min(S::npos, str.size() - pos2);
assert(s.size() == old_size - xlen + rlen);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > old_size || pos2 > str.size());
- assert(s == s0);
+ try
+ {
+ s.replace(pos1, n1, str, pos2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > old_size || pos2 > str.size());
+ assert(s == s0);
+ }
}
+#endif
}
diff --git a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
index 4ac13d10e670..757d5eeb2dc3 100644
--- a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp
@@ -22,6 +22,7 @@
// This tests a conforming extension
#include <string>
+#include <utility>
#include <cassert>
#include "test_macros.h"
@@ -56,30 +57,26 @@ int main()
{
{
typedef std::string C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::basic_string<char, std::char_traits<char>, test_allocator<char>> C;
- C c1, c2;
- static_assert(noexcept(swap(c1, c2)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
}
{
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> 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::basic_string<char, std::char_traits<char>, some_alloc2<char>> 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/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
new file mode 100644
index 000000000000..65649465da29
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs != rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
new file mode 100644
index 000000000000..88c758c7aa70
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_op!=/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs != rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
new file mode 100644
index 000000000000..dec8f6f5af80
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs == rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
new file mode 100644
index 000000000000..2cd808659058
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_operator==/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs == rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
new file mode 100644
index 000000000000..d9f5d7106dbb
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs > rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
new file mode 100644
index 000000000000..c685bab8fc1e
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs > rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string <char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
new file mode 100644
index 000000000000..5b9671fca1d3
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs >= rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), false);
+ test(S(""), SV("abcdefghij"), false);
+ test(S(""), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), SV(""), true);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), false);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), SV(""), true);
+ test(S("abcdefghij"), SV("abcde"), true);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), SV(""), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
new file mode 100644
index 000000000000..07c8282a740f
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_opgt=/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs >= rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), false);
+ test(SV(""), S("abcdefghij"), false);
+ test(SV(""), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcde"), S(""), true);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), false);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghij"), S(""), true);
+ test(SV("abcdefghij"), S("abcde"), true);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(SV("abcdefghijklmnopqrst"), S(""), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
new file mode 100644
index 000000000000..8fef8e60a96b
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs < rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), false);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), false);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), false);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
new file mode 100644
index 000000000000..80da8cd00480
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs < rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), false);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), false);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), false);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
new file mode 100644
index 000000000000..97a9d7cc7175
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_string_view.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(const S& lhs, SV rhs, bool x)
+{
+ assert((lhs <= rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(S(""), SV(""), true);
+ test(S(""), SV("abcde"), true);
+ test(S(""), SV("abcdefghij"), true);
+ test(S(""), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), SV(""), false);
+ test(S("abcde"), SV("abcde"), true);
+ test(S("abcde"), SV("abcdefghij"), true);
+ test(S("abcde"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), SV(""), false);
+ test(S("abcdefghij"), SV("abcde"), false);
+ test(S("abcdefghij"), SV("abcdefghij"), true);
+ test(S("abcdefghij"), SV("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), SV(""), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), SV("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
new file mode 100644
index 000000000000..f19a4aa0fd5b
--- /dev/null
+++ b/test/std/strings/basic.string/string.nonmembers/string_oplt=/string_view_string.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// we get this comparison "for free" because the string implicitly converts to the string_view
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S, class SV>
+void
+test(SV lhs, const S& rhs, bool x)
+{
+ assert((lhs <= rhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test(SV(""), S(""), true);
+ test(SV(""), S("abcde"), true);
+ test(SV(""), S("abcdefghij"), true);
+ test(SV(""), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcde"), S(""), false);
+ test(SV("abcde"), S("abcde"), true);
+ test(SV("abcde"), S("abcdefghij"), true);
+ test(SV("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghij"), S(""), false);
+ test(SV("abcdefghij"), S("abcde"), false);
+ test(SV("abcdefghij"), S("abcdefghij"), true);
+ test(SV("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(SV("abcdefghijklmnopqrst"), S(""), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(SV("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+#endif
+}
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
new file mode 100644
index 000000000000..bc2bf656db01
--- /dev/null
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
@@ -0,0 +1,5993 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template <typename T>
+// int compare(size_type pos1, size_type n1, const T& t,
+// size_type pos2, size_type n2=npos) const;
+//
+// Mostly we're testing string_view here
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "min_allocator.h"
+
+#include "test_macros.h"
+
+int sign(int x)
+{
+ if (x == 0)
+ return 0;
+ if (x < 0)
+ return -1;
+ return 1;
+}
+
+template <class S, class SV>
+void
+test(const S& s, typename S::size_type pos1, typename S::size_type n1,
+ SV sv, typename S::size_type pos2, typename S::size_type n2, int x)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ if (pos1 <= s.size() && pos2 <= sv.size())
+ assert(sign(s.compare(pos1, n1, sv, pos2, n2)) == sign(x));
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.compare(pos1, n1, sv, pos2, n2);
+ assert(false);
+ }
+ catch (const std::out_of_range&)
+ {
+ assert(pos1 > s.size() || pos2 > sv.size());
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void
+test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
+ SV sv, typename S::size_type pos2, int x)
+{
+ static_assert((!std::is_same<S, SV>::value), "");
+ if (pos1 <= s.size() && pos2 <= sv.size())
+ assert(sign(s.compare(pos1, n1, sv, pos2)) == sign(x));
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
+ {
+ try
+ {
+ s.compare(pos1, n1, sv, pos2);
+ assert(false);
+ }
+ catch (const std::out_of_range&)
+ {
+ assert(pos1 > s.size() || pos2 > sv.size());
+ }
+ }
+#endif
+}
+
+template <class S, class SV>
+void test0()
+{
+ test(S(""), 0, 0, SV(""), 0, 0, 0);
+ test(S(""), 0, 0, SV(""), 0, 1, 0);
+ test(S(""), 0, 0, SV(""), 1, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 0, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 0, 1, -1);
+ test(S(""), 0, 0, SV("abcde"), 0, 2, -2);
+ test(S(""), 0, 0, SV("abcde"), 0, 4, -4);
+ test(S(""), 0, 0, SV("abcde"), 0, 5, -5);
+ test(S(""), 0, 0, SV("abcde"), 0, 6, -5);
+ test(S(""), 0, 0, SV("abcde"), 1, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 1, 1, -1);
+ test(S(""), 0, 0, SV("abcde"), 1, 2, -2);
+ test(S(""), 0, 0, SV("abcde"), 1, 3, -3);
+ test(S(""), 0, 0, SV("abcde"), 1, 4, -4);
+ test(S(""), 0, 0, SV("abcde"), 1, 5, -4);
+ test(S(""), 0, 0, SV("abcde"), 2, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 2, 1, -1);
+ test(S(""), 0, 0, SV("abcde"), 2, 2, -2);
+ test(S(""), 0, 0, SV("abcde"), 2, 3, -3);
+ test(S(""), 0, 0, SV("abcde"), 2, 4, -3);
+ test(S(""), 0, 0, SV("abcde"), 4, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 4, 1, -1);
+ test(S(""), 0, 0, SV("abcde"), 4, 2, -1);
+ test(S(""), 0, 0, SV("abcde"), 5, 0, 0);
+ test(S(""), 0, 0, SV("abcde"), 5, 1, 0);
+ test(S(""), 0, 0, SV("abcde"), 6, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S(""), 0, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S(""), 0, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S(""), 0, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S(""), 0, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S(""), 0, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S(""), 0, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S(""), 0, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S(""), 0, 1, SV(""), 0, 0, 0);
+ test(S(""), 0, 1, SV(""), 0, 1, 0);
+ test(S(""), 0, 1, SV(""), 1, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 0, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 0, 1, -1);
+ test(S(""), 0, 1, SV("abcde"), 0, 2, -2);
+ test(S(""), 0, 1, SV("abcde"), 0, 4, -4);
+ test(S(""), 0, 1, SV("abcde"), 0, 5, -5);
+ test(S(""), 0, 1, SV("abcde"), 0, 6, -5);
+ test(S(""), 0, 1, SV("abcde"), 1, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 1, 1, -1);
+ test(S(""), 0, 1, SV("abcde"), 1, 2, -2);
+ test(S(""), 0, 1, SV("abcde"), 1, 3, -3);
+ test(S(""), 0, 1, SV("abcde"), 1, 4, -4);
+ test(S(""), 0, 1, SV("abcde"), 1, 5, -4);
+ test(S(""), 0, 1, SV("abcde"), 2, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 2, 1, -1);
+ test(S(""), 0, 1, SV("abcde"), 2, 2, -2);
+ test(S(""), 0, 1, SV("abcde"), 2, 3, -3);
+ test(S(""), 0, 1, SV("abcde"), 2, 4, -3);
+ test(S(""), 0, 1, SV("abcde"), 4, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 4, 1, -1);
+ test(S(""), 0, 1, SV("abcde"), 4, 2, -1);
+ test(S(""), 0, 1, SV("abcde"), 5, 0, 0);
+ test(S(""), 0, 1, SV("abcde"), 5, 1, 0);
+ test(S(""), 0, 1, SV("abcde"), 6, 0, 0);
+}
+
+template <class S, class SV>
+void test1()
+{
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 5, -5);
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 9, -9);
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 10, -10);
+ test(S(""), 0, 1, SV("abcdefghij"), 0, 11, -10);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 4, -4);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 8, -8);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 9, -9);
+ test(S(""), 0, 1, SV("abcdefghij"), 1, 10, -9);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 2, -2);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S(""), 0, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S(""), 0, 1, SV("abcdefghij"), 9, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 9, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghij"), 9, 2, -1);
+ test(S(""), 0, 1, SV("abcdefghij"), 10, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 10, 1, 0);
+ test(S(""), 0, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S(""), 0, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S(""), 1, 0, SV(""), 0, 0, 0);
+ test(S(""), 1, 0, SV(""), 0, 1, 0);
+ test(S(""), 1, 0, SV(""), 1, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 1, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 2, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 4, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 5, 0);
+ test(S(""), 1, 0, SV("abcde"), 0, 6, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 1, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 2, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 3, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 4, 0);
+ test(S(""), 1, 0, SV("abcde"), 1, 5, 0);
+ test(S(""), 1, 0, SV("abcde"), 2, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 2, 1, 0);
+ test(S(""), 1, 0, SV("abcde"), 2, 2, 0);
+ test(S(""), 1, 0, SV("abcde"), 2, 3, 0);
+ test(S(""), 1, 0, SV("abcde"), 2, 4, 0);
+ test(S(""), 1, 0, SV("abcde"), 4, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 4, 1, 0);
+ test(S(""), 1, 0, SV("abcde"), 4, 2, 0);
+ test(S(""), 1, 0, SV("abcde"), 5, 0, 0);
+ test(S(""), 1, 0, SV("abcde"), 5, 1, 0);
+ test(S(""), 1, 0, SV("abcde"), 6, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 5, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 9, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 10, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 0, 11, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 4, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 8, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 9, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 1, 10, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 2, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 4, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 5, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 5, 6, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 9, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 9, 2, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+}
+
+template <class S, class SV>
+void test2()
+{
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 18, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 5, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 9, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S(""), 1, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 0, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 0, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 0, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 0, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 0, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 0, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcde"), 0, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 0, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 0, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 0, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 1, SV(""), 0, 0, 1);
+ test(S("abcde"), 0, 1, SV(""), 0, 1, 1);
+ test(S("abcde"), 0, 1, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 0, 1);
+}
+
+template <class S, class SV>
+void test3()
+{
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 1, 0);
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 2, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 4, -3);
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 5, -4);
+ test(S("abcde"), 0, 1, SV("abcde"), 0, 6, -4);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 0, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcde"), 2, 1, -2);
+ test(S("abcde"), 0, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 1, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 0, 1, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 0, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcde"), 4, 1, -4);
+ test(S("abcde"), 0, 1, SV("abcde"), 4, 2, -4);
+ test(S("abcde"), 0, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcde"), 0, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 5, -4);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 9, -8);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 10, -9);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 0, 11, -9);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 10, -9);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 19, -18);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 20, -19);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 21, -19);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcde"), 0, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 2, SV(""), 0, 0, 2);
+ test(S("abcde"), 0, 2, SV(""), 0, 1, 2);
+ test(S("abcde"), 0, 2, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 2, 0);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 4, -2);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 5, -3);
+ test(S("abcde"), 0, 2, SV("abcde"), 0, 6, -3);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 0, 2, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 0, 2, SV("abcde"), 2, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 2, 1, -2);
+ test(S("abcde"), 0, 2, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 2, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 0, 2, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 0, 2, SV("abcde"), 4, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 4, 1, -4);
+ test(S("abcde"), 0, 2, SV("abcde"), 4, 2, -4);
+ test(S("abcde"), 0, 2, SV("abcde"), 5, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 5, 1, 2);
+ test(S("abcde"), 0, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 5, -3);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 9, -7);
+}
+
+template <class S, class SV>
+void test4()
+{
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 10, -8);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 0, 11, -8);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 9, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 10, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 10, 1, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 10, -8);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 19, -17);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 20, -18);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 0, 21, -18);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 19, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 20, 0, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 20, 1, 2);
+ test(S("abcde"), 0, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 4, SV(""), 0, 0, 4);
+ test(S("abcde"), 0, 4, SV(""), 0, 1, 4);
+ test(S("abcde"), 0, 4, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 1, 3);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 2, 2);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 4, 0);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 5, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 0, 6, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 0, 4, SV("abcde"), 2, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 2, 1, -2);
+ test(S("abcde"), 0, 4, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 4, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 0, 4, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 0, 4, SV("abcde"), 4, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 4, 1, -4);
+ test(S("abcde"), 0, 4, SV("abcde"), 4, 2, -4);
+ test(S("abcde"), 0, 4, SV("abcde"), 5, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 5, 1, 4);
+ test(S("abcde"), 0, 4, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 1, 3);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 5, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 9, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 10, -6);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 0, 11, -6);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 9, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 10, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 10, 1, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 1, 3);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 10, -6);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 19, -15);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 20, -16);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 0, 21, -16);
+}
+
+template <class S, class SV>
+void test5()
+{
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 19, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 20, 0, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 20, 1, 4);
+ test(S("abcde"), 0, 4, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 5, SV(""), 0, 0, 5);
+ test(S("abcde"), 0, 5, SV(""), 0, 1, 5);
+ test(S("abcde"), 0, 5, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 1, 4);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 2, 3);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 5, 0);
+ test(S("abcde"), 0, 5, SV("abcde"), 0, 6, 0);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 0, 5, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 0, 5, SV("abcde"), 2, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 2, 1, -2);
+ test(S("abcde"), 0, 5, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 5, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 0, 5, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 0, 5, SV("abcde"), 4, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 4, 1, -4);
+ test(S("abcde"), 0, 5, SV("abcde"), 4, 2, -4);
+ test(S("abcde"), 0, 5, SV("abcde"), 5, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 5, 1, 5);
+ test(S("abcde"), 0, 5, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 1, 4);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 9, -4);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 10, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 0, 11, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 1, 4);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 10, -5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 19, -14);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 20, -15);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 21, -15);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcde"), 0, 5, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 0, 6, SV(""), 0, 0, 5);
+ test(S("abcde"), 0, 6, SV(""), 0, 1, 5);
+ test(S("abcde"), 0, 6, SV(""), 1, 0, 0);
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 1, 4);
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 2, 3);
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 5, 0);
+}
+
+template <class S, class SV>
+void test6()
+{
+ test(S("abcde"), 0, 6, SV("abcde"), 0, 6, 0);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 0, 6, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 0, 6, SV("abcde"), 2, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 2, 1, -2);
+ test(S("abcde"), 0, 6, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 0, 6, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 0, 6, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 0, 6, SV("abcde"), 4, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 4, 1, -4);
+ test(S("abcde"), 0, 6, SV("abcde"), 4, 2, -4);
+ test(S("abcde"), 0, 6, SV("abcde"), 5, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 5, 1, 5);
+ test(S("abcde"), 0, 6, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 1, 4);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 9, -4);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 10, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 0, 11, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 1, 4);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 10, -5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 19, -14);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 20, -15);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 0, 21, -15);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcde"), 0, 6, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 1, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 1, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 1, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 1, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 1, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 1, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 1, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcde"), 1, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 1, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 1, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 1, -1);
+}
+
+template <class S, class SV>
+void test7()
+{
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 1, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 1, SV(""), 0, 0, 1);
+ test(S("abcde"), 1, 1, SV(""), 0, 1, 1);
+ test(S("abcde"), 1, 1, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 2, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 5, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 0, 6, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 1, 0);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 3, -2);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 4, -3);
+ test(S("abcde"), 1, 1, SV("abcde"), 1, 5, -3);
+ test(S("abcde"), 1, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 1, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 1, 1, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 1, 1, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 1, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 4, 1, -3);
+ test(S("abcde"), 1, 1, SV("abcde"), 4, 2, -3);
+ test(S("abcde"), 1, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 4, -3);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 8, -7);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 9, -8);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 1, 10, -8);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 9, -8);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 18, -17);
+}
+
+template <class S, class SV>
+void test8()
+{
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 19, -18);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 20, -18);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcde"), 1, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 2, SV(""), 0, 0, 2);
+ test(S("abcde"), 1, 2, SV(""), 0, 1, 2);
+ test(S("abcde"), 1, 2, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 2, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 5, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 0, 6, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 2, 0);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 3, -1);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 4, -2);
+ test(S("abcde"), 1, 2, SV("abcde"), 1, 5, -2);
+ test(S("abcde"), 1, 2, SV("abcde"), 2, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 2, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 1, 2, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 1, 2, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 1, 2, SV("abcde"), 4, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 4, 1, -3);
+ test(S("abcde"), 1, 2, SV("abcde"), 4, 2, -3);
+ test(S("abcde"), 1, 2, SV("abcde"), 5, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 5, 1, 2);
+ test(S("abcde"), 1, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 4, -2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 8, -6);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 9, -7);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 1, 10, -7);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 9, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 10, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 10, 1, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 1, 1);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 9, -7);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 18, -16);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 19, -17);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 1, 20, -17);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 19, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 20, 0, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 20, 1, 2);
+ test(S("abcde"), 1, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 3, SV(""), 0, 0, 3);
+ test(S("abcde"), 1, 3, SV(""), 0, 1, 3);
+ test(S("abcde"), 1, 3, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 2, 1);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 5, 1);
+ test(S("abcde"), 1, 3, SV("abcde"), 0, 6, 1);
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 1, 2);
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 2, 1);
+}
+
+template <class S, class SV>
+void test9()
+{
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 3, 0);
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 4, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 1, 5, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 2, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 1, 3, SV("abcde"), 4, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 4, 1, -3);
+ test(S("abcde"), 1, 3, SV("abcde"), 4, 2, -3);
+ test(S("abcde"), 1, 3, SV("abcde"), 5, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 5, 1, 3);
+ test(S("abcde"), 1, 3, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 1, 2);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 8, -5);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 9, -6);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 1, 10, -6);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 9, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 10, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 10, 1, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 1, 2);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 9, -6);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 18, -15);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 19, -16);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 1, 20, -16);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 19, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 20, 0, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 20, 1, 3);
+ test(S("abcde"), 1, 3, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 4, SV(""), 0, 0, 4);
+ test(S("abcde"), 1, 4, SV(""), 0, 1, 4);
+ test(S("abcde"), 1, 4, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 2, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 5, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 0, 6, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 1, 3);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 2, 2);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 4, 0);
+ test(S("abcde"), 1, 4, SV("abcde"), 1, 5, 0);
+ test(S("abcde"), 1, 4, SV("abcde"), 2, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 4, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 1, 4, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 1, 4, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 1, 4, SV("abcde"), 4, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 4, 1, -3);
+ test(S("abcde"), 1, 4, SV("abcde"), 4, 2, -3);
+ test(S("abcde"), 1, 4, SV("abcde"), 5, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 5, 1, 4);
+ test(S("abcde"), 1, 4, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 1, 3);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 8, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 9, -5);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 1, 10, -5);
+}
+
+template <class S, class SV>
+void test10()
+{
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 9, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 10, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 10, 1, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 1, 3);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 9, -5);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 18, -14);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 19, -15);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 20, -15);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 20, 0, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 20, 1, 4);
+ test(S("abcde"), 1, 4, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 1, 5, SV(""), 0, 0, 4);
+ test(S("abcde"), 1, 5, SV(""), 0, 1, 4);
+ test(S("abcde"), 1, 5, SV(""), 1, 0, 0);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 1, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 2, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 4, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 5, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 0, 6, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 1, 3);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 2, 2);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 4, 0);
+ test(S("abcde"), 1, 5, SV("abcde"), 1, 5, 0);
+ test(S("abcde"), 1, 5, SV("abcde"), 2, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 1, 5, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 1, 5, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 1, 5, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 1, 5, SV("abcde"), 4, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 4, 1, -3);
+ test(S("abcde"), 1, 5, SV("abcde"), 4, 2, -3);
+ test(S("abcde"), 1, 5, SV("abcde"), 5, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 5, 1, 4);
+ test(S("abcde"), 1, 5, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 1, 3);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 8, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 9, -5);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 1, 10, -5);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 9, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 10, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 10, 1, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 1, 3);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 9, -5);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 18, -14);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 19, -15);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 1, 20, -15);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+}
+
+template <class S, class SV>
+void test11()
+{
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 19, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 20, 0, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 20, 1, 4);
+ test(S("abcde"), 1, 5, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 2, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 2, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 2, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 2, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 2, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 2, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 2, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 2, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcde"), 2, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 2, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 2, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 2, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 2, 1, SV(""), 0, 0, 1);
+ test(S("abcde"), 2, 1, SV(""), 0, 1, 1);
+ test(S("abcde"), 2, 1, SV(""), 1, 0, 0);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 1, 2);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 2, 2);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 4, 2);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 5, 2);
+ test(S("abcde"), 2, 1, SV("abcde"), 0, 6, 2);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 2, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 4, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 1, 5, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 2, 0, 1);
+}
+
+template <class S, class SV>
+void test12()
+{
+ test(S("abcde"), 2, 1, SV("abcde"), 2, 1, 0);
+ test(S("abcde"), 2, 1, SV("abcde"), 2, 2, -1);
+ test(S("abcde"), 2, 1, SV("abcde"), 2, 3, -2);
+ test(S("abcde"), 2, 1, SV("abcde"), 2, 4, -2);
+ test(S("abcde"), 2, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 4, 1, -2);
+ test(S("abcde"), 2, 1, SV("abcde"), 4, 2, -2);
+ test(S("abcde"), 2, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 1, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 5, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 9, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 10, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 0, 11, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 4, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 9, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 1, 10, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 1, -3);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 2, -3);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 4, -3);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 5, -3);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 5, 6, -3);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 9, 1, -7);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 9, 2, -7);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 1, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 10, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 19, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 20, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 0, 21, 2);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 9, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 19, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 1, 20, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 1, -8);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 5, -8);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 9, -8);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 10, -8);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 10, 11, -8);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 19, 1, -17);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 19, 2, -17);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcde"), 2, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 2, 2, SV(""), 0, 0, 2);
+ test(S("abcde"), 2, 2, SV(""), 0, 1, 2);
+ test(S("abcde"), 2, 2, SV(""), 1, 0, 0);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 2, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 4, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 5, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 0, 6, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 1, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 2, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 4, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 1, 5, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 2, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 2, 1, 1);
+ test(S("abcde"), 2, 2, SV("abcde"), 2, 2, 0);
+ test(S("abcde"), 2, 2, SV("abcde"), 2, 3, -1);
+ test(S("abcde"), 2, 2, SV("abcde"), 2, 4, -1);
+ test(S("abcde"), 2, 2, SV("abcde"), 4, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 4, 1, -2);
+ test(S("abcde"), 2, 2, SV("abcde"), 4, 2, -2);
+ test(S("abcde"), 2, 2, SV("abcde"), 5, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 5, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 5, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 9, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 10, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 0, 11, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 1, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 4, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 9, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 1, 10, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 1, -3);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 2, -3);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 4, -3);
+}
+
+template <class S, class SV>
+void test13()
+{
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 5, -3);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 5, 6, -3);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 9, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 9, 1, -7);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 9, 2, -7);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 10, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 10, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 10, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 19, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 20, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 0, 21, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 1, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 9, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 19, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 1, 20, 1);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 1, -8);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 5, -8);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 9, -8);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 10, -8);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 10, 11, -8);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 19, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 19, 1, -17);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 19, 2, -17);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 20, 0, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 20, 1, 2);
+ test(S("abcde"), 2, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 2, 3, SV(""), 0, 0, 3);
+ test(S("abcde"), 2, 3, SV(""), 0, 1, 3);
+ test(S("abcde"), 2, 3, SV(""), 1, 0, 0);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 1, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 2, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 4, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 5, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 0, 6, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 1, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 2, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 4, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 1, 5, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 2, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 2, 1, 2);
+ test(S("abcde"), 2, 3, SV("abcde"), 2, 2, 1);
+ test(S("abcde"), 2, 3, SV("abcde"), 2, 3, 0);
+ test(S("abcde"), 2, 3, SV("abcde"), 2, 4, 0);
+ test(S("abcde"), 2, 3, SV("abcde"), 4, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 4, 1, -2);
+ test(S("abcde"), 2, 3, SV("abcde"), 4, 2, -2);
+ test(S("abcde"), 2, 3, SV("abcde"), 5, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 5, 1, 3);
+ test(S("abcde"), 2, 3, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 1, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 5, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 9, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 10, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 0, 11, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 1, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 4, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 9, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 1, 10, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 1, -3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 2, -3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 4, -3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 5, -3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 5, 6, -3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 9, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 9, 1, -7);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 9, 2, -7);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 10, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 10, 1, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 1, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 10, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 19, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 20, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 0, 21, 2);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 1, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 9, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 19, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 1, 20, 1);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 1, -8);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 5, -8);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 9, -8);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 10, -8);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 10, 11, -8);
+}
+
+template <class S, class SV>
+void test14()
+{
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 19, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 19, 1, -17);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 19, 2, -17);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 20, 0, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 20, 1, 3);
+ test(S("abcde"), 2, 3, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 2, 4, SV(""), 0, 0, 3);
+ test(S("abcde"), 2, 4, SV(""), 0, 1, 3);
+ test(S("abcde"), 2, 4, SV(""), 1, 0, 0);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 1, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 2, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 4, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 5, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 0, 6, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 1, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 2, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 3, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 4, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 1, 5, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 2, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 2, 1, 2);
+ test(S("abcde"), 2, 4, SV("abcde"), 2, 2, 1);
+ test(S("abcde"), 2, 4, SV("abcde"), 2, 3, 0);
+ test(S("abcde"), 2, 4, SV("abcde"), 2, 4, 0);
+ test(S("abcde"), 2, 4, SV("abcde"), 4, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 4, 1, -2);
+ test(S("abcde"), 2, 4, SV("abcde"), 4, 2, -2);
+ test(S("abcde"), 2, 4, SV("abcde"), 5, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 5, 1, 3);
+ test(S("abcde"), 2, 4, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 1, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 5, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 9, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 10, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 0, 11, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 1, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 4, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 9, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 1, 10, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 1, -3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 2, -3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 4, -3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 5, -3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 5, 6, -3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 9, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 9, 1, -7);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 9, 2, -7);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 10, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 10, 1, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 1, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 10, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 19, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 20, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 0, 21, 2);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 1, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 9, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 19, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 1, 20, 1);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 1, -8);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 5, -8);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 9, -8);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 10, -8);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 10, 11, -8);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 19, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 19, 1, -17);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 19, 2, -17);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 20, 0, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 20, 1, 3);
+ test(S("abcde"), 2, 4, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 4, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 4, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 4, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 4, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 4, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 4, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 4, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 4, 0, SV("abcde"), 2, 4, -3);
+}
+
+template <class S, class SV>
+void test15()
+{
+ test(S("abcde"), 4, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 4, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 4, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 4, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 4, 1, SV(""), 0, 0, 1);
+ test(S("abcde"), 4, 1, SV(""), 0, 1, 1);
+ test(S("abcde"), 4, 1, SV(""), 1, 0, 0);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 1, 4);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 2, 4);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 4, 4);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 5, 4);
+ test(S("abcde"), 4, 1, SV("abcde"), 0, 6, 4);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 1, 3);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 2, 3);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 3, 3);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 4, 3);
+ test(S("abcde"), 4, 1, SV("abcde"), 1, 5, 3);
+ test(S("abcde"), 4, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 2, 1, 2);
+ test(S("abcde"), 4, 1, SV("abcde"), 2, 2, 2);
+ test(S("abcde"), 4, 1, SV("abcde"), 2, 3, 2);
+ test(S("abcde"), 4, 1, SV("abcde"), 2, 4, 2);
+ test(S("abcde"), 4, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 4, 1, 0);
+ test(S("abcde"), 4, 1, SV("abcde"), 4, 2, 0);
+ test(S("abcde"), 4, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcde"), 4, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 1, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 5, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 9, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 10, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 0, 11, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 1, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 4, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 8, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 9, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 1, 10, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 2, -1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 4, -1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 5, -1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 5, 6, -1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 1, -5);
+}
+
+template <class S, class SV>
+void test16()
+{
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 9, 2, -5);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 1, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 10, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 19, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 20, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 0, 21, 4);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 1, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 9, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 18, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 19, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 1, 20, 3);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 1, -6);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 5, -6);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 9, -6);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 10, -6);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 10, 11, -6);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 19, 1, -15);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 19, 2, -15);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcde"), 4, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 4, 2, SV(""), 0, 0, 1);
+ test(S("abcde"), 4, 2, SV(""), 0, 1, 1);
+ test(S("abcde"), 4, 2, SV(""), 1, 0, 0);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 1, 4);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 2, 4);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 4, 4);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 5, 4);
+ test(S("abcde"), 4, 2, SV("abcde"), 0, 6, 4);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 1, 3);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 2, 3);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 3, 3);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 4, 3);
+ test(S("abcde"), 4, 2, SV("abcde"), 1, 5, 3);
+ test(S("abcde"), 4, 2, SV("abcde"), 2, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 2, 1, 2);
+ test(S("abcde"), 4, 2, SV("abcde"), 2, 2, 2);
+ test(S("abcde"), 4, 2, SV("abcde"), 2, 3, 2);
+ test(S("abcde"), 4, 2, SV("abcde"), 2, 4, 2);
+ test(S("abcde"), 4, 2, SV("abcde"), 4, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 4, 1, 0);
+ test(S("abcde"), 4, 2, SV("abcde"), 4, 2, 0);
+ test(S("abcde"), 4, 2, SV("abcde"), 5, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 5, 1, 1);
+ test(S("abcde"), 4, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 1, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 5, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 9, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 10, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 0, 11, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 1, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 4, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 8, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 9, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 1, 10, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 2, -1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 4, -1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 5, -1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 5, 6, -1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 9, 1, -5);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 9, 2, -5);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 1, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 10, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 19, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 20, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 0, 21, 4);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 1, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 9, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 18, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 19, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 1, 20, 3);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 1, -6);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 5, -6);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 9, -6);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 10, -6);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 10, 11, -6);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 19, 1, -15);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 19, 2, -15);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+}
+
+template <class S, class SV>
+void test17()
+{
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcde"), 4, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 5, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 5, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 5, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 5, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 5, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 5, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 5, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 5, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcde"), 5, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 5, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 5, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 5, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 5, 1, SV(""), 0, 0, 0);
+ test(S("abcde"), 5, 1, SV(""), 0, 1, 0);
+ test(S("abcde"), 5, 1, SV(""), 1, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 2, -2);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 4, -4);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 5, -5);
+ test(S("abcde"), 5, 1, SV("abcde"), 0, 6, -5);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 2, -2);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 3, -3);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 4, -4);
+ test(S("abcde"), 5, 1, SV("abcde"), 1, 5, -4);
+ test(S("abcde"), 5, 1, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcde"), 5, 1, SV("abcde"), 2, 3, -3);
+ test(S("abcde"), 5, 1, SV("abcde"), 2, 4, -3);
+ test(S("abcde"), 5, 1, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 4, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcde"), 4, 2, -1);
+ test(S("abcde"), 5, 1, SV("abcde"), 5, 0, 0);
+}
+
+template <class S, class SV>
+void test18()
+{
+ test(S("abcde"), 5, 1, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 5, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 5, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcde"), 6, 0, SV(""), 0, 0, 0);
+ test(S("abcde"), 6, 0, SV(""), 0, 1, 0);
+ test(S("abcde"), 6, 0, SV(""), 1, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 4, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 5, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 0, 6, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 3, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 4, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 1, 5, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 2, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 2, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 2, 3, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 2, 4, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 4, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 4, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 9, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 8, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 4, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 5, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 5, 6, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 9, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 9, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghij"), 11, 0, 0);
+}
+
+template <class S, class SV>
+void test19()
+{
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 19, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 18, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 5, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 9, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcde"), 6, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 0, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 0, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV(""), 0, 1, 1);
+}
+
+template <class S, class SV>
+void test20()
+{
+ test(S("abcdefghij"), 0, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 1, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 2, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 4, -3);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 5, -4);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 0, 6, -4);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 5, -4);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 9, -8);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 10, -9);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 0, 11, -9);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 10, -9);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 19, -18);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 20, -19);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 21, -19);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghij"), 0, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 5, SV(""), 0, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV(""), 0, 1, 5);
+ test(S("abcdefghij"), 0, 5, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 1, 4);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 2, 3);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 5, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 0, 6, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 2, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 4, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 5, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 5, 1, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 1, 4);
+}
+
+template <class S, class SV>
+void test21()
+{
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 9, -4);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 10, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 0, 11, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 1, 4);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 10, -5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 19, -14);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 20, -15);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 0, 21, -15);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcdefghij"), 0, 5, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 9, SV(""), 0, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV(""), 0, 1, 9);
+ test(S("abcdefghij"), 0, 9, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 1, 8);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 2, 7);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 5, 4);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 0, 6, 4);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 2, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 4, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 5, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 5, 1, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 1, 8);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 5, 4);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 9, 0);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 10, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 0, 11, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 9, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 10, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 10, 1, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 1, 8);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 10, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 19, -10);
+}
+
+template <class S, class SV>
+void test22()
+{
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 20, -11);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 0, 21, -11);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 19, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 20, 0, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 20, 1, 9);
+ test(S("abcdefghij"), 0, 9, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 10, SV(""), 0, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV(""), 0, 1, 10);
+ test(S("abcdefghij"), 0, 10, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 2, 8);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 4, 6);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 2, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 4, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 5, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 5, 1, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 9, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 10, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 10, 1, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 19, -9);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 20, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 21, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 20, 0, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 20, 1, 10);
+ test(S("abcdefghij"), 0, 10, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 0, 11, SV(""), 0, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV(""), 0, 1, 10);
+ test(S("abcdefghij"), 0, 11, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 2, 8);
+}
+
+template <class S, class SV>
+void test23()
+{
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 4, 6);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 2, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 4, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 5, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 5, 1, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 9, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 10, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 10, 1, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 1, 9);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 19, -9);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 20, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 0, 21, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 19, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 20, 0, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 20, 1, 10);
+ test(S("abcdefghij"), 0, 11, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 1, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 0, 11, -10);
+}
+
+template <class S, class SV>
+void test24()
+{
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 1, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 1, 0);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 3, -2);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 4, -3);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 1, 5, -3);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 4, -3);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 8, -7);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 9, -8);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 1, 10, -8);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+}
+
+template <class S, class SV>
+void test25()
+{
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 9, -8);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 18, -17);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 19, -18);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 20, -18);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghij"), 1, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 4, SV(""), 0, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV(""), 0, 1, 4);
+ test(S("abcdefghij"), 1, 4, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 1, 3);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 2, 2);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 3, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 4, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 1, 5, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 2, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 4, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 5, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 5, 1, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 1, 3);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 8, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 9, -5);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 1, 10, -5);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 9, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 10, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 10, 1, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 1, 3);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 9, -5);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 18, -14);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 19, -15);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 1, 20, -15);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 20, 0, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 20, 1, 4);
+ test(S("abcdefghij"), 1, 4, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 8, SV(""), 0, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV(""), 0, 1, 8);
+ test(S("abcdefghij"), 1, 8, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 0, 8);
+}
+
+template <class S, class SV>
+void test26()
+{
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 1, 7);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 2, 6);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 3, 5);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 4, 4);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 2, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 4, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 5, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 5, 1, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 1, 7);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 8, 0);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 9, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 10, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 10, 1, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 1, 7);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 18, -10);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 19, -11);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 1, 20, -11);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 19, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 20, 0, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 20, 1, 8);
+ test(S("abcdefghij"), 1, 8, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 9, SV(""), 0, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV(""), 0, 1, 9);
+ test(S("abcdefghij"), 1, 9, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 2, 7);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 3, 6);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 4, 5);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 1, 5, 5);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 2, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 4, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 5, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 5, 1, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 4, 5);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 8, 1);
+}
+
+template <class S, class SV>
+void test27()
+{
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 9, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 10, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 10, 1, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 18, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 19, -10);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 20, -10);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 20, 0, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 20, 1, 9);
+ test(S("abcdefghij"), 1, 9, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 1, 10, SV(""), 0, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV(""), 0, 1, 9);
+ test(S("abcdefghij"), 1, 10, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 2, 7);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 3, 6);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 4, 5);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 1, 5, 5);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 2, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 4, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 5, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 5, 1, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 4, 5);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 9, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 10, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 10, 1, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 1, 8);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 18, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 19, -10);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 1, 20, -10);
+}
+
+template <class S, class SV>
+void test28()
+{
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 19, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 20, 0, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 20, 1, 9);
+ test(S("abcdefghij"), 1, 10, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 5, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 5, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghij"), 5, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 2, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 2, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 3, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 4, 4);
+}
+
+template <class S, class SV>
+void test29()
+{
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 1, 3);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 2, 3);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 3, 3);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 2, 4, 3);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 4, 1, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 4, 2, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 9, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 0, 11, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 8, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 1, 10, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 1, 0);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 2, -1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 4, -3);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 9, 1, -4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 9, 2, -4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 19, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 20, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 0, 21, 5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 18, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 19, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 1, 20, 4);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 1, -5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 9, -5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 1, -14);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 19, 2, -14);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghij"), 5, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 2, SV(""), 0, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV(""), 0, 1, 2);
+ test(S("abcdefghij"), 5, 2, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 2, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 2, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 3, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 2, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 2, 1, 3);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 2, 2, 3);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 2, 3, 3);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 2, 4, 3);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 4, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 4, 1, 1);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 4, 2, 1);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 5, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 5, 1, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 9, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 0, 11, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 8, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 1, 10, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 1, 1);
+}
+
+template <class S, class SV>
+void test30()
+{
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 2, 0);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 4, -2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 5, -3);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 5, 6, -3);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 9, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 9, 1, -4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 9, 2, -4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 10, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 10, 1, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 19, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 20, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 0, 21, 5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 18, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 19, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 1, 20, 4);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 1, -5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 9, -5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 19, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 19, 1, -14);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 19, 2, -14);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 20, 0, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 20, 1, 2);
+ test(S("abcdefghij"), 5, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 4, SV(""), 0, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV(""), 0, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 2, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 2, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 3, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 2, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 2, 1, 3);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 2, 2, 3);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 2, 3, 3);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 2, 4, 3);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 4, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 4, 1, 1);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 4, 2, 1);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 5, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 5, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 9, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 0, 11, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 8, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 1, 10, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 1, 3);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 2, 2);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 4, 0);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 5, -1);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 5, 6, -1);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 9, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 9, 1, -4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 9, 2, -4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 10, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 10, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 19, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 20, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 0, 21, 5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 18, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 19, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 1, 20, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 1, -5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 9, -5);
+}
+
+template <class S, class SV>
+void test31()
+{
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 19, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 19, 1, -14);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 19, 2, -14);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 20, 0, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 20, 1, 4);
+ test(S("abcdefghij"), 5, 4, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 5, SV(""), 0, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV(""), 0, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 2, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 2, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 3, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 2, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 2, 1, 3);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 2, 2, 3);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 2, 3, 3);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 2, 4, 3);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 4, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 4, 1, 1);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 4, 2, 1);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 5, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 5, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 9, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 0, 11, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 8, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 1, 10, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 1, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 2, 3);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 4, 1);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 5, 0);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 5, 6, 0);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 9, 1, -4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 9, 2, -4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 19, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 20, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 0, 21, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 18, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 19, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 1, 20, 4);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 1, -5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 9, -5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 19, 1, -14);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 19, 2, -14);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcdefghij"), 5, 5, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 5, 6, SV(""), 0, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV(""), 0, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 2, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 4, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 2, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 3, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 1, 5, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 1, 3);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 2, 3);
+}
+
+template <class S, class SV>
+void test32()
+{
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 3, 3);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 2, 4, 3);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 4, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 4, 1, 1);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 4, 2, 1);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 5, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 5, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 9, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 0, 11, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 4, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 8, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 1, 10, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 1, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 2, 3);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 4, 1);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 5, 0);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 5, 6, 0);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 9, 1, -4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 9, 2, -4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 10, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 19, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 20, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 0, 21, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 1, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 9, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 18, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 19, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 1, 20, 4);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 1, -5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 9, -5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 19, 1, -14);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 19, 2, -14);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcdefghij"), 5, 6, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 9, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 5, 6, -5);
+}
+
+template <class S, class SV>
+void test33()
+{
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 9, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 9, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghij"), 9, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 2, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 4, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 5, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 0, 6, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 2, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 3, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 4, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 1, 5, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 2, 1, 7);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 2, 2, 7);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 2, 3, 7);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 2, 4, 7);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 4, 1, 5);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 4, 2, 5);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 5, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 9, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 10, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 0, 11, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 4, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 8, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 9, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 1, 10, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 1, 4);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 2, 4);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 4, 4);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 5, 4);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 5, 6, 4);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 9, 1, 0);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 9, 2, 0);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 10, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 19, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 20, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 0, 21, 9);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 9, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 18, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 19, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 1, 20, 8);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 5, -1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 9, -1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 10, -1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 10, 11, -1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 1, -10);
+}
+
+template <class S, class SV>
+void test34()
+{
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 19, 2, -10);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghij"), 9, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 9, 2, SV(""), 0, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV(""), 0, 1, 1);
+ test(S("abcdefghij"), 9, 2, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 2, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 4, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 5, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 0, 6, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 2, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 3, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 4, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 1, 5, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 2, 1, 7);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 2, 2, 7);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 2, 3, 7);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 2, 4, 7);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 4, 1, 5);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 4, 2, 5);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 5, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 9, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 10, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 0, 11, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 4, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 8, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 9, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 1, 10, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 1, 4);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 2, 4);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 4, 4);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 5, 4);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 5, 6, 4);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 9, 1, 0);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 9, 2, 0);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 1, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 10, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 19, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 20, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 0, 21, 9);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 1, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 9, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 18, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 19, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 1, 20, 8);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 5, -1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 9, -1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 10, -1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 10, 11, -1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 19, 1, -10);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 19, 2, -10);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghij"), 9, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 10, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 1, -1);
+}
+
+template <class S, class SV>
+void test35()
+{
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 10, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 10, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 10, 0, 0);
+}
+
+template <class S, class SV>
+void test36()
+{
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 10, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 4, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 5, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 0, 6, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 3, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 4, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 1, 5, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 2, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 2, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 2, 3, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 2, 4, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 4, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 4, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 9, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 8, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 4, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 5, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 5, 6, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 9, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 9, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 19, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 18, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 5, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 9, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghij"), 11, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+}
+
+template <class S, class SV>
+void test37()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 0, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcde"), 6, 0, 0);
+}
+
+template <class S, class SV>
+void test38()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 9, -8);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 0, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 19, -18);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 0, 21, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 4, 6);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 0, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 2, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 4, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 5, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 9, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 10, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 1, 9);
+}
+
+template <class S, class SV>
+void test39()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 19, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 20, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 0, 21, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 20, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 20, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 10, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 2, 17);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 4, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 5, 14);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 0, 6, 14);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 2, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 4, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 5, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 5, 14);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 0, 11, 9);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 9, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 10, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 19, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 0, 21, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 19, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 20, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 20, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 19, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 0, 20);
+}
+
+template <class S, class SV>
+void test40()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 2, 18);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 4, 16);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 0, 6, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 2, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 4, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 5, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 5, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 9, 11);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 9, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 10, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 10, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 19, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 20, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 20, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 20, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 2, 18);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 4, 16);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 0, 6, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 1, 5, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 2, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 2, 1, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 2, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 2, 4, -2);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 4, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 4, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 4, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 5, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 5, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 9, 11);
+}
+
+template <class S, class SV>
+void test41()
+{
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 8, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 1, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 1, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 2, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 4, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 9, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 9, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 9, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 10, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 10, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 9, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 18, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 1, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 5, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 9, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 19, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 19, 1, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 19, 2, -19);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 20, 0, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 20, 1, 20);
+ test(S("abcdefghijklmnopqrst"), 0, 21, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+}
+
+template <class S, class SV>
+void test42()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 3, -2);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 1, 5, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 8, -7);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 9, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 1, 10, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 9, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 18, -17);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 19, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 1, 20, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 5, 1);
+}
+
+template <class S, class SV>
+void test43()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 2, 7);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 3, 6);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 1, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 2, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 4, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 5, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 5, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 8, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 9, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 10, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 18, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 19, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 1, 20, -10);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 20, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 20, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 9, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 1, 17);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 2, 16);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 3, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 4, 14);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 1, 5, 14);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 2, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 4, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 5, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 5, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 1, 17);
+}
+
+template <class S, class SV>
+void test44()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 4, 14);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 8, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 1, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 9, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 10, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 10, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 1, 17);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 18, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 19, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 1, 20, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 19, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 20, 0, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 20, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 18, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 2, 17);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 3, 16);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 4, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 1, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 2, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 4, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 5, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 4, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 8, 11);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 1, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 9, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 10, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+}
+
+template <class S, class SV>
+void test45()
+{
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 19, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 20, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 20, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 19, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 4, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 0, 6, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 2, 17);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 3, 16);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 4, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 1, 5, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 2, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 2, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 2, 3, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 2, 4, -1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 4, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 4, 1, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 4, 2, -3);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 5, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 5, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 0, 11, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 4, 15);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 8, 11);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 1, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 1, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 2, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 5, 6, -4);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 9, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 9, 1, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 9, 2, -8);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 10, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 10, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 19, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 20, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 0, 21, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 18, 1);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 5, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 19, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 19, 1, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 19, 2, -18);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 20, 0, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 20, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 1, 20, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 2, -2);
+}
+
+template <class S, class SV>
+void test46()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 4, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 0, 6, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 2, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 3, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 1, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 2, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 2, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 2, 3, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 2, 4, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 4, 1, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 4, 2, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 8, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 1, 10, 9);
+}
+
+template <class S, class SV>
+void test47()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 2, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 5, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 9, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 9, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 19, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 20, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 0, 21, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 18, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 19, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 1, 20, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 9, -8);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 10, 11, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 19, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 4, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 0, 6, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 2, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 3, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 1, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 2, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 2, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 2, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 2, 3, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 2, 4, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 4, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 4, 1, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 4, 2, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 5, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 8, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 1, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 2, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 5, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 9, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 9, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 9, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 10, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 10, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 19, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 20, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 0, 21, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 18, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 19, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 1, 20, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 1, 4);
+}
+
+template <class S, class SV>
+void test48()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 9, -4);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 10, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 10, 11, -5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 19, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 19, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 19, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 20, 0, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 20, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 5, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 4, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 0, 6, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 2, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 3, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 1, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 2, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 2, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 2, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 2, 3, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 2, 4, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 4, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 4, 1, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 4, 2, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 5, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 5, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 8, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 1, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 2, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 5, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 9, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 9, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 9, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 10, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 19, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 20, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 0, 21, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 18, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 19, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 1, 20, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 5, 4);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 10, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 10, 11, -1);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 19, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 19, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 19, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 20, 0, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 20, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 9, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 4, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 0, 6, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 2, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 3, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 1, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 0, 10);
+}
+
+template <class S, class SV>
+void test49()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 3, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 2, 4, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 4, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 4, 1, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 4, 2, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 5, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 8, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 1, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 2, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 4, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 5, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 9, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 9, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 9, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 10, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 19, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 20, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 0, 21, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 18, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 19, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 1, 20, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 19, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 19, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 19, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 20, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 20, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 10, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 4, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 0, 6, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 2, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 3, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 1, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 2, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 2, 1, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 2, 2, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 2, 3, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 2, 4, 8);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 4, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 4, 1, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 4, 2, 6);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 5, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 5, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 9, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 0, 11, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 4, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 8, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 1, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 1, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 2, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 4, 5);
+}
+
+template <class S, class SV>
+void test50()
+{
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 5, 6, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 9, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 9, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 9, 2, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 10, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 10, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 19, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 20, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 0, 21, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 18, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 19, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 1, 20, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 5, 5);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 9, 1);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 19, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 19, 1, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 19, 2, -9);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 20, 0, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 20, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 10, 11, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+}
+
+template <class S, class SV>
+void test51()
+{
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 2, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 4, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 5, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 0, 6, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 2, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 3, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 4, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 1, 5, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 2, 1, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 2, 2, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 2, 3, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 2, 4, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 4, 1, 15);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 4, 2, 15);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 5, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 9, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 10, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 0, 11, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 4, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 8, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 9, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 1, 10, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 1, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 2, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 4, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 5, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 5, 6, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 9, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 9, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 10, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 19, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 20, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 0, 21, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 9, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 18, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 19, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 1, 20, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 10, 11, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 2, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 4, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 5, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 0, 6, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 2, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 3, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 4, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 1, 5, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 1, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 2, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 3, 17);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 2, 4, 17);
+}
+
+template <class S, class SV>
+void test52()
+{
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 4, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 4, 1, 15);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 4, 2, 15);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 5, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 5, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 9, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 10, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 0, 11, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 4, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 8, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 9, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 1, 10, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 1, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 2, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 4, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 5, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 5, 6, 14);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 9, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 9, 1, 10);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 9, 2, 10);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 10, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 1, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 10, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 19, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 20, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 0, 21, 19);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 1, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 9, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 18, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 19, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 1, 20, 18);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 1, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 5, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 9, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 10, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 10, 11, 9);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 19, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 20, 0, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 20, 1, 1);
+ test(S("abcdefghijklmnopqrst"), 19, 2, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 1, -1);
+}
+
+template <class S, class SV>
+void test53()
+{
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 0, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 1, 5, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 2, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 2, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 2, 3, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 2, 4, -3);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 4, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 4, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 0, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 8, -8);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 1, 10, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 2, -2);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 4, -4);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 5, 6, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 9, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 9, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 20, -20);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 0, 21, -20);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 18, -18);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 19, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 1, 20, -19);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 5, -5);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 9, -9);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 10, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 10, 11, -10);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 19, 1, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 19, 2, -1);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+}
+
+template <class S, class SV>
+void test54()
+{
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 20, 1, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 4, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 0, 6, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 3, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 4, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 1, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 2, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 2, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 2, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 2, 3, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 2, 4, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 4, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 4, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 4, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcde"), 6, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 0, 11, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 4, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 8, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 1, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 4, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 5, 6, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 9, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 9, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 9, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghij"), 11, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 19, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 0, 21, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 18, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 19, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 1, 20, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 5, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 9, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 10, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 10, 11, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 19, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 19, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 19, 2, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 20, 0, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 20, 1, 0);
+ test(S("abcdefghijklmnopqrst"), 21, 0, SV("abcdefghijklmnopqrst"), 21, 0, 0);
+}
+
+template <class S, class SV>
+void test55()
+{
+ test_npos(S(""), 0, 0, SV(""), 0, 0);
+ test_npos(S(""), 0, 0, SV("abcde"), 0, -5);
+ test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 0, -10);
+ test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 1, -9);
+ test_npos(S("abcde"), 0, 0, SV("abcdefghij"), 5, -5);
+}
+
+int main()
+{
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ test31<S, SV>();
+ test32<S, SV>();
+ test33<S, SV>();
+ test34<S, SV>();
+ test35<S, SV>();
+ test36<S, SV>();
+ test37<S, SV>();
+ test38<S, SV>();
+ test39<S, SV>();
+ test40<S, SV>();
+ test41<S, SV>();
+ test42<S, SV>();
+ test43<S, SV>();
+ test44<S, SV>();
+ test45<S, SV>();
+ test46<S, SV>();
+ test47<S, SV>();
+ test48<S, SV>();
+ test49<S, SV>();
+ test50<S, SV>();
+ test51<S, SV>();
+ test52<S, SV>();
+ test53<S, SV>();
+ test54<S, SV>();
+ test55<S, SV>();
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+ typedef std::basic_string_view<char, std::char_traits<char>> SV;
+ test0<S, SV>();
+ test1<S, SV>();
+ test2<S, SV>();
+ test3<S, SV>();
+ test4<S, SV>();
+ test5<S, SV>();
+ test6<S, SV>();
+ test7<S, SV>();
+ test8<S, SV>();
+ test9<S, SV>();
+ test10<S, SV>();
+ test11<S, SV>();
+ test12<S, SV>();
+ test13<S, SV>();
+ test14<S, SV>();
+ test15<S, SV>();
+ test16<S, SV>();
+ test17<S, SV>();
+ test18<S, SV>();
+ test19<S, SV>();
+ test20<S, SV>();
+ test21<S, SV>();
+ test22<S, SV>();
+ test23<S, SV>();
+ test24<S, SV>();
+ test25<S, SV>();
+ test26<S, SV>();
+ test27<S, SV>();
+ test28<S, SV>();
+ test29<S, SV>();
+ test30<S, SV>();
+ test31<S, SV>();
+ test32<S, SV>();
+ test33<S, SV>();
+ test34<S, SV>();
+ test35<S, SV>();
+ test36<S, SV>();
+ test37<S, SV>();
+ test38<S, SV>();
+ test39<S, SV>();
+ test40<S, SV>();
+ test41<S, SV>();
+ test42<S, SV>();
+ test43<S, SV>();
+ test44<S, SV>();
+ test45<S, SV>();
+ test46<S, SV>();
+ test47<S, SV>();
+ test48<S, SV>();
+ test49<S, SV>();
+ test50<S, SV>();
+ test51<S, SV>();
+ test52<S, SV>();
+ test53<S, SV>();
+ test54<S, SV>();
+ test55<S, SV>();
+ }
+#endif
+ {
+ typedef std::string S;
+ typedef std::string_view SV;
+ S s = "MNOP";
+ SV sv = "CDEF";
+ char arr[] = "MNOP";
+
+// calls compare(pos, n1, const char *, 0)
+ assert(s.compare(0, 4, "QRST", 0) > 0);
+
+// calls compare(pos, n1, string("QRST"), 0, npos)
+ assert(s.compare(0, 4, "QRST", 0, std::string::npos) < 0);
+
+// calls compare(pos, n1, T, 0, npos)
+ assert(s.compare(0, 4, sv, 0) > 0);
+
+// calls compare(pos, n1, T, 0, npos)
+ assert(s.compare(0, 4, sv, 0, std::string::npos) > 0);
+
+// calls compare(pos, n1, const char *, 0)
+ assert(s.compare(0, 4, arr, 0) > 0);
+
+// calls compare(size, size, string(arr), 0, npos)
+ assert(s.compare(0, 4, arr, 0, std::string::npos) == 0);
+ }
+}
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
index 094c227030b8..13f6c5a1cd7a 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos, size_type n1, const charT *s) const;
@@ -18,6 +17,8 @@
#include "min_allocator.h"
+#include "test_macros.h"
+
int sign(int x)
{
if (x == 0)
@@ -32,15 +33,22 @@ void
test(const S& s, typename S::size_type pos1, typename S::size_type n1,
const typename S::value_type* str, int x)
{
- try
- {
+ if (pos1 <= s.size())
assert(sign(s.compare(pos1, n1, str)) == sign(x));
- assert(pos1 <= s.size());
- }
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > s.size());
+ try
+ {
+ s.compare(pos1, n1, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > s.size());
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
index 22aae785c19a..fc811c84671b 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const;
@@ -18,6 +17,8 @@
#include "min_allocator.h"
+#include "test_macros.h"
+
int sign(int x)
{
if (x == 0)
@@ -32,15 +33,22 @@ void
test(const S& s, typename S::size_type pos, typename S::size_type n1,
const typename S::value_type* str, typename S::size_type n2, int x)
{
- try
- {
+ if (pos <= s.size())
assert(sign(s.compare(pos, n1, str, n2)) == sign(x));
- assert(pos <= s.size());
- }
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > s.size());
+ try
+ {
+ s.compare(pos, n1, str, n2);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > s.size());
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
index 90b4230f64da..b3d7da29fb1f 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos1, size_type n1, const basic_string& str) const;
@@ -18,6 +17,8 @@
#include "min_allocator.h"
+#include "test_macros.h"
+
int sign(int x)
{
if (x == 0)
@@ -32,15 +33,22 @@ void
test(const S& s, typename S::size_type pos1, typename S::size_type n1,
const S& str, int x)
{
- try
- {
+ if (pos1 <= s.size())
assert(sign(s.compare(pos1, n1, str)) == sign(x));
- assert(pos1 <= s.size());
- }
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > s.size());
+ try
+ {
+ s.compare(pos1, n1, str);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos1 > s.size());
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
index 3cbbea7b490b..42bba9d5eb2b 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos1, size_type n1, const basic_string& str,
@@ -20,6 +19,8 @@
#include "min_allocator.h"
+#include "test_macros.h"
+
int sign(int x)
{
if (x == 0)
@@ -31,36 +32,48 @@ int sign(int x)
template <class S>
void
-test(const S& s, typename S::size_type pos1, typename S::size_type n1,
+test(const S& s, typename S::size_type pos1, typename S::size_type n1,
const S& str, typename S::size_type pos2, typename S::size_type n2, int x)
{
- try
- {
+ if (pos1 <= s.size() && pos2 <= str.size())
assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x));
- assert(pos1 <= s.size());
- assert(pos2 <= str.size());
- }
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > s.size() || pos2 > str.size());
+ try
+ {
+ s.compare(pos1, n1, str, pos2, n2);
+ assert(false);
+ }
+ catch (const std::out_of_range&)
+ {
+ assert(pos1 > s.size() || pos2 > str.size());
+ }
}
+#endif
}
template <class S>
void
-test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
- const S& str, typename S::size_type pos2, int x)
+test_npos(const S& s, typename S::size_type pos1, typename S::size_type n1,
+ const S& str, typename S::size_type pos2, int x)
{
- try
- {
+ if (pos1 <= s.size() && pos2 <= str.size())
assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x));
- assert(pos1 <= s.size());
- assert(pos2 <= str.size());
- }
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos1 > s.size() || pos2 > str.size());
+ try
+ {
+ s.compare(pos1, n1, str, pos2);
+ assert(false);
+ }
+ catch (const std::out_of_range&)
+ {
+ assert(pos1 > s.size() || pos2 > str.size());
+ }
}
+#endif
}
template <class S>
diff --git a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index 145e8dde58bf..f94739eb4413 100644
--- a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// basic_string substr(size_type pos = 0, size_type n = npos) const;
@@ -24,7 +23,7 @@ template <class S>
void
test(const S& s, typename S::size_type pos, typename S::size_type n)
{
- try
+ if (pos <= s.size())
{
S str = s.substr(pos, n);
LIBCPP_ASSERT(str.__invariants());
@@ -33,10 +32,20 @@ test(const S& s, typename S::size_type pos, typename S::size_type n)
assert(str.size() == rlen);
assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0);
}
- catch (std::out_of_range&)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ else
{
- assert(pos > s.size());
+ try
+ {
+ S str = s.substr(pos, n);
+ assert(false);
+ }
+ catch (std::out_of_range&)
+ {
+ assert(pos > s.size());
+ }
}
+#endif
}
int main()
diff --git a/test/std/strings/basic.string/string.require/contiguous.pass.cpp b/test/std/strings/basic.string/string.require/contiguous.pass.cpp
index 49773fe491a2..1cc8e96e8cd4 100644
--- a/test/std/strings/basic.string/string.require/contiguous.pass.cpp
+++ b/test/std/strings/basic.string/string.require/contiguous.pass.cpp
@@ -22,7 +22,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/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp
index a4a0e294c262..a9eb6c961a31 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp
@@ -18,7 +18,6 @@
int main()
{
- char s1[] = {1, 2, 3};
char s2[3] = {0};
assert(std::char_traits<char>::assign(s2, 3, char(5)) == s2);
assert(s2[0] == char(5));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
index f7f84e85924c..8a2f2964c765 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
@@ -18,7 +18,6 @@
int main()
{
- char c = '\0';
assert(std::char_traits<char>::eq('a', 'a'));
assert(!std::char_traits<char>::eq('a', 'A'));
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign3.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign3.pass.cpp
index fc1ba6e8670a..4b702fa8b409 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign3.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign3.pass.cpp
@@ -19,7 +19,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- char16_t s1[] = {1, 2, 3};
char16_t s2[3] = {0};
assert(std::char_traits<char16_t>::assign(s2, 3, char16_t(5)) == s2);
assert(s2[0] == char16_t(5));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
index 4e5a1834aeb5..3b6e0d609d09 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
@@ -20,5 +20,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
std::char_traits<char16_t>::int_type i = std::char_traits<char16_t>::eof();
+ ((void)i); // Prevent unused warning
#endif
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
index 1ae4cb8fe8d9..c58db4c1492f 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
@@ -22,7 +22,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
- char16_t c = u'\0';
assert(std::char_traits<char16_t>::eq(u'a', u'a'));
assert(!std::char_traits<char16_t>::eq(u'a', u'A'));
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
index b27ee06f4a59..2327670690ac 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
@@ -22,7 +22,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
- char16_t c = u'\0';
assert(!std::char_traits<char16_t>::lt(u'a', u'a'));
assert( std::char_traits<char16_t>::lt(u'A', u'a'));
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp
index 0c31ea7ae97e..8e0ee2f6ff9e 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp
@@ -19,7 +19,6 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- char32_t s1[] = {1, 2, 3};
char32_t s2[3] = {0};
assert(std::char_traits<char32_t>::assign(s2, 3, char32_t(5)) == s2);
assert(s2[0] == char32_t(5));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
index 8f804aa22e7a..178486d701fa 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
@@ -20,5 +20,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
std::char_traits<char32_t>::int_type i = std::char_traits<char32_t>::eof();
+ ((void)i); // Prevent unused warning
#endif
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
index 0284d9f7933b..92dd5b87b54a 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
@@ -22,7 +22,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
- char32_t c = U'\0';
assert(std::char_traits<char32_t>::eq(U'a', U'a'));
assert(!std::char_traits<char32_t>::eq(U'a', U'A'));
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
index 9816df738709..f091bd980182 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
@@ -22,7 +22,6 @@ int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
- char32_t c = U'\0';
assert(!std::char_traits<char32_t>::lt(U'a', U'a'));
assert( std::char_traits<char32_t>::lt(U'A', U'a'));
#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp
index 2a00fe06e5a2..acb505671728 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp
@@ -18,7 +18,6 @@
int main()
{
- wchar_t s1[] = {1, 2, 3};
wchar_t s2[3] = {0};
assert(std::char_traits<wchar_t>::assign(s2, 3, wchar_t(5)) == s2);
assert(s2[0] == wchar_t(5));
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
index 98d0926e3071..bd00b07ad281 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
@@ -18,7 +18,6 @@
int main()
{
- wchar_t c = L'\0';
assert(std::char_traits<wchar_t>::eq(L'a', L'a'));
assert(!std::char_traits<wchar_t>::eq(L'a', L'A'));
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
index 147a57914e09..60cbc218b72a 100644
--- a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
@@ -18,7 +18,6 @@
int main()
{
- wchar_t c = L'\0';
assert(!std::char_traits<wchar_t>::lt(L'a', L'a'));
assert( std::char_traits<wchar_t>::lt(L'A', L'a'));
}
diff --git a/test/std/strings/string.conversions/stod.pass.cpp b/test/std/strings/string.conversions/stod.pass.cpp
index 27d5e5cbd19b..3d5db63e0983 100644
--- a/test/std/strings/string.conversions/stod.pass.cpp
+++ b/test/std/strings/string.conversions/stod.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// double stod(const string& str, size_t *idx = 0);
@@ -17,6 +16,8 @@
#include <cmath>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stod("0") == 0);
@@ -33,20 +34,25 @@ int main()
idx = 0;
assert(std::stod(L"10g", &idx) == 10);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::stod("1.e60", &idx) == 1.e60);
assert(idx == 5);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
try
+#endif
{
assert(std::stod(L"1.e60", &idx) == 1.e60);
assert(idx == 5);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
@@ -71,40 +77,54 @@ int main()
assert(idx == 0);
}
try
+#endif
{
assert(std::stod("INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::stod(L"INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stod("NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stod(L"NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
@@ -164,4 +184,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp
index 38519a2feba0..1e17e1d3abdd 100644
--- a/test/std/strings/string.conversions/stof.pass.cpp
+++ b/test/std/strings/string.conversions/stof.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
@@ -20,6 +19,8 @@
#include <cmath>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stof("0") == 0);
@@ -36,6 +37,7 @@ int main()
idx = 0;
assert(std::stof(L"10g", &idx) == 10);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
idx = 0;
try
{
@@ -75,40 +77,54 @@ int main()
assert(idx == 0);
}
try
+#endif
{
assert(std::stof("INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::stof(L"INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stof("NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stof(L"NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
@@ -168,4 +184,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stoi.pass.cpp b/test/std/strings/string.conversions/stoi.pass.cpp
index 238072740703..8852d47f0011 100644
--- a/test/std/strings/string.conversions/stoi.pass.cpp
+++ b/test/std/strings/string.conversions/stoi.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// int stoi(const string& str, size_t *idx = 0, int base = 10);
@@ -16,6 +15,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stoi("0") == 0);
@@ -32,6 +33,7 @@ int main()
idx = 0;
assert(std::stoi(L"10g", &idx, 16) == 16);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
if (std::numeric_limits<long>::max() > std::numeric_limits<int>::max())
{
try
@@ -106,4 +108,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp
index 2ca2c01cfb8c..457cf0a76997 100644
--- a/test/std/strings/string.conversions/stol.pass.cpp
+++ b/test/std/strings/string.conversions/stol.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
@@ -19,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stol("0") == 0);
@@ -35,6 +36,7 @@ int main()
idx = 0;
assert(std::stol(L"10g", &idx, 16) == 16);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
idx = 0;
try
{
@@ -109,4 +111,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stold.pass.cpp b/test/std/strings/string.conversions/stold.pass.cpp
index f489df2f124d..9d9dc3832ba6 100644
--- a/test/std/strings/string.conversions/stold.pass.cpp
+++ b/test/std/strings/string.conversions/stold.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <string>
// long double stold(const string& str, size_t *idx = 0);
@@ -19,6 +18,8 @@
#include <cmath>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stold("0") == 0);
@@ -35,25 +36,32 @@ int main()
idx = 0;
assert(std::stold(L"10g", &idx) == 10);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::stold("1.e60", &idx) == 1.e60L);
assert(idx == 5);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
try
+#endif
{
assert(std::stold(L"1.e60", &idx) == 1.e60L);
assert(idx == 5);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
assert(std::stold("1.e6000", &idx) == INFINITY);
@@ -73,40 +81,54 @@ int main()
assert(idx == 0);
}
try
+#endif
{
assert(std::stold("INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::stold(L"INF", &idx) == INFINITY);
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stold("NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
}
+#endif
idx = 0;
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
+#endif
{
assert(std::isnan(std::stold(L"NAN", &idx)));
assert(idx == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (const std::out_of_range&)
{
assert(false);
@@ -166,4 +188,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp
index d41db4284acd..ca8412aeb758 100644
--- a/test/std/strings/string.conversions/stoll.pass.cpp
+++ b/test/std/strings/string.conversions/stoll.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
@@ -19,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stoll("0") == 0);
@@ -35,6 +36,7 @@ int main()
idx = 0;
assert(std::stoll(L"10g", &idx, 16) == 16);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
idx = 0;
try
{
@@ -108,4 +110,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp
index 9dbd952434a9..1acdf116458f 100644
--- a/test/std/strings/string.conversions/stoul.pass.cpp
+++ b/test/std/strings/string.conversions/stoul.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
@@ -19,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stoul("0") == 0);
@@ -33,6 +34,7 @@ int main()
idx = 0;
assert(std::stoul(L"10g", &idx, 16) == 16);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
idx = 0;
try
{
@@ -107,4 +109,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp
index 837ca3120100..e63679eed2f4 100644
--- a/test/std/strings/string.conversions/stoull.pass.cpp
+++ b/test/std/strings/string.conversions/stoull.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
@@ -19,6 +18,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
assert(std::stoull("0") == 0);
@@ -33,6 +34,7 @@ int main()
idx = 0;
assert(std::stoull(L"10g", &idx, 16) == 16);
assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
idx = 0;
try
{
@@ -108,4 +110,5 @@ int main()
{
assert(idx == 0);
}
+#endif
}
diff --git a/test/std/strings/string.view/nothing_to_do.pass.cpp b/test/std/strings/string.view/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..353dd98f415e
--- /dev/null
+++ b/test/std/strings/string.view/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <string_view>
+
+int main () {}
diff --git a/test/std/strings/string.view/string.view.access/at.pass.cpp b/test/std/strings/string.view/string.view.access/at.pass.cpp
new file mode 100644
index 000000000000..0f1636d3f94f
--- /dev/null
+++ b/test/std/strings/string.view/string.view.access/at.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: Older versions of clang have a bug where they fail to evalute
+// string_view::at as a constant expression.
+// XFAIL: clang-3.4, clang-3.3
+
+
+// <string_view>
+
+// constexpr const _CharT& at(size_type _pos) const;
+
+#include <string_view>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename CharT>
+void test ( const CharT *s, size_t len ) {
+ std::basic_string_view<CharT> sv ( s, len );
+ assert ( sv.length() == len );
+ for ( size_t i = 0; i < len; ++i ) {
+ assert ( sv.at(i) == s[i] );
+ assert ( &sv.at(i) == s + i );
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try { sv.at(len); } catch ( const std::out_of_range & ) { return ; }
+ assert ( false );
+#endif
+}
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+#endif
+
+#if TEST_STD_VER >= 11
+ {
+ constexpr std::basic_string_view<char> sv ( "ABC", 2 );
+ static_assert ( sv.length() == 2, "" );
+ static_assert ( sv.at(0) == 'A', "" );
+ static_assert ( sv.at(1) == 'B', "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.access/back.pass.cpp b/test/std/strings/string.view/string.view.access/back.pass.cpp
new file mode 100644
index 000000000000..73f7737265d5
--- /dev/null
+++ b/test/std/strings/string.view/string.view.access/back.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr const _CharT& front();
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename CharT>
+bool test ( const CharT *s, size_t len ) {
+ std::basic_string_view<CharT> sv ( s, len );
+ assert ( sv.length() == len );
+ assert ( sv.back() == s[len-1] );
+ return &sv.back() == s + len - 1;
+ }
+
+int main () {
+ assert ( test ( "ABCDE", 5 ));
+ assert ( test ( "a", 1 ));
+
+ assert ( test ( L"ABCDE", 5 ));
+ assert ( test ( L"a", 1 ));
+
+#if TEST_STD_VER >= 11
+ assert ( test ( u"ABCDE", 5 ));
+ assert ( test ( u"a", 1 ));
+
+ assert ( test ( U"ABCDE", 5 ));
+ assert ( test ( U"a", 1 ));
+#endif
+
+#if TEST_STD_VER >= 11
+ {
+ constexpr std::basic_string_view<char> sv ( "ABC", 2 );
+ static_assert ( sv.length() == 2, "" );
+ static_assert ( sv.back() == 'B', "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.access/data.pass.cpp b/test/std/strings/string.view/string.view.access/data.pass.cpp
new file mode 100644
index 000000000000..7b2350923bb6
--- /dev/null
+++ b/test/std/strings/string.view/string.view.access/data.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr const _CharT* data() const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename CharT>
+void test ( const CharT *s, size_t len ) {
+ std::basic_string_view<CharT> sv ( s, len );
+ assert ( sv.length() == len );
+ assert ( sv.data() == s );
+ }
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr const char *s = "ABC";
+ constexpr std::basic_string_view<char> sv( s, 2 );
+ static_assert( sv.length() == 2, "" );
+ static_assert( sv.data() == s, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.access/front.pass.cpp b/test/std/strings/string.view/string.view.access/front.pass.cpp
new file mode 100644
index 000000000000..c627e02c410f
--- /dev/null
+++ b/test/std/strings/string.view/string.view.access/front.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr const _CharT& back();
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename CharT>
+bool test ( const CharT *s, size_t len ) {
+ std::basic_string_view<CharT> sv ( s, len );
+ assert ( sv.length() == len );
+ assert ( sv.front() == s[0] );
+ return &sv.front() == s;
+ }
+
+int main () {
+ assert ( test ( "ABCDE", 5 ));
+ assert ( test ( "a", 1 ));
+
+ assert ( test ( L"ABCDE", 5 ));
+ assert ( test ( L"a", 1 ));
+
+#if TEST_STD_VER >= 11
+ assert ( test ( u"ABCDE", 5 ));
+ assert ( test ( u"a", 1 ));
+
+ assert ( test ( U"ABCDE", 5 ));
+ assert ( test ( U"a", 1 ));
+#endif
+
+#if TEST_STD_VER >= 11
+ {
+ constexpr std::basic_string_view<char> sv ( "ABC", 2 );
+ static_assert ( sv.length() == 2, "" );
+ static_assert ( sv.front() == 'A', "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.access/index.pass.cpp b/test/std/strings/string.view/string.view.access/index.pass.cpp
new file mode 100644
index 000000000000..65eb6b4f65e9
--- /dev/null
+++ b/test/std/strings/string.view/string.view.access/index.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr const _CharT& operator[](size_type _pos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename CharT>
+void test ( const CharT *s, size_t len ) {
+ std::basic_string_view<CharT> sv ( s, len );
+ assert ( sv.length() == len );
+ for ( size_t i = 0; i < len; ++i ) {
+ assert ( sv[i] == s[i] );
+ assert ( &sv[i] == s + i );
+ }
+ }
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr std::basic_string_view<char> sv ( "ABC", 2 );
+ static_assert ( sv.length() == 2, "" );
+ static_assert ( sv[0] == 'A', "" );
+ static_assert ( sv[1] == 'B', "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
new file mode 100644
index 000000000000..d36c27886295
--- /dev/null
+++ b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// [string.view.capacity], capacity
+// constexpr size_type size() const noexcept;
+// constexpr size_type length() const noexcept;
+// constexpr size_type max_size() const noexcept;
+// constexpr bool empty() const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename SV>
+void test1 () {
+#if TEST_STD_VER > 11
+ {
+ constexpr SV sv1;
+ static_assert ( sv1.size() == 0, "" );
+ static_assert ( sv1.empty(), "");
+ static_assert ( sv1.size() == sv1.length(), "" );
+ static_assert ( sv1.max_size() > sv1.size(), "");
+ }
+#endif
+
+ {
+ SV sv1;
+ assert ( sv1.size() == 0 );
+ assert ( sv1.empty());
+ assert ( sv1.size() == sv1.length());
+ assert ( sv1.max_size() > sv1.size());
+ }
+}
+
+template<typename CharT>
+void test2 ( const CharT *s, size_t len ) {
+ {
+ std::basic_string_view<CharT> sv1 ( s );
+ assert ( sv1.size() == len );
+ assert ( sv1.data() == s );
+ assert ( sv1.empty() == (len == 0));
+ assert ( sv1.size() == sv1.length());
+ assert ( sv1.max_size() > sv1.size());
+ }
+}
+
+int main () {
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test1<string_view> ();
+ test1<u16string_view> ();
+ test1<u32string_view> ();
+ test1<wstring_view> ();
+
+ test2 ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
+ test2 ( "ABCDE", 5 );
+ test2 ( "a", 1 );
+ test2 ( "", 0 );
+
+ test2 ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
+ test2 ( L"ABCDE", 5 );
+ test2 ( L"a", 1 );
+ test2 ( L"", 0 );
+
+#if TEST_STD_VER >= 11
+ test2 ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
+ test2 ( u"ABCDE", 5 );
+ test2 ( u"a", 1 );
+ test2 ( u"", 0 );
+
+ test2 ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
+ test2 ( U"ABCDE", 5 );
+ test2 ( U"a", 1 );
+ test2 ( U"", 0 );
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..079c89191e49
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opeq.string_view.pointer.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator==(basic_string_view<charT,traits> lhs, const charT* rhs);
+// template<class charT, class traits>
+// constexpr bool operator==(const charT* lhs, basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(S lhs, const typename S::value_type* rhs, bool x)
+{
+ assert((lhs == rhs) == x);
+ assert((rhs == lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", true);
+ test(S(""), "abcde", false);
+ test(S(""), "abcdefghij", false);
+ test(S(""), "abcdefghijklmnopqrst", false);
+ test(S("abcde"), "", false);
+ test(S("abcde"), "abcde", true);
+ test(S("abcde"), "abcdefghij", false);
+ test(S("abcde"), "abcdefghijklmnopqrst", false);
+ test(S("abcdefghij"), "", false);
+ test(S("abcdefghij"), "abcde", false);
+ test(S("abcdefghij"), "abcdefghij", true);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", false);
+ test(S("abcdefghijklmnopqrst"), "", false);
+ test(S("abcdefghijklmnopqrst"), "abcde", false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+ static_assert ( sv1 == "", "" );
+ static_assert ( "" == sv1, "" );
+ static_assert (!(sv1 == "abcde"), "" );
+ static_assert (!("abcde" == sv1), "" );
+
+ static_assert ( sv2 == "abcde", "" );
+ static_assert ( "abcde" == sv2, "" );
+ static_assert (!(sv2 == "abcde0"), "" );
+ static_assert (!("abcde0" == sv2), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
new file mode 100644
index 000000000000..4b107b01e2c6
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opeq.string_view.string.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator==(const charT* lhs, const basic_string<charT,traits> rhs);
+// template<class charT, class traits, class Allocator>
+// bool operator==(const basic_string_view<charT,traits> lhs, const CharT* rhs);
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const std::string &lhs, S rhs, bool x)
+{
+ assert((lhs == rhs) == x);
+ assert((rhs == lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), true);
+ test("", S("abcde"), false);
+ test("", S("abcdefghij"), false);
+ test("", S("abcdefghijklmnopqrst"), false);
+ test("abcde", S(""), false);
+ test("abcde", S("abcde"), true);
+ test("abcde", S("abcdefghij"), false);
+ test("abcde", S("abcdefghijklmnopqrst"), false);
+ test("abcdefghij", S(""), false);
+ test("abcdefghij", S("abcde"), false);
+ test("abcdefghij", S("abcdefghij"), true);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), false);
+ test("abcdefghijklmnopqrst", S(""), false);
+ test("abcdefghijklmnopqrst", S("abcde"), false);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), false);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true);
+ }
+}
+
diff --git a/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..59cd7215b7e6
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opeq.string_view.string_view.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator==(const basic_string_view<charT,traits> lhs,
+// const basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(S lhs, S rhs, bool x)
+{
+ assert((lhs == rhs) == x);
+ assert((rhs == lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), true);
+ test(S(""), S("abcde"), false);
+ test(S(""), S("abcdefghij"), false);
+ test(S(""), S("abcdefghijklmnopqrst"), false);
+ test(S("abcde"), S(""), false);
+ test(S("abcde"), S("abcde"), true);
+ test(S("abcde"), S("abcdefghij"), false);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghij"), S(""), false);
+ test(S("abcdefghij"), S("abcde"), false);
+ test(S("abcdefghij"), S("abcdefghij"), true);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false);
+ test(S("abcdefghijklmnopqrst"), S(""), false);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2;
+ constexpr SV sv3 { "abcde", 5 };
+ static_assert ( sv1 == sv2, "" );
+ static_assert (!(sv1 == sv3), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..a75cb318505c
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opge.string_view.pointer.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator>=(const charT* lhs, basic_string_wiew<charT,traits> rhs);
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator>=(basic_string_wiew<charT,traits> lhs, const charT* rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs >= rhs) == x);
+ assert((rhs >= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), true, true);
+ test("", S("abcde"), false, true);
+ test("", S("abcdefghij"), false, true);
+ test("", S("abcdefghijklmnopqrst"), false, true);
+ test("abcde", S(""), true, false);
+ test("abcde", S("abcde"), true, true);
+ test("abcde", S("abcdefghij"), false, true);
+ test("abcde", S("abcdefghijklmnopqrst"), false, true);
+ test("abcdefghij", S(""), true, false);
+ test("abcdefghij", S("abcde"), true, false);
+ test("abcdefghij", S("abcdefghij"), true, true);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), false, true);
+ test("abcdefghijklmnopqrst", S(""), true, false);
+ test("abcdefghijklmnopqrst", S("abcde"), true, false);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), true, false);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert ( sv1 >= "", "" );
+ static_assert ( "" >= sv1, "" );
+ static_assert (!(sv1 >= "abcde"), "" );
+ static_assert ( "abcde" >= sv1, "" );
+
+ static_assert ( sv2 >= "", "" );
+ static_assert (!("" >= sv2), "" );
+ static_assert ( sv2 >= "abcde", "" );
+ static_assert ( "abcde" >= sv2, "" );
+ static_assert (!(sv2 >= "abcde0"), "" );
+ static_assert ( "abcde0" >= sv2, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp
new file mode 100644
index 000000000000..3881372ffc34
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opge.string_view.string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator>=(const basic_string<charT,traits,Allocator>& lhs,
+// basic_string_view<charT,traits> rhs);
+// bool operator>=(basic_string_view<charT,traits> lhs,
+// const basic_string<charT,traits,Allocator>& rhs);
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
+{
+ assert((lhs >= rhs) == x);
+ assert((rhs >= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", true, true);
+ test(S(""), "abcde", false, true);
+ test(S(""), "abcdefghij", false, true);
+ test(S(""), "abcdefghijklmnopqrst", false, true);
+ test(S("abcde"), "", true, false);
+ test(S("abcde"), "abcde", true, true);
+ test(S("abcde"), "abcdefghij", false, true);
+ test(S("abcde"), "abcdefghijklmnopqrst", false, true);
+ test(S("abcdefghij"), "", true, false);
+ test(S("abcdefghij"), "abcde", true, false);
+ test(S("abcdefghij"), "abcdefghij", true, true);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true);
+ test(S("abcdefghijklmnopqrst"), "", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcde", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true);
+ }
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..85455e18d071
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opge.string_view.string_view.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator>=(basic_string_view<charT,traits> lhs,
+// basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs >= rhs) == x);
+ assert((rhs >= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), true, true);
+ test(S(""), S("abcde"), false, true);
+ test(S(""), S("abcdefghij"), false, true);
+ test(S(""), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcde"), S(""), true, false);
+ test(S("abcde"), S("abcde"), true, true);
+ test(S("abcde"), S("abcdefghij"), false, true);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcdefghij"), S(""), true, false);
+ test(S("abcdefghij"), S("abcde"), true, false);
+ test(S("abcdefghij"), S("abcdefghij"), true, true);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcdefghijklmnopqrst"), S(""), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert ( sv1 >= sv1, "" );
+ static_assert ( sv2 >= sv2, "" );
+
+ static_assert (!(sv1 >= sv2), "" );
+ static_assert ( sv2 >= sv1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..d4dc39e891fc
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opgt.string_view.pointer.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr template<class charT, class traits, class Allocator>
+// bool operator>(const charT* lhs, basic_string_wiew<charT,traits> rhs);
+// constexpr template<class charT, class traits, class Allocator>
+// bool operator>(basic_string_wiew<charT,traits> lhs, const charT* rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs > rhs) == x);
+ assert((rhs > lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), false, false);
+ test("", S("abcde"), false, true);
+ test("", S("abcdefghij"), false, true);
+ test("", S("abcdefghijklmnopqrst"), false, true);
+ test("abcde", S(""), true, false);
+ test("abcde", S("abcde"), false, false);
+ test("abcde", S("abcdefghij"), false, true);
+ test("abcde", S("abcdefghijklmnopqrst"), false, true);
+ test("abcdefghij", S(""), true, false);
+ test("abcdefghij", S("abcde"), true, false);
+ test("abcdefghij", S("abcdefghij"), false, false);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), false, true);
+ test("abcdefghijklmnopqrst", S(""), true, false);
+ test("abcdefghijklmnopqrst", S("abcde"), true, false);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), true, false);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (!(sv1 > ""), "" );
+ static_assert (!("" > sv1), "" );
+ static_assert (!(sv1 > "abcde"), "" );
+ static_assert ( "abcde" > sv1, "" );
+
+ static_assert ( sv2 > "", "" );
+ static_assert (!("" > sv2), "" );
+ static_assert (!(sv2 > "abcde"), "" );
+ static_assert (!("abcde" > sv2), "" );
+ static_assert (!(sv2 > "abcde0"), "" );
+ static_assert ( "abcde0" > sv2, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp
new file mode 100644
index 000000000000..f0058c809e4d
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opgt.string_view.string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator>(const basic_string<charT,traits,Allocator>& lhs,
+// basic_string_view<charT,traits> rhs);
+// bool operator>(basic_string_view<charT,traits> lhs,
+// const basic_string<charT,traits,Allocator>& rhs);
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
+{
+ assert((lhs > rhs) == x);
+ assert((rhs > lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", false, false);
+ test(S(""), "abcde", false, true);
+ test(S(""), "abcdefghij", false, true);
+ test(S(""), "abcdefghijklmnopqrst", false, true);
+ test(S("abcde"), "", true, false);
+ test(S("abcde"), "abcde", false, false);
+ test(S("abcde"), "abcdefghij", false, true);
+ test(S("abcde"), "abcdefghijklmnopqrst", false, true);
+ test(S("abcdefghij"), "", true, false);
+ test(S("abcdefghij"), "abcde", true, false);
+ test(S("abcdefghij"), "abcdefghij", false, false);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", false, true);
+ test(S("abcdefghijklmnopqrst"), "", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcde", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", true, false);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false);
+ }
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..09f5360cd817
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opgt.string_view.string_view.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator>(basic_string_view<charT,traits> lhs,
+// basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs > rhs) == x);
+ assert((rhs > lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), false, false);
+ test(S(""), S("abcde"), false, true);
+ test(S(""), S("abcdefghij"), false, true);
+ test(S(""), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcde"), S(""), true, false);
+ test(S("abcde"), S("abcde"), false, false);
+ test(S("abcde"), S("abcdefghij"), false, true);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcdefghij"), S(""), true, false);
+ test(S("abcdefghij"), S("abcde"), true, false);
+ test(S("abcdefghij"), S("abcdefghij"), false, false);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), false, true);
+ test(S("abcdefghijklmnopqrst"), S(""), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true, false);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (!(sv1 > sv1), "" );
+ static_assert (!(sv2 > sv2), "" );
+
+ static_assert (!(sv1 > sv2), "" );
+ static_assert ( sv2 > sv1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..da6e2d90a975
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/ople.string_view.pointer.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator<=(const charT* lhs, basic_string_wiew<charT,traits> rhs);
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator<=(basic_string_wiew<charT,traits> lhs, const charT* rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs <= rhs) == x);
+ assert((rhs <= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), true, true);
+ test("", S("abcde"), true, false);
+ test("", S("abcdefghij"), true, false);
+ test("", S("abcdefghijklmnopqrst"), true, false);
+ test("abcde", S(""), false, true);
+ test("abcde", S("abcde"), true, true);
+ test("abcde", S("abcdefghij"), true, false);
+ test("abcde", S("abcdefghijklmnopqrst"), true, false);
+ test("abcdefghij", S(""), false, true);
+ test("abcdefghij", S("abcde"), false, true);
+ test("abcdefghij", S("abcdefghij"), true, true);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), true, false);
+ test("abcdefghijklmnopqrst", S(""), false, true);
+ test("abcdefghijklmnopqrst", S("abcde"), false, true);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), false, true);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), true, true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert ( sv1 <= "", "" );
+ static_assert ( "" <= sv1, "" );
+ static_assert ( sv1 <= "abcde", "" );
+ static_assert (!("abcde" <= sv1), "" );
+
+ static_assert (!(sv2 <= ""), "" );
+ static_assert ( "" <= sv2, "" );
+ static_assert ( sv2 <= "abcde", "" );
+ static_assert ( "abcde" <= sv2, "" );
+ static_assert ( sv2 <= "abcde0", "" );
+ static_assert (!("abcde0" <= sv2), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp
new file mode 100644
index 000000000000..092bc23b1c1d
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/ople.string_view.string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator<=(const basic_string<charT,traits,Allocator>& lhs,
+// basic_string_view<charT,traits> rhs);
+// bool operator<=(basic_string_view<charT,traits> lhs,
+// const basic_string<charT,traits,Allocator>& rhs);
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
+{
+ assert((lhs <= rhs) == x);
+ assert((rhs <= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", true, true);
+ test(S(""), "abcde", true, false);
+ test(S(""), "abcdefghij", true, false);
+ test(S(""), "abcdefghijklmnopqrst", true, false);
+ test(S("abcde"), "", false, true);
+ test(S("abcde"), "abcde", true, true);
+ test(S("abcde"), "abcdefghij", true, false);
+ test(S("abcde"), "abcdefghijklmnopqrst", true, false);
+ test(S("abcdefghij"), "", false, true);
+ test(S("abcdefghij"), "abcde", false, true);
+ test(S("abcdefghij"), "abcdefghij", true, true);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false);
+ test(S("abcdefghijklmnopqrst"), "", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcde", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", true, true);
+ }
+}
diff --git a/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..17c0b6bfd1cb
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/ople.string_view.string_view.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator<=(basic_string_view<charT,traits> lhs,
+// basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs <= rhs) == x);
+ assert((rhs <= lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), true, true);
+ test(S(""), S("abcde"), true, false);
+ test(S(""), S("abcdefghij"), true, false);
+ test(S(""), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcde"), S(""), false, true);
+ test(S("abcde"), S("abcde"), true, true);
+ test(S("abcde"), S("abcdefghij"), true, false);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcdefghij"), S(""), false, true);
+ test(S("abcdefghij"), S("abcde"), false, true);
+ test(S("abcdefghij"), S("abcdefghij"), true, true);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcdefghijklmnopqrst"), S(""), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), true, true);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert ( sv1 <= sv1, "" );
+ static_assert ( sv2 <= sv2, "" );
+
+ static_assert ( sv1 <= sv2, "" );
+ static_assert (!(sv2 <= sv1), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..554663f1b828
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/oplt.string_view.pointer.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator<(const charT* lhs, basic_string_wiew<charT,traits> rhs);
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator<(basic_string_wiew<charT,traits> lhs, const charT* rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const typename S::value_type* lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs < rhs) == x);
+ assert((rhs < lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), false, false);
+ test("", S("abcde"), true, false);
+ test("", S("abcdefghij"), true, false);
+ test("", S("abcdefghijklmnopqrst"), true, false);
+ test("abcde", S(""), false, true);
+ test("abcde", S("abcde"), false, false);
+ test("abcde", S("abcdefghij"), true, false);
+ test("abcde", S("abcdefghijklmnopqrst"), true, false);
+ test("abcdefghij", S(""), false, true);
+ test("abcdefghij", S("abcde"), false, true);
+ test("abcdefghij", S("abcdefghij"), false, false);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), true, false);
+ test("abcdefghijklmnopqrst", S(""), false, true);
+ test("abcdefghijklmnopqrst", S("abcde"), false, true);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), false, true);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false, false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (!(sv1 < ""), "" );
+ static_assert (!("" < sv1), "" );
+ static_assert ( sv1 < "abcde", "" );
+ static_assert (!("abcde" < sv1), "" );
+
+ static_assert (!(sv2 < ""), "" );
+ static_assert ( "" < sv2, "" );
+ static_assert (!(sv2 < "abcde"), "" );
+ static_assert (!("abcde" < sv2), "" );
+ static_assert ( sv2 < "abcde0", "" );
+ static_assert (!("abcde0" < sv2), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp
new file mode 100644
index 000000000000..609edd764cfe
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/oplt.string_view.string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator<(const basic_string<charT,traits,Allocator>& lhs,
+// basic_string_view<charT,traits> rhs);
+// bool operator<(basic_string_view<charT,traits> lhs,
+// const basic_string<charT,traits,Allocator>& rhs);
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& lhs, const typename S::value_type* rhs, bool x, bool y)
+{
+ assert((lhs < rhs) == x);
+ assert((rhs < lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", false, false);
+ test(S(""), "abcde", true, false);
+ test(S(""), "abcdefghij", true, false);
+ test(S(""), "abcdefghijklmnopqrst", true, false);
+ test(S("abcde"), "", false, true);
+ test(S("abcde"), "abcde", false, false);
+ test(S("abcde"), "abcdefghij", true, false);
+ test(S("abcde"), "abcdefghijklmnopqrst", true, false);
+ test(S("abcdefghij"), "", false, true);
+ test(S("abcdefghij"), "abcde", false, true);
+ test(S("abcdefghij"), "abcdefghij", false, false);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", true, false);
+ test(S("abcdefghijklmnopqrst"), "", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcde", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", false, true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false, false);
+ }
+}
diff --git a/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..9ae1927b44e1
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/oplt.string_view.string_view.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator<(basic_string_view<charT,traits> lhs,
+// basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& lhs, const S& rhs, bool x, bool y)
+{
+ assert((lhs < rhs) == x);
+ assert((rhs < lhs) == y);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), false, false);
+ test(S(""), S("abcde"), true, false);
+ test(S(""), S("abcdefghij"), true, false);
+ test(S(""), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcde"), S(""), false, true);
+ test(S("abcde"), S("abcde"), false, false);
+ test(S("abcde"), S("abcdefghij"), true, false);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcdefghij"), S(""), false, true);
+ test(S("abcdefghij"), S("abcde"), false, true);
+ test(S("abcdefghij"), S("abcdefghij"), false, false);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true, false);
+ test(S("abcdefghijklmnopqrst"), S(""), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), false, true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false, false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (!(sv1 < sv1), "" );
+ static_assert (!(sv2 < sv2), "" );
+
+ static_assert ( sv1 < sv2, "" );
+ static_assert (!(sv2 < sv1), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp b/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
new file mode 100644
index 000000000000..8a9c4dbfe782
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opne.string_view.pointer.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits>
+// constexpr bool operator!=(basic_string_view<charT,traits> lhs, const charT* rhs);
+// template<class charT, class traits>
+// constexpr bool operator!=(const charT* lhs, basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(S lhs, const typename S::value_type* rhs, bool x)
+{
+ assert((lhs != rhs) == x);
+ assert((rhs != lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), "", false);
+ test(S(""), "abcde", true);
+ test(S(""), "abcdefghij", true);
+ test(S(""), "abcdefghijklmnopqrst", true);
+ test(S("abcde"), "", true);
+ test(S("abcde"), "abcde", false);
+ test(S("abcde"), "abcdefghij", true);
+ test(S("abcde"), "abcdefghijklmnopqrst", true);
+ test(S("abcdefghij"), "", true);
+ test(S("abcdefghij"), "abcde", true);
+ test(S("abcdefghij"), "abcdefghij", false);
+ test(S("abcdefghij"), "abcdefghijklmnopqrst", true);
+ test(S("abcdefghijklmnopqrst"), "", true);
+ test(S("abcdefghijklmnopqrst"), "abcde", true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghij", true);
+ test(S("abcdefghijklmnopqrst"), "abcdefghijklmnopqrst", false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (!(sv1 != ""), "" );
+ static_assert (!("" != sv1), "" );
+ static_assert ( sv1 != "abcde", "" );
+ static_assert ( "abcde" != sv1, "" );
+
+ static_assert (!(sv2 != "abcde"), "" );
+ static_assert (!("abcde" != sv2), "" );
+ static_assert ( sv2 != "abcde0", "" );
+ static_assert ( "abcde0" != sv2, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp b/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp
new file mode 100644
index 000000000000..0c981e21d2aa
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opne.string_view.string.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// bool operator!=(const basic_string<charT, traits, Allocator> &lhs, basic_string_view<charT,traits> rhs);
+// template<class charT, class traits, class Allocator>
+// bool operator!=(basic_string_view<charT,traits> lhs, const basic_string<charT, traits, Allocator> &rhs);
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+template <class S>
+void
+test(const std::string &lhs, S rhs, bool x)
+{
+ assert((lhs != rhs) == x);
+ assert((rhs != lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test("", S(""), false);
+ test("", S("abcde"), true);
+ test("", S("abcdefghij"), true);
+ test("", S("abcdefghijklmnopqrst"), true);
+ test("abcde", S(""), true);
+ test("abcde", S("abcde"), false);
+ test("abcde", S("abcdefghij"), true);
+ test("abcde", S("abcdefghijklmnopqrst"), true);
+ test("abcdefghij", S(""), true);
+ test("abcdefghij", S("abcde"), true);
+ test("abcdefghij", S("abcdefghij"), false);
+ test("abcdefghij", S("abcdefghijklmnopqrst"), true);
+ test("abcdefghijklmnopqrst", S(""), true);
+ test("abcdefghijklmnopqrst", S("abcde"), true);
+ test("abcdefghijklmnopqrst", S("abcdefghij"), true);
+ test("abcdefghijklmnopqrst", S("abcdefghijklmnopqrst"), false);
+ }
+}
diff --git a/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp b/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
new file mode 100644
index 000000000000..63a3000f9360
--- /dev/null
+++ b/test/std/strings/string.view/string.view.comparison/opne.string_view.string_view.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// template<class charT, class traits, class Allocator>
+// constexpr bool operator!=(const basic_string_view<charT,traits> lhs,
+// const basic_string_view<charT,traits> rhs);
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(S lhs, S rhs, bool x)
+{
+ assert((lhs != rhs) == x);
+ assert((rhs != lhs) == x);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), S(""), false);
+ test(S(""), S("abcde"), true);
+ test(S(""), S("abcdefghij"), true);
+ test(S(""), S("abcdefghijklmnopqrst"), true);
+ test(S("abcde"), S(""), true);
+ test(S("abcde"), S("abcde"), false);
+ test(S("abcde"), S("abcdefghij"), true);
+ test(S("abcde"), S("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghij"), S(""), true);
+ test(S("abcdefghij"), S("abcde"), true);
+ test(S("abcdefghij"), S("abcdefghij"), false);
+ test(S("abcdefghij"), S("abcdefghijklmnopqrst"), true);
+ test(S("abcdefghijklmnopqrst"), S(""), true);
+ test(S("abcdefghijklmnopqrst"), S("abcde"), true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghij"), true);
+ test(S("abcdefghijklmnopqrst"), S("abcdefghijklmnopqrst"), false);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2;
+ constexpr SV sv3 { "abcde", 5 };
+ static_assert (!( sv1 != sv2), "" );
+ static_assert ( sv1 != sv3, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.cons/default.pass.cpp b/test/std/strings/string.view/string.view.cons/default.pass.cpp
new file mode 100644
index 000000000000..ca332801ead9
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr basic_string_view () noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename T>
+void test () {
+#if TEST_STD_VER > 11
+ {
+ constexpr T sv1;
+ static_assert ( sv1.size() == 0, "" );
+ static_assert ( sv1.empty(), "");
+ }
+#endif
+
+ {
+ T sv1;
+ assert ( sv1.size() == 0 );
+ assert ( sv1.empty());
+ }
+}
+
+int main () {
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test<string_view> ();
+ test<u16string_view> ();
+ test<u32string_view> ();
+ test<wstring_view> ();
+
+}
diff --git a/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp b/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
new file mode 100644
index 000000000000..6c9939340ce2
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/from_literal.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr basic_string_view(const _CharT* _s)
+// : __data (_s), __size(_Traits::length(_s)) {}
+
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template<typename CharT>
+size_t StrLen ( const CharT *s ) {
+ size_t retVal = 0;
+ while ( *s != 0 ) { ++retVal; ++s; }
+ return retVal;
+ }
+
+template<typename CharT>
+void test ( const CharT *s ) {
+ std::basic_string_view<CharT> sv1 ( s );
+ assert ( sv1.size() == StrLen( s ));
+ assert ( sv1.data() == s );
+ }
+
+
+int main () {
+
+ test ( "QBCDE" );
+ test ( "A" );
+ test ( "" );
+
+ test ( L"QBCDE" );
+ test ( L"A" );
+ test ( L"" );
+
+#if TEST_STD_VER >= 11
+ test ( u"QBCDE" );
+ test ( u"A" );
+ test ( u"" );
+
+ test ( U"QBCDE" );
+ test ( U"A" );
+ test ( U"" );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr std::basic_string_view<char, constexpr_char_traits<char>> sv1 ( "ABCDE" );
+ static_assert ( sv1.size() == 5, "");
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
new file mode 100644
index 000000000000..da4d264ae371
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/from_ptr_len.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// constexpr basic_string_view(const _CharT* _s, size_type _len)
+// : __data (_s), __size(_len) {}
+
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test ( const CharT *s, size_t sz ) {
+ {
+ std::basic_string_view<CharT> sv1 ( s, sz );
+ assert ( sv1.size() == sz );
+ assert ( sv1.data() == s );
+ }
+}
+
+int main () {
+
+ test ( "QBCDE", 5 );
+ test ( "QBCDE", 2 );
+ test ( "", 0 );
+#if TEST_STD_VER > 11
+ {
+ constexpr const char *s = "QBCDE";
+ constexpr std::basic_string_view<char> sv1 ( s, 2 );
+ static_assert ( sv1.size() == 2, "" );
+ static_assert ( sv1.data() == s, "" );
+ }
+#endif
+
+ test ( L"QBCDE", 5 );
+ test ( L"QBCDE", 2 );
+ test ( L"", 0 );
+#if TEST_STD_VER > 11
+ {
+ constexpr const wchar_t *s = L"QBCDE";
+ constexpr std::basic_string_view<wchar_t> sv1 ( s, 2 );
+ static_assert ( sv1.size() == 2, "" );
+ static_assert ( sv1.data() == s, "" );
+ }
+#endif
+
+#if TEST_STD_VER >= 11
+ test ( u"QBCDE", 5 );
+ test ( u"QBCDE", 2 );
+ test ( u"", 0 );
+#if TEST_STD_VER > 11
+ {
+ constexpr const char16_t *s = u"QBCDE";
+ constexpr std::basic_string_view<char16_t> sv1 ( s, 2 );
+ static_assert ( sv1.size() == 2, "" );
+ static_assert ( sv1.data() == s, "" );
+ }
+#endif
+
+ test ( U"QBCDE", 5 );
+ test ( U"QBCDE", 2 );
+ test ( U"", 0 );
+#if TEST_STD_VER > 11
+ {
+ constexpr const char32_t *s = U"QBCDE";
+ constexpr std::basic_string_view<char32_t> sv1 ( s, 2 );
+ static_assert ( sv1.size() == 2, "" );
+ static_assert ( sv1.data() == s, "" );
+ }
+#endif
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.cons/from_string.pass.cpp b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
new file mode 100644
index 000000000000..3ca6ea16f5b8
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// template<class Allocator>
+// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept
+
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct dummy_char_traits : public std::char_traits<char> {};
+
+template<typename CharT, typename Traits>
+void test ( const std::basic_string<CharT, Traits> &str ) {
+ std::basic_string_view<CharT, Traits> sv1 ( str );
+ assert ( sv1.size() == str.size());
+ assert ( sv1.data() == str.data());
+}
+
+int main () {
+
+ test ( std::string("QBCDE") );
+ test ( std::string("") );
+ test ( std::string() );
+
+ test ( std::wstring(L"QBCDE") );
+ test ( std::wstring(L"") );
+ test ( std::wstring() );
+
+#if TEST_STD_VER >= 11
+ test ( std::u16string{u"QBCDE"} );
+ test ( std::u16string{u""} );
+ test ( std::u16string{} );
+
+ test ( std::u32string{U"QBCDE"} );
+ test ( std::u32string{U""} );
+ test ( std::u32string{} );
+#endif
+
+ test ( std::basic_string<char, dummy_char_traits>("QBCDE") );
+ test ( std::basic_string<char, dummy_char_traits>("") );
+ test ( std::basic_string<char, dummy_char_traits>() );
+
+}
diff --git a/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp b/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp
new file mode 100644
index 000000000000..0f33dd87bca0
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/from_string1.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// template<class Allocator>
+// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+struct dummy_char_traits : public std::char_traits<char> {};
+
+int main () {
+ using string_view = std::basic_string_view<char>;
+ using string = std:: basic_string <char, dummy_char_traits>;
+
+ {
+ string s{"QBCDE"};
+ string_view sv1 ( s );
+ assert ( sv1.size() == s.size());
+ assert ( sv1.data() == s.data());
+ }
+} \ No newline at end of file
diff --git a/test/std/strings/string.view/string.view.cons/from_string2.fail.cpp b/test/std/strings/string.view/string.view.cons/from_string2.fail.cpp
new file mode 100644
index 000000000000..6c9ac6436ef3
--- /dev/null
+++ b/test/std/strings/string.view/string.view.cons/from_string2.fail.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// template<class Allocator>
+// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept
+
+#include <string_view>
+#include <string>
+#include <cassert>
+
+struct dummy_char_traits : public std::char_traits<char> {};
+
+int main () {
+ using string_view = std::basic_string_view<char, dummy_char_traits>;
+ using string = std:: basic_string <char>;
+
+ {
+ string s{"QBCDE"};
+ string_view sv1 ( s );
+ assert ( sv1.size() == s.size());
+ assert ( sv1.data() == s.data());
+ }
+}
diff --git a/test/std/strings/string.view/string.view.find/find_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_char_size.pass.cpp
new file mode 100644
index 000000000000..67a9133088ff
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_char_size.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find(charT c, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find(c, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x + 1 <= s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.find(c) == x);
+ if (x != S::npos)
+ assert(0 <= x && x + 1 <= s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'c', 0, S::npos);
+ test(S(""), 'c', 1, S::npos);
+ test(S("abcde"), 'c', 0, 2);
+ test(S("abcde"), 'c', 1, 2);
+ test(S("abcde"), 'c', 2, 2);
+ test(S("abcde"), 'c', 4, S::npos);
+ test(S("abcde"), 'c', 5, S::npos);
+ test(S("abcde"), 'c', 6, S::npos);
+ test(S("abcdeabcde"), 'c', 0, 2);
+ test(S("abcdeabcde"), 'c', 1, 2);
+ test(S("abcdeabcde"), 'c', 5, 7);
+ test(S("abcdeabcde"), 'c', 9, S::npos);
+ test(S("abcdeabcde"), 'c', 10, S::npos);
+ test(S("abcdeabcde"), 'c', 11, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos);
+
+ test(S(""), 'c', S::npos);
+ test(S("abcde"), 'c', 2);
+ test(S("abcdeabcde"), 'c', 2);
+ test(S("abcdeabcdeabcdeabcde"), 'c', 2);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find( 'c', 0 ) == SV::npos, "" );
+ static_assert (sv1.find( 'c', 1 ) == SV::npos, "" );
+ static_assert (sv2.find( 'c', 0 ) == 2, "" );
+ static_assert (sv2.find( 'c', 1 ) == 2, "" );
+ static_assert (sv2.find( 'c', 2 ) == 2, "" );
+ static_assert (sv2.find( 'c', 3 ) == SV::npos, "" );
+ static_assert (sv2.find( 'c', 4 ) == SV::npos, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
new file mode 100644
index 000000000000..77e1343cb00e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_not_of_char_size.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_first_not_of(charT c, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_first_not_of(c, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.find_first_not_of(c) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'q', 0, S::npos);
+ test(S(""), 'q', 1, S::npos);
+ test(S("kitcj"), 'q', 0, 0);
+ test(S("qkamf"), 'q', 1, 1);
+ test(S("nhmko"), 'q', 2, 2);
+ test(S("tpsaf"), 'q', 4, 4);
+ test(S("lahfb"), 'q', 5, S::npos);
+ test(S("irkhs"), 'q', 6, S::npos);
+ test(S("gmfhdaipsr"), 'q', 0, 0);
+ test(S("kantesmpgj"), 'q', 1, 1);
+ test(S("odaftiegpm"), 'q', 5, 5);
+ test(S("oknlrstdpi"), 'q', 9, 9);
+ test(S("eolhfgpjqk"), 'q', 10, S::npos);
+ test(S("pcdrofikas"), 'q', 11, S::npos);
+ test(S("nbatdlmekrgcfqsophij"), 'q', 0, 0);
+ test(S("bnrpehidofmqtcksjgla"), 'q', 1, 1);
+ test(S("jdmciepkaqgotsrfnhlb"), 'q', 10, 10);
+ test(S("jtdaefblsokrmhpgcnqi"), 'q', 19, 19);
+ test(S("hkbgspofltajcnedqmri"), 'q', 20, S::npos);
+ test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos);
+
+ test(S(""), 'q', S::npos);
+ test(S("q"), 'q', S::npos);
+ test(S("qqq"), 'q', S::npos);
+ test(S("csope"), 'q', 0);
+ test(S("gfsmthlkon"), 'q', 0);
+ test(S("laenfsbridchgotmkqpj"), 'q', 0);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_not_of( 'q', 0 ) == SV::npos, "" );
+ static_assert (sv1.find_first_not_of( 'q', 1 ) == SV::npos, "" );
+ static_assert (sv2.find_first_not_of( 'q', 0 ) == 0, "" );
+ static_assert (sv2.find_first_not_of( 'q', 1 ) == 1, "" );
+ static_assert (sv2.find_first_not_of( 'q', 5 ) == SV::npos, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
new file mode 100644
index 000000000000..a15ac1ef2ba9
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_first_not_of(str, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.find_first_not_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, S::npos);
+ test(S(""), "laenf", 0, S::npos);
+ test(S(""), "pqlnkmbdjo", 0, S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", 0, S::npos);
+ test(S(""), "", 1, S::npos);
+ test(S(""), "bjaht", 1, S::npos);
+ test(S(""), "hjlcmgpket", 1, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos);
+ test(S("fodgq"), "", 0, 0);
+ test(S("qanej"), "dfkap", 0, 0);
+ test(S("clbao"), "ihqrfebgad", 0, 0);
+ test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, S::npos);
+ test(S("srdfq"), "", 1, 1);
+ test(S("oemth"), "ikcrq", 1, 1);
+ test(S("cdaih"), "dmajblfhsg", 1, 3);
+ test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, S::npos);
+ test(S("cshmd"), "", 2, 2);
+ test(S("lhcdo"), "oebqi", 2, 2);
+ test(S("qnsoh"), "kojhpmbsfe", 2, S::npos);
+ test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, S::npos);
+ test(S("fmtsp"), "", 4, 4);
+ test(S("khbpm"), "aobjd", 4, 4);
+ test(S("pbsji"), "pcbahntsje", 4, 4);
+ test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, S::npos);
+ test(S("eqmpa"), "", 5, S::npos);
+ test(S("omigs"), "kocgb", 5, S::npos);
+ test(S("onmje"), "fbslrjiqkm", 5, S::npos);
+ test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos);
+ test(S("schfa"), "", 6, S::npos);
+ test(S("igdsc"), "qngpd", 6, S::npos);
+ test(S("brqgo"), "rodhqklgmb", 6, S::npos);
+ test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos);
+ test(S("hcjitbfapl"), "", 0, 0);
+ test(S("daiprenocl"), "ashjd", 0, 2);
+ test(S("litpcfdghe"), "mgojkldsqh", 0, 1);
+ test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, S::npos);
+ test(S("qpghtfbaji"), "", 1, 1);
+ test(S("gfshlcmdjr"), "nadkh", 1, 1);
+ test(S("nkodajteqp"), "ofdrqmkebl", 1, 4);
+ test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, S::npos);
+ test(S("crnklpmegd"), "", 5, 5);
+ test(S("jsbtafedoc"), "prqgn", 5, 5);
+ test(S("qnmodrtkeb"), "pejafmnokr", 5, 6);
+ test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, S::npos);
+ test(S("lmofqdhpki"), "", 9, 9);
+ test(S("hnefkqimca"), "rtjpa", 9, S::npos);
+ test(S("drtasbgmfp"), "ktsrmnqagd", 9, 9);
+ test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, S::npos);
+ test(S("elgofjmbrq"), "", 10, S::npos);
+ test(S("mjqdgalkpc"), "dplqa", 10, S::npos);
+ test(S("kthqnfcerm"), "dkacjoptns", 10, S::npos);
+ test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos);
+ test(S("eqsgalomhb"), "", 11, S::npos);
+ test(S("akiteljmoh"), "lofbc", 11, S::npos);
+ test(S("hlbdfreqjo"), "astoegbfpn", 11, S::npos);
+ test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), "", 0, 0);
+ test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 0);
+ test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 1);
+ test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, S::npos);
+ test(S("jlnkraeodhcspfgbqitm"), "", 1, 1);
+ test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 1);
+ test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 3);
+ test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, S::npos);
+ test(S("hdpkobnsalmcfijregtq"), "", 10, 10);
+ test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 11);
+ test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 13);
+ test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, S::npos);
+ test(S("niptglfbosehkamrdqcj"), "", 19, 19);
+ test(S("copqdhstbingamjfkler"), "djkqc", 19, 19);
+ test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, S::npos);
+ test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, S::npos);
+ test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, S::npos);
+ test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, S::npos);
+ test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, S::npos);
+ test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, S::npos);
+ test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", S::npos);
+ test(S(""), "laenf", S::npos);
+ test(S(""), "pqlnkmbdjo", S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", S::npos);
+ test(S("nhmko"), "", 0);
+ test(S("lahfb"), "irkhs", 0);
+ test(S("gmfhd"), "kantesmpgj", 2);
+ test(S("odaft"), "oknlrstdpiqmjbaghcfe", S::npos);
+ test(S("eolhfgpjqk"), "", 0);
+ test(S("nbatdlmekr"), "bnrpe", 2);
+ test(S("jdmciepkaq"), "jtdaefblso", 2);
+ test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", S::npos);
+ test(S("gprdcokbnjhlsfmtieqa"), "", 0);
+ test(S("qjghlnftcaismkropdeb"), "bjaht", 0);
+ test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 1);
+ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_not_of( "", 0) == SV::npos, "" );
+ static_assert (sv1.find_first_not_of( "irkhs", 0) == SV::npos, "" );
+ static_assert (sv2.find_first_not_of( "", 0) == 0, "" );
+ static_assert (sv2.find_first_not_of( "gfsrt", 0) == 0, "" );
+ static_assert (sv2.find_first_not_of( "lecar", 0) == 1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..5587a0334783
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_not_of_pointer_size_size.pass.cpp
@@ -0,0 +1,393 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.find_first_not_of(str, pos, n) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, S::npos);
+ test(S(""), "irkhs", 0, 0, S::npos);
+ test(S(""), "kante", 0, 1, S::npos);
+ test(S(""), "oknlr", 0, 2, S::npos);
+ test(S(""), "pcdro", 0, 4, S::npos);
+ test(S(""), "bnrpe", 0, 5, S::npos);
+ test(S(""), "jtdaefblso", 0, 0, S::npos);
+ test(S(""), "oselktgbca", 0, 1, S::npos);
+ test(S(""), "eqgaplhckj", 0, 5, S::npos);
+ test(S(""), "bjahtcmnlp", 0, 9, S::npos);
+ test(S(""), "hjlcmgpket", 0, 10, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos);
+ test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos);
+ test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos);
+ test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos);
+ test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos);
+ test(S(""), "", 1, 0, S::npos);
+ test(S(""), "lbtqd", 1, 0, S::npos);
+ test(S(""), "tboim", 1, 1, S::npos);
+ test(S(""), "slcer", 1, 2, S::npos);
+ test(S(""), "cbjfs", 1, 4, S::npos);
+ test(S(""), "aqibs", 1, 5, S::npos);
+ test(S(""), "gtfblmqinc", 1, 0, S::npos);
+ test(S(""), "mkqpbtdalg", 1, 1, S::npos);
+ test(S(""), "kphatlimcd", 1, 5, S::npos);
+ test(S(""), "pblasqogic", 1, 9, S::npos);
+ test(S(""), "arosdhcfme", 1, 10, S::npos);
+ test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos);
+ test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos);
+ test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos);
+ test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos);
+ test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos);
+ test(S("eaint"), "", 0, 0, 0);
+ test(S("binja"), "gfsrt", 0, 0, 0);
+ test(S("latkm"), "pfsoc", 0, 1, 0);
+ test(S("lecfr"), "tpflm", 0, 2, 0);
+ test(S("eqkst"), "sgkec", 0, 4, 1);
+ test(S("cdafr"), "romds", 0, 5, 0);
+ test(S("prbhe"), "qhjistlgmr", 0, 0, 0);
+ test(S("lbisk"), "pedfirsglo", 0, 1, 0);
+ test(S("hrlpd"), "aqcoslgrmk", 0, 5, 0);
+ test(S("ehmja"), "dabckmepqj", 0, 9, 1);
+ test(S("mhqgd"), "pqscrjthli", 0, 10, 0);
+ test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, 0);
+ test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, 0);
+ test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, 0);
+ test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, S::npos);
+ test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, S::npos);
+ test(S("clrgb"), "", 1, 0, 1);
+ test(S("tjmek"), "osmia", 1, 0, 1);
+ test(S("bgstp"), "ckonl", 1, 1, 1);
+ test(S("hstrk"), "ilcaj", 1, 2, 1);
+ test(S("kmspj"), "lasiq", 1, 4, 1);
+ test(S("tjboh"), "kfqmr", 1, 5, 1);
+ test(S("ilbcj"), "klnitfaobg", 1, 0, 1);
+ test(S("jkngf"), "gjhmdlqikp", 1, 1, 1);
+ test(S("gfcql"), "skbgtahqej", 1, 5, 1);
+ test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 1);
+ test(S("bthpg"), "bjgfmnlkio", 1, 10, 1);
+ test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, 1);
+ test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, 1);
+ test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 3);
+ test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, S::npos);
+ test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, S::npos);
+ test(S("ndrhl"), "", 2, 0, 2);
+ test(S("mrecp"), "otkgb", 2, 0, 2);
+ test(S("qlasf"), "cqsjl", 2, 1, 2);
+ test(S("smaqd"), "dpifl", 2, 2, 2);
+ test(S("hjeni"), "oapht", 2, 4, 2);
+ test(S("ocmfj"), "cifts", 2, 5, 2);
+ test(S("hmftq"), "nmsckbgalo", 2, 0, 2);
+ test(S("fklad"), "tpksqhamle", 2, 1, 2);
+ test(S("dirnm"), "tpdrchmkji", 2, 5, 3);
+ test(S("hrgdc"), "ijagfkblst", 2, 9, 3);
+ test(S("ifakg"), "kpocsignjb", 2, 10, 2);
+ test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, 2);
+ test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, 2);
+ test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 2);
+ test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, S::npos);
+ test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, S::npos);
+ test(S("cjgao"), "", 4, 0, 4);
+ test(S("kjplq"), "mabns", 4, 0, 4);
+ test(S("herni"), "bdnrp", 4, 1, 4);
+ test(S("tadrb"), "scidp", 4, 2, 4);
+ test(S("pkfeo"), "agbjl", 4, 4, 4);
+ test(S("hoser"), "jfmpr", 4, 5, S::npos);
+ test(S("kgrsp"), "rbpefghsmj", 4, 0, 4);
+ test(S("pgejb"), "apsfntdoqc", 4, 1, 4);
+ test(S("thlnq"), "ndkjeisgcl", 4, 5, 4);
+ test(S("nbmit"), "rnfpqatdeo", 4, 9, S::npos);
+ test(S("jgmib"), "bntjlqrfik", 4, 10, S::npos);
+ test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, 4);
+ test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, 4);
+ test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, S::npos);
+ test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, S::npos);
+ test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, S::npos);
+ test(S("klopi"), "", 5, 0, S::npos);
+ test(S("dajhn"), "psthd", 5, 0, S::npos);
+ test(S("jbgno"), "rpmjd", 5, 1, S::npos);
+ test(S("hkjae"), "dfsmk", 5, 2, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S("gbhqo"), "skqne", 5, 4, S::npos);
+ test(S("ktdor"), "kipnf", 5, 5, S::npos);
+ test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos);
+ test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos);
+ test(S("armql"), "pcdgltbrfj", 5, 5, S::npos);
+ test(S("cdhjo"), "aekfctpirg", 5, 9, S::npos);
+ test(S("jcons"), "ledihrsgpf", 5, 10, S::npos);
+ test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos);
+ test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos);
+ test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, S::npos);
+ test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, S::npos);
+ test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos);
+ test(S("gajqn"), "", 6, 0, S::npos);
+ test(S("stedk"), "hrnat", 6, 0, S::npos);
+ test(S("tjkaf"), "gsqdt", 6, 1, S::npos);
+ test(S("dthpe"), "bspkd", 6, 2, S::npos);
+ test(S("klhde"), "ohcmb", 6, 4, S::npos);
+ test(S("bhlki"), "heatr", 6, 5, S::npos);
+ test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos);
+ test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos);
+ test(S("dpqbr"), "lmbtdehjrn", 6, 5, S::npos);
+ test(S("kdhmo"), "teqmcrlgib", 6, 9, S::npos);
+ test(S("jblqp"), "njolbmspac", 6, 10, S::npos);
+ test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos);
+ test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos);
+ test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, S::npos);
+ test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos);
+ test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos);
+ test(S("jnkrfhotgl"), "", 0, 0, 0);
+ test(S("dltjfngbko"), "rqegt", 0, 0, 0);
+ test(S("bmjlpkiqde"), "dashm", 0, 1, 0);
+ test(S("skrflobnqm"), "jqirk", 0, 2, 0);
+ test(S("jkpldtshrm"), "rckeg", 0, 4, 0);
+ test(S("ghasdbnjqo"), "jscie", 0, 5, 0);
+ test(S("igrkhpbqjt"), "efsphndliq", 0, 0, 0);
+ test(S("ikthdgcamf"), "gdicosleja", 0, 1, 0);
+ test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 2);
+ test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 4);
+ test(S("itphbqsker"), "dtablcrseo", 0, 10, 0);
+ test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, 0);
+ test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, 0);
+ test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 0);
+ test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 1);
+ test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, S::npos);
+ test(S("shbcqnmoar"), "", 1, 0, 1);
+ test(S("bdoshlmfin"), "ontrs", 1, 0, 1);
+ test(S("khfrebnsgq"), "pfkna", 1, 1, 1);
+ test(S("getcrsaoji"), "ekosa", 1, 2, 2);
+ test(S("fjiknedcpq"), "anqhk", 1, 4, 1);
+ test(S("tkejgnafrm"), "jekca", 1, 5, 4);
+ test(S("jnakolqrde"), "ikemsjgacf", 1, 0, 1);
+ test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, 1);
+ test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 3);
+ test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 1);
+ test(S("cigfqkated"), "sqcflrgtim", 1, 10, 5);
+ test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, 1);
+ test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, 1);
+ test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 5);
+ test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 5);
+ test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, S::npos);
+ test(S("ectnhskflp"), "", 5, 0, 5);
+ test(S("fgtianblpq"), "pijag", 5, 0, 5);
+ test(S("mfeqklirnh"), "jrckd", 5, 1, 5);
+ test(S("astedncjhk"), "qcloh", 5, 2, 5);
+ test(S("fhlqgcajbr"), "thlmp", 5, 4, 5);
+ test(S("epfhocmdng"), "qidmo", 5, 5, 5);
+ test(S("apcnsibger"), "lnegpsjqrd", 5, 0, 5);
+ test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 6);
+ test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 5);
+ test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 6);
+ test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 5);
+ test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, 5);
+ test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, 5);
+ test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 6);
+ test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 8);
+ test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, S::npos);
+ test(S("shoiedtcjb"), "", 9, 0, 9);
+ test(S("ebcinjgads"), "tqbnh", 9, 0, 9);
+ test(S("dqmregkcfl"), "akmle", 9, 1, 9);
+ test(S("ngcrieqajf"), "iqfkm", 9, 2, 9);
+ test(S("qosmilgnjb"), "tqjsr", 9, 4, 9);
+ test(S("ikabsjtdfl"), "jplqg", 9, 5, S::npos);
+ test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, 9);
+ test(S("fdnplotmgh"), "morkglpesn", 9, 1, 9);
+ test(S("fdbicojerm"), "dmicerngat", 9, 5, S::npos);
+ test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 9);
+ test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 9);
+ test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, 9);
+ test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 9);
+ test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 9);
+ test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, S::npos);
+ test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, S::npos);
+ test(S("ncjpmaekbs"), "", 10, 0, S::npos);
+ test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos);
+ test(S("pqfhsgilen"), "qnpor", 10, 1, S::npos);
+ test(S("gqtjsbdckh"), "otdma", 10, 2, S::npos);
+ test(S("cfkqpjlegi"), "efhjg", 10, 4, S::npos);
+ test(S("beanrfodgj"), "odpte", 10, 5, S::npos);
+ test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos);
+ test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos);
+}
+
+template <class S>
+void test2()
+{
+ test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos);
+ test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos);
+ test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, S::npos);
+ test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos);
+ test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, S::npos);
+ test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, S::npos);
+ test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, S::npos);
+ test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos);
+ test(S("cqjohampgd"), "", 11, 0, S::npos);
+ test(S("hobitmpsan"), "aocjb", 11, 0, S::npos);
+ test(S("tjehkpsalm"), "jbrnk", 11, 1, S::npos);
+ test(S("ngfbojitcl"), "tqedg", 11, 2, S::npos);
+ test(S("rcfkdbhgjo"), "nqskp", 11, 4, S::npos);
+ test(S("qghptonrea"), "eaqkl", 11, 5, S::npos);
+ test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos);
+ test(S("hlmgabenti"), "lsftgajqpm", 11, 1, S::npos);
+ test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, S::npos);
+ test(S("jqedtkornm"), "shkncmiaqj", 11, 9, S::npos);
+ test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, S::npos);
+ test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos);
+ test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos);
+ test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, S::npos);
+ test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos);
+ test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos);
+ test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, 0);
+ test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, 0);
+ test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 0);
+ test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 0);
+ test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 0);
+ test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 0);
+ test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, 0);
+ test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 0);
+ test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 0);
+ test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 0);
+ test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 0);
+ test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, 0);
+ test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 0);
+ test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 0);
+ test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 11);
+ test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, S::npos);
+ test(S("febhmqtjanokscdirpgl"), "", 1, 0, 1);
+ test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, 1);
+ test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 1);
+ test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 2);
+ test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 2);
+ test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 1);
+ test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, 1);
+ test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 1);
+ test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 1);
+ test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 3);
+ test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 2);
+ test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, 1);
+ test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 1);
+ test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 2);
+ test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 13);
+ test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, S::npos);
+ test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, 10);
+ test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, 10);
+ test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 10);
+ test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 10);
+ test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 11);
+ test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 10);
+ test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, 10);
+ test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 10);
+ test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 10);
+ test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 11);
+ test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 10);
+ test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, 10);
+ test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 10);
+ test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 11);
+ test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 11);
+ test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, S::npos);
+ test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, 19);
+ test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, 19);
+ test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 19);
+ test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 19);
+ test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 19);
+ test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, S::npos);
+ test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, 19);
+ test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 19);
+ test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 19);
+ test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 19);
+ test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 19);
+ test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, 19);
+ test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 19);
+ test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, S::npos);
+ test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, S::npos);
+ test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, S::npos);
+ test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos);
+ test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos);
+ test(S("grkpahljcftesdmonqib"), "odife", 20, 1, S::npos);
+ test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, S::npos);
+ test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, S::npos);
+ test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, S::npos);
+ test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos);
+ test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, S::npos);
+ test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, S::npos);
+ test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, S::npos);
+ test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, S::npos);
+ test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos);
+}
+
+template <class S>
+void test3()
+{
+ test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos);
+ test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos);
+ test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, S::npos);
+ test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos);
+ test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos);
+ test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos);
+ test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, S::npos);
+ test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, S::npos);
+ test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, S::npos);
+ test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, S::npos);
+ test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos);
+ test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, S::npos);
+ test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, S::npos);
+ test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, S::npos);
+ test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, S::npos);
+ test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos);
+ test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, S::npos);
+ test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, S::npos);
+ test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, S::npos);
+ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_not_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv1.find_first_not_of( "irkhs", 0, 5) == SV::npos, "" );
+ static_assert (sv2.find_first_not_of( "", 0, 0) == 0, "" );
+ static_assert (sv2.find_first_not_of( "gfsrt", 0, 5) == 0, "" );
+ static_assert (sv2.find_first_not_of( "lecar", 0, 5) == 1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp
new file mode 100644
index 000000000000..a52c577660de
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_not_of_string_view_size.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.find_first_not_of(str, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.find_first_not_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, S::npos);
+ test(S(""), S("laenf"), 0, S::npos);
+ test(S(""), S("pqlnkmbdjo"), 0, S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos);
+ test(S(""), S(""), 1, S::npos);
+ test(S(""), S("bjaht"), 1, S::npos);
+ test(S(""), S("hjlcmgpket"), 1, S::npos);
+ test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos);
+ test(S("fodgq"), S(""), 0, 0);
+ test(S("qanej"), S("dfkap"), 0, 0);
+ test(S("clbao"), S("ihqrfebgad"), 0, 0);
+ test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, S::npos);
+ test(S("srdfq"), S(""), 1, 1);
+ test(S("oemth"), S("ikcrq"), 1, 1);
+ test(S("cdaih"), S("dmajblfhsg"), 1, 3);
+ test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, S::npos);
+ test(S("cshmd"), S(""), 2, 2);
+ test(S("lhcdo"), S("oebqi"), 2, 2);
+ test(S("qnsoh"), S("kojhpmbsfe"), 2, S::npos);
+ test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, S::npos);
+ test(S("fmtsp"), S(""), 4, 4);
+ test(S("khbpm"), S("aobjd"), 4, 4);
+ test(S("pbsji"), S("pcbahntsje"), 4, 4);
+ test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, S::npos);
+ test(S("eqmpa"), S(""), 5, S::npos);
+ test(S("omigs"), S("kocgb"), 5, S::npos);
+ test(S("onmje"), S("fbslrjiqkm"), 5, S::npos);
+ test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos);
+ test(S("schfa"), S(""), 6, S::npos);
+ test(S("igdsc"), S("qngpd"), 6, S::npos);
+ test(S("brqgo"), S("rodhqklgmb"), 6, S::npos);
+ test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos);
+ test(S("hcjitbfapl"), S(""), 0, 0);
+ test(S("daiprenocl"), S("ashjd"), 0, 2);
+ test(S("litpcfdghe"), S("mgojkldsqh"), 0, 1);
+ test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, S::npos);
+ test(S("qpghtfbaji"), S(""), 1, 1);
+ test(S("gfshlcmdjr"), S("nadkh"), 1, 1);
+ test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 4);
+ test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, S::npos);
+ test(S("crnklpmegd"), S(""), 5, 5);
+ test(S("jsbtafedoc"), S("prqgn"), 5, 5);
+ test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 6);
+ test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, S::npos);
+ test(S("lmofqdhpki"), S(""), 9, 9);
+ test(S("hnefkqimca"), S("rtjpa"), 9, S::npos);
+ test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 9);
+ test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, S::npos);
+ test(S("elgofjmbrq"), S(""), 10, S::npos);
+ test(S("mjqdgalkpc"), S("dplqa"), 10, S::npos);
+ test(S("kthqnfcerm"), S("dkacjoptns"), 10, S::npos);
+ test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos);
+ test(S("eqsgalomhb"), S(""), 11, S::npos);
+ test(S("akiteljmoh"), S("lofbc"), 11, S::npos);
+ test(S("hlbdfreqjo"), S("astoegbfpn"), 11, S::npos);
+ test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), S(""), 0, 0);
+ test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 0);
+ test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 1);
+ test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, S::npos);
+ test(S("jlnkraeodhcspfgbqitm"), S(""), 1, 1);
+ test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 1);
+ test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 3);
+ test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, S::npos);
+ test(S("hdpkobnsalmcfijregtq"), S(""), 10, 10);
+ test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 11);
+ test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 13);
+ test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, S::npos);
+ test(S("niptglfbosehkamrdqcj"), S(""), 19, 19);
+ test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 19);
+ test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, S::npos);
+ test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, S::npos);
+ test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, S::npos);
+ test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, S::npos);
+ test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, S::npos);
+ test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, S::npos);
+ test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), S::npos);
+ test(S(""), S("laenf"), S::npos);
+ test(S(""), S("pqlnkmbdjo"), S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), S::npos);
+ test(S("nhmko"), S(""), 0);
+ test(S("lahfb"), S("irkhs"), 0);
+ test(S("gmfhd"), S("kantesmpgj"), 2);
+ test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), S::npos);
+ test(S("eolhfgpjqk"), S(""), 0);
+ test(S("nbatdlmekr"), S("bnrpe"), 2);
+ test(S("jdmciepkaq"), S("jtdaefblso"), 2);
+ test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), S::npos);
+ test(S("gprdcokbnjhlsfmtieqa"), S(""), 0);
+ test(S("qjghlnftcaismkropdeb"), S("bjaht"), 0);
+ test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 1);
+ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp
new file mode 100644
index 000000000000..21722ecc75d7
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_of_char_size.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr size_type find_first_of(charT c, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_first_of(c, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.find_first_of(c) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'e', 0, S::npos);
+ test(S(""), 'e', 1, S::npos);
+ test(S("kitcj"), 'e', 0, S::npos);
+ test(S("qkamf"), 'e', 1, S::npos);
+ test(S("nhmko"), 'e', 2, S::npos);
+ test(S("tpsaf"), 'e', 4, S::npos);
+ test(S("lahfb"), 'e', 5, S::npos);
+ test(S("irkhs"), 'e', 6, S::npos);
+ test(S("gmfhdaipsr"), 'e', 0, S::npos);
+ test(S("kantesmpgj"), 'e', 1, 4);
+ test(S("odaftiegpm"), 'e', 5, 6);
+ test(S("oknlrstdpi"), 'e', 9, S::npos);
+ test(S("eolhfgpjqk"), 'e', 10, S::npos);
+ test(S("pcdrofikas"), 'e', 11, S::npos);
+ test(S("nbatdlmekrgcfqsophij"), 'e', 0, 7);
+ test(S("bnrpehidofmqtcksjgla"), 'e', 1, 4);
+ test(S("jdmciepkaqgotsrfnhlb"), 'e', 10, S::npos);
+ test(S("jtdaefblsokrmhpgcnqi"), 'e', 19, S::npos);
+ test(S("hkbgspofltajcnedqmri"), 'e', 20, S::npos);
+ test(S("oselktgbcapndfjihrmq"), 'e', 21, S::npos);
+
+ test(S(""), 'e', S::npos);
+ test(S("csope"), 'e', 4);
+ test(S("gfsmthlkon"), 'e', S::npos);
+ test(S("laenfsbridchgotmkqpj"), 'e', 2);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_of( 'e', 0 ) == SV::npos, "" );
+ static_assert (sv1.find_first_of( 'e', 1 ) == SV::npos, "" );
+ static_assert (sv2.find_first_of( 'q', 0 ) == SV::npos, "" );
+ static_assert (sv2.find_first_of( 'e', 1 ) == 4, "" );
+ static_assert (sv2.find_first_of( 'e', 5 ) == SV::npos, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
new file mode 100644
index 000000000000..55e71c4f5832
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_of_pointer_size.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_first_of(str, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.find_first_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, S::npos);
+ test(S(""), "laenf", 0, S::npos);
+ test(S(""), "pqlnkmbdjo", 0, S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", 0, S::npos);
+ test(S(""), "", 1, S::npos);
+ test(S(""), "bjaht", 1, S::npos);
+ test(S(""), "hjlcmgpket", 1, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos);
+ test(S("fodgq"), "", 0, S::npos);
+ test(S("qanej"), "dfkap", 0, 1);
+ test(S("clbao"), "ihqrfebgad", 0, 2);
+ test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, 0);
+ test(S("srdfq"), "", 1, S::npos);
+ test(S("oemth"), "ikcrq", 1, S::npos);
+ test(S("cdaih"), "dmajblfhsg", 1, 1);
+ test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, 1);
+ test(S("cshmd"), "", 2, S::npos);
+ test(S("lhcdo"), "oebqi", 2, 4);
+ test(S("qnsoh"), "kojhpmbsfe", 2, 2);
+ test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, 2);
+ test(S("fmtsp"), "", 4, S::npos);
+ test(S("khbpm"), "aobjd", 4, S::npos);
+ test(S("pbsji"), "pcbahntsje", 4, S::npos);
+ test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, 4);
+ test(S("eqmpa"), "", 5, S::npos);
+ test(S("omigs"), "kocgb", 5, S::npos);
+ test(S("onmje"), "fbslrjiqkm", 5, S::npos);
+ test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos);
+ test(S("schfa"), "", 6, S::npos);
+ test(S("igdsc"), "qngpd", 6, S::npos);
+ test(S("brqgo"), "rodhqklgmb", 6, S::npos);
+ test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos);
+ test(S("hcjitbfapl"), "", 0, S::npos);
+ test(S("daiprenocl"), "ashjd", 0, 0);
+ test(S("litpcfdghe"), "mgojkldsqh", 0, 0);
+ test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, 0);
+ test(S("qpghtfbaji"), "", 1, S::npos);
+ test(S("gfshlcmdjr"), "nadkh", 1, 3);
+ test(S("nkodajteqp"), "ofdrqmkebl", 1, 1);
+ test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, 1);
+ test(S("crnklpmegd"), "", 5, S::npos);
+ test(S("jsbtafedoc"), "prqgn", 5, S::npos);
+ test(S("qnmodrtkeb"), "pejafmnokr", 5, 5);
+ test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, 5);
+ test(S("lmofqdhpki"), "", 9, S::npos);
+ test(S("hnefkqimca"), "rtjpa", 9, 9);
+ test(S("drtasbgmfp"), "ktsrmnqagd", 9, S::npos);
+ test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, 9);
+ test(S("elgofjmbrq"), "", 10, S::npos);
+ test(S("mjqdgalkpc"), "dplqa", 10, S::npos);
+ test(S("kthqnfcerm"), "dkacjoptns", 10, S::npos);
+ test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos);
+ test(S("eqsgalomhb"), "", 11, S::npos);
+ test(S("akiteljmoh"), "lofbc", 11, S::npos);
+ test(S("hlbdfreqjo"), "astoegbfpn", 11, S::npos);
+ test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), "", 0, S::npos);
+ test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 3);
+ test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 0);
+ test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, 0);
+ test(S("jlnkraeodhcspfgbqitm"), "", 1, S::npos);
+ test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 3);
+ test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 1);
+ test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, 1);
+ test(S("hdpkobnsalmcfijregtq"), "", 10, S::npos);
+ test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 10);
+ test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 10);
+ test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, 10);
+ test(S("niptglfbosehkamrdqcj"), "", 19, S::npos);
+ test(S("copqdhstbingamjfkler"), "djkqc", 19, S::npos);
+ test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 19);
+ test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, 19);
+ test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, S::npos);
+ test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, S::npos);
+ test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, S::npos);
+ test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, S::npos);
+ test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", S::npos);
+ test(S(""), "laenf", S::npos);
+ test(S(""), "pqlnkmbdjo", S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", S::npos);
+ test(S("nhmko"), "", S::npos);
+ test(S("lahfb"), "irkhs", 2);
+ test(S("gmfhd"), "kantesmpgj", 0);
+ test(S("odaft"), "oknlrstdpiqmjbaghcfe", 0);
+ test(S("eolhfgpjqk"), "", S::npos);
+ test(S("nbatdlmekr"), "bnrpe", 0);
+ test(S("jdmciepkaq"), "jtdaefblso", 0);
+ test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", 0);
+ test(S("gprdcokbnjhlsfmtieqa"), "", S::npos);
+ test(S("qjghlnftcaismkropdeb"), "bjaht", 1);
+ test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 0);
+ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_of( "", 0) == SV::npos, "" );
+ static_assert (sv1.find_first_of( "irkhs", 0) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "", 0) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "gfsrt", 0) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "lecar", 0) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..fa9917c6e33a
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_of_pointer_size_size.pass.cpp
@@ -0,0 +1,393 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.find_first_of(str, pos, n) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, S::npos);
+ test(S(""), "irkhs", 0, 0, S::npos);
+ test(S(""), "kante", 0, 1, S::npos);
+ test(S(""), "oknlr", 0, 2, S::npos);
+ test(S(""), "pcdro", 0, 4, S::npos);
+ test(S(""), "bnrpe", 0, 5, S::npos);
+ test(S(""), "jtdaefblso", 0, 0, S::npos);
+ test(S(""), "oselktgbca", 0, 1, S::npos);
+ test(S(""), "eqgaplhckj", 0, 5, S::npos);
+ test(S(""), "bjahtcmnlp", 0, 9, S::npos);
+ test(S(""), "hjlcmgpket", 0, 10, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos);
+ test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos);
+ test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos);
+ test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos);
+ test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos);
+ test(S(""), "", 1, 0, S::npos);
+ test(S(""), "lbtqd", 1, 0, S::npos);
+ test(S(""), "tboim", 1, 1, S::npos);
+ test(S(""), "slcer", 1, 2, S::npos);
+ test(S(""), "cbjfs", 1, 4, S::npos);
+ test(S(""), "aqibs", 1, 5, S::npos);
+ test(S(""), "gtfblmqinc", 1, 0, S::npos);
+ test(S(""), "mkqpbtdalg", 1, 1, S::npos);
+ test(S(""), "kphatlimcd", 1, 5, S::npos);
+ test(S(""), "pblasqogic", 1, 9, S::npos);
+ test(S(""), "arosdhcfme", 1, 10, S::npos);
+ test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos);
+ test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos);
+ test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos);
+ test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos);
+ test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos);
+ test(S("eaint"), "", 0, 0, S::npos);
+ test(S("binja"), "gfsrt", 0, 0, S::npos);
+ test(S("latkm"), "pfsoc", 0, 1, S::npos);
+ test(S("lecfr"), "tpflm", 0, 2, S::npos);
+ test(S("eqkst"), "sgkec", 0, 4, 0);
+ test(S("cdafr"), "romds", 0, 5, 1);
+ test(S("prbhe"), "qhjistlgmr", 0, 0, S::npos);
+ test(S("lbisk"), "pedfirsglo", 0, 1, S::npos);
+ test(S("hrlpd"), "aqcoslgrmk", 0, 5, S::npos);
+ test(S("ehmja"), "dabckmepqj", 0, 9, 0);
+ test(S("mhqgd"), "pqscrjthli", 0, 10, 1);
+ test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, S::npos);
+ test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, S::npos);
+ test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, S::npos);
+ test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, 0);
+ test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, 0);
+ test(S("clrgb"), "", 1, 0, S::npos);
+ test(S("tjmek"), "osmia", 1, 0, S::npos);
+ test(S("bgstp"), "ckonl", 1, 1, S::npos);
+ test(S("hstrk"), "ilcaj", 1, 2, S::npos);
+ test(S("kmspj"), "lasiq", 1, 4, 2);
+ test(S("tjboh"), "kfqmr", 1, 5, S::npos);
+ test(S("ilbcj"), "klnitfaobg", 1, 0, S::npos);
+ test(S("jkngf"), "gjhmdlqikp", 1, 1, 3);
+ test(S("gfcql"), "skbgtahqej", 1, 5, S::npos);
+ test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 2);
+ test(S("bthpg"), "bjgfmnlkio", 1, 10, 4);
+ test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, S::npos);
+ test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, S::npos);
+ test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 1);
+ test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, 1);
+ test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, 1);
+ test(S("ndrhl"), "", 2, 0, S::npos);
+ test(S("mrecp"), "otkgb", 2, 0, S::npos);
+ test(S("qlasf"), "cqsjl", 2, 1, S::npos);
+ test(S("smaqd"), "dpifl", 2, 2, 4);
+ test(S("hjeni"), "oapht", 2, 4, S::npos);
+ test(S("ocmfj"), "cifts", 2, 5, 3);
+ test(S("hmftq"), "nmsckbgalo", 2, 0, S::npos);
+ test(S("fklad"), "tpksqhamle", 2, 1, S::npos);
+ test(S("dirnm"), "tpdrchmkji", 2, 5, 2);
+ test(S("hrgdc"), "ijagfkblst", 2, 9, 2);
+ test(S("ifakg"), "kpocsignjb", 2, 10, 3);
+ test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, S::npos);
+ test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, S::npos);
+ test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 3);
+ test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, 2);
+ test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, 2);
+ test(S("cjgao"), "", 4, 0, S::npos);
+ test(S("kjplq"), "mabns", 4, 0, S::npos);
+ test(S("herni"), "bdnrp", 4, 1, S::npos);
+ test(S("tadrb"), "scidp", 4, 2, S::npos);
+ test(S("pkfeo"), "agbjl", 4, 4, S::npos);
+ test(S("hoser"), "jfmpr", 4, 5, 4);
+ test(S("kgrsp"), "rbpefghsmj", 4, 0, S::npos);
+ test(S("pgejb"), "apsfntdoqc", 4, 1, S::npos);
+ test(S("thlnq"), "ndkjeisgcl", 4, 5, S::npos);
+ test(S("nbmit"), "rnfpqatdeo", 4, 9, 4);
+ test(S("jgmib"), "bntjlqrfik", 4, 10, 4);
+ test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, S::npos);
+ test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, S::npos);
+ test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 4);
+ test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 4);
+ test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, 4);
+ test(S("klopi"), "", 5, 0, S::npos);
+ test(S("dajhn"), "psthd", 5, 0, S::npos);
+ test(S("jbgno"), "rpmjd", 5, 1, S::npos);
+ test(S("hkjae"), "dfsmk", 5, 2, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S("gbhqo"), "skqne", 5, 4, S::npos);
+ test(S("ktdor"), "kipnf", 5, 5, S::npos);
+ test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos);
+ test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos);
+ test(S("armql"), "pcdgltbrfj", 5, 5, S::npos);
+ test(S("cdhjo"), "aekfctpirg", 5, 9, S::npos);
+ test(S("jcons"), "ledihrsgpf", 5, 10, S::npos);
+ test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos);
+ test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos);
+ test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, S::npos);
+ test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, S::npos);
+ test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos);
+ test(S("gajqn"), "", 6, 0, S::npos);
+ test(S("stedk"), "hrnat", 6, 0, S::npos);
+ test(S("tjkaf"), "gsqdt", 6, 1, S::npos);
+ test(S("dthpe"), "bspkd", 6, 2, S::npos);
+ test(S("klhde"), "ohcmb", 6, 4, S::npos);
+ test(S("bhlki"), "heatr", 6, 5, S::npos);
+ test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos);
+ test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos);
+ test(S("dpqbr"), "lmbtdehjrn", 6, 5, S::npos);
+ test(S("kdhmo"), "teqmcrlgib", 6, 9, S::npos);
+ test(S("jblqp"), "njolbmspac", 6, 10, S::npos);
+ test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos);
+ test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos);
+ test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, S::npos);
+ test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos);
+ test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos);
+ test(S("jnkrfhotgl"), "", 0, 0, S::npos);
+ test(S("dltjfngbko"), "rqegt", 0, 0, S::npos);
+ test(S("bmjlpkiqde"), "dashm", 0, 1, 8);
+ test(S("skrflobnqm"), "jqirk", 0, 2, 8);
+ test(S("jkpldtshrm"), "rckeg", 0, 4, 1);
+ test(S("ghasdbnjqo"), "jscie", 0, 5, 3);
+ test(S("igrkhpbqjt"), "efsphndliq", 0, 0, S::npos);
+ test(S("ikthdgcamf"), "gdicosleja", 0, 1, 5);
+ test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 0);
+ test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 0);
+ test(S("itphbqsker"), "dtablcrseo", 0, 10, 1);
+ test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, S::npos);
+ test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, S::npos);
+ test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 4);
+ test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 0);
+ test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, 0);
+ test(S("shbcqnmoar"), "", 1, 0, S::npos);
+ test(S("bdoshlmfin"), "ontrs", 1, 0, S::npos);
+ test(S("khfrebnsgq"), "pfkna", 1, 1, S::npos);
+ test(S("getcrsaoji"), "ekosa", 1, 2, 1);
+ test(S("fjiknedcpq"), "anqhk", 1, 4, 4);
+ test(S("tkejgnafrm"), "jekca", 1, 5, 1);
+ test(S("jnakolqrde"), "ikemsjgacf", 1, 0, S::npos);
+ test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, S::npos);
+ test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 1);
+ test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 4);
+ test(S("cigfqkated"), "sqcflrgtim", 1, 10, 1);
+ test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, S::npos);
+ test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, S::npos);
+ test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 1);
+ test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 1);
+ test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, 1);
+ test(S("ectnhskflp"), "", 5, 0, S::npos);
+ test(S("fgtianblpq"), "pijag", 5, 0, S::npos);
+ test(S("mfeqklirnh"), "jrckd", 5, 1, S::npos);
+ test(S("astedncjhk"), "qcloh", 5, 2, 6);
+ test(S("fhlqgcajbr"), "thlmp", 5, 4, S::npos);
+ test(S("epfhocmdng"), "qidmo", 5, 5, 6);
+ test(S("apcnsibger"), "lnegpsjqrd", 5, 0, S::npos);
+ test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 5);
+ test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 7);
+ test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 5);
+ test(S("jbhcfposld"), "trfqgmckbe", 5, 10, S::npos);
+ test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, S::npos);
+ test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, S::npos);
+ test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 5);
+ test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 5);
+ test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, 5);
+ test(S("shoiedtcjb"), "", 9, 0, S::npos);
+ test(S("ebcinjgads"), "tqbnh", 9, 0, S::npos);
+ test(S("dqmregkcfl"), "akmle", 9, 1, S::npos);
+ test(S("ngcrieqajf"), "iqfkm", 9, 2, S::npos);
+ test(S("qosmilgnjb"), "tqjsr", 9, 4, S::npos);
+ test(S("ikabsjtdfl"), "jplqg", 9, 5, 9);
+ test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, S::npos);
+ test(S("fdnplotmgh"), "morkglpesn", 9, 1, S::npos);
+ test(S("fdbicojerm"), "dmicerngat", 9, 5, 9);
+ test(S("mbtafndjcq"), "radgeskbtc", 9, 9, S::npos);
+ test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, S::npos);
+ test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, S::npos);
+ test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, S::npos);
+ test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, S::npos);
+ test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 9);
+ test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, 9);
+ test(S("ncjpmaekbs"), "", 10, 0, S::npos);
+ test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos);
+ test(S("pqfhsgilen"), "qnpor", 10, 1, S::npos);
+ test(S("gqtjsbdckh"), "otdma", 10, 2, S::npos);
+ test(S("cfkqpjlegi"), "efhjg", 10, 4, S::npos);
+ test(S("beanrfodgj"), "odpte", 10, 5, S::npos);
+ test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos);
+ test(S("iomkfthagj"), "oaklidrbqg", 10, 1, S::npos);
+}
+
+template <class S>
+void test2()
+{
+ test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, S::npos);
+ test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, S::npos);
+ test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, S::npos);
+ test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos);
+ test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, S::npos);
+ test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, S::npos);
+ test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, S::npos);
+ test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos);
+ test(S("cqjohampgd"), "", 11, 0, S::npos);
+ test(S("hobitmpsan"), "aocjb", 11, 0, S::npos);
+ test(S("tjehkpsalm"), "jbrnk", 11, 1, S::npos);
+ test(S("ngfbojitcl"), "tqedg", 11, 2, S::npos);
+ test(S("rcfkdbhgjo"), "nqskp", 11, 4, S::npos);
+ test(S("qghptonrea"), "eaqkl", 11, 5, S::npos);
+ test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos);
+ test(S("hlmgabenti"), "lsftgajqpm", 11, 1, S::npos);
+ test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, S::npos);
+ test(S("jqedtkornm"), "shkncmiaqj", 11, 9, S::npos);
+ test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, S::npos);
+ test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos);
+ test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos);
+ test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, S::npos);
+ test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos);
+ test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos);
+ test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, S::npos);
+ test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, S::npos);
+ test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 4);
+ test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 3);
+ test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 3);
+ test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 3);
+ test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, S::npos);
+ test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 19);
+ test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 2);
+ test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 2);
+ test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 2);
+ test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, S::npos);
+ test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 16);
+ test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 1);
+ test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 0);
+ test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, 0);
+ test(S("febhmqtjanokscdirpgl"), "", 1, 0, S::npos);
+ test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, S::npos);
+ test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 6);
+ test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 1);
+ test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 1);
+ test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 6);
+ test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, S::npos);
+ test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 19);
+ test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 4);
+ test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 1);
+ test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 1);
+ test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, S::npos);
+ test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 7);
+ test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 1);
+ test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 1);
+ test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, 1);
+ test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, S::npos);
+ test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, S::npos);
+ test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 12);
+ test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, S::npos);
+ test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 10);
+ test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 15);
+ test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, S::npos);
+ test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, S::npos);
+ test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 11);
+ test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 10);
+ test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 11);
+ test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, S::npos);
+ test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 18);
+ test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 10);
+ test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 10);
+ test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, 10);
+ test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, S::npos);
+ test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, S::npos);
+ test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, S::npos);
+ test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, S::npos);
+ test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, S::npos);
+ test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 19);
+ test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, S::npos);
+ test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, S::npos);
+ test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, S::npos);
+ test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, S::npos);
+ test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, S::npos);
+ test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, S::npos);
+ test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, S::npos);
+ test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 19);
+ test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 19);
+ test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, 19);
+ test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos);
+ test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos);
+ test(S("grkpahljcftesdmonqib"), "odife", 20, 1, S::npos);
+ test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, S::npos);
+ test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, S::npos);
+ test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, S::npos);
+ test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos);
+ test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, S::npos);
+ test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, S::npos);
+ test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, S::npos);
+ test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, S::npos);
+ test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos);
+}
+
+template <class S>
+void test3()
+{
+ test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, S::npos);
+ test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, S::npos);
+ test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, S::npos);
+ test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos);
+ test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos);
+ test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos);
+ test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, S::npos);
+ test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, S::npos);
+ test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, S::npos);
+ test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, S::npos);
+ test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos);
+ test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, S::npos);
+ test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, S::npos);
+ test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, S::npos);
+ test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, S::npos);
+ test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos);
+ test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, S::npos);
+ test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, S::npos);
+ test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, S::npos);
+ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_first_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv1.find_first_of( "irkhs", 0, 5) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "gfsrt", 0, 5) == SV::npos, "" );
+ static_assert (sv2.find_first_of( "lecar", 0, 5) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_first_of_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_first_of_string_view_size.pass.cpp
new file mode 100644
index 000000000000..b8bbd86a4592
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_first_of_string_view_size.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// size_type find_first_of(const basic_string_view& str, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.find_first_of(str, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.find_first_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, S::npos);
+ test(S(""), S("laenf"), 0, S::npos);
+ test(S(""), S("pqlnkmbdjo"), 0, S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos);
+ test(S(""), S(""), 1, S::npos);
+ test(S(""), S("bjaht"), 1, S::npos);
+ test(S(""), S("hjlcmgpket"), 1, S::npos);
+ test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos);
+ test(S("fodgq"), S(""), 0, S::npos);
+ test(S("qanej"), S("dfkap"), 0, 1);
+ test(S("clbao"), S("ihqrfebgad"), 0, 2);
+ test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, 0);
+ test(S("srdfq"), S(""), 1, S::npos);
+ test(S("oemth"), S("ikcrq"), 1, S::npos);
+ test(S("cdaih"), S("dmajblfhsg"), 1, 1);
+ test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, 1);
+ test(S("cshmd"), S(""), 2, S::npos);
+ test(S("lhcdo"), S("oebqi"), 2, 4);
+ test(S("qnsoh"), S("kojhpmbsfe"), 2, 2);
+ test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, 2);
+ test(S("fmtsp"), S(""), 4, S::npos);
+ test(S("khbpm"), S("aobjd"), 4, S::npos);
+ test(S("pbsji"), S("pcbahntsje"), 4, S::npos);
+ test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, 4);
+ test(S("eqmpa"), S(""), 5, S::npos);
+ test(S("omigs"), S("kocgb"), 5, S::npos);
+ test(S("onmje"), S("fbslrjiqkm"), 5, S::npos);
+ test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos);
+ test(S("schfa"), S(""), 6, S::npos);
+ test(S("igdsc"), S("qngpd"), 6, S::npos);
+ test(S("brqgo"), S("rodhqklgmb"), 6, S::npos);
+ test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos);
+ test(S("hcjitbfapl"), S(""), 0, S::npos);
+ test(S("daiprenocl"), S("ashjd"), 0, 0);
+ test(S("litpcfdghe"), S("mgojkldsqh"), 0, 0);
+ test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, 0);
+ test(S("qpghtfbaji"), S(""), 1, S::npos);
+ test(S("gfshlcmdjr"), S("nadkh"), 1, 3);
+ test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 1);
+ test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, 1);
+ test(S("crnklpmegd"), S(""), 5, S::npos);
+ test(S("jsbtafedoc"), S("prqgn"), 5, S::npos);
+ test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 5);
+ test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, 5);
+ test(S("lmofqdhpki"), S(""), 9, S::npos);
+ test(S("hnefkqimca"), S("rtjpa"), 9, 9);
+ test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, S::npos);
+ test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, 9);
+ test(S("elgofjmbrq"), S(""), 10, S::npos);
+ test(S("mjqdgalkpc"), S("dplqa"), 10, S::npos);
+ test(S("kthqnfcerm"), S("dkacjoptns"), 10, S::npos);
+ test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos);
+ test(S("eqsgalomhb"), S(""), 11, S::npos);
+ test(S("akiteljmoh"), S("lofbc"), 11, S::npos);
+ test(S("hlbdfreqjo"), S("astoegbfpn"), 11, S::npos);
+ test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), S(""), 0, S::npos);
+ test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 3);
+ test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 0);
+ test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, 0);
+ test(S("jlnkraeodhcspfgbqitm"), S(""), 1, S::npos);
+ test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 3);
+ test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 1);
+ test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, 1);
+ test(S("hdpkobnsalmcfijregtq"), S(""), 10, S::npos);
+ test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 10);
+ test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 10);
+ test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, 10);
+ test(S("niptglfbosehkamrdqcj"), S(""), 19, S::npos);
+ test(S("copqdhstbingamjfkler"), S("djkqc"), 19, S::npos);
+ test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 19);
+ test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, 19);
+ test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, S::npos);
+ test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, S::npos);
+ test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, S::npos);
+ test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, S::npos);
+ test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), S::npos);
+ test(S(""), S("laenf"), S::npos);
+ test(S(""), S("pqlnkmbdjo"), S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), S::npos);
+ test(S("nhmko"), S(""), S::npos);
+ test(S("lahfb"), S("irkhs"), 2);
+ test(S("gmfhd"), S("kantesmpgj"), 0);
+ test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), 0);
+ test(S("eolhfgpjqk"), S(""), S::npos);
+ test(S("nbatdlmekr"), S("bnrpe"), 0);
+ test(S("jdmciepkaq"), S("jtdaefblso"), 0);
+ test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), 0);
+ test(S("gprdcokbnjhlsfmtieqa"), S(""), S::npos);
+ test(S("qjghlnftcaismkropdeb"), S("bjaht"), 1);
+ test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 0);
+ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
new file mode 100644
index 000000000000..5a792974f8c5
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// const size_type find_last_not_of(charT c, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_last_not_of(c, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.find_last_not_of(c) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'i', 0, S::npos);
+ test(S(""), 'i', 1, S::npos);
+ test(S("kitcj"), 'i', 0, 0);
+ test(S("qkamf"), 'i', 1, 1);
+ test(S("nhmko"), 'i', 2, 2);
+ test(S("tpsaf"), 'i', 4, 4);
+ test(S("lahfb"), 'i', 5, 4);
+ test(S("irkhs"), 'i', 6, 4);
+ test(S("gmfhdaipsr"), 'i', 0, 0);
+ test(S("kantesmpgj"), 'i', 1, 1);
+ test(S("odaftiegpm"), 'i', 5, 4);
+ test(S("oknlrstdpi"), 'i', 9, 8);
+ test(S("eolhfgpjqk"), 'i', 10, 9);
+ test(S("pcdrofikas"), 'i', 11, 9);
+ test(S("nbatdlmekrgcfqsophij"), 'i', 0, 0);
+ test(S("bnrpehidofmqtcksjgla"), 'i', 1, 1);
+ test(S("jdmciepkaqgotsrfnhlb"), 'i', 10, 10);
+ test(S("jtdaefblsokrmhpgcnqi"), 'i', 19, 18);
+ test(S("hkbgspofltajcnedqmri"), 'i', 20, 18);
+ test(S("oselktgbcapndfjihrmq"), 'i', 21, 19);
+
+ test(S(""), 'i', S::npos);
+ test(S("csope"), 'i', 4);
+ test(S("gfsmthlkon"), 'i', 9);
+ test(S("laenfsbridchgotmkqpj"), 'i', 19);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_not_of( 'i', 0 ) == SV::npos, "" );
+ static_assert (sv1.find_last_not_of( 'i', 1 ) == SV::npos, "" );
+ static_assert (sv2.find_last_not_of( 'a', 0 ) == SV::npos, "" );
+ static_assert (sv2.find_last_not_of( 'a', 1 ) == 1, "" );
+ static_assert (sv2.find_last_not_of( 'e', 5 ) == 3, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
new file mode 100644
index 000000000000..81881deadf30
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_last_not_of(str, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.find_last_not_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, S::npos);
+ test(S(""), "laenf", 0, S::npos);
+ test(S(""), "pqlnkmbdjo", 0, S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", 0, S::npos);
+ test(S(""), "", 1, S::npos);
+ test(S(""), "bjaht", 1, S::npos);
+ test(S(""), "hjlcmgpket", 1, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos);
+ test(S("fodgq"), "", 0, 0);
+ test(S("qanej"), "dfkap", 0, 0);
+ test(S("clbao"), "ihqrfebgad", 0, 0);
+ test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, S::npos);
+ test(S("srdfq"), "", 1, 1);
+ test(S("oemth"), "ikcrq", 1, 1);
+ test(S("cdaih"), "dmajblfhsg", 1, 0);
+ test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, S::npos);
+ test(S("cshmd"), "", 2, 2);
+ test(S("lhcdo"), "oebqi", 2, 2);
+ test(S("qnsoh"), "kojhpmbsfe", 2, 1);
+ test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, S::npos);
+ test(S("fmtsp"), "", 4, 4);
+ test(S("khbpm"), "aobjd", 4, 4);
+ test(S("pbsji"), "pcbahntsje", 4, 4);
+ test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, S::npos);
+ test(S("eqmpa"), "", 5, 4);
+ test(S("omigs"), "kocgb", 5, 4);
+ test(S("onmje"), "fbslrjiqkm", 5, 4);
+ test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, S::npos);
+ test(S("schfa"), "", 6, 4);
+ test(S("igdsc"), "qngpd", 6, 4);
+ test(S("brqgo"), "rodhqklgmb", 6, S::npos);
+ test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, S::npos);
+ test(S("hcjitbfapl"), "", 0, 0);
+ test(S("daiprenocl"), "ashjd", 0, S::npos);
+ test(S("litpcfdghe"), "mgojkldsqh", 0, S::npos);
+ test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, S::npos);
+ test(S("qpghtfbaji"), "", 1, 1);
+ test(S("gfshlcmdjr"), "nadkh", 1, 1);
+ test(S("nkodajteqp"), "ofdrqmkebl", 1, 0);
+ test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, S::npos);
+ test(S("crnklpmegd"), "", 5, 5);
+ test(S("jsbtafedoc"), "prqgn", 5, 5);
+ test(S("qnmodrtkeb"), "pejafmnokr", 5, 4);
+ test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, S::npos);
+ test(S("lmofqdhpki"), "", 9, 9);
+ test(S("hnefkqimca"), "rtjpa", 9, 8);
+ test(S("drtasbgmfp"), "ktsrmnqagd", 9, 9);
+ test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, S::npos);
+ test(S("elgofjmbrq"), "", 10, 9);
+ test(S("mjqdgalkpc"), "dplqa", 10, 9);
+ test(S("kthqnfcerm"), "dkacjoptns", 10, 9);
+ test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, S::npos);
+ test(S("eqsgalomhb"), "", 11, 9);
+ test(S("akiteljmoh"), "lofbc", 11, 9);
+ test(S("hlbdfreqjo"), "astoegbfpn", 11, 8);
+ test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), "", 0, 0);
+ test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, 0);
+ test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, S::npos);
+ test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, S::npos);
+ test(S("jlnkraeodhcspfgbqitm"), "", 1, 1);
+ test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, 1);
+ test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 0);
+ test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, S::npos);
+ test(S("hdpkobnsalmcfijregtq"), "", 10, 10);
+ test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 9);
+ test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 9);
+ test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, S::npos);
+ test(S("niptglfbosehkamrdqcj"), "", 19, 19);
+ test(S("copqdhstbingamjfkler"), "djkqc", 19, 19);
+ test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 16);
+ test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, S::npos);
+ test(S("eaintpchlqsbdgrkjofm"), "", 20, 19);
+ test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, 18);
+ test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, 19);
+ test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), "", 21, 19);
+ test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, 19);
+ test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, 19);
+ test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", S::npos);
+ test(S(""), "laenf", S::npos);
+ test(S(""), "pqlnkmbdjo", S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", S::npos);
+ test(S("nhmko"), "", 4);
+ test(S("lahfb"), "irkhs", 4);
+ test(S("gmfhd"), "kantesmpgj", 4);
+ test(S("odaft"), "oknlrstdpiqmjbaghcfe", S::npos);
+ test(S("eolhfgpjqk"), "", 9);
+ test(S("nbatdlmekr"), "bnrpe", 8);
+ test(S("jdmciepkaq"), "jtdaefblso", 9);
+ test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", S::npos);
+ test(S("gprdcokbnjhlsfmtieqa"), "", 19);
+ test(S("qjghlnftcaismkropdeb"), "bjaht", 18);
+ test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 17);
+ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_not_of( "", 0) == SV::npos, "" );
+ static_assert (sv1.find_last_not_of( "irkhs", 5) == SV::npos, "" );
+ static_assert (sv2.find_last_not_of( "", 0) == 0, "" );
+ static_assert (sv2.find_last_not_of( "gfsrt", 5) == 4, "" );
+ static_assert (sv2.find_last_not_of( "lecar", 5) == 3, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..314f338e775e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp
@@ -0,0 +1,393 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.find_last_not_of(str, pos, n) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, S::npos);
+ test(S(""), "irkhs", 0, 0, S::npos);
+ test(S(""), "kante", 0, 1, S::npos);
+ test(S(""), "oknlr", 0, 2, S::npos);
+ test(S(""), "pcdro", 0, 4, S::npos);
+ test(S(""), "bnrpe", 0, 5, S::npos);
+ test(S(""), "jtdaefblso", 0, 0, S::npos);
+ test(S(""), "oselktgbca", 0, 1, S::npos);
+ test(S(""), "eqgaplhckj", 0, 5, S::npos);
+ test(S(""), "bjahtcmnlp", 0, 9, S::npos);
+ test(S(""), "hjlcmgpket", 0, 10, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos);
+ test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos);
+ test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos);
+ test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos);
+ test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos);
+ test(S(""), "", 1, 0, S::npos);
+ test(S(""), "lbtqd", 1, 0, S::npos);
+ test(S(""), "tboim", 1, 1, S::npos);
+ test(S(""), "slcer", 1, 2, S::npos);
+ test(S(""), "cbjfs", 1, 4, S::npos);
+ test(S(""), "aqibs", 1, 5, S::npos);
+ test(S(""), "gtfblmqinc", 1, 0, S::npos);
+ test(S(""), "mkqpbtdalg", 1, 1, S::npos);
+ test(S(""), "kphatlimcd", 1, 5, S::npos);
+ test(S(""), "pblasqogic", 1, 9, S::npos);
+ test(S(""), "arosdhcfme", 1, 10, S::npos);
+ test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos);
+ test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos);
+ test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos);
+ test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos);
+ test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos);
+ test(S("eaint"), "", 0, 0, 0);
+ test(S("binja"), "gfsrt", 0, 0, 0);
+ test(S("latkm"), "pfsoc", 0, 1, 0);
+ test(S("lecfr"), "tpflm", 0, 2, 0);
+ test(S("eqkst"), "sgkec", 0, 4, S::npos);
+ test(S("cdafr"), "romds", 0, 5, 0);
+ test(S("prbhe"), "qhjistlgmr", 0, 0, 0);
+ test(S("lbisk"), "pedfirsglo", 0, 1, 0);
+ test(S("hrlpd"), "aqcoslgrmk", 0, 5, 0);
+ test(S("ehmja"), "dabckmepqj", 0, 9, S::npos);
+ test(S("mhqgd"), "pqscrjthli", 0, 10, 0);
+ test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, 0);
+ test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, 0);
+ test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, 0);
+ test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, S::npos);
+ test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, S::npos);
+ test(S("clrgb"), "", 1, 0, 1);
+ test(S("tjmek"), "osmia", 1, 0, 1);
+ test(S("bgstp"), "ckonl", 1, 1, 1);
+ test(S("hstrk"), "ilcaj", 1, 2, 1);
+ test(S("kmspj"), "lasiq", 1, 4, 1);
+ test(S("tjboh"), "kfqmr", 1, 5, 1);
+ test(S("ilbcj"), "klnitfaobg", 1, 0, 1);
+ test(S("jkngf"), "gjhmdlqikp", 1, 1, 1);
+ test(S("gfcql"), "skbgtahqej", 1, 5, 1);
+ test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 1);
+ test(S("bthpg"), "bjgfmnlkio", 1, 10, 1);
+ test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, 1);
+ test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, 1);
+ test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, S::npos);
+ test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, S::npos);
+ test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, S::npos);
+ test(S("ndrhl"), "", 2, 0, 2);
+ test(S("mrecp"), "otkgb", 2, 0, 2);
+ test(S("qlasf"), "cqsjl", 2, 1, 2);
+ test(S("smaqd"), "dpifl", 2, 2, 2);
+ test(S("hjeni"), "oapht", 2, 4, 2);
+ test(S("ocmfj"), "cifts", 2, 5, 2);
+ test(S("hmftq"), "nmsckbgalo", 2, 0, 2);
+ test(S("fklad"), "tpksqhamle", 2, 1, 2);
+ test(S("dirnm"), "tpdrchmkji", 2, 5, 1);
+ test(S("hrgdc"), "ijagfkblst", 2, 9, 1);
+ test(S("ifakg"), "kpocsignjb", 2, 10, 2);
+ test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, 2);
+ test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, 2);
+ test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 2);
+ test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, S::npos);
+ test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, S::npos);
+ test(S("cjgao"), "", 4, 0, 4);
+ test(S("kjplq"), "mabns", 4, 0, 4);
+ test(S("herni"), "bdnrp", 4, 1, 4);
+ test(S("tadrb"), "scidp", 4, 2, 4);
+ test(S("pkfeo"), "agbjl", 4, 4, 4);
+ test(S("hoser"), "jfmpr", 4, 5, 3);
+ test(S("kgrsp"), "rbpefghsmj", 4, 0, 4);
+ test(S("pgejb"), "apsfntdoqc", 4, 1, 4);
+ test(S("thlnq"), "ndkjeisgcl", 4, 5, 4);
+ test(S("nbmit"), "rnfpqatdeo", 4, 9, 3);
+ test(S("jgmib"), "bntjlqrfik", 4, 10, 2);
+ test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, 4);
+ test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, 4);
+ test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 3);
+ test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 2);
+ test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, S::npos);
+ test(S("klopi"), "", 5, 0, 4);
+ test(S("dajhn"), "psthd", 5, 0, 4);
+ test(S("jbgno"), "rpmjd", 5, 1, 4);
+ test(S("hkjae"), "dfsmk", 5, 2, 4);
+}
+
+template <class S>
+void test1()
+{
+ test(S("gbhqo"), "skqne", 5, 4, 4);
+ test(S("ktdor"), "kipnf", 5, 5, 4);
+ test(S("ldprn"), "hmrnqdgifl", 5, 0, 4);
+ test(S("egmjk"), "fsmjcdairn", 5, 1, 4);
+ test(S("armql"), "pcdgltbrfj", 5, 5, 3);
+ test(S("cdhjo"), "aekfctpirg", 5, 9, 4);
+ test(S("jcons"), "ledihrsgpf", 5, 10, 3);
+ test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, 4);
+ test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, 4);
+ test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, 1);
+ test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, 2);
+ test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, S::npos);
+ test(S("gajqn"), "", 6, 0, 4);
+ test(S("stedk"), "hrnat", 6, 0, 4);
+ test(S("tjkaf"), "gsqdt", 6, 1, 4);
+ test(S("dthpe"), "bspkd", 6, 2, 4);
+ test(S("klhde"), "ohcmb", 6, 4, 4);
+ test(S("bhlki"), "heatr", 6, 5, 4);
+ test(S("lqmoh"), "pmblckedfn", 6, 0, 4);
+ test(S("mtqin"), "aceqmsrbik", 6, 1, 4);
+ test(S("dpqbr"), "lmbtdehjrn", 6, 5, 4);
+ test(S("kdhmo"), "teqmcrlgib", 6, 9, 4);
+ test(S("jblqp"), "njolbmspac", 6, 10, 3);
+ test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, 4);
+ test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, 4);
+ test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, 1);
+ test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, S::npos);
+ test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, S::npos);
+ test(S("jnkrfhotgl"), "", 0, 0, 0);
+ test(S("dltjfngbko"), "rqegt", 0, 0, 0);
+ test(S("bmjlpkiqde"), "dashm", 0, 1, 0);
+ test(S("skrflobnqm"), "jqirk", 0, 2, 0);
+ test(S("jkpldtshrm"), "rckeg", 0, 4, 0);
+ test(S("ghasdbnjqo"), "jscie", 0, 5, 0);
+ test(S("igrkhpbqjt"), "efsphndliq", 0, 0, 0);
+ test(S("ikthdgcamf"), "gdicosleja", 0, 1, 0);
+ test(S("pcofgeniam"), "qcpjibosfl", 0, 5, S::npos);
+ test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, S::npos);
+ test(S("itphbqsker"), "dtablcrseo", 0, 10, 0);
+ test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, 0);
+ test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, 0);
+ test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, 0);
+ test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, S::npos);
+ test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, S::npos);
+ test(S("shbcqnmoar"), "", 1, 0, 1);
+ test(S("bdoshlmfin"), "ontrs", 1, 0, 1);
+ test(S("khfrebnsgq"), "pfkna", 1, 1, 1);
+ test(S("getcrsaoji"), "ekosa", 1, 2, 0);
+ test(S("fjiknedcpq"), "anqhk", 1, 4, 1);
+ test(S("tkejgnafrm"), "jekca", 1, 5, 0);
+ test(S("jnakolqrde"), "ikemsjgacf", 1, 0, 1);
+ test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, 1);
+ test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 0);
+ test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 1);
+ test(S("cigfqkated"), "sqcflrgtim", 1, 10, S::npos);
+ test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, 1);
+ test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, 1);
+ test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, S::npos);
+ test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, S::npos);
+ test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, S::npos);
+ test(S("ectnhskflp"), "", 5, 0, 5);
+ test(S("fgtianblpq"), "pijag", 5, 0, 5);
+ test(S("mfeqklirnh"), "jrckd", 5, 1, 5);
+ test(S("astedncjhk"), "qcloh", 5, 2, 5);
+ test(S("fhlqgcajbr"), "thlmp", 5, 4, 5);
+ test(S("epfhocmdng"), "qidmo", 5, 5, 5);
+ test(S("apcnsibger"), "lnegpsjqrd", 5, 0, 5);
+ test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 4);
+ test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, 5);
+ test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 3);
+ test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 5);
+ test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, 5);
+ test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, 5);
+ test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 1);
+ test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, S::npos);
+ test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, S::npos);
+ test(S("shoiedtcjb"), "", 9, 0, 9);
+ test(S("ebcinjgads"), "tqbnh", 9, 0, 9);
+ test(S("dqmregkcfl"), "akmle", 9, 1, 9);
+ test(S("ngcrieqajf"), "iqfkm", 9, 2, 9);
+ test(S("qosmilgnjb"), "tqjsr", 9, 4, 9);
+ test(S("ikabsjtdfl"), "jplqg", 9, 5, 8);
+ test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, 9);
+ test(S("fdnplotmgh"), "morkglpesn", 9, 1, 9);
+ test(S("fdbicojerm"), "dmicerngat", 9, 5, 8);
+ test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 9);
+ test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 9);
+ test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, 9);
+ test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 9);
+ test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 9);
+ test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 3);
+ test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, S::npos);
+ test(S("ncjpmaekbs"), "", 10, 0, 9);
+ test(S("hlbosgmrak"), "hpmsd", 10, 0, 9);
+ test(S("pqfhsgilen"), "qnpor", 10, 1, 9);
+ test(S("gqtjsbdckh"), "otdma", 10, 2, 9);
+ test(S("cfkqpjlegi"), "efhjg", 10, 4, 9);
+ test(S("beanrfodgj"), "odpte", 10, 5, 9);
+ test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, 9);
+ test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 9);
+}
+
+template <class S>
+void test2()
+{
+ test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 8);
+ test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 9);
+ test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, 8);
+ test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, 9);
+ test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, 9);
+ test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, 7);
+ test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, 5);
+ test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, S::npos);
+ test(S("cqjohampgd"), "", 11, 0, 9);
+ test(S("hobitmpsan"), "aocjb", 11, 0, 9);
+ test(S("tjehkpsalm"), "jbrnk", 11, 1, 9);
+ test(S("ngfbojitcl"), "tqedg", 11, 2, 9);
+ test(S("rcfkdbhgjo"), "nqskp", 11, 4, 9);
+ test(S("qghptonrea"), "eaqkl", 11, 5, 7);
+ test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, 9);
+ test(S("hlmgabenti"), "lsftgajqpm", 11, 1, 9);
+ test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, 9);
+ test(S("jqedtkornm"), "shkncmiaqj", 11, 9, 7);
+ test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, 8);
+ test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, 9);
+ test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, 9);
+ test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, 8);
+ test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, S::npos);
+ test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, S::npos);
+ test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, 0);
+ test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, 0);
+ test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, 0);
+ test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, 0);
+ test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, 0);
+ test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, 0);
+ test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, 0);
+ test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, 0);
+ test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, 0);
+ test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, 0);
+ test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, 0);
+ test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, 0);
+ test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, 0);
+ test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, 0);
+ test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, S::npos);
+ test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, S::npos);
+ test(S("febhmqtjanokscdirpgl"), "", 1, 0, 1);
+ test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, 1);
+ test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, 1);
+ test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 0);
+ test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 0);
+ test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, 1);
+ test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, 1);
+ test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, 1);
+ test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, 1);
+ test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 0);
+ test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 0);
+ test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, 1);
+ test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, 1);
+ test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 0);
+ test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, S::npos);
+ test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, S::npos);
+ test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, 10);
+ test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, 10);
+ test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, 10);
+ test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 10);
+ test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 9);
+ test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 10);
+ test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, 10);
+ test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 10);
+ test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 10);
+ test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 8);
+ test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 10);
+ test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, 10);
+ test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, 10);
+ test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 8);
+ test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, S::npos);
+ test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, S::npos);
+ test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, 19);
+ test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, 19);
+ test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 19);
+ test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 19);
+ test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 19);
+ test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 17);
+ test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, 19);
+ test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 19);
+ test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 19);
+ test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 19);
+ test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 19);
+ test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, 19);
+ test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 19);
+ test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 18);
+ test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 7);
+ test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, S::npos);
+ test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, 19);
+ test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, 19);
+ test(S("grkpahljcftesdmonqib"), "odife", 20, 1, 19);
+ test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, 19);
+ test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, 18);
+ test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, 18);
+ test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, 19);
+ test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, 19);
+ test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, 18);
+ test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, 18);
+ test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, 17);
+ test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, 19);
+}
+
+template <class S>
+void test3()
+{
+ test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 19);
+ test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 19);
+ test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, 1);
+ test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, S::npos);
+ test(S("ecgdanriptblhjfqskom"), "", 21, 0, 19);
+ test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, 19);
+ test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, 19);
+ test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, 19);
+ test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, 19);
+ test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, 19);
+ test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, 19);
+ test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, 19);
+ test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, 18);
+ test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, 19);
+ test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, 19);
+ test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, 19);
+ test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, 19);
+ test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, 19);
+ test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, 7);
+ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_not_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv1.find_last_not_of( "irkhs", 0, 5) == SV::npos, "" );
+ static_assert (sv2.find_last_not_of( "", 0, 0) == 0, "" );
+ static_assert (sv2.find_last_not_of( "gfsrt", 5, 0) == 4, "" );
+ static_assert (sv2.find_last_not_of( "lecar", 5, 0) == 4, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp
new file mode 100644
index 000000000000..89a8f9f3859e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_not_of_string_view_size.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// size_type find_last_not_of(const basic_string& str, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.find_last_not_of(str, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.find_last_not_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, S::npos);
+ test(S(""), S("laenf"), 0, S::npos);
+ test(S(""), S("pqlnkmbdjo"), 0, S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos);
+ test(S(""), S(""), 1, S::npos);
+ test(S(""), S("bjaht"), 1, S::npos);
+ test(S(""), S("hjlcmgpket"), 1, S::npos);
+ test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos);
+ test(S("fodgq"), S(""), 0, 0);
+ test(S("qanej"), S("dfkap"), 0, 0);
+ test(S("clbao"), S("ihqrfebgad"), 0, 0);
+ test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, S::npos);
+ test(S("srdfq"), S(""), 1, 1);
+ test(S("oemth"), S("ikcrq"), 1, 1);
+ test(S("cdaih"), S("dmajblfhsg"), 1, 0);
+ test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, S::npos);
+ test(S("cshmd"), S(""), 2, 2);
+ test(S("lhcdo"), S("oebqi"), 2, 2);
+ test(S("qnsoh"), S("kojhpmbsfe"), 2, 1);
+ test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, S::npos);
+ test(S("fmtsp"), S(""), 4, 4);
+ test(S("khbpm"), S("aobjd"), 4, 4);
+ test(S("pbsji"), S("pcbahntsje"), 4, 4);
+ test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, S::npos);
+ test(S("eqmpa"), S(""), 5, 4);
+ test(S("omigs"), S("kocgb"), 5, 4);
+ test(S("onmje"), S("fbslrjiqkm"), 5, 4);
+ test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, S::npos);
+ test(S("schfa"), S(""), 6, 4);
+ test(S("igdsc"), S("qngpd"), 6, 4);
+ test(S("brqgo"), S("rodhqklgmb"), 6, S::npos);
+ test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, S::npos);
+ test(S("hcjitbfapl"), S(""), 0, 0);
+ test(S("daiprenocl"), S("ashjd"), 0, S::npos);
+ test(S("litpcfdghe"), S("mgojkldsqh"), 0, S::npos);
+ test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, S::npos);
+ test(S("qpghtfbaji"), S(""), 1, 1);
+ test(S("gfshlcmdjr"), S("nadkh"), 1, 1);
+ test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 0);
+ test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, S::npos);
+ test(S("crnklpmegd"), S(""), 5, 5);
+ test(S("jsbtafedoc"), S("prqgn"), 5, 5);
+ test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 4);
+ test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, S::npos);
+ test(S("lmofqdhpki"), S(""), 9, 9);
+ test(S("hnefkqimca"), S("rtjpa"), 9, 8);
+ test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 9);
+ test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, S::npos);
+ test(S("elgofjmbrq"), S(""), 10, 9);
+ test(S("mjqdgalkpc"), S("dplqa"), 10, 9);
+ test(S("kthqnfcerm"), S("dkacjoptns"), 10, 9);
+ test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, S::npos);
+ test(S("eqsgalomhb"), S(""), 11, 9);
+ test(S("akiteljmoh"), S("lofbc"), 11, 9);
+ test(S("hlbdfreqjo"), S("astoegbfpn"), 11, 8);
+ test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, S::npos);
+ test(S("snafbdlghrjkpqtoceim"), S(""), 0, 0);
+ test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, 0);
+ test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, S::npos);
+ test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, S::npos);
+ test(S("jlnkraeodhcspfgbqitm"), S(""), 1, 1);
+ test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, 1);
+ test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 0);
+ test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, S::npos);
+ test(S("hdpkobnsalmcfijregtq"), S(""), 10, 10);
+ test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 9);
+ test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 9);
+ test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, S::npos);
+ test(S("niptglfbosehkamrdqcj"), S(""), 19, 19);
+ test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 19);
+ test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 16);
+ test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, S::npos);
+ test(S("eaintpchlqsbdgrkjofm"), S(""), 20, 19);
+ test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, 18);
+ test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, 19);
+ test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, S::npos);
+ test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, 19);
+ test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, 19);
+ test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, 19);
+ test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), S::npos);
+ test(S(""), S("laenf"), S::npos);
+ test(S(""), S("pqlnkmbdjo"), S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), S::npos);
+ test(S("nhmko"), S(""), 4);
+ test(S("lahfb"), S("irkhs"), 4);
+ test(S("gmfhd"), S("kantesmpgj"), 4);
+ test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), S::npos);
+ test(S("eolhfgpjqk"), S(""), 9);
+ test(S("nbatdlmekr"), S("bnrpe"), 8);
+ test(S("jdmciepkaq"), S("jtdaefblso"), 9);
+ test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), S::npos);
+ test(S("gprdcokbnjhlsfmtieqa"), S(""), 19);
+ test(S("qjghlnftcaismkropdeb"), S("bjaht"), 18);
+ test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 17);
+ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp
new file mode 100644
index 000000000000..b4e0196a515b
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_of_char_size.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_last_of(charT c, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_last_of(c, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.find_last_of(c) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'm', 0, S::npos);
+ test(S(""), 'm', 1, S::npos);
+ test(S("kitcj"), 'm', 0, S::npos);
+ test(S("qkamf"), 'm', 1, S::npos);
+ test(S("nhmko"), 'm', 2, 2);
+ test(S("tpsaf"), 'm', 4, S::npos);
+ test(S("lahfb"), 'm', 5, S::npos);
+ test(S("irkhs"), 'm', 6, S::npos);
+ test(S("gmfhdaipsr"), 'm', 0, S::npos);
+ test(S("kantesmpgj"), 'm', 1, S::npos);
+ test(S("odaftiegpm"), 'm', 5, S::npos);
+ test(S("oknlrstdpi"), 'm', 9, S::npos);
+ test(S("eolhfgpjqk"), 'm', 10, S::npos);
+ test(S("pcdrofikas"), 'm', 11, S::npos);
+ test(S("nbatdlmekrgcfqsophij"), 'm', 0, S::npos);
+ test(S("bnrpehidofmqtcksjgla"), 'm', 1, S::npos);
+ test(S("jdmciepkaqgotsrfnhlb"), 'm', 10, 2);
+ test(S("jtdaefblsokrmhpgcnqi"), 'm', 19, 12);
+ test(S("hkbgspofltajcnedqmri"), 'm', 20, 17);
+ test(S("oselktgbcapndfjihrmq"), 'm', 21, 18);
+
+ test(S(""), 'm', S::npos);
+ test(S("csope"), 'm', S::npos);
+ test(S("gfsmthlkon"), 'm', 3);
+ test(S("laenfsbridchgotmkqpj"), 'm', 15);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_of( 'i', 0 ) == SV::npos, "" );
+ static_assert (sv1.find_last_of( 'i', 1 ) == SV::npos, "" );
+ static_assert (sv2.find_last_of( 'a', 0 ) == 0, "" );
+ static_assert (sv2.find_last_of( 'a', 1 ) == 0, "" );
+ static_assert (sv2.find_last_of( 'e', 5 ) == 4, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
new file mode 100644
index 000000000000..d19010e07a62
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_of_pointer_size.pass.cpp
@@ -0,0 +1,166 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find_last_of(str, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.find_last_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, S::npos);
+ test(S(""), "laenf", 0, S::npos);
+ test(S(""), "pqlnkmbdjo", 0, S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", 0, S::npos);
+ test(S(""), "", 1, S::npos);
+ test(S(""), "bjaht", 1, S::npos);
+ test(S(""), "hjlcmgpket", 1, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 1, S::npos);
+ test(S("fodgq"), "", 0, S::npos);
+ test(S("qanej"), "dfkap", 0, S::npos);
+ test(S("clbao"), "ihqrfebgad", 0, S::npos);
+ test(S("mekdn"), "ngtjfcalbseiqrphmkdo", 0, 0);
+ test(S("srdfq"), "", 1, S::npos);
+ test(S("oemth"), "ikcrq", 1, S::npos);
+ test(S("cdaih"), "dmajblfhsg", 1, 1);
+ test(S("qohtk"), "oqftjhdmkgsblacenirp", 1, 1);
+ test(S("cshmd"), "", 2, S::npos);
+ test(S("lhcdo"), "oebqi", 2, S::npos);
+ test(S("qnsoh"), "kojhpmbsfe", 2, 2);
+ test(S("pkrof"), "acbsjqogpltdkhinfrem", 2, 2);
+ test(S("fmtsp"), "", 4, S::npos);
+ test(S("khbpm"), "aobjd", 4, 2);
+ test(S("pbsji"), "pcbahntsje", 4, 3);
+ test(S("mprdj"), "fhepcrntkoagbmldqijs", 4, 4);
+ test(S("eqmpa"), "", 5, S::npos);
+ test(S("omigs"), "kocgb", 5, 3);
+ test(S("onmje"), "fbslrjiqkm", 5, 3);
+ test(S("oqmrj"), "jeidpcmalhfnqbgtrsko", 5, 4);
+ test(S("schfa"), "", 6, S::npos);
+ test(S("igdsc"), "qngpd", 6, 2);
+ test(S("brqgo"), "rodhqklgmb", 6, 4);
+ test(S("tnrph"), "thdjgafrlbkoiqcspmne", 6, 4);
+ test(S("hcjitbfapl"), "", 0, S::npos);
+ test(S("daiprenocl"), "ashjd", 0, 0);
+ test(S("litpcfdghe"), "mgojkldsqh", 0, 0);
+ test(S("aidjksrolc"), "imqnaghkfrdtlopbjesc", 0, 0);
+ test(S("qpghtfbaji"), "", 1, S::npos);
+ test(S("gfshlcmdjr"), "nadkh", 1, S::npos);
+ test(S("nkodajteqp"), "ofdrqmkebl", 1, 1);
+ test(S("gbmetiprqd"), "bdfjqgatlksriohemnpc", 1, 1);
+ test(S("crnklpmegd"), "", 5, S::npos);
+ test(S("jsbtafedoc"), "prqgn", 5, S::npos);
+ test(S("qnmodrtkeb"), "pejafmnokr", 5, 5);
+ test(S("cpebqsfmnj"), "odnqkgijrhabfmcestlp", 5, 5);
+ test(S("lmofqdhpki"), "", 9, S::npos);
+ test(S("hnefkqimca"), "rtjpa", 9, 9);
+ test(S("drtasbgmfp"), "ktsrmnqagd", 9, 7);
+ test(S("lsaijeqhtr"), "rtdhgcisbnmoaqkfpjle", 9, 9);
+ test(S("elgofjmbrq"), "", 10, S::npos);
+ test(S("mjqdgalkpc"), "dplqa", 10, 8);
+ test(S("kthqnfcerm"), "dkacjoptns", 10, 6);
+ test(S("dfsjhanorc"), "hqfimtrgnbekpdcsjalo", 10, 9);
+ test(S("eqsgalomhb"), "", 11, S::npos);
+ test(S("akiteljmoh"), "lofbc", 11, 8);
+ test(S("hlbdfreqjo"), "astoegbfpn", 11, 9);
+ test(S("taqobhlerg"), "pdgreqomsncafklhtibj", 11, 9);
+ test(S("snafbdlghrjkpqtoceim"), "", 0, S::npos);
+ test(S("aemtbrgcklhndjisfpoq"), "lbtqd", 0, S::npos);
+ test(S("pnracgfkjdiholtbqsem"), "tboimldpjh", 0, 0);
+ test(S("dicfltehbsgrmojnpkaq"), "slcerthdaiqjfnobgkpm", 0, 0);
+ test(S("jlnkraeodhcspfgbqitm"), "", 1, S::npos);
+ test(S("lhosrngtmfjikbqpcade"), "aqibs", 1, S::npos);
+ test(S("rbtaqjhgkneisldpmfoc"), "gtfblmqinc", 1, 1);
+ test(S("gpifsqlrdkbonjtmheca"), "mkqpbtdalgniorhfescj", 1, 1);
+ test(S("hdpkobnsalmcfijregtq"), "", 10, S::npos);
+ test(S("jtlshdgqaiprkbcoenfm"), "pblas", 10, 10);
+ test(S("fkdrbqltsgmcoiphneaj"), "arosdhcfme", 10, 10);
+ test(S("crsplifgtqedjohnabmk"), "blkhjeogicatqfnpdmsr", 10, 10);
+ test(S("niptglfbosehkamrdqcj"), "", 19, S::npos);
+ test(S("copqdhstbingamjfkler"), "djkqc", 19, 16);
+ test(S("mrtaefilpdsgocnhqbjk"), "lgokshjtpb", 19, 19);
+ test(S("kojatdhlcmigpbfrqnes"), "bqjhtkfepimcnsgrlado", 19, 19);
+ test(S("eaintpchlqsbdgrkjofm"), "", 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), "nocfa", 20, 19);
+ test(S("spocfaktqdbiejlhngmr"), "bgtajmiedc", 20, 18);
+ test(S("rphmlekgfscndtaobiqj"), "lsckfnqgdahejiopbtmr", 20, 19);
+ test(S("liatsqdoegkmfcnbhrpj"), "", 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), "gfsrt", 21, 12);
+ test(S("latkmisecnorjbfhqpdg"), "pfsocbhjtm", 21, 17);
+ test(S("lecfratdjkhnsmqpoigb"), "tpflmdnoicjgkberhqsa", 21, 19);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", S::npos);
+ test(S(""), "laenf", S::npos);
+ test(S(""), "pqlnkmbdjo", S::npos);
+ test(S(""), "qkamfogpnljdcshbreti", S::npos);
+ test(S("nhmko"), "", S::npos);
+ test(S("lahfb"), "irkhs", 2);
+ test(S("gmfhd"), "kantesmpgj", 1);
+ test(S("odaft"), "oknlrstdpiqmjbaghcfe", 4);
+ test(S("eolhfgpjqk"), "", S::npos);
+ test(S("nbatdlmekr"), "bnrpe", 9);
+ test(S("jdmciepkaq"), "jtdaefblso", 8);
+ test(S("hkbgspoflt"), "oselktgbcapndfjihrmq", 9);
+ test(S("gprdcokbnjhlsfmtieqa"), "", S::npos);
+ test(S("qjghlnftcaismkropdeb"), "bjaht", 19);
+ test(S("pnalfrdtkqcmojiesbhg"), "hjlcmgpket", 19);
+ test(S("pniotcfrhqsmgdkjbael"), "htaobedqikfplcgjsmrn", 19);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_of( "", 0) == SV::npos, "" );
+ static_assert (sv1.find_last_of( "irkhs", 5) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "", 0) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "gfsrt", 5) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "lecar", 5) == 4, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..7d2804bf64b1
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
@@ -0,0 +1,393 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.find_last_of(str, pos, n) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, S::npos);
+ test(S(""), "irkhs", 0, 0, S::npos);
+ test(S(""), "kante", 0, 1, S::npos);
+ test(S(""), "oknlr", 0, 2, S::npos);
+ test(S(""), "pcdro", 0, 4, S::npos);
+ test(S(""), "bnrpe", 0, 5, S::npos);
+ test(S(""), "jtdaefblso", 0, 0, S::npos);
+ test(S(""), "oselktgbca", 0, 1, S::npos);
+ test(S(""), "eqgaplhckj", 0, 5, S::npos);
+ test(S(""), "bjahtcmnlp", 0, 9, S::npos);
+ test(S(""), "hjlcmgpket", 0, 10, S::npos);
+ test(S(""), "htaobedqikfplcgjsmrn", 0, 0, S::npos);
+ test(S(""), "hpqiarojkcdlsgnmfetb", 0, 1, S::npos);
+ test(S(""), "dfkaprhjloqetcsimnbg", 0, 10, S::npos);
+ test(S(""), "ihqrfebgadntlpmjksoc", 0, 19, S::npos);
+ test(S(""), "ngtjfcalbseiqrphmkdo", 0, 20, S::npos);
+ test(S(""), "", 1, 0, S::npos);
+ test(S(""), "lbtqd", 1, 0, S::npos);
+ test(S(""), "tboim", 1, 1, S::npos);
+ test(S(""), "slcer", 1, 2, S::npos);
+ test(S(""), "cbjfs", 1, 4, S::npos);
+ test(S(""), "aqibs", 1, 5, S::npos);
+ test(S(""), "gtfblmqinc", 1, 0, S::npos);
+ test(S(""), "mkqpbtdalg", 1, 1, S::npos);
+ test(S(""), "kphatlimcd", 1, 5, S::npos);
+ test(S(""), "pblasqogic", 1, 9, S::npos);
+ test(S(""), "arosdhcfme", 1, 10, S::npos);
+ test(S(""), "blkhjeogicatqfnpdmsr", 1, 0, S::npos);
+ test(S(""), "bmhineprjcoadgstflqk", 1, 1, S::npos);
+ test(S(""), "djkqcmetslnghpbarfoi", 1, 10, S::npos);
+ test(S(""), "lgokshjtpbemarcdqnfi", 1, 19, S::npos);
+ test(S(""), "bqjhtkfepimcnsgrlado", 1, 20, S::npos);
+ test(S("eaint"), "", 0, 0, S::npos);
+ test(S("binja"), "gfsrt", 0, 0, S::npos);
+ test(S("latkm"), "pfsoc", 0, 1, S::npos);
+ test(S("lecfr"), "tpflm", 0, 2, S::npos);
+ test(S("eqkst"), "sgkec", 0, 4, 0);
+ test(S("cdafr"), "romds", 0, 5, S::npos);
+ test(S("prbhe"), "qhjistlgmr", 0, 0, S::npos);
+ test(S("lbisk"), "pedfirsglo", 0, 1, S::npos);
+ test(S("hrlpd"), "aqcoslgrmk", 0, 5, S::npos);
+ test(S("ehmja"), "dabckmepqj", 0, 9, 0);
+ test(S("mhqgd"), "pqscrjthli", 0, 10, S::npos);
+ test(S("tgklq"), "kfphdcsjqmobliagtren", 0, 0, S::npos);
+ test(S("bocjs"), "rokpefncljibsdhqtagm", 0, 1, S::npos);
+ test(S("grbsd"), "afionmkphlebtcjqsgrd", 0, 10, S::npos);
+ test(S("ofjqr"), "aenmqplidhkofrjbctsg", 0, 19, 0);
+ test(S("btlfi"), "osjmbtcadhiklegrpqnf", 0, 20, 0);
+ test(S("clrgb"), "", 1, 0, S::npos);
+ test(S("tjmek"), "osmia", 1, 0, S::npos);
+ test(S("bgstp"), "ckonl", 1, 1, S::npos);
+ test(S("hstrk"), "ilcaj", 1, 2, S::npos);
+ test(S("kmspj"), "lasiq", 1, 4, S::npos);
+ test(S("tjboh"), "kfqmr", 1, 5, S::npos);
+ test(S("ilbcj"), "klnitfaobg", 1, 0, S::npos);
+ test(S("jkngf"), "gjhmdlqikp", 1, 1, S::npos);
+ test(S("gfcql"), "skbgtahqej", 1, 5, 0);
+ test(S("dqtlg"), "bjsdgtlpkf", 1, 9, 0);
+ test(S("bthpg"), "bjgfmnlkio", 1, 10, 0);
+ test(S("dgsnq"), "lbhepotfsjdqigcnamkr", 1, 0, S::npos);
+ test(S("rmfhp"), "tebangckmpsrqdlfojhi", 1, 1, S::npos);
+ test(S("jfdam"), "joflqbdkhtegimscpanr", 1, 10, 1);
+ test(S("edapb"), "adpmcohetfbsrjinlqkg", 1, 19, 1);
+ test(S("brfsm"), "iacldqjpfnogbsrhmetk", 1, 20, 1);
+ test(S("ndrhl"), "", 2, 0, S::npos);
+ test(S("mrecp"), "otkgb", 2, 0, S::npos);
+ test(S("qlasf"), "cqsjl", 2, 1, S::npos);
+ test(S("smaqd"), "dpifl", 2, 2, S::npos);
+ test(S("hjeni"), "oapht", 2, 4, 0);
+ test(S("ocmfj"), "cifts", 2, 5, 1);
+ test(S("hmftq"), "nmsckbgalo", 2, 0, S::npos);
+ test(S("fklad"), "tpksqhamle", 2, 1, S::npos);
+ test(S("dirnm"), "tpdrchmkji", 2, 5, 2);
+ test(S("hrgdc"), "ijagfkblst", 2, 9, 2);
+ test(S("ifakg"), "kpocsignjb", 2, 10, 0);
+ test(S("ebrgd"), "pecqtkjsnbdrialgmohf", 2, 0, S::npos);
+ test(S("rcjml"), "aiortphfcmkjebgsndql", 2, 1, S::npos);
+ test(S("peqmt"), "sdbkeamglhipojqftrcn", 2, 10, 1);
+ test(S("frehn"), "ljqncehgmfktroapidbs", 2, 19, 2);
+ test(S("tqolf"), "rtcfodilamkbenjghqps", 2, 20, 2);
+ test(S("cjgao"), "", 4, 0, S::npos);
+ test(S("kjplq"), "mabns", 4, 0, S::npos);
+ test(S("herni"), "bdnrp", 4, 1, S::npos);
+ test(S("tadrb"), "scidp", 4, 2, S::npos);
+ test(S("pkfeo"), "agbjl", 4, 4, S::npos);
+ test(S("hoser"), "jfmpr", 4, 5, 4);
+ test(S("kgrsp"), "rbpefghsmj", 4, 0, S::npos);
+ test(S("pgejb"), "apsfntdoqc", 4, 1, S::npos);
+ test(S("thlnq"), "ndkjeisgcl", 4, 5, 3);
+ test(S("nbmit"), "rnfpqatdeo", 4, 9, 4);
+ test(S("jgmib"), "bntjlqrfik", 4, 10, 4);
+ test(S("ncrfj"), "kcrtmpolnaqejghsfdbi", 4, 0, S::npos);
+ test(S("ncsik"), "lobheanpkmqidsrtcfgj", 4, 1, S::npos);
+ test(S("sgbfh"), "athdkljcnreqbgpmisof", 4, 10, 4);
+ test(S("dktbn"), "qkdmjialrscpbhefgont", 4, 19, 4);
+ test(S("fthqm"), "dmasojntqleribkgfchp", 4, 20, 4);
+ test(S("klopi"), "", 5, 0, S::npos);
+ test(S("dajhn"), "psthd", 5, 0, S::npos);
+ test(S("jbgno"), "rpmjd", 5, 1, S::npos);
+ test(S("hkjae"), "dfsmk", 5, 2, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S("gbhqo"), "skqne", 5, 4, 3);
+ test(S("ktdor"), "kipnf", 5, 5, 0);
+ test(S("ldprn"), "hmrnqdgifl", 5, 0, S::npos);
+ test(S("egmjk"), "fsmjcdairn", 5, 1, S::npos);
+ test(S("armql"), "pcdgltbrfj", 5, 5, 4);
+ test(S("cdhjo"), "aekfctpirg", 5, 9, 0);
+ test(S("jcons"), "ledihrsgpf", 5, 10, 4);
+ test(S("cbrkp"), "mqcklahsbtirgopefndj", 5, 0, S::npos);
+ test(S("fhgna"), "kmlthaoqgecrnpdbjfis", 5, 1, S::npos);
+ test(S("ejfcd"), "sfhbamcdptojlkrenqgi", 5, 10, 4);
+ test(S("kqjhe"), "pbniofmcedrkhlstgaqj", 5, 19, 4);
+ test(S("pbdjl"), "mongjratcskbhqiepfdl", 5, 20, 4);
+ test(S("gajqn"), "", 6, 0, S::npos);
+ test(S("stedk"), "hrnat", 6, 0, S::npos);
+ test(S("tjkaf"), "gsqdt", 6, 1, S::npos);
+ test(S("dthpe"), "bspkd", 6, 2, S::npos);
+ test(S("klhde"), "ohcmb", 6, 4, 2);
+ test(S("bhlki"), "heatr", 6, 5, 1);
+ test(S("lqmoh"), "pmblckedfn", 6, 0, S::npos);
+ test(S("mtqin"), "aceqmsrbik", 6, 1, S::npos);
+ test(S("dpqbr"), "lmbtdehjrn", 6, 5, 3);
+ test(S("kdhmo"), "teqmcrlgib", 6, 9, 3);
+ test(S("jblqp"), "njolbmspac", 6, 10, 4);
+ test(S("qmjgl"), "pofnhidklamecrbqjgst", 6, 0, S::npos);
+ test(S("rothp"), "jbhckmtgrqnosafedpli", 6, 1, S::npos);
+ test(S("ghknq"), "dobntpmqklicsahgjerf", 6, 10, 4);
+ test(S("eopfi"), "tpdshainjkbfoemlrgcq", 6, 19, 4);
+ test(S("dsnmg"), "oldpfgeakrnitscbjmqh", 6, 20, 4);
+ test(S("jnkrfhotgl"), "", 0, 0, S::npos);
+ test(S("dltjfngbko"), "rqegt", 0, 0, S::npos);
+ test(S("bmjlpkiqde"), "dashm", 0, 1, S::npos);
+ test(S("skrflobnqm"), "jqirk", 0, 2, S::npos);
+ test(S("jkpldtshrm"), "rckeg", 0, 4, S::npos);
+ test(S("ghasdbnjqo"), "jscie", 0, 5, S::npos);
+ test(S("igrkhpbqjt"), "efsphndliq", 0, 0, S::npos);
+ test(S("ikthdgcamf"), "gdicosleja", 0, 1, S::npos);
+ test(S("pcofgeniam"), "qcpjibosfl", 0, 5, 0);
+ test(S("rlfjgesqhc"), "lrhmefnjcq", 0, 9, 0);
+ test(S("itphbqsker"), "dtablcrseo", 0, 10, S::npos);
+ test(S("skjafcirqm"), "apckjsftedbhgomrnilq", 0, 0, S::npos);
+ test(S("tcqomarsfd"), "pcbrgflehjtiadnsokqm", 0, 1, S::npos);
+ test(S("rocfeldqpk"), "nsiadegjklhobrmtqcpf", 0, 10, S::npos);
+ test(S("cfpegndlkt"), "cpmajdqnolikhgsbretf", 0, 19, 0);
+ test(S("fqbtnkeasj"), "jcflkntmgiqrphdosaeb", 0, 20, 0);
+ test(S("shbcqnmoar"), "", 1, 0, S::npos);
+ test(S("bdoshlmfin"), "ontrs", 1, 0, S::npos);
+ test(S("khfrebnsgq"), "pfkna", 1, 1, S::npos);
+ test(S("getcrsaoji"), "ekosa", 1, 2, 1);
+ test(S("fjiknedcpq"), "anqhk", 1, 4, S::npos);
+ test(S("tkejgnafrm"), "jekca", 1, 5, 1);
+ test(S("jnakolqrde"), "ikemsjgacf", 1, 0, S::npos);
+ test(S("lcjptsmgbe"), "arolgsjkhm", 1, 1, S::npos);
+ test(S("itfsmcjorl"), "oftkbldhre", 1, 5, 1);
+ test(S("omchkfrjea"), "gbkqdoeftl", 1, 9, 0);
+ test(S("cigfqkated"), "sqcflrgtim", 1, 10, 1);
+ test(S("tscenjikml"), "fmhbkislrjdpanogqcet", 1, 0, S::npos);
+ test(S("qcpaemsinf"), "rnioadktqlgpbcjsmhef", 1, 1, S::npos);
+ test(S("gltkojeipd"), "oakgtnldpsefihqmjcbr", 1, 10, 1);
+ test(S("qistfrgnmp"), "gbnaelosidmcjqktfhpr", 1, 19, 1);
+ test(S("bdnpfcqaem"), "akbripjhlosndcmqgfet", 1, 20, 1);
+ test(S("ectnhskflp"), "", 5, 0, S::npos);
+ test(S("fgtianblpq"), "pijag", 5, 0, S::npos);
+ test(S("mfeqklirnh"), "jrckd", 5, 1, S::npos);
+ test(S("astedncjhk"), "qcloh", 5, 2, S::npos);
+ test(S("fhlqgcajbr"), "thlmp", 5, 4, 2);
+ test(S("epfhocmdng"), "qidmo", 5, 5, 4);
+ test(S("apcnsibger"), "lnegpsjqrd", 5, 0, S::npos);
+ test(S("aqkocrbign"), "rjqdablmfs", 5, 1, 5);
+ test(S("ijsmdtqgce"), "enkgpbsjaq", 5, 5, S::npos);
+ test(S("clobgsrken"), "kdsgoaijfh", 5, 9, 5);
+ test(S("jbhcfposld"), "trfqgmckbe", 5, 10, 4);
+ test(S("oqnpblhide"), "igetsracjfkdnpoblhqm", 5, 0, S::npos);
+ test(S("lroeasctif"), "nqctfaogirshlekbdjpm", 5, 1, S::npos);
+ test(S("bpjlgmiedh"), "csehfgomljdqinbartkp", 5, 10, 5);
+ test(S("pamkeoidrj"), "qahoegcmplkfsjbdnitr", 5, 19, 5);
+ test(S("espogqbthk"), "dpteiajrqmsognhlfbkc", 5, 20, 5);
+ test(S("shoiedtcjb"), "", 9, 0, S::npos);
+ test(S("ebcinjgads"), "tqbnh", 9, 0, S::npos);
+ test(S("dqmregkcfl"), "akmle", 9, 1, S::npos);
+ test(S("ngcrieqajf"), "iqfkm", 9, 2, 6);
+ test(S("qosmilgnjb"), "tqjsr", 9, 4, 8);
+ test(S("ikabsjtdfl"), "jplqg", 9, 5, 9);
+ test(S("ersmicafdh"), "oilnrbcgtj", 9, 0, S::npos);
+ test(S("fdnplotmgh"), "morkglpesn", 9, 1, 7);
+ test(S("fdbicojerm"), "dmicerngat", 9, 5, 9);
+ test(S("mbtafndjcq"), "radgeskbtc", 9, 9, 6);
+ test(S("mlenkpfdtc"), "ljikprsmqo", 9, 10, 5);
+ test(S("ahlcifdqgs"), "trqihkcgsjamfdbolnpe", 9, 0, S::npos);
+ test(S("bgjemaltks"), "lqmthbsrekajgnofcipd", 9, 1, 6);
+ test(S("pdhslbqrfc"), "jtalmedribkgqsopcnfh", 9, 10, 7);
+ test(S("dirhtsnjkc"), "spqfoiclmtagejbndkrh", 9, 19, 9);
+ test(S("dlroktbcja"), "nmotklspigjrdhcfaebq", 9, 20, 9);
+ test(S("ncjpmaekbs"), "", 10, 0, S::npos);
+ test(S("hlbosgmrak"), "hpmsd", 10, 0, S::npos);
+ test(S("pqfhsgilen"), "qnpor", 10, 1, 1);
+ test(S("gqtjsbdckh"), "otdma", 10, 2, 2);
+ test(S("cfkqpjlegi"), "efhjg", 10, 4, 7);
+ test(S("beanrfodgj"), "odpte", 10, 5, 7);
+ test(S("adtkqpbjfi"), "bctdgfmolr", 10, 0, S::npos);
+ test(S("iomkfthagj"), "oaklidrbqg", 10, 1, 1);
+}
+
+template <class S>
+void test2()
+{
+ test(S("sdpcilonqj"), "dnjfsagktr", 10, 5, 9);
+ test(S("gtfbdkqeml"), "nejaktmiqg", 10, 9, 8);
+ test(S("bmeqgcdorj"), "pjqonlebsf", 10, 10, 9);
+ test(S("etqlcanmob"), "dshmnbtolcjepgaikfqr", 10, 0, S::npos);
+ test(S("roqmkbdtia"), "iogfhpabtjkqlrnemcds", 10, 1, 8);
+ test(S("kadsithljf"), "ngridfabjsecpqltkmoh", 10, 10, 9);
+ test(S("sgtkpbfdmh"), "athmknplcgofrqejsdib", 10, 19, 9);
+ test(S("qgmetnabkl"), "ldobhmqcafnjtkeisgrp", 10, 20, 9);
+ test(S("cqjohampgd"), "", 11, 0, S::npos);
+ test(S("hobitmpsan"), "aocjb", 11, 0, S::npos);
+ test(S("tjehkpsalm"), "jbrnk", 11, 1, 1);
+ test(S("ngfbojitcl"), "tqedg", 11, 2, 7);
+ test(S("rcfkdbhgjo"), "nqskp", 11, 4, 3);
+ test(S("qghptonrea"), "eaqkl", 11, 5, 9);
+ test(S("hnprfgqjdl"), "reaoicljqm", 11, 0, S::npos);
+ test(S("hlmgabenti"), "lsftgajqpm", 11, 1, 1);
+ test(S("ofcjanmrbs"), "rlpfogmits", 11, 5, 7);
+ test(S("jqedtkornm"), "shkncmiaqj", 11, 9, 9);
+ test(S("rfedlasjmg"), "fpnatrhqgs", 11, 10, 9);
+ test(S("talpqjsgkm"), "sjclemqhnpdbgikarfot", 11, 0, S::npos);
+ test(S("lrkcbtqpie"), "otcmedjikgsfnqbrhpla", 11, 1, S::npos);
+ test(S("cipogdskjf"), "bonsaefdqiprkhlgtjcm", 11, 10, 9);
+ test(S("nqedcojahi"), "egpscmahijlfnkrodqtb", 11, 19, 9);
+ test(S("hefnrkmctj"), "kmqbfepjthgilscrndoa", 11, 20, 9);
+ test(S("atqirnmekfjolhpdsgcb"), "", 0, 0, S::npos);
+ test(S("echfkmlpribjnqsaogtd"), "prboq", 0, 0, S::npos);
+ test(S("qnhiftdgcleajbpkrosm"), "fjcqh", 0, 1, S::npos);
+ test(S("chamfknorbedjitgslpq"), "fmosa", 0, 2, S::npos);
+ test(S("njhqpibfmtlkaecdrgso"), "qdbok", 0, 4, S::npos);
+ test(S("ebnghfsqkprmdcljoiat"), "amslg", 0, 5, S::npos);
+ test(S("letjomsgihfrpqbkancd"), "smpltjneqb", 0, 0, S::npos);
+ test(S("nblgoipcrqeaktshjdmf"), "flitskrnge", 0, 1, S::npos);
+ test(S("cehkbngtjoiflqapsmrd"), "pgqihmlbef", 0, 5, S::npos);
+ test(S("mignapfoklbhcqjetdrs"), "cfpdqjtgsb", 0, 9, S::npos);
+ test(S("ceatbhlsqjgpnokfrmdi"), "htpsiaflom", 0, 10, S::npos);
+ test(S("ocihkjgrdelpfnmastqb"), "kpjfiaceghsrdtlbnomq", 0, 0, S::npos);
+ test(S("noelgschdtbrjfmiqkap"), "qhtbomidljgafneksprc", 0, 1, S::npos);
+ test(S("dkclqfombepritjnghas"), "nhtjobkcefldimpsaqgr", 0, 10, S::npos);
+ test(S("miklnresdgbhqcojftap"), "prabcjfqnoeskilmtgdh", 0, 19, 0);
+ test(S("htbcigojaqmdkfrnlsep"), "dtrgmchilkasqoebfpjn", 0, 20, 0);
+ test(S("febhmqtjanokscdirpgl"), "", 1, 0, S::npos);
+ test(S("loakbsqjpcrdhftniegm"), "sqome", 1, 0, S::npos);
+ test(S("reagphsqflbitdcjmkno"), "smfte", 1, 1, S::npos);
+ test(S("jitlfrqemsdhkopncabg"), "ciboh", 1, 2, 1);
+ test(S("mhtaepscdnrjqgbkifol"), "haois", 1, 4, 1);
+ test(S("tocesrfmnglpbjihqadk"), "abfki", 1, 5, S::npos);
+ test(S("lpfmctjrhdagneskbqoi"), "frdkocntmq", 1, 0, S::npos);
+ test(S("lsmqaepkdhncirbtjfgo"), "oasbpedlnr", 1, 1, S::npos);
+ test(S("epoiqmtldrabnkjhcfsg"), "kltqmhgand", 1, 5, S::npos);
+ test(S("emgasrilpknqojhtbdcf"), "gdtfjchpmr", 1, 9, 1);
+ test(S("hnfiagdpcklrjetqbsom"), "ponmcqblet", 1, 10, 1);
+ test(S("nsdfebgajhmtricpoklq"), "sgphqdnofeiklatbcmjr", 1, 0, S::npos);
+ test(S("atjgfsdlpobmeiqhncrk"), "ljqprsmigtfoneadckbh", 1, 1, S::npos);
+ test(S("sitodfgnrejlahcbmqkp"), "ligeojhafnkmrcsqtbdp", 1, 10, 1);
+ test(S("fraghmbiceknltjpqosd"), "lsimqfnjarbopedkhcgt", 1, 19, 1);
+ test(S("pmafenlhqtdbkirjsogc"), "abedmfjlghniorcqptks", 1, 20, 1);
+ test(S("pihgmoeqtnakrjslcbfd"), "", 10, 0, S::npos);
+ test(S("gjdkeprctqblnhiafsom"), "hqtoa", 10, 0, S::npos);
+ test(S("mkpnblfdsahrcqijteog"), "cahif", 10, 1, S::npos);
+ test(S("gckarqnelodfjhmbptis"), "kehis", 10, 2, 7);
+ test(S("gqpskidtbclomahnrjfe"), "kdlmh", 10, 4, 10);
+ test(S("pkldjsqrfgitbhmaecno"), "paeql", 10, 5, 6);
+ test(S("aftsijrbeklnmcdqhgop"), "aghoqiefnb", 10, 0, S::npos);
+ test(S("mtlgdrhafjkbiepqnsoc"), "jrbqaikpdo", 10, 1, 9);
+ test(S("pqgirnaefthokdmbsclj"), "smjonaeqcl", 10, 5, 5);
+ test(S("kpdbgjmtherlsfcqoina"), "eqbdrkcfah", 10, 9, 10);
+ test(S("jrlbothiknqmdgcfasep"), "kapmsienhf", 10, 10, 9);
+ test(S("mjogldqferckabinptsh"), "jpqotrlenfcsbhkaimdg", 10, 0, S::npos);
+ test(S("apoklnefbhmgqcdrisjt"), "jlbmhnfgtcqprikeados", 10, 1, S::npos);
+ test(S("ifeopcnrjbhkdgatmqls"), "stgbhfmdaljnpqoicker", 10, 10, 10);
+ test(S("ckqhaiesmjdnrgolbtpf"), "oihcetflbjagdsrkmqpn", 10, 19, 10);
+ test(S("bnlgapfimcoterskqdjh"), "adtclebmnpjsrqfkigoh", 10, 20, 10);
+ test(S("kgdlrobpmjcthqsafeni"), "", 19, 0, S::npos);
+ test(S("dfkechomjapgnslbtqir"), "beafg", 19, 0, S::npos);
+ test(S("rloadknfbqtgmhcsipje"), "iclat", 19, 1, 16);
+ test(S("mgjhkolrnadqbpetcifs"), "rkhnf", 19, 2, 7);
+ test(S("cmlfakiojdrgtbsphqen"), "clshq", 19, 4, 16);
+ test(S("kghbfipeomsntdalrqjc"), "dtcoj", 19, 5, 19);
+ test(S("eldiqckrnmtasbghjfpo"), "rqosnjmfth", 19, 0, S::npos);
+ test(S("abqjcfedgotihlnspkrm"), "siatdfqglh", 19, 1, 15);
+ test(S("qfbadrtjsimkolcenhpg"), "mrlshtpgjq", 19, 5, 17);
+ test(S("abseghclkjqifmtodrnp"), "adlcskgqjt", 19, 9, 16);
+ test(S("ibmsnlrjefhtdokacqpg"), "drshcjknaf", 19, 10, 16);
+ test(S("mrkfciqjebaponsthldg"), "etsaqroinghpkjdlfcbm", 19, 0, S::npos);
+ test(S("mjkticdeoqshpalrfbgn"), "sgepdnkqliambtrocfhj", 19, 1, 10);
+ test(S("rqnoclbdejgiphtfsakm"), "nlmcjaqgbsortfdihkpe", 19, 10, 19);
+ test(S("plkqbhmtfaeodjcrsing"), "racfnpmosldibqkghjet", 19, 19, 19);
+ test(S("oegalhmstjrfickpbndq"), "fjhdsctkqeiolagrnmbp", 19, 20, 19);
+ test(S("rdtgjcaohpblniekmsfq"), "", 20, 0, S::npos);
+ test(S("ofkqbnjetrmsaidphglc"), "ejanp", 20, 0, S::npos);
+ test(S("grkpahljcftesdmonqib"), "odife", 20, 1, 15);
+ test(S("jimlgbhfqkteospardcn"), "okaqd", 20, 2, 12);
+ test(S("gftenihpmslrjkqadcob"), "lcdbi", 20, 4, 19);
+ test(S("bmhldogtckrfsanijepq"), "fsqbj", 20, 5, 19);
+ test(S("nfqkrpjdesabgtlcmoih"), "bigdomnplq", 20, 0, S::npos);
+ test(S("focalnrpiqmdkstehbjg"), "apiblotgcd", 20, 1, 3);
+ test(S("rhqdspkmebiflcotnjga"), "acfhdenops", 20, 5, 19);
+ test(S("rahdtmsckfboqlpniegj"), "jopdeamcrk", 20, 9, 19);
+ test(S("fbkeiopclstmdqranjhg"), "trqncbkgmh", 20, 10, 19);
+ test(S("lifhpdgmbconstjeqark"), "tomglrkencbsfjqpihda", 20, 0, S::npos);
+}
+
+template <class S>
+void test3()
+{
+ test(S("pboqganrhedjmltsicfk"), "gbkhdnpoietfcmrslajq", 20, 1, 4);
+ test(S("klchabsimetjnqgorfpd"), "rtfnmbsglkjaichoqedp", 20, 10, 17);
+ test(S("sirfgmjqhctndbklaepo"), "ohkmdpfqbsacrtjnlgei", 20, 19, 19);
+ test(S("rlbdsiceaonqjtfpghkm"), "dlbrteoisgphmkncajfq", 20, 20, 19);
+ test(S("ecgdanriptblhjfqskom"), "", 21, 0, S::npos);
+ test(S("fdmiarlpgcskbhoteqjn"), "sjrlo", 21, 0, S::npos);
+ test(S("rlbstjqopignecmfadkh"), "qjpor", 21, 1, 6);
+ test(S("grjpqmbshektdolcafni"), "odhfn", 21, 2, 13);
+ test(S("sakfcohtqnibprjmlged"), "qtfin", 21, 4, 10);
+ test(S("mjtdglasihqpocebrfkn"), "hpqfo", 21, 5, 17);
+ test(S("okaplfrntghqbmeicsdj"), "fabmertkos", 21, 0, S::npos);
+ test(S("sahngemrtcjidqbklfpo"), "brqtgkmaej", 21, 1, 14);
+ test(S("dlmsipcnekhbgoaftqjr"), "nfrdeihsgl", 21, 5, 19);
+ test(S("ahegrmqnoiklpfsdbcjt"), "hlfrosekpi", 21, 9, 14);
+ test(S("hdsjbnmlegtkqripacof"), "atgbkrjdsm", 21, 10, 16);
+ test(S("pcnedrfjihqbalkgtoms"), "blnrptjgqmaifsdkhoec", 21, 0, S::npos);
+ test(S("qjidealmtpskrbfhocng"), "ctpmdahebfqjgknloris", 21, 1, 17);
+ test(S("qeindtagmokpfhsclrbj"), "apnkeqthrmlbfodiscgj", 21, 10, 17);
+ test(S("kpfegbjhsrnodltqciam"), "jdgictpframeoqlsbknh", 21, 19, 19);
+ test(S("hnbrcplsjfgiktoedmaq"), "qprlsfojamgndekthibc", 21, 20, 19);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find_last_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv1.find_last_of( "irkhs", 0, 5) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "", 0, 0) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "gfsrt", 5, 5) == SV::npos, "" );
+ static_assert (sv2.find_last_of( "lecar", 5, 5) == 4, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_last_of_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_last_of_string_view_size.pass.cpp
new file mode 100644
index 000000000000..ed530870e187
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_last_of_string_view_size.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// size_type find_last_of(const basic_string& str, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.find_last_of(str, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x < s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.find_last_of(str) == x);
+ if (x != S::npos)
+ assert(x < s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, S::npos);
+ test(S(""), S("laenf"), 0, S::npos);
+ test(S(""), S("pqlnkmbdjo"), 0, S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), 0, S::npos);
+ test(S(""), S(""), 1, S::npos);
+ test(S(""), S("bjaht"), 1, S::npos);
+ test(S(""), S("hjlcmgpket"), 1, S::npos);
+ test(S(""), S("htaobedqikfplcgjsmrn"), 1, S::npos);
+ test(S("fodgq"), S(""), 0, S::npos);
+ test(S("qanej"), S("dfkap"), 0, S::npos);
+ test(S("clbao"), S("ihqrfebgad"), 0, S::npos);
+ test(S("mekdn"), S("ngtjfcalbseiqrphmkdo"), 0, 0);
+ test(S("srdfq"), S(""), 1, S::npos);
+ test(S("oemth"), S("ikcrq"), 1, S::npos);
+ test(S("cdaih"), S("dmajblfhsg"), 1, 1);
+ test(S("qohtk"), S("oqftjhdmkgsblacenirp"), 1, 1);
+ test(S("cshmd"), S(""), 2, S::npos);
+ test(S("lhcdo"), S("oebqi"), 2, S::npos);
+ test(S("qnsoh"), S("kojhpmbsfe"), 2, 2);
+ test(S("pkrof"), S("acbsjqogpltdkhinfrem"), 2, 2);
+ test(S("fmtsp"), S(""), 4, S::npos);
+ test(S("khbpm"), S("aobjd"), 4, 2);
+ test(S("pbsji"), S("pcbahntsje"), 4, 3);
+ test(S("mprdj"), S("fhepcrntkoagbmldqijs"), 4, 4);
+ test(S("eqmpa"), S(""), 5, S::npos);
+ test(S("omigs"), S("kocgb"), 5, 3);
+ test(S("onmje"), S("fbslrjiqkm"), 5, 3);
+ test(S("oqmrj"), S("jeidpcmalhfnqbgtrsko"), 5, 4);
+ test(S("schfa"), S(""), 6, S::npos);
+ test(S("igdsc"), S("qngpd"), 6, 2);
+ test(S("brqgo"), S("rodhqklgmb"), 6, 4);
+ test(S("tnrph"), S("thdjgafrlbkoiqcspmne"), 6, 4);
+ test(S("hcjitbfapl"), S(""), 0, S::npos);
+ test(S("daiprenocl"), S("ashjd"), 0, 0);
+ test(S("litpcfdghe"), S("mgojkldsqh"), 0, 0);
+ test(S("aidjksrolc"), S("imqnaghkfrdtlopbjesc"), 0, 0);
+ test(S("qpghtfbaji"), S(""), 1, S::npos);
+ test(S("gfshlcmdjr"), S("nadkh"), 1, S::npos);
+ test(S("nkodajteqp"), S("ofdrqmkebl"), 1, 1);
+ test(S("gbmetiprqd"), S("bdfjqgatlksriohemnpc"), 1, 1);
+ test(S("crnklpmegd"), S(""), 5, S::npos);
+ test(S("jsbtafedoc"), S("prqgn"), 5, S::npos);
+ test(S("qnmodrtkeb"), S("pejafmnokr"), 5, 5);
+ test(S("cpebqsfmnj"), S("odnqkgijrhabfmcestlp"), 5, 5);
+ test(S("lmofqdhpki"), S(""), 9, S::npos);
+ test(S("hnefkqimca"), S("rtjpa"), 9, 9);
+ test(S("drtasbgmfp"), S("ktsrmnqagd"), 9, 7);
+ test(S("lsaijeqhtr"), S("rtdhgcisbnmoaqkfpjle"), 9, 9);
+ test(S("elgofjmbrq"), S(""), 10, S::npos);
+ test(S("mjqdgalkpc"), S("dplqa"), 10, 8);
+ test(S("kthqnfcerm"), S("dkacjoptns"), 10, 6);
+ test(S("dfsjhanorc"), S("hqfimtrgnbekpdcsjalo"), 10, 9);
+ test(S("eqsgalomhb"), S(""), 11, S::npos);
+ test(S("akiteljmoh"), S("lofbc"), 11, 8);
+ test(S("hlbdfreqjo"), S("astoegbfpn"), 11, 9);
+ test(S("taqobhlerg"), S("pdgreqomsncafklhtibj"), 11, 9);
+ test(S("snafbdlghrjkpqtoceim"), S(""), 0, S::npos);
+ test(S("aemtbrgcklhndjisfpoq"), S("lbtqd"), 0, S::npos);
+ test(S("pnracgfkjdiholtbqsem"), S("tboimldpjh"), 0, 0);
+ test(S("dicfltehbsgrmojnpkaq"), S("slcerthdaiqjfnobgkpm"), 0, 0);
+ test(S("jlnkraeodhcspfgbqitm"), S(""), 1, S::npos);
+ test(S("lhosrngtmfjikbqpcade"), S("aqibs"), 1, S::npos);
+ test(S("rbtaqjhgkneisldpmfoc"), S("gtfblmqinc"), 1, 1);
+ test(S("gpifsqlrdkbonjtmheca"), S("mkqpbtdalgniorhfescj"), 1, 1);
+ test(S("hdpkobnsalmcfijregtq"), S(""), 10, S::npos);
+ test(S("jtlshdgqaiprkbcoenfm"), S("pblas"), 10, 10);
+ test(S("fkdrbqltsgmcoiphneaj"), S("arosdhcfme"), 10, 10);
+ test(S("crsplifgtqedjohnabmk"), S("blkhjeogicatqfnpdmsr"), 10, 10);
+ test(S("niptglfbosehkamrdqcj"), S(""), 19, S::npos);
+ test(S("copqdhstbingamjfkler"), S("djkqc"), 19, 16);
+ test(S("mrtaefilpdsgocnhqbjk"), S("lgokshjtpb"), 19, 19);
+ test(S("kojatdhlcmigpbfrqnes"), S("bqjhtkfepimcnsgrlado"), 19, 19);
+ test(S("eaintpchlqsbdgrkjofm"), S(""), 20, S::npos);
+ test(S("gjnhidfsepkrtaqbmclo"), S("nocfa"), 20, 19);
+ test(S("spocfaktqdbiejlhngmr"), S("bgtajmiedc"), 20, 18);
+ test(S("rphmlekgfscndtaobiqj"), S("lsckfnqgdahejiopbtmr"), 20, 19);
+ test(S("liatsqdoegkmfcnbhrpj"), S(""), 21, S::npos);
+ test(S("binjagtfldkrspcomqeh"), S("gfsrt"), 21, 12);
+ test(S("latkmisecnorjbfhqpdg"), S("pfsocbhjtm"), 21, 17);
+ test(S("lecfratdjkhnsmqpoigb"), S("tpflmdnoicjgkberhqsa"), 21, 19);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), S::npos);
+ test(S(""), S("laenf"), S::npos);
+ test(S(""), S("pqlnkmbdjo"), S::npos);
+ test(S(""), S("qkamfogpnljdcshbreti"), S::npos);
+ test(S("nhmko"), S(""), S::npos);
+ test(S("lahfb"), S("irkhs"), 2);
+ test(S("gmfhd"), S("kantesmpgj"), 1);
+ test(S("odaft"), S("oknlrstdpiqmjbaghcfe"), 4);
+ test(S("eolhfgpjqk"), S(""), S::npos);
+ test(S("nbatdlmekr"), S("bnrpe"), 9);
+ test(S("jdmciepkaq"), S("jtdaefblso"), 8);
+ test(S("hkbgspoflt"), S("oselktgbcapndfjihrmq"), 9);
+ test(S("gprdcokbnjhlsfmtieqa"), S(""), S::npos);
+ test(S("qjghlnftcaismkropdeb"), S("bjaht"), 19);
+ test(S("pnalfrdtkqcmojiesbhg"), S("hjlcmgpket"), 19);
+ test(S("pniotcfrhqsmgdkjbael"), S("htaobedqikfplcgjsmrn"), 19);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+}
diff --git a/test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp
new file mode 100644
index 000000000000..9380f6cd82a0
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_pointer_size.pass.cpp
@@ -0,0 +1,172 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// constexpr size_type find(const charT* s, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.find(str, pos) == x);
+ if (x != S::npos)
+ {
+ typename S::size_type n = S::traits_type::length(str);
+ assert(pos <= x && x + n <= s.size());
+ }
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.find(str) == x);
+ if (x != S::npos)
+ {
+ typename S::size_type n = S::traits_type::length(str);
+ assert(0 <= x && x + n <= s.size());
+ }
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0);
+ test(S(""), "abcde", 0, S::npos);
+ test(S(""), "abcdeabcde", 0, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S(""), "", 1, S::npos);
+ test(S(""), "abcde", 1, S::npos);
+ test(S(""), "abcdeabcde", 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcde"), "", 0, 0);
+ test(S("abcde"), "abcde", 0, 0);
+ test(S("abcde"), "abcdeabcde", 0, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S("abcde"), "", 1, 1);
+ test(S("abcde"), "abcde", 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcde"), "", 2, 2);
+ test(S("abcde"), "abcde", 2, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, S::npos);
+ test(S("abcde"), "", 4, 4);
+ test(S("abcde"), "abcde", 4, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, S::npos);
+ test(S("abcde"), "", 5, 5);
+ test(S("abcde"), "abcde", 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
+ test(S("abcde"), "", 6, S::npos);
+ test(S("abcde"), "abcde", 6, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, S::npos);
+ test(S("abcdeabcde"), "", 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S("abcdeabcde"), "", 1, 1);
+ test(S("abcdeabcde"), "abcde", 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcdeabcde"), "", 5, 5);
+ test(S("abcdeabcde"), "abcde", 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
+ test(S("abcdeabcde"), "", 9, 9);
+ test(S("abcdeabcde"), "abcde", 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, S::npos);
+ test(S("abcdeabcde"), "", 10, 10);
+ test(S("abcdeabcde"), "abcde", 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos);
+ test(S("abcdeabcde"), "", 11, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 1, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 19, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 20, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", 0);
+ test(S(""), "abcde", S::npos);
+ test(S(""), "abcdeabcde", S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcde"), "", 0);
+ test(S("abcde"), "abcde", 0);
+ test(S("abcde"), "abcdeabcde", S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcdeabcde"), "", 0);
+ test(S("abcdeabcde"), "abcde", 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find( "") == 0, "" );
+ static_assert (sv1.find( "abcde") == SV::npos, "" );
+ static_assert (sv2.find( "") == 0, "" );
+ static_assert (sv2.find( "abcde") == 0, "" );
+ static_assert (sv2.find( "abcde", 1) == SV::npos, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..da01b75e7070
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_pointer_size_size.pass.cpp
@@ -0,0 +1,394 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.find(str, pos, n) == x);
+ if (x != S::npos)
+ assert(pos <= x && x + n <= s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, 0);
+ test(S(""), "abcde", 0, 0, 0);
+ test(S(""), "abcde", 0, 1, S::npos);
+ test(S(""), "abcde", 0, 2, S::npos);
+ test(S(""), "abcde", 0, 4, S::npos);
+ test(S(""), "abcde", 0, 5, S::npos);
+ test(S(""), "abcdeabcde", 0, 0, 0);
+ test(S(""), "abcdeabcde", 0, 1, S::npos);
+ test(S(""), "abcdeabcde", 0, 5, S::npos);
+ test(S(""), "abcdeabcde", 0, 9, S::npos);
+ test(S(""), "abcdeabcde", 0, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S(""), "", 1, 0, S::npos);
+ test(S(""), "abcde", 1, 0, S::npos);
+ test(S(""), "abcde", 1, 1, S::npos);
+ test(S(""), "abcde", 1, 2, S::npos);
+ test(S(""), "abcde", 1, 4, S::npos);
+ test(S(""), "abcde", 1, 5, S::npos);
+ test(S(""), "abcdeabcde", 1, 0, S::npos);
+ test(S(""), "abcdeabcde", 1, 1, S::npos);
+ test(S(""), "abcdeabcde", 1, 5, S::npos);
+ test(S(""), "abcdeabcde", 1, 9, S::npos);
+ test(S(""), "abcdeabcde", 1, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 0, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcde"), "", 0, 0, 0);
+ test(S("abcde"), "abcde", 0, 0, 0);
+ test(S("abcde"), "abcde", 0, 1, 0);
+ test(S("abcde"), "abcde", 0, 2, 0);
+ test(S("abcde"), "abcde", 0, 4, 0);
+ test(S("abcde"), "abcde", 0, 5, 0);
+ test(S("abcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcde"), "abcdeabcde", 0, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 0, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S("abcde"), "", 1, 0, 1);
+ test(S("abcde"), "abcde", 1, 0, 1);
+ test(S("abcde"), "abcde", 1, 1, S::npos);
+ test(S("abcde"), "abcde", 1, 2, S::npos);
+ test(S("abcde"), "abcde", 1, 4, S::npos);
+ test(S("abcde"), "abcde", 1, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcde"), "abcdeabcde", 1, 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcde"), "", 2, 0, 2);
+ test(S("abcde"), "abcde", 2, 0, 2);
+ test(S("abcde"), "abcde", 2, 1, S::npos);
+ test(S("abcde"), "abcde", 2, 2, S::npos);
+ test(S("abcde"), "abcde", 2, 4, S::npos);
+ test(S("abcde"), "abcde", 2, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, 0, 2);
+ test(S("abcde"), "abcdeabcde", 2, 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 0, 2);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 20, S::npos);
+ test(S("abcde"), "", 4, 0, 4);
+ test(S("abcde"), "abcde", 4, 0, 4);
+ test(S("abcde"), "abcde", 4, 1, S::npos);
+ test(S("abcde"), "abcde", 4, 2, S::npos);
+ test(S("abcde"), "abcde", 4, 4, S::npos);
+ test(S("abcde"), "abcde", 4, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, 0, 4);
+ test(S("abcde"), "abcdeabcde", 4, 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 0, 4);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 20, S::npos);
+ test(S("abcde"), "", 5, 0, 5);
+ test(S("abcde"), "abcde", 5, 0, 5);
+ test(S("abcde"), "abcde", 5, 1, S::npos);
+ test(S("abcde"), "abcde", 5, 2, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S("abcde"), "abcde", 5, 4, S::npos);
+ test(S("abcde"), "abcde", 5, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, 0, 5);
+ test(S("abcde"), "abcdeabcde", 5, 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 0, 5);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos);
+ test(S("abcde"), "", 6, 0, S::npos);
+ test(S("abcde"), "abcde", 6, 0, S::npos);
+ test(S("abcde"), "abcde", 6, 1, S::npos);
+ test(S("abcde"), "abcde", 6, 2, S::npos);
+ test(S("abcde"), "abcde", 6, 4, S::npos);
+ test(S("abcde"), "abcde", 6, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 0, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 1, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 5, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 0, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 20, S::npos);
+ test(S("abcdeabcde"), "", 0, 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcde", 0, 2, 0);
+ test(S("abcdeabcde"), "abcde", 0, 4, 0);
+ test(S("abcdeabcde"), "abcde", 0, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S("abcdeabcde"), "", 1, 0, 1);
+ test(S("abcdeabcde"), "abcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcde", 1, 1, 5);
+ test(S("abcdeabcde"), "abcde", 1, 2, 5);
+ test(S("abcdeabcde"), "abcde", 1, 4, 5);
+ test(S("abcdeabcde"), "abcde", 1, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcdeabcde"), "", 5, 0, 5);
+ test(S("abcdeabcde"), "abcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcde", 5, 2, 5);
+ test(S("abcdeabcde"), "abcde", 5, 4, 5);
+ test(S("abcdeabcde"), "abcde", 5, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos);
+ test(S("abcdeabcde"), "", 9, 0, 9);
+ test(S("abcdeabcde"), "abcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcde", 9, 1, S::npos);
+ test(S("abcdeabcde"), "abcde", 9, 2, S::npos);
+ test(S("abcdeabcde"), "abcde", 9, 4, S::npos);
+ test(S("abcdeabcde"), "abcde", 9, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 20, S::npos);
+ test(S("abcdeabcde"), "", 10, 0, 10);
+ test(S("abcdeabcde"), "abcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcde", 10, 1, S::npos);
+ test(S("abcdeabcde"), "abcde", 10, 2, S::npos);
+ test(S("abcdeabcde"), "abcde", 10, 4, S::npos);
+ test(S("abcdeabcde"), "abcde", 10, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 1, S::npos);
+}
+
+template <class S>
+void test2()
+{
+ test(S("abcdeabcde"), "abcdeabcde", 10, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos);
+ test(S("abcdeabcde"), "", 11, 0, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, 0, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, 1, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, 2, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, 4, S::npos);
+ test(S("abcdeabcde"), "abcde", 11, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 0, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 5, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 9, S::npos);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 0, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 1, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 10, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 2, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 4, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 9, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 2, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 4, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 9, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 10, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 5);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 2, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 4, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 5, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 5, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 9, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 2, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 4, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 9, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 2, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 4, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 9, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20);
+}
+
+template <class S>
+void test3()
+{
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 21, 0, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 0, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 2, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 4, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 0, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 5, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 9, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, S::npos);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find( "", 0, 0 ) == 0, "" );
+ static_assert (sv1.find( "abcde", 0, 0 ) == 0, "" );
+ static_assert (sv1.find( "abcde", 0, 1 ) == SV::npos, "" );
+ static_assert (sv2.find( "", 0, 0 ) == 0, "" );
+ static_assert (sv2.find( "abcde", 0, 0 ) == 0, "" );
+ static_assert (sv2.find( "abcde", 0, 1 ) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp
new file mode 100644
index 000000000000..387e834f4998
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/find_string_view_size.pass.cpp
@@ -0,0 +1,165 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type find(const basic_string_view& str, size_type pos = 0) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.find(str, pos) == x);
+ if (x != S::npos)
+ assert(pos <= x && x + str.size() <= s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.find(str) == x);
+ if (x != S::npos)
+ assert(0 <= x && x + str.size() <= s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, 0);
+ test(S(""), S("abcde"), 0, S::npos);
+ test(S(""), S("abcdeabcde"), 0, S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S(""), S(""), 1, S::npos);
+ test(S(""), S("abcde"), 1, S::npos);
+ test(S(""), S("abcdeabcde"), 1, S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcde"), S(""), 0, 0);
+ test(S("abcde"), S("abcde"), 0, 0);
+ test(S("abcde"), S("abcdeabcde"), 0, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S("abcde"), S(""), 1, 1);
+ test(S("abcde"), S("abcde"), 1, S::npos);
+ test(S("abcde"), S("abcdeabcde"), 1, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcde"), S(""), 2, 2);
+ test(S("abcde"), S("abcde"), 2, S::npos);
+ test(S("abcde"), S("abcdeabcde"), 2, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 2, S::npos);
+ test(S("abcde"), S(""), 4, 4);
+ test(S("abcde"), S("abcde"), 4, S::npos);
+ test(S("abcde"), S("abcdeabcde"), 4, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 4, S::npos);
+ test(S("abcde"), S(""), 5, 5);
+ test(S("abcde"), S("abcde"), 5, S::npos);
+ test(S("abcde"), S("abcdeabcde"), 5, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos);
+ test(S("abcde"), S(""), 6, S::npos);
+ test(S("abcde"), S("abcde"), 6, S::npos);
+ test(S("abcde"), S("abcdeabcde"), 6, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 6, S::npos);
+ test(S("abcdeabcde"), S(""), 0, 0);
+ test(S("abcdeabcde"), S("abcde"), 0, 0);
+ test(S("abcdeabcde"), S("abcdeabcde"), 0, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S("abcdeabcde"), S(""), 1, 1);
+ test(S("abcdeabcde"), S("abcde"), 1, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 1, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcdeabcde"), S(""), 5, 5);
+ test(S("abcdeabcde"), S("abcde"), 5, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 5, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos);
+ test(S("abcdeabcde"), S(""), 9, 9);
+ test(S("abcdeabcde"), S("abcde"), 9, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcde"), 9, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 9, S::npos);
+ test(S("abcdeabcde"), S(""), 10, 10);
+ test(S("abcdeabcde"), S("abcde"), 10, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcde"), 10, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos);
+ test(S("abcdeabcde"), S(""), 11, S::npos);
+ test(S("abcdeabcde"), S("abcde"), 11, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcde"), 11, S::npos);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 11, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 1, 1);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 1, 5);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 19, 19);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 19, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 20, 20);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 21, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, S::npos);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), 0);
+ test(S(""), S("abcde"), S::npos);
+ test(S(""), S("abcdeabcde"), S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcde"), S(""), 0);
+ test(S("abcde"), S("abcde"), 0);
+ test(S("abcde"), S("abcdeabcde"), S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcdeabcde"), S(""), 0);
+ test(S("abcdeabcde"), S("abcde"), 0);
+ test(S("abcdeabcde"), S("abcdeabcde"), 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.find(sv1) == 0, "" );
+ static_assert (sv1.find(sv2) == SV::npos, "" );
+ static_assert (sv2.find(sv1) == 0, "" );
+ static_assert (sv2.find(sv2) == 0, "" );
+ static_assert (sv2.find(sv2, 1 ) == SV::npos, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp b/test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp
new file mode 100644
index 000000000000..6fc87b8e935b
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/rfind_char_size.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+// constexpr size_type rfind(charT c, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.rfind(c, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x + 1 <= s.size());
+}
+
+template <class S>
+void
+test(const S& s, typename S::value_type c, typename S::size_type x)
+{
+ assert(s.rfind(c) == x);
+ if (x != S::npos)
+ assert(x + 1 <= s.size());
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test(S(""), 'b', 0, S::npos);
+ test(S(""), 'b', 1, S::npos);
+ test(S("abcde"), 'b', 0, S::npos);
+ test(S("abcde"), 'b', 1, 1);
+ test(S("abcde"), 'b', 2, 1);
+ test(S("abcde"), 'b', 4, 1);
+ test(S("abcde"), 'b', 5, 1);
+ test(S("abcde"), 'b', 6, 1);
+ test(S("abcdeabcde"), 'b', 0, S::npos);
+ test(S("abcdeabcde"), 'b', 1, 1);
+ test(S("abcdeabcde"), 'b', 5, 1);
+ test(S("abcdeabcde"), 'b', 9, 6);
+ test(S("abcdeabcde"), 'b', 10, 6);
+ test(S("abcdeabcde"), 'b', 11, 6);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 0, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 1, 1);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 10, 6);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 19, 16);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 20, 16);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 21, 16);
+
+ test(S(""), 'b', S::npos);
+ test(S("abcde"), 'b', 1);
+ test(S("abcdeabcde"), 'b', 6);
+ test(S("abcdeabcdeabcdeabcde"), 'b', 16);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.rfind( 'b', 0 ) == SV::npos, "" );
+ static_assert (sv1.rfind( 'b', 1 ) == SV::npos, "" );
+ static_assert (sv2.rfind( 'b', 0 ) == SV::npos, "" );
+ static_assert (sv2.rfind( 'b', 1 ) == 1, "" );
+ static_assert (sv2.rfind( 'b', 2 ) == 1, "" );
+ static_assert (sv2.rfind( 'b', 3 ) == 1, "" );
+ static_assert (sv2.rfind( 'b', 4 ) == 1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp
new file mode 100644
index 000000000000..4d7688206528
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/rfind_pointer_size.pass.cpp
@@ -0,0 +1,172 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+// constexpr size_type rfind(const charT* s, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type x)
+{
+ assert(s.rfind(str, pos) == x);
+ if (x != S::npos)
+ {
+ typename S::size_type n = S::traits_type::length(str);
+ assert(x <= pos && x + n <= s.size());
+ }
+}
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type x)
+{
+ assert(s.rfind(str) == x);
+ if (x != S::npos)
+ {
+ typename S::size_type pos = s.size();
+ typename S::size_type n = S::traits_type::length(str);
+ assert(x <= pos && x + n <= s.size());
+ }
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0);
+ test(S(""), "abcde", 0, S::npos);
+ test(S(""), "abcdeabcde", 0, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S(""), "", 1, 0);
+ test(S(""), "abcde", 1, S::npos);
+ test(S(""), "abcdeabcde", 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcde"), "", 0, 0);
+ test(S("abcde"), "abcde", 0, 0);
+ test(S("abcde"), "abcdeabcde", 0, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S("abcde"), "", 1, 1);
+ test(S("abcde"), "abcde", 1, 0);
+ test(S("abcde"), "abcdeabcde", 1, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcde"), "", 2, 2);
+ test(S("abcde"), "abcde", 2, 0);
+ test(S("abcde"), "abcdeabcde", 2, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, S::npos);
+ test(S("abcde"), "", 4, 4);
+ test(S("abcde"), "abcde", 4, 0);
+ test(S("abcde"), "abcdeabcde", 4, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, S::npos);
+ test(S("abcde"), "", 5, 5);
+ test(S("abcde"), "abcde", 5, 0);
+ test(S("abcde"), "abcdeabcde", 5, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
+ test(S("abcde"), "", 6, 5);
+ test(S("abcde"), "abcde", 6, 0);
+ test(S("abcde"), "abcdeabcde", 6, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, S::npos);
+ test(S("abcdeabcde"), "", 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, S::npos);
+ test(S("abcdeabcde"), "", 1, 1);
+ test(S("abcdeabcde"), "abcde", 1, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, S::npos);
+ test(S("abcdeabcde"), "", 5, 5);
+ test(S("abcdeabcde"), "abcde", 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, S::npos);
+ test(S("abcdeabcde"), "", 9, 9);
+ test(S("abcdeabcde"), "abcde", 9, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, S::npos);
+ test(S("abcdeabcde"), "", 10, 10);
+ test(S("abcdeabcde"), "abcde", 10, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, S::npos);
+ test(S("abcdeabcde"), "", 11, 10);
+ test(S("abcdeabcde"), "abcde", 11, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 1, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 19, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 20, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 21, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), "", 0);
+ test(S(""), "abcde", S::npos);
+ test(S(""), "abcdeabcde", S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcde"), "", 5);
+ test(S("abcde"), "abcde", 0);
+ test(S("abcde"), "abcdeabcde", S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcdeabcde"), "", 10);
+ test(S("abcdeabcde"), "abcde", 5);
+ test(S("abcdeabcde"), "abcdeabcde", 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.rfind( "") == 0, "" );
+ static_assert (sv1.rfind( "abcde") == SV::npos, "" );
+ static_assert (sv2.rfind( "") == 5, "" );
+ static_assert (sv2.rfind( "abcde") == 0, "" );
+ static_assert (sv2.rfind( "abcde", 1) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp b/test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
new file mode 100644
index 000000000000..ce16d418e194
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/rfind_pointer_size_size.pass.cpp
@@ -0,0 +1,393 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+// constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const typename S::value_type* str, typename S::size_type pos,
+ typename S::size_type n, typename S::size_type x)
+{
+ assert(s.rfind(str, pos, n) == x);
+ if (x != S::npos)
+ assert(x <= pos && x + n <= s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), "", 0, 0, 0);
+ test(S(""), "abcde", 0, 0, 0);
+ test(S(""), "abcde", 0, 1, S::npos);
+ test(S(""), "abcde", 0, 2, S::npos);
+ test(S(""), "abcde", 0, 4, S::npos);
+ test(S(""), "abcde", 0, 5, S::npos);
+ test(S(""), "abcdeabcde", 0, 0, 0);
+ test(S(""), "abcdeabcde", 0, 1, S::npos);
+ test(S(""), "abcdeabcde", 0, 5, S::npos);
+ test(S(""), "abcdeabcde", 0, 9, S::npos);
+ test(S(""), "abcdeabcde", 0, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S(""), "", 1, 0, 0);
+ test(S(""), "abcde", 1, 0, 0);
+ test(S(""), "abcde", 1, 1, S::npos);
+ test(S(""), "abcde", 1, 2, S::npos);
+ test(S(""), "abcde", 1, 4, S::npos);
+ test(S(""), "abcde", 1, 5, S::npos);
+ test(S(""), "abcdeabcde", 1, 0, 0);
+ test(S(""), "abcdeabcde", 1, 1, S::npos);
+ test(S(""), "abcdeabcde", 1, 5, S::npos);
+ test(S(""), "abcdeabcde", 1, 9, S::npos);
+ test(S(""), "abcdeabcde", 1, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 0, 0);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 1, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 10, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S(""), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcde"), "", 0, 0, 0);
+ test(S("abcde"), "abcde", 0, 0, 0);
+ test(S("abcde"), "abcde", 0, 1, 0);
+ test(S("abcde"), "abcde", 0, 2, 0);
+ test(S("abcde"), "abcde", 0, 4, 0);
+ test(S("abcde"), "abcde", 0, 5, 0);
+ test(S("abcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcde"), "abcdeabcde", 0, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 0, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S("abcde"), "", 1, 0, 1);
+ test(S("abcde"), "abcde", 1, 0, 1);
+ test(S("abcde"), "abcde", 1, 1, 0);
+ test(S("abcde"), "abcde", 1, 2, 0);
+ test(S("abcde"), "abcde", 1, 4, 0);
+ test(S("abcde"), "abcde", 1, 5, 0);
+ test(S("abcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcde"), "abcdeabcde", 1, 1, 0);
+ test(S("abcde"), "abcdeabcde", 1, 5, 0);
+ test(S("abcde"), "abcdeabcde", 1, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 1, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcde"), "", 2, 0, 2);
+ test(S("abcde"), "abcde", 2, 0, 2);
+ test(S("abcde"), "abcde", 2, 1, 0);
+ test(S("abcde"), "abcde", 2, 2, 0);
+ test(S("abcde"), "abcde", 2, 4, 0);
+ test(S("abcde"), "abcde", 2, 5, 0);
+ test(S("abcde"), "abcdeabcde", 2, 0, 2);
+ test(S("abcde"), "abcdeabcde", 2, 1, 0);
+ test(S("abcde"), "abcdeabcde", 2, 5, 0);
+ test(S("abcde"), "abcdeabcde", 2, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 2, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 0, 2);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 2, 20, S::npos);
+ test(S("abcde"), "", 4, 0, 4);
+ test(S("abcde"), "abcde", 4, 0, 4);
+ test(S("abcde"), "abcde", 4, 1, 0);
+ test(S("abcde"), "abcde", 4, 2, 0);
+ test(S("abcde"), "abcde", 4, 4, 0);
+ test(S("abcde"), "abcde", 4, 5, 0);
+ test(S("abcde"), "abcdeabcde", 4, 0, 4);
+ test(S("abcde"), "abcdeabcde", 4, 1, 0);
+ test(S("abcde"), "abcdeabcde", 4, 5, 0);
+ test(S("abcde"), "abcdeabcde", 4, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 4, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 0, 4);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 4, 20, S::npos);
+ test(S("abcde"), "", 5, 0, 5);
+ test(S("abcde"), "abcde", 5, 0, 5);
+ test(S("abcde"), "abcde", 5, 1, 0);
+ test(S("abcde"), "abcde", 5, 2, 0);
+}
+
+template <class S>
+void test1()
+{
+ test(S("abcde"), "abcde", 5, 4, 0);
+ test(S("abcde"), "abcde", 5, 5, 0);
+ test(S("abcde"), "abcdeabcde", 5, 0, 5);
+ test(S("abcde"), "abcdeabcde", 5, 1, 0);
+ test(S("abcde"), "abcdeabcde", 5, 5, 0);
+ test(S("abcde"), "abcdeabcde", 5, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 5, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 0, 5);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos);
+ test(S("abcde"), "", 6, 0, 5);
+ test(S("abcde"), "abcde", 6, 0, 5);
+ test(S("abcde"), "abcde", 6, 1, 0);
+ test(S("abcde"), "abcde", 6, 2, 0);
+ test(S("abcde"), "abcde", 6, 4, 0);
+ test(S("abcde"), "abcde", 6, 5, 0);
+ test(S("abcde"), "abcdeabcde", 6, 0, 5);
+ test(S("abcde"), "abcdeabcde", 6, 1, 0);
+ test(S("abcde"), "abcdeabcde", 6, 5, 0);
+ test(S("abcde"), "abcdeabcde", 6, 9, S::npos);
+ test(S("abcde"), "abcdeabcde", 6, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 0, 5);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 1, 0);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 10, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 19, S::npos);
+ test(S("abcde"), "abcdeabcdeabcdeabcde", 6, 20, S::npos);
+ test(S("abcdeabcde"), "", 0, 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcde", 0, 2, 0);
+ test(S("abcdeabcde"), "abcde", 0, 4, 0);
+ test(S("abcdeabcde"), "abcde", 0, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 0, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, S::npos);
+ test(S("abcdeabcde"), "", 1, 0, 1);
+ test(S("abcdeabcde"), "abcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcde", 1, 1, 0);
+ test(S("abcdeabcde"), "abcde", 1, 2, 0);
+ test(S("abcdeabcde"), "abcde", 1, 4, 0);
+ test(S("abcdeabcde"), "abcde", 1, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 5, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 1, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, S::npos);
+ test(S("abcdeabcde"), "", 5, 0, 5);
+ test(S("abcdeabcde"), "abcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcde", 5, 2, 5);
+ test(S("abcdeabcde"), "abcde", 5, 4, 5);
+ test(S("abcdeabcde"), "abcde", 5, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 5, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 0, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 5, 20, S::npos);
+ test(S("abcdeabcde"), "", 9, 0, 9);
+ test(S("abcdeabcde"), "abcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcde", 9, 1, 5);
+ test(S("abcdeabcde"), "abcde", 9, 2, 5);
+ test(S("abcdeabcde"), "abcde", 9, 4, 5);
+ test(S("abcdeabcde"), "abcde", 9, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 9, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 0, 9);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 9, 20, S::npos);
+ test(S("abcdeabcde"), "", 10, 0, 10);
+ test(S("abcdeabcde"), "abcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcde", 10, 1, 5);
+ test(S("abcdeabcde"), "abcde", 10, 2, 5);
+ test(S("abcdeabcde"), "abcde", 10, 4, 5);
+ test(S("abcdeabcde"), "abcde", 10, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 1, 5);
+}
+
+template <class S>
+void test2()
+{
+ test(S("abcdeabcde"), "abcdeabcde", 10, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 10, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, S::npos);
+ test(S("abcdeabcde"), "", 11, 0, 10);
+ test(S("abcdeabcde"), "abcde", 11, 0, 10);
+ test(S("abcdeabcde"), "abcde", 11, 1, 5);
+ test(S("abcdeabcde"), "abcde", 11, 2, 5);
+ test(S("abcdeabcde"), "abcde", 11, 4, 5);
+ test(S("abcdeabcde"), "abcde", 11, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 5, 5);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 9, 0);
+ test(S("abcdeabcde"), "abcdeabcde", 11, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 0, 10);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 1, 5);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 10, 0);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 19, S::npos);
+ test(S("abcdeabcde"), "abcdeabcdeabcdeabcde", 11, 20, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), "", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 2, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 4, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 0, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 9, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 0, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 0, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 2, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 4, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 1, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 5, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 9, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 1, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 0, 1);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 1, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 2, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 4, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 10, 5, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 5, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 9, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 10, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 0, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 1, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 10, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 2, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 4, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 19, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 9, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 19, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 0, 19);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 19, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 2, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 4, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 20, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 9, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 20, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 0, 20);
+}
+
+template <class S>
+void test3()
+{
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 20, 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), "", 21, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 2, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 4, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcde", 21, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 5, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 9, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcde", 21, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 0, 20);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 1, 15);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), "abcdeabcdeabcdeabcde", 21, 20, 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ test2<S>();
+ test3<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.rfind( "", 0, 0 ) == 0, "" );
+ static_assert (sv1.rfind( "abcde", 0, 0 ) == 0, "" );
+ static_assert (sv1.rfind( "abcde", 0, 1 ) == SV::npos, "" );
+ static_assert (sv2.rfind( "", 0, 0 ) == 0, "" );
+ static_assert (sv2.rfind( "abcde", 0, 0 ) == 0, "" );
+ static_assert (sv2.rfind( "abcde", 0, 1 ) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp b/test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp
new file mode 100644
index 000000000000..eded51af2447
--- /dev/null
+++ b/test/std/strings/string.view/string.view.find/rfind_string_view_size.pass.cpp
@@ -0,0 +1,165 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr size_type rfind(const basic_string& str, size_type pos = npos) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
+{
+ assert(s.rfind(str, pos) == x);
+ if (x != S::npos)
+ assert(x <= pos && x + str.size() <= s.size());
+}
+
+template <class S>
+void
+test(const S& s, const S& str, typename S::size_type x)
+{
+ assert(s.rfind(str) == x);
+ if (x != S::npos)
+ assert(0 <= x && x + str.size() <= s.size());
+}
+
+template <class S>
+void test0()
+{
+ test(S(""), S(""), 0, 0);
+ test(S(""), S("abcde"), 0, S::npos);
+ test(S(""), S("abcdeabcde"), 0, S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S(""), S(""), 1, 0);
+ test(S(""), S("abcde"), 1, S::npos);
+ test(S(""), S("abcdeabcde"), 1, S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcde"), S(""), 0, 0);
+ test(S("abcde"), S("abcde"), 0, 0);
+ test(S("abcde"), S("abcdeabcde"), 0, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S("abcde"), S(""), 1, 1);
+ test(S("abcde"), S("abcde"), 1, 0);
+ test(S("abcde"), S("abcdeabcde"), 1, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcde"), S(""), 2, 2);
+ test(S("abcde"), S("abcde"), 2, 0);
+ test(S("abcde"), S("abcdeabcde"), 2, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 2, S::npos);
+ test(S("abcde"), S(""), 4, 4);
+ test(S("abcde"), S("abcde"), 4, 0);
+ test(S("abcde"), S("abcdeabcde"), 4, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 4, S::npos);
+ test(S("abcde"), S(""), 5, 5);
+ test(S("abcde"), S("abcde"), 5, 0);
+ test(S("abcde"), S("abcdeabcde"), 5, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos);
+ test(S("abcde"), S(""), 6, 5);
+ test(S("abcde"), S("abcde"), 6, 0);
+ test(S("abcde"), S("abcdeabcde"), 6, S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), 6, S::npos);
+ test(S("abcdeabcde"), S(""), 0, 0);
+ test(S("abcdeabcde"), S("abcde"), 0, 0);
+ test(S("abcdeabcde"), S("abcdeabcde"), 0, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, S::npos);
+ test(S("abcdeabcde"), S(""), 1, 1);
+ test(S("abcdeabcde"), S("abcde"), 1, 0);
+ test(S("abcdeabcde"), S("abcdeabcde"), 1, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, S::npos);
+ test(S("abcdeabcde"), S(""), 5, 5);
+ test(S("abcdeabcde"), S("abcde"), 5, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 5, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 5, S::npos);
+ test(S("abcdeabcde"), S(""), 9, 9);
+ test(S("abcdeabcde"), S("abcde"), 9, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 9, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 9, S::npos);
+ test(S("abcdeabcde"), S(""), 10, 10);
+ test(S("abcdeabcde"), S("abcde"), 10, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 10, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, S::npos);
+ test(S("abcdeabcde"), S(""), 11, 10);
+ test(S("abcdeabcde"), S("abcde"), 11, 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 11, 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), 11, S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 1, 1);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 1, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 10, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 19, 19);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 19, 15);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 19, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 19, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 20, 20);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 20, 15);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 20, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 20, 0);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 21, 20);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 21, 15);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 21, 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 21, 0);
+}
+
+template <class S>
+void test1()
+{
+ test(S(""), S(""), 0);
+ test(S(""), S("abcde"), S::npos);
+ test(S(""), S("abcdeabcde"), S::npos);
+ test(S(""), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcde"), S(""), 5);
+ test(S("abcde"), S("abcde"), 0);
+ test(S("abcde"), S("abcdeabcde"), S::npos);
+ test(S("abcde"), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcdeabcde"), S(""), 10);
+ test(S("abcdeabcde"), S("abcde"), 5);
+ test(S("abcdeabcde"), S("abcdeabcde"), 0);
+ test(S("abcdeabcde"), S("abcdeabcdeabcdeabcde"), S::npos);
+ test(S("abcdeabcdeabcdeabcde"), S(""), 20);
+ test(S("abcdeabcdeabcdeabcde"), S("abcde"), 15);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcde"), 10);
+ test(S("abcdeabcdeabcdeabcde"), S("abcdeabcdeabcdeabcde"), 0);
+}
+
+int main()
+{
+ {
+ typedef std::string_view S;
+ test0<S>();
+ test1<S>();
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+
+ static_assert (sv1.rfind(sv1) == 0, "" );
+ static_assert (sv1.rfind(sv2) == SV::npos, "" );
+ static_assert (sv2.rfind(sv1) == 5, "" );
+ static_assert (sv2.rfind(sv2) == 0, "" );
+ static_assert (sv2.rfind(sv2, 1) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp
new file mode 100644
index 000000000000..63099e2c8864
--- /dev/null
+++ b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class T>
+// struct hash
+// : public unary_function<T, size_t>
+// {
+// size_t operator()(T val) const;
+// };
+
+// Not very portable
+
+#include <string_view>
+#include <cassert>
+#include <type_traits>
+
+using std::string_view;
+
+template <class T>
+void
+test()
+{
+ typedef std::hash<T> H;
+ static_assert((std::is_same<typename H::argument_type, T>::value), "" );
+ static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
+ H h;
+// std::string g1 = "1234567890";
+// std::string g2 = "1234567891";
+ typedef typename T::value_type char_type;
+ char_type g1 [ 10 ];
+ char_type g2 [ 10 ];
+ for ( int i = 0; i < 10; ++i )
+ g1[i] = g2[9-i] = static_cast<char_type>('0' + i);
+ T s1(g1, 10);
+ T s2(g2, 10);
+ assert(h(s1) != h(s2));
+}
+
+int main()
+{
+ test<std::string_view>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+ test<std::u16string_view>();
+ test<std::u32string_view>();
+#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ test<std::wstring_view>();
+}
diff --git a/test/std/strings/string.view/string.view.io/stream_insert.pass.cpp b/test/std/strings/string.view/string.view.io/stream_insert.pass.cpp
new file mode 100644
index 000000000000..343c297d2a24
--- /dev/null
+++ b/test/std/strings/string.view/string.view.io/stream_insert.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// template<class charT, class traits, class Allocator>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os,
+// const basic_string_view<charT,traits> str);
+
+#include <string_view>
+#include <sstream>
+#include <cassert>
+
+using std::string_view;
+using std::wstring_view;
+
+int main()
+{
+ {
+ std::ostringstream out;
+ string_view sv("some text");
+ out << sv;
+ assert(out.good());
+ assert(sv == out.str());
+ }
+ {
+ std::ostringstream out;
+ std::string s("some text");
+ string_view sv(s);
+ out.width(12);
+ out << sv;
+ assert(out.good());
+ assert(" " + s == out.str());
+ }
+ {
+ std::wostringstream out;
+ wstring_view sv(L"some text");
+ out << sv;
+ assert(out.good());
+ assert(sv == out.str());
+ }
+ {
+ std::wostringstream out;
+ std::wstring s(L"some text");
+ wstring_view sv(s);
+ out.width(12);
+ out << sv;
+ assert(out.good());
+ assert(L" " + s == out.str());
+ }
+}
diff --git a/test/std/strings/string.view/string.view.iterators/begin.pass.cpp b/test/std/strings/string.view/string.view.iterators/begin.pass.cpp
new file mode 100644
index 000000000000..b766c51682fa
--- /dev/null
+++ b/test/std/strings/string.view/string.view.iterators/begin.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr const_iterator begin() const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class S>
+void
+test(S s)
+{
+ const S& cs = s;
+ typename S::iterator b = s.begin();
+ typename S::const_iterator cb1 = cs.begin();
+ typename S::const_iterator cb2 = s.cbegin();
+ if (!s.empty())
+ {
+ assert( *b == s[0]);
+ assert( &*b == &s[0]);
+ assert( *cb1 == s[0]);
+ assert(&*cb1 == &s[0]);
+ assert( *cb2 == s[0]);
+ assert(&*cb2 == &s[0]);
+
+ }
+ assert( b == cb1);
+ assert( b == cb2);
+ assert(cb1 == cb2);
+}
+
+
+int main()
+{
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test(string_view ());
+ test(u16string_view());
+ test(u32string_view());
+ test(wstring_view ());
+ test(string_view ( "123"));
+ test(wstring_view (L"123"));
+#if TEST_STD_VER >= 11
+ test(u16string_view{u"123"});
+ test(u32string_view{U"123"});
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr string_view sv { "123", 3 };
+ constexpr u16string_view u16sv {u"123", 3 };
+ constexpr u32string_view u32sv {U"123", 3 };
+ constexpr wstring_view wsv {L"123", 3 };
+
+ static_assert ( *sv.begin() == sv[0], "" );
+ static_assert ( *u16sv.begin() == u16sv[0], "" );
+ static_assert ( *u32sv.begin() == u32sv[0], "" );
+ static_assert ( *wsv.begin() == wsv[0], "" );
+
+ static_assert ( *sv.cbegin() == sv[0], "" );
+ static_assert ( *u16sv.cbegin() == u16sv[0], "" );
+ static_assert ( *u32sv.cbegin() == u32sv[0], "" );
+ static_assert ( *wsv.cbegin() == wsv[0], "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.iterators/end.pass.cpp b/test/std/strings/string.view/string.view.iterators/end.pass.cpp
new file mode 100644
index 000000000000..b5759d701612
--- /dev/null
+++ b/test/std/strings/string.view/string.view.iterators/end.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr const_iterator end() const;
+
+#include <string_view>
+#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
+
+template <class S>
+void
+test(S s)
+{
+ const S& cs = s;
+ typename S::iterator e = s.end();
+ typename S::const_iterator ce1 = cs.end();
+ typename S::const_iterator ce2 = s.cend();
+
+ if (s.empty())
+ {
+ assert( e == s.begin());
+ assert(ce1 == cs.begin());
+ assert(ce2 == s.begin());
+ }
+ else
+ {
+ assert( e != s.begin());
+ assert(ce1 != cs.begin());
+ assert(ce2 != s.begin());
+ }
+
+ assert(static_cast<std::size_t>( e - s.begin()) == s.size());
+ assert(static_cast<std::size_t>(ce1 - cs.begin()) == cs.size());
+ assert(static_cast<std::size_t>(ce2 - s.cbegin()) == s.size());
+
+ assert( e == ce1);
+ assert( e == ce2);
+ assert(ce1 == ce2);
+}
+
+
+int main()
+{
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test(string_view ());
+ test(u16string_view());
+ test(u32string_view());
+ test(wstring_view ());
+ test(string_view ( "123"));
+ test(wstring_view (L"123"));
+#if TEST_STD_VER >= 11
+ test(u16string_view{u"123"});
+ test(u32string_view{U"123"});
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr string_view sv { "123", 3 };
+ constexpr u16string_view u16sv {u"123", 3 };
+ constexpr u32string_view u32sv {U"123", 3 };
+ constexpr wstring_view wsv {L"123", 3 };
+
+ static_assert ( sv.begin() != sv.end(), "" );
+ static_assert ( u16sv.begin() != u16sv.end(), "" );
+ static_assert ( u32sv.begin() != u32sv.end(), "" );
+ static_assert ( wsv.begin() != wsv.end(), "" );
+
+ static_assert ( sv.begin() != sv.cend(), "" );
+ static_assert ( u16sv.begin() != u16sv.cend(), "" );
+ static_assert ( u32sv.begin() != u32sv.cend(), "" );
+ static_assert ( wsv.begin() != wsv.cend(), "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp
new file mode 100644
index 000000000000..381f792e5ce0
--- /dev/null
+++ b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// const_iterator rbegin() const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class S>
+void
+test(S s)
+{
+ const S& cs = s;
+ typename S::reverse_iterator b = s.rbegin();
+ typename S::const_reverse_iterator cb1 = cs.rbegin();
+ typename S::const_reverse_iterator cb2 = s.crbegin();
+ if (!s.empty())
+ {
+ const size_t last = s.size() - 1;
+ assert( *b == s[last]);
+ assert( &*b == &s[last]);
+ assert( *cb1 == s[last]);
+ assert(&*cb1 == &s[last]);
+ assert( *cb2 == s[last]);
+ assert(&*cb2 == &s[last]);
+
+ }
+ assert( b == cb1);
+ assert( b == cb2);
+ assert(cb1 == cb2);
+}
+
+
+int main()
+{
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test(string_view ());
+ test(u16string_view());
+ test(u32string_view());
+ test(wstring_view ());
+ test(string_view ( "123"));
+ test(wstring_view (L"123"));
+#if TEST_STD_VER >= 11
+ test(u16string_view{u"123"});
+ test(u32string_view{U"123"});
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.iterators/rend.pass.cpp b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp
new file mode 100644
index 000000000000..ca529fb708dc
--- /dev/null
+++ b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr const_iterator rend() const;
+
+#include <string_view>
+#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
+
+template <class S>
+void
+test(S s)
+{
+ const S& cs = s;
+ typename S::reverse_iterator e = s.rend();
+ typename S::const_reverse_iterator ce1 = cs.rend();
+ typename S::const_reverse_iterator ce2 = s.crend();
+
+ if (s.empty())
+ {
+ assert( e == s.rbegin());
+ assert(ce1 == cs.rbegin());
+ assert(ce2 == s.rbegin());
+ }
+ else
+ {
+ assert( e != s.rbegin());
+ assert(ce1 != cs.rbegin());
+ assert(ce2 != s.rbegin());
+ }
+
+ assert(static_cast<std::size_t>( e - s.rbegin()) == s.size());
+ assert(static_cast<std::size_t>(ce1 - cs.rbegin()) == cs.size());
+ assert(static_cast<std::size_t>(ce2 - s.crbegin()) == s.size());
+
+ assert( e == ce1);
+ assert( e == ce2);
+ assert(ce1 == ce2);
+}
+
+
+int main()
+{
+ typedef std::string_view string_view;
+ typedef std::u16string_view u16string_view;
+ typedef std::u32string_view u32string_view;
+ typedef std::wstring_view wstring_view;
+
+ test(string_view ());
+ test(u16string_view());
+ test(u32string_view());
+ test(wstring_view ());
+ test(string_view ( "123"));
+ test(wstring_view (L"123"));
+#if TEST_STD_VER >= 11
+ test(u16string_view{u"123"});
+ test(u32string_view{U"123"});
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp b/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..c1137e80acaf
--- /dev/null
+++ b/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// void clear() noexcept
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test ( const CharT *s, size_t len ) {
+ typedef std::basic_string_view<CharT> SV;
+ {
+ SV sv1 ( s );
+ assert ( sv1.size() == len );
+ assert ( sv1.data() == s );
+
+ sv1.clear ();
+ assert ( sv1.data() == nullptr );
+ assert ( sv1.size() == 0 );
+ assert ( sv1 == SV());
+ }
+}
+
+#if TEST_STD_VER > 11
+constexpr size_t test_ce ( size_t n ) {
+ typedef std::basic_string_view<char> SV;
+ SV sv1{ "ABCDEFGHIJKL", n };
+ sv1.clear();
+ return sv1.size();
+}
+#endif
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+ test ( "", 0 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+ test ( L"", 0 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+ test ( u"", 0 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+ test ( U"", 0 );
+#endif
+
+#if TEST_STD_VER > 11
+ static_assert ( test_ce (5) == 0, "" );
+#endif
+
+}
diff --git a/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp
new file mode 100644
index 000000000000..f2f6313aed93
--- /dev/null
+++ b/test/std/strings/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// void remove_prefix(size_type _n)
+
+#include <string_view>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test ( const CharT *s, size_t len ) {
+ typedef std::basic_string_view<CharT> SV;
+ {
+ SV sv1 ( s );
+ assert ( sv1.size() == len );
+ assert ( sv1.data() == s );
+
+ if ( len > 0 ) {
+ sv1.remove_prefix ( 1 );
+ assert ( sv1.size() == (len - 1));
+ assert ( sv1.data() == (s + 1));
+ sv1.remove_prefix ( len - 1 );
+ }
+
+ assert ( sv1.size() == 0 );
+ sv1.remove_prefix ( 0 );
+ assert ( sv1.size() == 0 );
+ }
+}
+
+#if TEST_STD_VER > 11
+constexpr size_t test_ce ( size_t n, size_t k ) {
+ typedef std::basic_string_view<char> SV;
+ SV sv1{ "ABCDEFGHIJKL", n };
+ sv1.remove_prefix ( k );
+ return sv1.size();
+}
+#endif
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+ test ( "", 0 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+ test ( L"", 0 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+ test ( u"", 0 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+ test ( U"", 0 );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ static_assert ( test_ce ( 5, 0 ) == 5, "" );
+ static_assert ( test_ce ( 5, 1 ) == 4, "" );
+ static_assert ( test_ce ( 5, 5 ) == 0, "" );
+ static_assert ( test_ce ( 9, 3 ) == 6, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp
new file mode 100644
index 000000000000..41f8362d3104
--- /dev/null
+++ b/test/std/strings/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// void remove_suffix(size_type _n)
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test ( const CharT *s, size_t len ) {
+ typedef std::basic_string_view<CharT> SV;
+ {
+ SV sv1 ( s );
+ assert ( sv1.size() == len );
+ assert ( sv1.data() == s );
+
+ if ( len > 0 ) {
+ sv1.remove_suffix ( 1 );
+ assert ( sv1.size() == (len - 1));
+ assert ( sv1.data() == s);
+ sv1.remove_suffix ( len - 1 );
+ }
+
+ assert ( sv1.size() == 0 );
+ sv1.remove_suffix ( 0 );
+ assert ( sv1.size() == 0 );
+ }
+
+}
+
+#if TEST_STD_VER > 11
+constexpr size_t test_ce ( size_t n, size_t k ) {
+ typedef std::basic_string_view<char> SV;
+ SV sv1{ "ABCDEFGHIJKL", n };
+ sv1.remove_suffix ( k );
+ return sv1.size();
+}
+#endif
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+ test ( "", 0 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+ test ( L"", 0 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+ test ( u"", 0 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+ test ( U"", 0 );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ static_assert ( test_ce ( 5, 0 ) == 5, "" );
+ static_assert ( test_ce ( 5, 1 ) == 4, "" );
+ static_assert ( test_ce ( 5, 5 ) == 0, "" );
+ static_assert ( test_ce ( 9, 3 ) == 6, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp b/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp
new file mode 100644
index 000000000000..780fbad5f42b
--- /dev/null
+++ b/test/std/strings/string.view/string.view.modifiers/swap.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+
+// void swap(basic_string_view& _other) noexcept
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test ( const CharT *s, size_t len ) {
+ typedef std::basic_string_view<CharT> SV;
+ {
+ SV sv1(s);
+ SV sv2;
+
+ assert ( sv1.size() == len );
+ assert ( sv1.data() == s );
+ assert ( sv2.size() == 0 );
+
+ sv1.swap ( sv2 );
+ assert ( sv1.size() == 0 );
+ assert ( sv2.size() == len );
+ assert ( sv2.data() == s );
+ }
+
+}
+
+#if TEST_STD_VER > 11
+constexpr size_t test_ce ( size_t n, size_t k ) {
+ typedef std::basic_string_view<char> SV;
+ SV sv1{ "ABCDEFGHIJKL", n };
+ SV sv2 { sv1.data(), k };
+ sv1.swap ( sv2 );
+ return sv1.size();
+}
+#endif
+
+
+int main () {
+ test ( "ABCDE", 5 );
+ test ( "a", 1 );
+ test ( "", 0 );
+
+ test ( L"ABCDE", 5 );
+ test ( L"a", 1 );
+ test ( L"", 0 );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDE", 5 );
+ test ( u"a", 1 );
+ test ( u"", 0 );
+
+ test ( U"ABCDE", 5 );
+ test ( U"a", 1 );
+ test ( U"", 0 );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ static_assert ( test_ce (2, 3) == 3, "" );
+ static_assert ( test_ce (5, 3) == 3, "" );
+ static_assert ( test_ce (0, 1) == 1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.nonmem/quoted.pass.cpp b/test/std/strings/string.view/string.view.nonmem/quoted.pass.cpp
new file mode 100644
index 000000000000..c11e144a0968
--- /dev/null
+++ b/test/std/strings/string.view/string.view.nonmem/quoted.pass.cpp
@@ -0,0 +1,214 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <iomanip>
+
+// quoted
+
+#include <iomanip>
+#include <sstream>
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
+// quoted is C++14 only
+
+bool is_skipws ( const std::istream *is ) {
+ return ( is->flags() & std::ios_base::skipws ) != 0;
+ }
+
+
+bool is_skipws ( const std::wistream *is ) {
+ return ( is->flags() & std::ios_base::skipws ) != 0;
+ }
+
+void round_trip ( const char *p ) {
+ std::stringstream ss;
+ bool skippingws = is_skipws ( &ss );
+ std::string_view sv {p};
+
+ ss << std::quoted(sv);
+ std::string s;
+ ss >> std::quoted(s);
+ assert ( s == sv );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_ws ( const char *p ) {
+ std::stringstream ss;
+ std::noskipws ( ss );
+ bool skippingws = is_skipws ( &ss );
+ std::string_view sv {p};
+
+ ss << std::quoted(sv);
+ std::string s;
+ ss >> std::quoted(s);
+ assert ( s == sv );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_d ( const char *p, char delim ) {
+ std::stringstream ss;
+ std::string_view sv {p};
+
+ ss << std::quoted(sv, delim);
+ std::string s;
+ ss >> std::quoted(s, delim);
+ assert ( s == sv );
+ }
+
+void round_trip_e ( const char *p, char escape ) {
+ std::stringstream ss;
+ std::string_view sv {p};
+
+ ss << std::quoted(sv, '"', escape );
+ std::string s;
+ ss >> std::quoted(s, '"', escape );
+ assert ( s == sv );
+ }
+
+
+
+std::string quote ( const char *p, char delim='"', char escape='\\' ) {
+ std::stringstream ss;
+ ss << std::quoted(p, delim, escape);
+ std::string s;
+ ss >> s; // no quote
+ return s;
+}
+
+std::string unquote ( const char *p, char delim='"', char escape='\\' ) {
+ std::stringstream ss;
+ ss << p;
+ std::string s;
+ ss >> std::quoted(s, delim, escape);
+ return s;
+}
+
+
+void round_trip ( const wchar_t *p ) {
+ std::wstringstream ss;
+ bool skippingws = is_skipws ( &ss );
+ std::wstring_view sv {p};
+
+ ss << std::quoted(sv);
+ std::wstring s;
+ ss >> std::quoted(s);
+ assert ( s == sv );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+
+void round_trip_ws ( const wchar_t *p ) {
+ std::wstringstream ss;
+ std::noskipws ( ss );
+ bool skippingws = is_skipws ( &ss );
+ std::wstring_view sv {p};
+
+ ss << std::quoted(sv);
+ std::wstring s;
+ ss >> std::quoted(s);
+ assert ( s == sv );
+ assert ( skippingws == is_skipws ( &ss ));
+ }
+
+void round_trip_d ( const wchar_t *p, wchar_t delim ) {
+ std::wstringstream ss;
+ std::wstring_view sv {p};
+
+ ss << std::quoted(sv, delim);
+ std::wstring s;
+ ss >> std::quoted(s, delim);
+ assert ( s == sv );
+ }
+
+void round_trip_e ( const wchar_t *p, wchar_t escape ) {
+ std::wstringstream ss;
+ std::wstring_view sv {p};
+
+ ss << std::quoted(sv, wchar_t('"'), escape );
+ std::wstring s;
+ ss >> std::quoted(s, wchar_t('"'), escape );
+ assert ( s == sv );
+ }
+
+
+std::wstring quote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+ std::wstringstream ss;
+ std::wstring_view sv {p};
+
+ ss << std::quoted(sv, delim, escape);
+ std::wstring s;
+ ss >> s; // no quote
+ return s;
+}
+
+std::wstring unquote ( const wchar_t *p, wchar_t delim='"', wchar_t escape='\\' ) {
+ std::wstringstream ss;
+ std::wstring_view sv {p};
+
+ ss << sv;
+ std::wstring s;
+ ss >> std::quoted(s, delim, escape);
+ return s;
+}
+
+int main()
+{
+ round_trip ( "" );
+ round_trip_ws ( "" );
+ round_trip_d ( "", 'q' );
+ round_trip_e ( "", 'q' );
+
+ round_trip ( L"" );
+ round_trip_ws ( L"" );
+ round_trip_d ( L"", 'q' );
+ round_trip_e ( L"", 'q' );
+
+ round_trip ( "Hi" );
+ round_trip_ws ( "Hi" );
+ round_trip_d ( "Hi", '!' );
+ round_trip_e ( "Hi", '!' );
+ assert ( quote ( "Hi", '!' ) == "!Hi!" );
+ assert ( quote ( "Hi!", '!' ) == R"(!Hi\!!)" );
+
+ round_trip ( L"Hi" );
+ round_trip_ws ( L"Hi" );
+ round_trip_d ( L"Hi", '!' );
+ round_trip_e ( L"Hi", '!' );
+ assert ( quote ( L"Hi", '!' ) == L"!Hi!" );
+ assert ( quote ( L"Hi!", '!' ) == LR"(!Hi\!!)" );
+
+ round_trip ( "Hi Mom" );
+ round_trip_ws ( "Hi Mom" );
+ round_trip ( L"Hi Mom" );
+ round_trip_ws ( L"Hi Mom" );
+
+ assert ( quote ( "" ) == "\"\"" );
+ assert ( quote ( L"" ) == L"\"\"" );
+ assert ( quote ( "a" ) == "\"a\"" );
+ assert ( quote ( L"a" ) == L"\"a\"" );
+
+// missing end quote - must not hang
+ assert ( unquote ( "\"abc" ) == "abc" );
+ assert ( unquote ( L"\"abc" ) == L"abc" );
+
+ assert ( unquote ( "abc" ) == "abc" ); // no delimiter
+ assert ( unquote ( L"abc" ) == L"abc" ); // no delimiter
+ assert ( unquote ( "abc def" ) == "abc" ); // no delimiter
+ assert ( unquote ( L"abc def" ) == L"abc" ); // no delimiter
+
+ assert ( unquote ( "" ) == "" ); // nothing there
+ assert ( unquote ( L"" ) == L"" ); // nothing there
+ }
+#else
+int main() {}
+#endif
diff --git a/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
new file mode 100644
index 000000000000..eb6eb1e97ef5
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.pointer.pass.cpp
@@ -0,0 +1,127 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr int compare(const charT* s) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1, const CharT *s, int expected ) {
+ assert ( sign( sv1.compare(s)) == sign(expected));
+}
+
+template<typename CharT>
+void
+test( const CharT *s1, const CharT *s2, int expected)
+{
+ typedef std::basic_string_view<CharT> string_view_t;
+ string_view_t sv1 ( s1 );
+ test1 ( sv1, s2, expected );
+}
+
+int main()
+{
+ {
+ test("", "", 0);
+ test("", "abcde", -5);
+ test("", "abcdefghij", -10);
+ test("", "abcdefghijklmnopqrst", -20);
+ test("abcde", "", 5);
+ test("abcde", "abcde", 0);
+ test("abcde", "abcdefghij", -5);
+ test("abcde", "abcdefghijklmnopqrst", -15);
+ test("abcdefghij", "", 10);
+ test("abcdefghij", "abcde", 5);
+ test("abcdefghij", "abcdefghij", 0);
+ test("abcdefghij", "abcdefghijklmnopqrst", -10);
+ test("abcdefghijklmnopqrst", "", 20);
+ test("abcdefghijklmnopqrst", "abcde", 15);
+ test("abcdefghijklmnopqrst", "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0);
+ }
+
+ {
+ test(L"", L"", 0);
+ test(L"", L"abcde", -5);
+ test(L"", L"abcdefghij", -10);
+ test(L"", L"abcdefghijklmnopqrst", -20);
+ test(L"abcde", L"", 5);
+ test(L"abcde", L"abcde", 0);
+ test(L"abcde", L"abcdefghij", -5);
+ test(L"abcde", L"abcdefghijklmnopqrst", -15);
+ test(L"abcdefghij", L"", 10);
+ test(L"abcdefghij", L"abcde", 5);
+ test(L"abcdefghij", L"abcdefghij", 0);
+ test(L"abcdefghij", L"abcdefghijklmnopqrst", -10);
+ test(L"abcdefghijklmnopqrst", L"", 20);
+ test(L"abcdefghijklmnopqrst", L"abcde", 15);
+ test(L"abcdefghijklmnopqrst", L"abcdefghij", 10);
+ test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ test(U"", U"", 0);
+ test(U"", U"abcde", -5);
+ test(U"", U"abcdefghij", -10);
+ test(U"", U"abcdefghijklmnopqrst", -20);
+ test(U"abcde", U"", 5);
+ test(U"abcde", U"abcde", 0);
+ test(U"abcde", U"abcdefghij", -5);
+ test(U"abcde", U"abcdefghijklmnopqrst", -15);
+ test(U"abcdefghij", U"", 10);
+ test(U"abcdefghij", U"abcde", 5);
+ test(U"abcdefghij", U"abcdefghij", 0);
+ test(U"abcdefghij", U"abcdefghijklmnopqrst", -10);
+ test(U"abcdefghijklmnopqrst", U"", 20);
+ test(U"abcdefghijklmnopqrst", U"abcde", 15);
+ test(U"abcdefghijklmnopqrst", U"abcdefghij", 10);
+ test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0);
+ }
+
+ {
+ test(u"", u"", 0);
+ test(u"", u"abcde", -5);
+ test(u"", u"abcdefghij", -10);
+ test(u"", u"abcdefghijklmnopqrst", -20);
+ test(u"abcde", u"", 5);
+ test(u"abcde", u"abcde", 0);
+ test(u"abcde", u"abcdefghij", -5);
+ test(u"abcde", u"abcdefghijklmnopqrst", -15);
+ test(u"abcdefghij", u"", 10);
+ test(u"abcdefghij", u"abcde", 5);
+ test(u"abcdefghij", u"abcdefghij", 0);
+ test(u"abcdefghij", u"abcdefghijklmnopqrst", -10);
+ test(u"abcdefghijklmnopqrst", u"", 20);
+ test(u"abcdefghijklmnopqrst", u"abcde", 15);
+ test(u"abcdefghijklmnopqrst", u"abcdefghij", 10);
+ test(u"abcdefghijklmnopqrst", u"abcdefghijklmnopqrst", 0);
+ }
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+ static_assert ( sv1.compare("") == 0, "" );
+ static_assert ( sv1.compare("abcde") == -1, "" );
+ static_assert ( sv2.compare("") == 1, "" );
+ static_assert ( sv2.compare("abcde") == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
new file mode 100644
index 000000000000..84f9ce080443
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
@@ -0,0 +1,452 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1,
+ size_t pos1, size_t n1, const CharT *s, int expected ) {
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (pos1 <= sv1.size())
+ assert(sign(sv1.compare(pos1, n1, s)) == sign(expected));
+#else
+ try {
+ assert(sign(sv1.compare(pos1, n1, s)) == sign(expected));
+ assert(pos1 <= sv1.size());
+ }
+ catch (const std::out_of_range&) {
+ assert(pos1 > sv1.size());
+ }
+#endif
+}
+
+template<typename CharT>
+void
+test( const CharT *s1, size_t pos1, size_t n1, const CharT *s2, int expected)
+{
+ typedef std::basic_string_view<CharT> string_view_t;
+ string_view_t sv1 ( s1 );
+ test1 ( sv1, pos1, n1, s2, expected );
+}
+
+void test0()
+{
+ test("", 0, 0, "", 0);
+ test("", 0, 0, "abcde", -5);
+ test("", 0, 0, "abcdefghij", -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("", 0, 1, "", 0);
+ test("", 0, 1, "abcde", -5);
+ test("", 0, 1, "abcdefghij", -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", -20);
+ test("", 1, 0, "", 0);
+ test("", 1, 0, "abcde", 0);
+ test("", 1, 0, "abcdefghij", 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0);
+ test("abcde", 0, 0, "", 0);
+ test("abcde", 0, 0, "abcde", -5);
+ test("abcde", 0, 0, "abcdefghij", -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 0, 1, "", 1);
+ test("abcde", 0, 1, "abcde", -4);
+ test("abcde", 0, 1, "abcdefghij", -9);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcde", 0, 2, "", 2);
+ test("abcde", 0, 2, "abcde", -3);
+ test("abcde", 0, 2, "abcdefghij", -8);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", -18);
+ test("abcde", 0, 4, "", 4);
+ test("abcde", 0, 4, "abcde", -1);
+ test("abcde", 0, 4, "abcdefghij", -6);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", -16);
+ test("abcde", 0, 5, "", 5);
+ test("abcde", 0, 5, "abcde", 0);
+ test("abcde", 0, 5, "abcdefghij", -5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", -15);
+ test("abcde", 0, 6, "", 5);
+ test("abcde", 0, 6, "abcde", 0);
+ test("abcde", 0, 6, "abcdefghij", -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", -15);
+ test("abcde", 1, 0, "", 0);
+ test("abcde", 1, 0, "abcde", -5);
+ test("abcde", 1, 0, "abcdefghij", -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 1, 1, "", 1);
+ test("abcde", 1, 1, "abcde", 1);
+ test("abcde", 1, 1, "abcdefghij", 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 2, "", 2);
+ test("abcde", 1, 2, "abcde", 1);
+ test("abcde", 1, 2, "abcdefghij", 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 3, "", 3);
+ test("abcde", 1, 3, "abcde", 1);
+ test("abcde", 1, 3, "abcdefghij", 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 4, "", 4);
+ test("abcde", 1, 4, "abcde", 1);
+ test("abcde", 1, 4, "abcdefghij", 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 5, "", 4);
+ test("abcde", 1, 5, "abcde", 1);
+ test("abcde", 1, 5, "abcdefghij", 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1);
+ test("abcde", 2, 0, "", 0);
+ test("abcde", 2, 0, "abcde", -5);
+ test("abcde", 2, 0, "abcdefghij", -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 2, 1, "", 1);
+ test("abcde", 2, 1, "abcde", 2);
+ test("abcde", 2, 1, "abcdefghij", 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 2, "", 2);
+ test("abcde", 2, 2, "abcde", 2);
+ test("abcde", 2, 2, "abcdefghij", 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 3, "", 3);
+ test("abcde", 2, 3, "abcde", 2);
+ test("abcde", 2, 3, "abcdefghij", 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 4, "", 3);
+ test("abcde", 2, 4, "abcde", 2);
+ test("abcde", 2, 4, "abcdefghij", 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 2);
+ test("abcde", 4, 0, "", 0);
+ test("abcde", 4, 0, "abcde", -5);
+ test("abcde", 4, 0, "abcdefghij", -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 4, 1, "", 1);
+ test("abcde", 4, 1, "abcde", 4);
+ test("abcde", 4, 1, "abcdefghij", 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 4);
+ test("abcde", 4, 2, "", 1);
+ test("abcde", 4, 2, "abcde", 4);
+ test("abcde", 4, 2, "abcdefghij", 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 4);
+ test("abcde", 5, 0, "", 0);
+ test("abcde", 5, 0, "abcde", -5);
+ test("abcde", 5, 0, "abcdefghij", -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 5, 1, "", 0);
+ test("abcde", 5, 1, "abcde", -5);
+ test("abcde", 5, 1, "abcdefghij", -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", -20);
+}
+
+void test1()
+{
+ test("abcde", 6, 0, "", 0);
+ test("abcde", 6, 0, "abcde", 0);
+ test("abcde", 6, 0, "abcdefghij", 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0);
+ test("abcdefghij", 0, 0, "", 0);
+ test("abcdefghij", 0, 0, "abcde", -5);
+ test("abcdefghij", 0, 0, "abcdefghij", -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 0, 1, "", 1);
+ test("abcdefghij", 0, 1, "abcde", -4);
+ test("abcdefghij", 0, 1, "abcdefghij", -9);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcdefghij", 0, 5, "", 5);
+ test("abcdefghij", 0, 5, "abcde", 0);
+ test("abcdefghij", 0, 5, "abcdefghij", -5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", -15);
+ test("abcdefghij", 0, 9, "", 9);
+ test("abcdefghij", 0, 9, "abcde", 4);
+ test("abcdefghij", 0, 9, "abcdefghij", -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", -11);
+ test("abcdefghij", 0, 10, "", 10);
+ test("abcdefghij", 0, 10, "abcde", 5);
+ test("abcdefghij", 0, 10, "abcdefghij", 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", -10);
+ test("abcdefghij", 0, 11, "", 10);
+ test("abcdefghij", 0, 11, "abcde", 5);
+ test("abcdefghij", 0, 11, "abcdefghij", 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", -10);
+ test("abcdefghij", 1, 0, "", 0);
+ test("abcdefghij", 1, 0, "abcde", -5);
+ test("abcdefghij", 1, 0, "abcdefghij", -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 1, 1, "", 1);
+ test("abcdefghij", 1, 1, "abcde", 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 4, "", 4);
+ test("abcdefghij", 1, 4, "abcde", 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 8, "", 8);
+ test("abcdefghij", 1, 8, "abcde", 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 9, "", 9);
+ test("abcdefghij", 1, 9, "abcde", 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 10, "", 9);
+ test("abcdefghij", 1, 10, "abcde", 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 5, 0, "", 0);
+ test("abcdefghij", 5, 0, "abcde", -5);
+ test("abcdefghij", 5, 0, "abcdefghij", -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 5, 1, "", 1);
+ test("abcdefghij", 5, 1, "abcde", 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 2, "", 2);
+ test("abcdefghij", 5, 2, "abcde", 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 4, "", 4);
+ test("abcdefghij", 5, 4, "abcde", 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 5, "", 5);
+ test("abcdefghij", 5, 5, "abcde", 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 6, "", 5);
+ test("abcdefghij", 5, 6, "abcde", 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 9, 0, "", 0);
+ test("abcdefghij", 9, 0, "abcde", -5);
+ test("abcdefghij", 9, 0, "abcdefghij", -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 9, 1, "", 1);
+ test("abcdefghij", 9, 1, "abcde", 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 9);
+ test("abcdefghij", 9, 2, "", 1);
+ test("abcdefghij", 9, 2, "abcde", 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 9);
+ test("abcdefghij", 10, 0, "", 0);
+ test("abcdefghij", 10, 0, "abcde", -5);
+ test("abcdefghij", 10, 0, "abcdefghij", -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 10, 1, "", 0);
+ test("abcdefghij", 10, 1, "abcde", -5);
+ test("abcdefghij", 10, 1, "abcdefghij", -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 11, 0, "", 0);
+ test("abcdefghij", 11, 0, "abcde", 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0);
+}
+
+void test2()
+{
+ test("abcdefghijklmnopqrst", 0, 0, "", 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 0, 1, "", 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcdefghijklmnopqrst", 0, 10, "", 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", -10);
+ test("abcdefghijklmnopqrst", 0, 19, "", 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", -1);
+ test("abcdefghijklmnopqrst", 0, 20, "", 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0);
+ test("abcdefghijklmnopqrst", 0, 21, "", 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 1, 1, "", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "", 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "", 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "", 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "", 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 10, 0, "", 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 10, 1, "", 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "", 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "", 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 19, 0, "", 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 19, 1, "", 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "", 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19);
+ test("abcdefghijklmnopqrst", 20, 0, "", 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 20, 1, "", 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 21, 0, "", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0);
+}
+
+
+int main()
+{
+ test0();
+ test1();
+ test2();
+
+ {
+ test("", 0, 0, "", 0);
+ test("", 0, 0, "abcde", -5);
+ test("", 0, 0, "abcdefghij", -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 0, 2, "", 5);
+ test("abcde", 0, 6,"abcde", 0);
+ test("abcde", 0, 6, "abcdefghij", -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", -15);
+ test("abcdefghij", 3, 3, "", 10);
+ test("abcdefghij", 3, 3,"abcde", 5);
+ test("abcdefghij", 3, 3, "def", 0);
+ test("abcdefghij", 0, 4, "abcdefghijklmnopqrst", -10);
+ test("abcdefghijklmnopqrst", 5, 5, "", 20);
+ test("abcdefghijklmnopqrst", 0, 8, "abcde", 15);
+ test("abcdefghijklmnopqrst", 0, 12, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), "abcdefghijklmnopqrst", 0);
+ }
+
+ {
+ test(L"", 0, 0, L"", 0);
+ test(L"", 0, 0, L"abcde", -5);
+ test(L"", 0, 0, L"abcdefghij", -10);
+ test(L"", 0, 0, L"abcdefghijklmnopqrst", -20);
+ test(L"abcde", 0, 2, L"", 5);
+ test(L"abcde", 0, 6, L"abcde", 0);
+ test(L"abcde", 0, 6, L"abcdefghij", -5);
+ test(L"abcde", 0, 6, L"abcdefghijklmnopqrst", -15);
+ test(L"abcdefghij", 3, 3, L"", 10);
+ test(L"abcdefghij", 3, 3, L"abcde", 5);
+ test(L"abcdefghij", 3, 3, L"def", 0);
+ test(L"abcdefghij", 0, 4, L"abcdefghijklmnopqrst", -10);
+ test(L"abcdefghijklmnopqrst", 5, 5, L"", 20);
+ test(L"abcdefghijklmnopqrst", 0, 8, L"abcde", 15);
+ test(L"abcdefghijklmnopqrst", 0, 12, L"abcdefghij", 10);
+ test(L"abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), L"abcdefghijklmnopqrst", 0);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ test(U"", 0, 0, U"", 0);
+ test(U"", 0, 0, U"abcde", -5);
+ test(U"", 0, 0, U"abcdefghij", -10);
+ test(U"", 0, 0, U"abcdefghijklmnopqrst", -20);
+ test(U"abcde", 0, 2, U"", 5);
+ test(U"abcde", 0, 6, U"abcde", 0);
+ test(U"abcde", 0, 6, U"abcdefghij", -5);
+ test(U"abcde", 0, 6, U"abcdefghijklmnopqrst", -15);
+ test(U"abcdefghij", 3, 3, U"", 10);
+ test(U"abcdefghij", 3, 3, U"abcde", 5);
+ test(U"abcdefghij", 3, 3, U"def", 0);
+ test(U"abcdefghij", 0, 4, U"abcdefghijklmnopqrst", -10);
+ test(U"abcdefghijklmnopqrst", 5, 5, U"", 20);
+ test(U"abcdefghijklmnopqrst", 0, 8, U"abcde", 15);
+ test(U"abcdefghijklmnopqrst", 0, 12, U"abcdefghij", 10);
+ test(U"abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), U"abcdefghijklmnopqrst", 0);
+ }
+
+ {
+ test(u"", 0, 0, u"", 0);
+ test(u"", 0, 0, u"abcde", -5);
+ test(u"", 0, 0, u"abcdefghij", -10);
+ test(u"", 0, 0, u"abcdefghijklmnopqrst", -20);
+ test(u"abcde", 0, 2, u"", 5);
+ test(u"abcde", 0, 6, u"abcde", 0);
+ test(u"abcde", 0, 6, u"abcdefghij", -5);
+ test(u"abcde", 0, 6, u"abcdefghijklmnopqrst", -15);
+ test(u"abcdefghij", 3, 3, u"", 10);
+ test(u"abcdefghij", 3, 3, u"abcde", 5);
+ test(u"abcdefghij", 3, 3, u"def", 0);
+ test(u"abcdefghij", 0, 4, u"abcdefghijklmnopqrst", -10);
+ test(u"abcdefghijklmnopqrst", 5, 5, u"", 20);
+ test(u"abcdefghijklmnopqrst", 0, 8, u"abcde", 15);
+ test(u"abcdefghijklmnopqrst", 0, 12, u"abcdefghij", 10);
+ test(u"abcdefghijklmnopqrst", 0, static_cast<size_t>(-1), u"abcdefghijklmnopqrst", 0);
+ }
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcde", 5 };
+ static_assert ( sv1.compare(0, 0, "") == 0, "" );
+ static_assert ( sv1.compare(0, 0, "abcde") == -1, "" );
+ static_assert ( sv2.compare(0, 2, "") == 1, "" );
+ static_assert ( sv2.compare(0, 6, "abcde") == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
new file mode 100644
index 000000000000..2bef7fdbac1a
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
@@ -0,0 +1,401 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr int compare(size_type pos1, size_type n1, basic_string_view str) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1, size_t pos1, size_t n1,
+ std::basic_string_view<CharT> sv2, int expected ) {
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (pos1 <= sv1.size())
+ assert(sign( sv1.compare(pos1, n1, sv2)) == sign(expected));
+#else
+ try {
+ assert(sign( sv1.compare(pos1, n1, sv2)) == sign(expected));
+ assert(pos1 <= sv1.size());
+ }
+ catch (const std::out_of_range&) {
+ assert(pos1 > sv1.size());
+ }
+#endif
+}
+
+
+template<typename CharT>
+void test ( const CharT *s1, size_t pos1, size_t n1, const CharT *s2, int expected ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+ string_view_t sv1 ( s1 );
+ string_view_t sv2 ( s2 );
+ test1(sv1, pos1, n1, sv2, expected);
+}
+
+void test0()
+{
+ test("", 0, 0, "", 0);
+ test("", 0, 0, "abcde", -5);
+ test("", 0, 0, "abcdefghij", -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("", 0, 1, "", 0);
+ test("", 0, 1, "abcde", -5);
+ test("", 0, 1, "abcdefghij", -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", -20);
+ test("", 1, 0, "", 0);
+ test("", 1, 0, "abcde", 0);
+ test("", 1, 0, "abcdefghij", 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0);
+ test("abcde", 0, 0, "", 0);
+ test("abcde", 0, 0, "abcde", -5);
+ test("abcde", 0, 0, "abcdefghij", -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 0, 1, "", 1);
+ test("abcde", 0, 1, "abcde", -4);
+ test("abcde", 0, 1, "abcdefghij", -9);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcde", 0, 2, "", 2);
+ test("abcde", 0, 2, "abcde", -3);
+ test("abcde", 0, 2, "abcdefghij", -8);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", -18);
+ test("abcde", 0, 4, "", 4);
+ test("abcde", 0, 4, "abcde", -1);
+ test("abcde", 0, 4, "abcdefghij", -6);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", -16);
+ test("abcde", 0, 5, "", 5);
+ test("abcde", 0, 5, "abcde", 0);
+ test("abcde", 0, 5, "abcdefghij", -5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", -15);
+ test("abcde", 0, 6, "", 5);
+ test("abcde", 0, 6, "abcde", 0);
+ test("abcde", 0, 6, "abcdefghij", -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", -15);
+ test("abcde", 1, 0, "", 0);
+ test("abcde", 1, 0, "abcde", -5);
+ test("abcde", 1, 0, "abcdefghij", -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 1, 1, "", 1);
+ test("abcde", 1, 1, "abcde", 1);
+ test("abcde", 1, 1, "abcdefghij", 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 2, "", 2);
+ test("abcde", 1, 2, "abcde", 1);
+ test("abcde", 1, 2, "abcdefghij", 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 3, "", 3);
+ test("abcde", 1, 3, "abcde", 1);
+ test("abcde", 1, 3, "abcdefghij", 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 4, "", 4);
+ test("abcde", 1, 4, "abcde", 1);
+ test("abcde", 1, 4, "abcdefghij", 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1);
+ test("abcde", 1, 5, "", 4);
+ test("abcde", 1, 5, "abcde", 1);
+ test("abcde", 1, 5, "abcdefghij", 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1);
+ test("abcde", 2, 0, "", 0);
+ test("abcde", 2, 0, "abcde", -5);
+ test("abcde", 2, 0, "abcdefghij", -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 2, 1, "", 1);
+ test("abcde", 2, 1, "abcde", 2);
+ test("abcde", 2, 1, "abcdefghij", 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 2, "", 2);
+ test("abcde", 2, 2, "abcde", 2);
+ test("abcde", 2, 2, "abcdefghij", 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 3, "", 3);
+ test("abcde", 2, 3, "abcde", 2);
+ test("abcde", 2, 3, "abcdefghij", 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 2);
+ test("abcde", 2, 4, "", 3);
+ test("abcde", 2, 4, "abcde", 2);
+ test("abcde", 2, 4, "abcdefghij", 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 2);
+ test("abcde", 4, 0, "", 0);
+ test("abcde", 4, 0, "abcde", -5);
+ test("abcde", 4, 0, "abcdefghij", -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 4, 1, "", 1);
+ test("abcde", 4, 1, "abcde", 4);
+ test("abcde", 4, 1, "abcdefghij", 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 4);
+ test("abcde", 4, 2, "", 1);
+ test("abcde", 4, 2, "abcde", 4);
+ test("abcde", 4, 2, "abcdefghij", 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 4);
+ test("abcde", 5, 0, "", 0);
+ test("abcde", 5, 0, "abcde", -5);
+ test("abcde", 5, 0, "abcdefghij", -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", -20);
+ test("abcde", 5, 1, "", 0);
+ test("abcde", 5, 1, "abcde", -5);
+ test("abcde", 5, 1, "abcdefghij", -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", -20);
+}
+
+void test1()
+{
+ test("abcde", 6, 0, "", 0);
+ test("abcde", 6, 0, "abcde", 0);
+ test("abcde", 6, 0, "abcdefghij", 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0);
+ test("abcdefghij", 0, 0, "", 0);
+ test("abcdefghij", 0, 0, "abcde", -5);
+ test("abcdefghij", 0, 0, "abcdefghij", -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 0, 1, "", 1);
+ test("abcdefghij", 0, 1, "abcde", -4);
+ test("abcdefghij", 0, 1, "abcdefghij", -9);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcdefghij", 0, 5, "", 5);
+ test("abcdefghij", 0, 5, "abcde", 0);
+ test("abcdefghij", 0, 5, "abcdefghij", -5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", -15);
+ test("abcdefghij", 0, 9, "", 9);
+ test("abcdefghij", 0, 9, "abcde", 4);
+ test("abcdefghij", 0, 9, "abcdefghij", -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", -11);
+ test("abcdefghij", 0, 10, "", 10);
+ test("abcdefghij", 0, 10, "abcde", 5);
+ test("abcdefghij", 0, 10, "abcdefghij", 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", -10);
+ test("abcdefghij", 0, 11, "", 10);
+ test("abcdefghij", 0, 11, "abcde", 5);
+ test("abcdefghij", 0, 11, "abcdefghij", 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", -10);
+ test("abcdefghij", 1, 0, "", 0);
+ test("abcdefghij", 1, 0, "abcde", -5);
+ test("abcdefghij", 1, 0, "abcdefghij", -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 1, 1, "", 1);
+ test("abcdefghij", 1, 1, "abcde", 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 4, "", 4);
+ test("abcdefghij", 1, 4, "abcde", 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 8, "", 8);
+ test("abcdefghij", 1, 8, "abcde", 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 9, "", 9);
+ test("abcdefghij", 1, 9, "abcde", 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 1, 10, "", 9);
+ test("abcdefghij", 1, 10, "abcde", 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1);
+ test("abcdefghij", 5, 0, "", 0);
+ test("abcdefghij", 5, 0, "abcde", -5);
+ test("abcdefghij", 5, 0, "abcdefghij", -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 5, 1, "", 1);
+ test("abcdefghij", 5, 1, "abcde", 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 2, "", 2);
+ test("abcdefghij", 5, 2, "abcde", 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 4, "", 4);
+ test("abcdefghij", 5, 4, "abcde", 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 5, "", 5);
+ test("abcdefghij", 5, 5, "abcde", 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 5, 6, "", 5);
+ test("abcdefghij", 5, 6, "abcde", 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 5);
+ test("abcdefghij", 9, 0, "", 0);
+ test("abcdefghij", 9, 0, "abcde", -5);
+ test("abcdefghij", 9, 0, "abcdefghij", -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 9, 1, "", 1);
+ test("abcdefghij", 9, 1, "abcde", 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 9);
+ test("abcdefghij", 9, 2, "", 1);
+ test("abcdefghij", 9, 2, "abcde", 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 9);
+ test("abcdefghij", 10, 0, "", 0);
+ test("abcdefghij", 10, 0, "abcde", -5);
+ test("abcdefghij", 10, 0, "abcdefghij", -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 10, 1, "", 0);
+ test("abcdefghij", 10, 1, "abcde", -5);
+ test("abcdefghij", 10, 1, "abcdefghij", -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", -20);
+ test("abcdefghij", 11, 0, "", 0);
+ test("abcdefghij", 11, 0, "abcde", 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0);
+}
+
+void test2()
+{
+ test("abcdefghijklmnopqrst", 0, 0, "", 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 0, 1, "", 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", -19);
+ test("abcdefghijklmnopqrst", 0, 10, "", 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", -10);
+ test("abcdefghijklmnopqrst", 0, 19, "", 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", -1);
+ test("abcdefghijklmnopqrst", 0, 20, "", 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0);
+ test("abcdefghijklmnopqrst", 0, 21, "", 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 1, 1, "", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "", 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "", 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "", 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "", 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1);
+ test("abcdefghijklmnopqrst", 10, 0, "", 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 10, 1, "", 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "", 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "", 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10);
+ test("abcdefghijklmnopqrst", 19, 0, "", 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 19, 1, "", 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "", 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19);
+ test("abcdefghijklmnopqrst", 20, 0, "", 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 20, 1, "", 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", -20);
+ test("abcdefghijklmnopqrst", 21, 0, "", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0);
+}
+
+
+int main () {
+ test0();
+ test1();
+ test2();
+
+ {
+ test("abcde", 5, 1, "", 0);
+ test("abcde", 2, 4, "", 3);
+ test("abcde", 2, 4, "abcde", 2);
+ test("ABCde", 2, 4, "abcde", -1);
+ }
+
+ {
+ test(L"abcde", 5, 1, L"", 0);
+ test(L"abcde", 2, 4, L"", 3);
+ test(L"abcde", 2, 4, L"abcde", 2);
+ test(L"ABCde", 2, 4, L"abcde", -1);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ test(u"abcde", 5, 1, u"", 0);
+ test(u"abcde", 2, 4, u"", 3);
+ test(u"abcde", 2, 4, u"abcde", 2);
+ test(u"ABCde", 2, 4, u"abcde", -1);
+ }
+
+ {
+ test(U"abcde", 5, 1, U"", 0);
+ test(U"abcde", 2, 4, U"", 3);
+ test(U"abcde", 2, 4, U"abcde", 2);
+ test(U"ABCde", 2, 4, U"abcde", -1);
+ }
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1 { "abcde", 5 };
+ constexpr SV sv2 { "abcde", 0 };
+ static_assert ( sv1.compare(5, 1, sv2) == 0, "" );
+ static_assert ( sv1.compare(2, 4, sv2) == 1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
new file mode 100644
index 000000000000..8256c997b118
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
@@ -0,0 +1,1352 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr int compare(size_type pos1, size_type n1,
+// const charT* s, size_type n2) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1, size_t pos1, size_t n1,
+ const CharT *s2, size_t n2, int expected ) {
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (pos1 <= sv1.size())
+ assert(sign(sv1.compare(pos1, n1, s2, n2)) == sign(expected));
+#else
+ try {
+ assert(sign(sv1.compare(pos1, n1, s2, n2)) == sign(expected));
+ assert(pos1 <= sv1.size());
+ }
+ catch (const std::out_of_range&) {
+ assert(pos1 > sv1.size());
+ }
+#endif
+}
+
+
+template<typename CharT>
+void test ( const CharT *s1, size_t pos1, size_t n1,
+ const CharT *s2, size_t n2,
+ int expected ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+ string_view_t sv1 ( s1 );
+ test1 (sv1, pos1, n1, s2, n2, expected);
+}
+
+
+void test0()
+{
+ test("", 0, 0, "", 0, 0);
+ test("", 0, 0, "abcde", 0, 0);
+ test("", 0, 0, "abcde", 1, -1);
+ test("", 0, 0, "abcde", 2, -2);
+ test("", 0, 0, "abcde", 4, -4);
+ test("", 0, 0, "abcde", 5, -5);
+ test("", 0, 0, "abcdefghij", 0, 0);
+ test("", 0, 0, "abcdefghij", 1, -1);
+ test("", 0, 0, "abcdefghij", 5, -5);
+ test("", 0, 0, "abcdefghij", 9, -9);
+ test("", 0, 0, "abcdefghij", 10, -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("", 0, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("", 0, 1, "", 0, 0);
+ test("", 0, 1, "abcde", 0, 0);
+ test("", 0, 1, "abcde", 1, -1);
+ test("", 0, 1, "abcde", 2, -2);
+ test("", 0, 1, "abcde", 4, -4);
+ test("", 0, 1, "abcde", 5, -5);
+ test("", 0, 1, "abcdefghij", 0, 0);
+ test("", 0, 1, "abcdefghij", 1, -1);
+ test("", 0, 1, "abcdefghij", 5, -5);
+ test("", 0, 1, "abcdefghij", 9, -9);
+ test("", 0, 1, "abcdefghij", 10, -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", 19, -19);
+ test("", 0, 1, "abcdefghijklmnopqrst", 20, -20);
+ test("", 1, 0, "", 0, 0);
+ test("", 1, 0, "abcde", 0, 0);
+ test("", 1, 0, "abcde", 1, 0);
+ test("", 1, 0, "abcde", 2, 0);
+ test("", 1, 0, "abcde", 4, 0);
+ test("", 1, 0, "abcde", 5, 0);
+ test("", 1, 0, "abcdefghij", 0, 0);
+ test("", 1, 0, "abcdefghij", 1, 0);
+ test("", 1, 0, "abcdefghij", 5, 0);
+ test("", 1, 0, "abcdefghij", 9, 0);
+ test("", 1, 0, "abcdefghij", 10, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 19, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 20, 0);
+ test("abcde", 0, 0, "", 0, 0);
+ test("abcde", 0, 0, "abcde", 0, 0);
+ test("abcde", 0, 0, "abcde", 1, -1);
+ test("abcde", 0, 0, "abcde", 2, -2);
+ test("abcde", 0, 0, "abcde", 4, -4);
+ test("abcde", 0, 0, "abcde", 5, -5);
+ test("abcde", 0, 0, "abcdefghij", 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 1, -1);
+ test("abcde", 0, 0, "abcdefghij", 5, -5);
+ test("abcde", 0, 0, "abcdefghij", 9, -9);
+ test("abcde", 0, 0, "abcdefghij", 10, -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcde", 0, 1, "", 0, 1);
+ test("abcde", 0, 1, "abcde", 0, 1);
+ test("abcde", 0, 1, "abcde", 1, 0);
+ test("abcde", 0, 1, "abcde", 2, -1);
+ test("abcde", 0, 1, "abcde", 4, -3);
+ test("abcde", 0, 1, "abcde", 5, -4);
+ test("abcde", 0, 1, "abcdefghij", 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 1, 0);
+ test("abcde", 0, 1, "abcdefghij", 5, -4);
+ test("abcde", 0, 1, "abcdefghij", 9, -8);
+ test("abcde", 0, 1, "abcdefghij", 10, -9);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 0);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, -9);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, -18);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, -19);
+ test("abcde", 0, 2, "", 0, 2);
+ test("abcde", 0, 2, "abcde", 0, 2);
+ test("abcde", 0, 2, "abcde", 1, 1);
+ test("abcde", 0, 2, "abcde", 2, 0);
+ test("abcde", 0, 2, "abcde", 4, -2);
+ test("abcde", 0, 2, "abcde", 5, -3);
+ test("abcde", 0, 2, "abcdefghij", 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 1, 1);
+ test("abcde", 0, 2, "abcdefghij", 5, -3);
+ test("abcde", 0, 2, "abcdefghij", 9, -7);
+ test("abcde", 0, 2, "abcdefghij", 10, -8);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, -8);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, -17);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, -18);
+ test("abcde", 0, 4, "", 0, 4);
+ test("abcde", 0, 4, "abcde", 0, 4);
+ test("abcde", 0, 4, "abcde", 1, 3);
+ test("abcde", 0, 4, "abcde", 2, 2);
+}
+
+
+void test1()
+{
+ test("abcde", 0, 4, "abcde", 4, 0);
+ test("abcde", 0, 4, "abcde", 5, -1);
+ test("abcde", 0, 4, "abcdefghij", 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 1, 3);
+ test("abcde", 0, 4, "abcdefghij", 5, -1);
+ test("abcde", 0, 4, "abcdefghij", 9, -5);
+ test("abcde", 0, 4, "abcdefghij", 10, -6);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 3);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, -6);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, -15);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, -16);
+ test("abcde", 0, 5, "", 0, 5);
+ test("abcde", 0, 5, "abcde", 0, 5);
+ test("abcde", 0, 5, "abcde", 1, 4);
+ test("abcde", 0, 5, "abcde", 2, 3);
+ test("abcde", 0, 5, "abcde", 4, 1);
+ test("abcde", 0, 5, "abcde", 5, 0);
+ test("abcde", 0, 5, "abcdefghij", 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 1, 4);
+ test("abcde", 0, 5, "abcdefghij", 5, 0);
+ test("abcde", 0, 5, "abcdefghij", 9, -4);
+ test("abcde", 0, 5, "abcdefghij", 10, -5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 4);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, -5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, -14);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, -15);
+ test("abcde", 0, 6, "", 0, 5);
+ test("abcde", 0, 6, "abcde", 0, 5);
+ test("abcde", 0, 6, "abcde", 1, 4);
+ test("abcde", 0, 6, "abcde", 2, 3);
+ test("abcde", 0, 6, "abcde", 4, 1);
+ test("abcde", 0, 6, "abcde", 5, 0);
+ test("abcde", 0, 6, "abcdefghij", 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 1, 4);
+ test("abcde", 0, 6, "abcdefghij", 5, 0);
+ test("abcde", 0, 6, "abcdefghij", 9, -4);
+ test("abcde", 0, 6, "abcdefghij", 10, -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 4);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, -14);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, -15);
+ test("abcde", 1, 0, "", 0, 0);
+ test("abcde", 1, 0, "abcde", 0, 0);
+ test("abcde", 1, 0, "abcde", 1, -1);
+ test("abcde", 1, 0, "abcde", 2, -2);
+ test("abcde", 1, 0, "abcde", 4, -4);
+ test("abcde", 1, 0, "abcde", 5, -5);
+ test("abcde", 1, 0, "abcdefghij", 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 1, -1);
+ test("abcde", 1, 0, "abcdefghij", 5, -5);
+ test("abcde", 1, 0, "abcdefghij", 9, -9);
+ test("abcde", 1, 0, "abcdefghij", 10, -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcde", 1, 1, "", 0, 1);
+ test("abcde", 1, 1, "abcde", 0, 1);
+ test("abcde", 1, 1, "abcde", 1, 1);
+ test("abcde", 1, 1, "abcde", 2, 1);
+ test("abcde", 1, 1, "abcde", 4, 1);
+ test("abcde", 1, 1, "abcde", 5, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 1, 1);
+ test("abcde", 1, 1, "abcdefghij", 5, 1);
+ test("abcde", 1, 1, "abcdefghij", 9, 1);
+ test("abcde", 1, 1, "abcdefghij", 10, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 1);
+ test("abcde", 1, 2, "", 0, 2);
+ test("abcde", 1, 2, "abcde", 0, 2);
+ test("abcde", 1, 2, "abcde", 1, 1);
+ test("abcde", 1, 2, "abcde", 2, 1);
+ test("abcde", 1, 2, "abcde", 4, 1);
+ test("abcde", 1, 2, "abcde", 5, 1);
+ test("abcde", 1, 2, "abcdefghij", 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 1, 1);
+ test("abcde", 1, 2, "abcdefghij", 5, 1);
+ test("abcde", 1, 2, "abcdefghij", 9, 1);
+ test("abcde", 1, 2, "abcdefghij", 10, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 1);
+ test("abcde", 1, 3, "", 0, 3);
+ test("abcde", 1, 3, "abcde", 0, 3);
+ test("abcde", 1, 3, "abcde", 1, 1);
+ test("abcde", 1, 3, "abcde", 2, 1);
+ test("abcde", 1, 3, "abcde", 4, 1);
+ test("abcde", 1, 3, "abcde", 5, 1);
+ test("abcde", 1, 3, "abcdefghij", 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 1, 1);
+}
+
+
+void test2()
+{
+ test("abcde", 1, 3, "abcdefghij", 5, 1);
+ test("abcde", 1, 3, "abcdefghij", 9, 1);
+ test("abcde", 1, 3, "abcdefghij", 10, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 1);
+ test("abcde", 1, 4, "", 0, 4);
+ test("abcde", 1, 4, "abcde", 0, 4);
+ test("abcde", 1, 4, "abcde", 1, 1);
+ test("abcde", 1, 4, "abcde", 2, 1);
+ test("abcde", 1, 4, "abcde", 4, 1);
+ test("abcde", 1, 4, "abcde", 5, 1);
+ test("abcde", 1, 4, "abcdefghij", 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 1, 1);
+ test("abcde", 1, 4, "abcdefghij", 5, 1);
+ test("abcde", 1, 4, "abcdefghij", 9, 1);
+ test("abcde", 1, 4, "abcdefghij", 10, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 1);
+ test("abcde", 1, 5, "", 0, 4);
+ test("abcde", 1, 5, "abcde", 0, 4);
+ test("abcde", 1, 5, "abcde", 1, 1);
+ test("abcde", 1, 5, "abcde", 2, 1);
+ test("abcde", 1, 5, "abcde", 4, 1);
+ test("abcde", 1, 5, "abcde", 5, 1);
+ test("abcde", 1, 5, "abcdefghij", 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 1, 1);
+ test("abcde", 1, 5, "abcdefghij", 5, 1);
+ test("abcde", 1, 5, "abcdefghij", 9, 1);
+ test("abcde", 1, 5, "abcdefghij", 10, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 1);
+ test("abcde", 2, 0, "", 0, 0);
+ test("abcde", 2, 0, "abcde", 0, 0);
+ test("abcde", 2, 0, "abcde", 1, -1);
+ test("abcde", 2, 0, "abcde", 2, -2);
+ test("abcde", 2, 0, "abcde", 4, -4);
+ test("abcde", 2, 0, "abcde", 5, -5);
+ test("abcde", 2, 0, "abcdefghij", 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 1, -1);
+ test("abcde", 2, 0, "abcdefghij", 5, -5);
+ test("abcde", 2, 0, "abcdefghij", 9, -9);
+ test("abcde", 2, 0, "abcdefghij", 10, -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcde", 2, 1, "", 0, 1);
+ test("abcde", 2, 1, "abcde", 0, 1);
+ test("abcde", 2, 1, "abcde", 1, 2);
+ test("abcde", 2, 1, "abcde", 2, 2);
+ test("abcde", 2, 1, "abcde", 4, 2);
+ test("abcde", 2, 1, "abcde", 5, 2);
+ test("abcde", 2, 1, "abcdefghij", 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 2);
+ test("abcde", 2, 1, "abcdefghij", 5, 2);
+ test("abcde", 2, 1, "abcdefghij", 9, 2);
+ test("abcde", 2, 1, "abcdefghij", 10, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 2);
+ test("abcde", 2, 2, "", 0, 2);
+ test("abcde", 2, 2, "abcde", 0, 2);
+ test("abcde", 2, 2, "abcde", 1, 2);
+ test("abcde", 2, 2, "abcde", 2, 2);
+ test("abcde", 2, 2, "abcde", 4, 2);
+ test("abcde", 2, 2, "abcde", 5, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 1, 2);
+ test("abcde", 2, 2, "abcdefghij", 5, 2);
+ test("abcde", 2, 2, "abcdefghij", 9, 2);
+ test("abcde", 2, 2, "abcdefghij", 10, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 2);
+ test("abcde", 2, 3, "", 0, 3);
+ test("abcde", 2, 3, "abcde", 0, 3);
+ test("abcde", 2, 3, "abcde", 1, 2);
+ test("abcde", 2, 3, "abcde", 2, 2);
+ test("abcde", 2, 3, "abcde", 4, 2);
+ test("abcde", 2, 3, "abcde", 5, 2);
+ test("abcde", 2, 3, "abcdefghij", 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 1, 2);
+ test("abcde", 2, 3, "abcdefghij", 5, 2);
+ test("abcde", 2, 3, "abcdefghij", 9, 2);
+ test("abcde", 2, 3, "abcdefghij", 10, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 3);
+}
+
+
+void test3()
+{
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 2);
+ test("abcde", 2, 4, "", 0, 3);
+ test("abcde", 2, 4, "abcde", 0, 3);
+ test("abcde", 2, 4, "abcde", 1, 2);
+ test("abcde", 2, 4, "abcde", 2, 2);
+ test("abcde", 2, 4, "abcde", 4, 2);
+ test("abcde", 2, 4, "abcde", 5, 2);
+ test("abcde", 2, 4, "abcdefghij", 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 1, 2);
+ test("abcde", 2, 4, "abcdefghij", 5, 2);
+ test("abcde", 2, 4, "abcdefghij", 9, 2);
+ test("abcde", 2, 4, "abcdefghij", 10, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 2);
+ test("abcde", 4, 0, "", 0, 0);
+ test("abcde", 4, 0, "abcde", 0, 0);
+ test("abcde", 4, 0, "abcde", 1, -1);
+ test("abcde", 4, 0, "abcde", 2, -2);
+ test("abcde", 4, 0, "abcde", 4, -4);
+ test("abcde", 4, 0, "abcde", 5, -5);
+ test("abcde", 4, 0, "abcdefghij", 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 1, -1);
+ test("abcde", 4, 0, "abcdefghij", 5, -5);
+ test("abcde", 4, 0, "abcdefghij", 9, -9);
+ test("abcde", 4, 0, "abcdefghij", 10, -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcde", 4, 1, "", 0, 1);
+ test("abcde", 4, 1, "abcde", 0, 1);
+ test("abcde", 4, 1, "abcde", 1, 4);
+ test("abcde", 4, 1, "abcde", 2, 4);
+ test("abcde", 4, 1, "abcde", 4, 4);
+ test("abcde", 4, 1, "abcde", 5, 4);
+ test("abcde", 4, 1, "abcdefghij", 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 1, 4);
+ test("abcde", 4, 1, "abcdefghij", 5, 4);
+ test("abcde", 4, 1, "abcdefghij", 9, 4);
+ test("abcde", 4, 1, "abcdefghij", 10, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 4);
+ test("abcde", 4, 2, "", 0, 1);
+ test("abcde", 4, 2, "abcde", 0, 1);
+ test("abcde", 4, 2, "abcde", 1, 4);
+ test("abcde", 4, 2, "abcde", 2, 4);
+ test("abcde", 4, 2, "abcde", 4, 4);
+ test("abcde", 4, 2, "abcde", 5, 4);
+ test("abcde", 4, 2, "abcdefghij", 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 1, 4);
+ test("abcde", 4, 2, "abcdefghij", 5, 4);
+ test("abcde", 4, 2, "abcdefghij", 9, 4);
+ test("abcde", 4, 2, "abcdefghij", 10, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 4);
+ test("abcde", 5, 0, "", 0, 0);
+ test("abcde", 5, 0, "abcde", 0, 0);
+ test("abcde", 5, 0, "abcde", 1, -1);
+ test("abcde", 5, 0, "abcde", 2, -2);
+ test("abcde", 5, 0, "abcde", 4, -4);
+ test("abcde", 5, 0, "abcde", 5, -5);
+ test("abcde", 5, 0, "abcdefghij", 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 1, -1);
+ test("abcde", 5, 0, "abcdefghij", 5, -5);
+ test("abcde", 5, 0, "abcdefghij", 9, -9);
+ test("abcde", 5, 0, "abcdefghij", 10, -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcde", 5, 1, "", 0, 0);
+ test("abcde", 5, 1, "abcde", 0, 0);
+ test("abcde", 5, 1, "abcde", 1, -1);
+ test("abcde", 5, 1, "abcde", 2, -2);
+ test("abcde", 5, 1, "abcde", 4, -4);
+ test("abcde", 5, 1, "abcde", 5, -5);
+ test("abcde", 5, 1, "abcdefghij", 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 1, -1);
+ test("abcde", 5, 1, "abcdefghij", 5, -5);
+ test("abcde", 5, 1, "abcdefghij", 9, -9);
+ test("abcde", 5, 1, "abcdefghij", 10, -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, -19);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, -20);
+}
+
+
+void test4()
+{
+ test("abcde", 6, 0, "", 0, 0);
+ test("abcde", 6, 0, "abcde", 0, 0);
+ test("abcde", 6, 0, "abcde", 1, 0);
+ test("abcde", 6, 0, "abcde", 2, 0);
+ test("abcde", 6, 0, "abcde", 4, 0);
+ test("abcde", 6, 0, "abcde", 5, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 0);
+ test("abcde", 6, 0, "abcdefghij", 9, 0);
+ test("abcde", 6, 0, "abcdefghij", 10, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 0);
+ test("abcdefghij", 0, 0, "", 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 1, -1);
+ test("abcdefghij", 0, 0, "abcde", 2, -2);
+ test("abcdefghij", 0, 0, "abcde", 4, -4);
+ test("abcdefghij", 0, 0, "abcde", 5, -5);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, -5);
+ test("abcdefghij", 0, 0, "abcdefghij", 9, -9);
+ test("abcdefghij", 0, 0, "abcdefghij", 10, -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 0, 1, "", 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 1, 0);
+ test("abcdefghij", 0, 1, "abcde", 2, -1);
+ test("abcdefghij", 0, 1, "abcde", 4, -3);
+ test("abcdefghij", 0, 1, "abcde", 5, -4);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 0);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, -4);
+ test("abcdefghij", 0, 1, "abcdefghij", 9, -8);
+ test("abcdefghij", 0, 1, "abcdefghij", 10, -9);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 0);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, -9);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, -18);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, -19);
+ test("abcdefghij", 0, 5, "", 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 1, 4);
+ test("abcdefghij", 0, 5, "abcde", 2, 3);
+ test("abcdefghij", 0, 5, "abcde", 4, 1);
+ test("abcdefghij", 0, 5, "abcde", 5, 0);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 4);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 0);
+ test("abcdefghij", 0, 5, "abcdefghij", 9, -4);
+ test("abcdefghij", 0, 5, "abcdefghij", 10, -5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 4);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, -5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, -14);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, -15);
+ test("abcdefghij", 0, 9, "", 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 1, 8);
+ test("abcdefghij", 0, 9, "abcde", 2, 7);
+ test("abcdefghij", 0, 9, "abcde", 4, 5);
+ test("abcdefghij", 0, 9, "abcde", 5, 4);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 8);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 4);
+ test("abcdefghij", 0, 9, "abcdefghij", 9, 0);
+ test("abcdefghij", 0, 9, "abcdefghij", 10, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 8);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, -11);
+ test("abcdefghij", 0, 10, "", 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 1, 9);
+ test("abcdefghij", 0, 10, "abcde", 2, 8);
+ test("abcdefghij", 0, 10, "abcde", 4, 6);
+ test("abcdefghij", 0, 10, "abcde", 5, 5);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 9);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 5);
+ test("abcdefghij", 0, 10, "abcdefghij", 9, 1);
+ test("abcdefghij", 0, 10, "abcdefghij", 10, 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 9);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, -9);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, -10);
+ test("abcdefghij", 0, 11, "", 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 1, 9);
+ test("abcdefghij", 0, 11, "abcde", 2, 8);
+}
+
+
+void test5()
+{
+ test("abcdefghij", 0, 11, "abcde", 4, 6);
+ test("abcdefghij", 0, 11, "abcde", 5, 5);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 9);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 5);
+ test("abcdefghij", 0, 11, "abcdefghij", 9, 1);
+ test("abcdefghij", 0, 11, "abcdefghij", 10, 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 9);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, -9);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, -10);
+ test("abcdefghij", 1, 0, "", 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 1, -1);
+ test("abcdefghij", 1, 0, "abcde", 2, -2);
+ test("abcdefghij", 1, 0, "abcde", 4, -4);
+ test("abcdefghij", 1, 0, "abcde", 5, -5);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, -5);
+ test("abcdefghij", 1, 0, "abcdefghij", 9, -9);
+ test("abcdefghij", 1, 0, "abcdefghij", 10, -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 1, 1, "", 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 1, 1);
+ test("abcdefghij", 1, 1, "abcde", 2, 1);
+ test("abcdefghij", 1, 1, "abcde", 4, 1);
+ test("abcdefghij", 1, 1, "abcde", 5, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 9, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 10, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghij", 1, 4, "", 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 1, 1);
+ test("abcdefghij", 1, 4, "abcde", 2, 1);
+ test("abcdefghij", 1, 4, "abcde", 4, 1);
+ test("abcdefghij", 1, 4, "abcde", 5, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 9, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 10, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghij", 1, 8, "", 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 1, 1);
+ test("abcdefghij", 1, 8, "abcde", 2, 1);
+ test("abcdefghij", 1, 8, "abcde", 4, 1);
+ test("abcdefghij", 1, 8, "abcde", 5, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 9, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 10, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghij", 1, 9, "", 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 1, 1);
+ test("abcdefghij", 1, 9, "abcde", 2, 1);
+ test("abcdefghij", 1, 9, "abcde", 4, 1);
+ test("abcdefghij", 1, 9, "abcde", 5, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 9, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 10, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghij", 1, 10, "", 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 1, 1);
+ test("abcdefghij", 1, 10, "abcde", 2, 1);
+ test("abcdefghij", 1, 10, "abcde", 4, 1);
+ test("abcdefghij", 1, 10, "abcde", 5, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 1);
+}
+
+
+void test6()
+{
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 9, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 10, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghij", 5, 0, "", 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 1, -1);
+ test("abcdefghij", 5, 0, "abcde", 2, -2);
+ test("abcdefghij", 5, 0, "abcde", 4, -4);
+ test("abcdefghij", 5, 0, "abcde", 5, -5);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, -5);
+ test("abcdefghij", 5, 0, "abcdefghij", 9, -9);
+ test("abcdefghij", 5, 0, "abcdefghij", 10, -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 5, 1, "", 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 1, 5);
+ test("abcdefghij", 5, 1, "abcde", 2, 5);
+ test("abcdefghij", 5, 1, "abcde", 4, 5);
+ test("abcdefghij", 5, 1, "abcde", 5, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 9, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 10, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 5);
+ test("abcdefghij", 5, 2, "", 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 1, 5);
+ test("abcdefghij", 5, 2, "abcde", 2, 5);
+ test("abcdefghij", 5, 2, "abcde", 4, 5);
+ test("abcdefghij", 5, 2, "abcde", 5, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 9, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 10, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 5);
+ test("abcdefghij", 5, 4, "", 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 5);
+ test("abcdefghij", 5, 4, "abcde", 2, 5);
+ test("abcdefghij", 5, 4, "abcde", 4, 5);
+ test("abcdefghij", 5, 4, "abcde", 5, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 9, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 10, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 5);
+ test("abcdefghij", 5, 5, "", 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 1, 5);
+ test("abcdefghij", 5, 5, "abcde", 2, 5);
+ test("abcdefghij", 5, 5, "abcde", 4, 5);
+ test("abcdefghij", 5, 5, "abcde", 5, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 9, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 10, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 5);
+ test("abcdefghij", 5, 6, "", 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 1, 5);
+ test("abcdefghij", 5, 6, "abcde", 2, 5);
+ test("abcdefghij", 5, 6, "abcde", 4, 5);
+ test("abcdefghij", 5, 6, "abcde", 5, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 9, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 10, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 5);
+}
+
+
+void test7()
+{
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 5);
+ test("abcdefghij", 9, 0, "", 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 1, -1);
+ test("abcdefghij", 9, 0, "abcde", 2, -2);
+ test("abcdefghij", 9, 0, "abcde", 4, -4);
+ test("abcdefghij", 9, 0, "abcde", 5, -5);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, -5);
+ test("abcdefghij", 9, 0, "abcdefghij", 9, -9);
+ test("abcdefghij", 9, 0, "abcdefghij", 10, -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 9, 1, "", 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 1, 9);
+ test("abcdefghij", 9, 1, "abcde", 2, 9);
+ test("abcdefghij", 9, 1, "abcde", 4, 9);
+ test("abcdefghij", 9, 1, "abcde", 5, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 9, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 10, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 9);
+ test("abcdefghij", 9, 2, "", 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 1, 9);
+ test("abcdefghij", 9, 2, "abcde", 2, 9);
+ test("abcdefghij", 9, 2, "abcde", 4, 9);
+ test("abcdefghij", 9, 2, "abcde", 5, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 9, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 10, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 9);
+ test("abcdefghij", 10, 0, "", 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 1, -1);
+ test("abcdefghij", 10, 0, "abcde", 2, -2);
+ test("abcdefghij", 10, 0, "abcde", 4, -4);
+ test("abcdefghij", 10, 0, "abcde", 5, -5);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, -5);
+ test("abcdefghij", 10, 0, "abcdefghij", 9, -9);
+ test("abcdefghij", 10, 0, "abcdefghij", 10, -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 10, 1, "", 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 1, -1);
+ test("abcdefghij", 10, 1, "abcde", 2, -2);
+ test("abcdefghij", 10, 1, "abcde", 4, -4);
+ test("abcdefghij", 10, 1, "abcde", 5, -5);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, -5);
+ test("abcdefghij", 10, 1, "abcdefghij", 9, -9);
+ test("abcdefghij", 10, 1, "abcdefghij", 10, -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghij", 11, 0, "", 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 0);
+ test("abcdefghij", 11, 0, "abcde", 4, 0);
+ test("abcdefghij", 11, 0, "abcde", 5, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 9, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 0);
+}
+
+void test8()
+{
+ test("abcdefghijklmnopqrst", 0, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, -2);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 0, 1, "", 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, -3);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, -8);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, -18);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, -19);
+ test("abcdefghijklmnopqrst", 0, 10, "", 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 8);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 6);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, -9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "", 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 17);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 15);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 18);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 16);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 11);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 18);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 16);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 11);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, -2);
+}
+
+
+void test9()
+{
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 1, 1, "", 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "", 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "", 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 1);
+ test("abcdefghijklmnopqrst", 10, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, -2);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, -1);
+}
+
+
+void test10()
+{
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 10, 1, "", 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "", 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "", 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 10);
+ test("abcdefghijklmnopqrst", 19, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, -2);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 0);
+}
+
+
+void test11()
+{
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 19, 1, "", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 19);
+ test("abcdefghijklmnopqrst", 20, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, -2);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 20, 1, "", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, -2);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, -19);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, -20);
+ test("abcdefghijklmnopqrst", 21, 0, "", 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 0);
+ }
+
+
+int main () {
+ test0();
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
+
+ {
+ test("", 0, 0, "abcde", 0, 0);
+ test("", 0, 0, "abcde", 1, -1);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, -10);
+ }
+
+ {
+ test(L"", 0, 0, L"abcde", 0, 0);
+ test(L"", 0, 0, L"abcde", 1, -1);
+ test(L"abcdefghijklmnopqrst", 21, 0, L"abcde", 0, 0);
+ test(L"abcdefghijklmnopqrst", 21, 0, L"abcde", 1, 0);
+ test(L"abcdefghijklmnopqrst", 10, 0, L"abcdefghij", 10, -10);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ test(U"", 0, 0, U"abcde", 0, 0);
+ test(U"", 0, 0, U"abcde", 1, -1);
+ test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 0, 0);
+ test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 1, 0);
+ test(U"abcdefghijklmnopqrst", 10, 0, U"abcdefghij", 10, -10);
+ }
+
+ {
+ test(U"", 0, 0, U"abcde", 0, 0);
+ test(U"", 0, 0, U"abcde", 1, -1);
+ test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 0, 0);
+ test(U"abcdefghijklmnopqrst", 21, 0, U"abcde", 1, 0);
+ test(U"abcdefghijklmnopqrst", 10, 0, U"abcdefghij", 10, -10);
+ }
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1;
+ constexpr SV sv2 { "abcdefghijklmnopqrst", 21 };
+ static_assert ( sv1.compare(0, 0, "abcde", 0) == 0, "" );
+ static_assert ( sv1.compare(0, 0, "abcde", 1) == -1, "" );
+ static_assert ( sv2.compare(0, 0, "abcde", 1, 0) == 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
new file mode 100644
index 000000000000..5b47486192cd
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
@@ -0,0 +1,5847 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr int compare(size_type pos1, size_type n1, basic_string_view str,
+// size_type pos2, size_type n2) const;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1, size_t pos1, size_t n1,
+ std::basic_string_view<CharT> sv2, size_t pos2, size_t n2,
+ int expected ) {
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (pos1 <= sv1.size() && pos2 <= sv2.size())
+ assert (sign( sv1.compare(pos1, n1, sv2, pos2, n2)) == sign(expected));
+#else
+ try {
+ assert (sign( sv1.compare(pos1, n1, sv2, pos2, n2)) == sign(expected));
+ assert(pos1 <= sv1.size() && pos2 <= sv2.size());
+ }
+ catch (const std::out_of_range&) {
+ assert(pos1 > sv1.size() || pos2 > sv2.size());
+ }
+#endif
+}
+
+
+template<typename CharT>
+void test ( const CharT *s1, size_t pos1, size_t n1,
+ const CharT *s2, size_t pos2, size_t n2,
+ int expected ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+
+ string_view_t sv1 ( s1 );
+ string_view_t sv2 ( s2 );
+ test1(sv1, pos1, n1, sv2, pos2, n2, expected);
+}
+
+void test0()
+{
+ test("", 0, 0, "", 0, 0, 0);
+ test("", 0, 0, "", 0, 1, 0);
+ test("", 0, 0, "", 1, 0, 0);
+ test("", 0, 0, "abcde", 0, 0, 0);
+ test("", 0, 0, "abcde", 0, 1, -1);
+ test("", 0, 0, "abcde", 0, 2, -2);
+ test("", 0, 0, "abcde", 0, 4, -4);
+ test("", 0, 0, "abcde", 0, 5, -5);
+ test("", 0, 0, "abcde", 0, 6, -5);
+ test("", 0, 0, "abcde", 1, 0, 0);
+ test("", 0, 0, "abcde", 1, 1, -1);
+ test("", 0, 0, "abcde", 1, 2, -2);
+ test("", 0, 0, "abcde", 1, 3, -3);
+ test("", 0, 0, "abcde", 1, 4, -4);
+ test("", 0, 0, "abcde", 1, 5, -4);
+ test("", 0, 0, "abcde", 2, 0, 0);
+ test("", 0, 0, "abcde", 2, 1, -1);
+ test("", 0, 0, "abcde", 2, 2, -2);
+ test("", 0, 0, "abcde", 2, 3, -3);
+ test("", 0, 0, "abcde", 2, 4, -3);
+ test("", 0, 0, "abcde", 4, 0, 0);
+ test("", 0, 0, "abcde", 4, 1, -1);
+ test("", 0, 0, "abcde", 4, 2, -1);
+ test("", 0, 0, "abcde", 5, 0, 0);
+ test("", 0, 0, "abcde", 5, 1, 0);
+ test("", 0, 0, "abcde", 6, 0, 0);
+ test("", 0, 0, "abcdefghij", 0, 0, 0);
+ test("", 0, 0, "abcdefghij", 0, 1, -1);
+ test("", 0, 0, "abcdefghij", 0, 5, -5);
+ test("", 0, 0, "abcdefghij", 0, 9, -9);
+ test("", 0, 0, "abcdefghij", 0, 10, -10);
+ test("", 0, 0, "abcdefghij", 0, 11, -10);
+ test("", 0, 0, "abcdefghij", 1, 0, 0);
+ test("", 0, 0, "abcdefghij", 1, 1, -1);
+ test("", 0, 0, "abcdefghij", 1, 4, -4);
+ test("", 0, 0, "abcdefghij", 1, 8, -8);
+ test("", 0, 0, "abcdefghij", 1, 9, -9);
+ test("", 0, 0, "abcdefghij", 1, 10, -9);
+ test("", 0, 0, "abcdefghij", 5, 0, 0);
+ test("", 0, 0, "abcdefghij", 5, 1, -1);
+ test("", 0, 0, "abcdefghij", 5, 2, -2);
+ test("", 0, 0, "abcdefghij", 5, 4, -4);
+ test("", 0, 0, "abcdefghij", 5, 5, -5);
+ test("", 0, 0, "abcdefghij", 5, 6, -5);
+ test("", 0, 0, "abcdefghij", 9, 0, 0);
+ test("", 0, 0, "abcdefghij", 9, 1, -1);
+ test("", 0, 0, "abcdefghij", 9, 2, -1);
+ test("", 0, 0, "abcdefghij", 10, 0, 0);
+ test("", 0, 0, "abcdefghij", 10, 1, 0);
+ test("", 0, 0, "abcdefghij", 11, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("", 0, 1, "", 0, 0, 0);
+ test("", 0, 1, "", 0, 1, 0);
+ test("", 0, 1, "", 1, 0, 0);
+ test("", 0, 1, "abcde", 0, 0, 0);
+ test("", 0, 1, "abcde", 0, 1, -1);
+ test("", 0, 1, "abcde", 0, 2, -2);
+ test("", 0, 1, "abcde", 0, 4, -4);
+ test("", 0, 1, "abcde", 0, 5, -5);
+ test("", 0, 1, "abcde", 0, 6, -5);
+ test("", 0, 1, "abcde", 1, 0, 0);
+ test("", 0, 1, "abcde", 1, 1, -1);
+ test("", 0, 1, "abcde", 1, 2, -2);
+ test("", 0, 1, "abcde", 1, 3, -3);
+ test("", 0, 1, "abcde", 1, 4, -4);
+ test("", 0, 1, "abcde", 1, 5, -4);
+ test("", 0, 1, "abcde", 2, 0, 0);
+ test("", 0, 1, "abcde", 2, 1, -1);
+ test("", 0, 1, "abcde", 2, 2, -2);
+ test("", 0, 1, "abcde", 2, 3, -3);
+ test("", 0, 1, "abcde", 2, 4, -3);
+ test("", 0, 1, "abcde", 4, 0, 0);
+ test("", 0, 1, "abcde", 4, 1, -1);
+ test("", 0, 1, "abcde", 4, 2, -1);
+ test("", 0, 1, "abcde", 5, 0, 0);
+ test("", 0, 1, "abcde", 5, 1, 0);
+ test("", 0, 1, "abcde", 6, 0, 0);
+}
+
+void test1()
+{
+ test("", 0, 1, "abcdefghij", 0, 0, 0);
+ test("", 0, 1, "abcdefghij", 0, 1, -1);
+ test("", 0, 1, "abcdefghij", 0, 5, -5);
+ test("", 0, 1, "abcdefghij", 0, 9, -9);
+ test("", 0, 1, "abcdefghij", 0, 10, -10);
+ test("", 0, 1, "abcdefghij", 0, 11, -10);
+ test("", 0, 1, "abcdefghij", 1, 0, 0);
+ test("", 0, 1, "abcdefghij", 1, 1, -1);
+ test("", 0, 1, "abcdefghij", 1, 4, -4);
+ test("", 0, 1, "abcdefghij", 1, 8, -8);
+ test("", 0, 1, "abcdefghij", 1, 9, -9);
+ test("", 0, 1, "abcdefghij", 1, 10, -9);
+ test("", 0, 1, "abcdefghij", 5, 0, 0);
+ test("", 0, 1, "abcdefghij", 5, 1, -1);
+ test("", 0, 1, "abcdefghij", 5, 2, -2);
+ test("", 0, 1, "abcdefghij", 5, 4, -4);
+ test("", 0, 1, "abcdefghij", 5, 5, -5);
+ test("", 0, 1, "abcdefghij", 5, 6, -5);
+ test("", 0, 1, "abcdefghij", 9, 0, 0);
+ test("", 0, 1, "abcdefghij", 9, 1, -1);
+ test("", 0, 1, "abcdefghij", 9, 2, -1);
+ test("", 0, 1, "abcdefghij", 10, 0, 0);
+ test("", 0, 1, "abcdefghij", 10, 1, 0);
+ test("", 0, 1, "abcdefghij", 11, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("", 0, 1, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("", 0, 1, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("", 0, 1, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("", 0, 1, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("", 1, 0, "", 0, 0, 0);
+ test("", 1, 0, "", 0, 1, 0);
+ test("", 1, 0, "", 1, 0, 0);
+ test("", 1, 0, "abcde", 0, 0, 0);
+ test("", 1, 0, "abcde", 0, 1, 0);
+ test("", 1, 0, "abcde", 0, 2, 0);
+ test("", 1, 0, "abcde", 0, 4, 0);
+ test("", 1, 0, "abcde", 0, 5, 0);
+ test("", 1, 0, "abcde", 0, 6, 0);
+ test("", 1, 0, "abcde", 1, 0, 0);
+ test("", 1, 0, "abcde", 1, 1, 0);
+ test("", 1, 0, "abcde", 1, 2, 0);
+ test("", 1, 0, "abcde", 1, 3, 0);
+ test("", 1, 0, "abcde", 1, 4, 0);
+ test("", 1, 0, "abcde", 1, 5, 0);
+ test("", 1, 0, "abcde", 2, 0, 0);
+ test("", 1, 0, "abcde", 2, 1, 0);
+ test("", 1, 0, "abcde", 2, 2, 0);
+ test("", 1, 0, "abcde", 2, 3, 0);
+ test("", 1, 0, "abcde", 2, 4, 0);
+ test("", 1, 0, "abcde", 4, 0, 0);
+ test("", 1, 0, "abcde", 4, 1, 0);
+ test("", 1, 0, "abcde", 4, 2, 0);
+ test("", 1, 0, "abcde", 5, 0, 0);
+ test("", 1, 0, "abcde", 5, 1, 0);
+ test("", 1, 0, "abcde", 6, 0, 0);
+ test("", 1, 0, "abcdefghij", 0, 0, 0);
+ test("", 1, 0, "abcdefghij", 0, 1, 0);
+ test("", 1, 0, "abcdefghij", 0, 5, 0);
+ test("", 1, 0, "abcdefghij", 0, 9, 0);
+ test("", 1, 0, "abcdefghij", 0, 10, 0);
+ test("", 1, 0, "abcdefghij", 0, 11, 0);
+ test("", 1, 0, "abcdefghij", 1, 0, 0);
+ test("", 1, 0, "abcdefghij", 1, 1, 0);
+ test("", 1, 0, "abcdefghij", 1, 4, 0);
+ test("", 1, 0, "abcdefghij", 1, 8, 0);
+ test("", 1, 0, "abcdefghij", 1, 9, 0);
+ test("", 1, 0, "abcdefghij", 1, 10, 0);
+ test("", 1, 0, "abcdefghij", 5, 0, 0);
+ test("", 1, 0, "abcdefghij", 5, 1, 0);
+ test("", 1, 0, "abcdefghij", 5, 2, 0);
+ test("", 1, 0, "abcdefghij", 5, 4, 0);
+ test("", 1, 0, "abcdefghij", 5, 5, 0);
+ test("", 1, 0, "abcdefghij", 5, 6, 0);
+ test("", 1, 0, "abcdefghij", 9, 0, 0);
+ test("", 1, 0, "abcdefghij", 9, 1, 0);
+ test("", 1, 0, "abcdefghij", 9, 2, 0);
+ test("", 1, 0, "abcdefghij", 10, 0, 0);
+ test("", 1, 0, "abcdefghij", 10, 1, 0);
+ test("", 1, 0, "abcdefghij", 11, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 1, 0);
+}
+
+void test2()
+{
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 19, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 18, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 1, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 5, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 9, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 0, "", 0, 0, 0);
+ test("abcde", 0, 0, "", 0, 1, 0);
+ test("abcde", 0, 0, "", 1, 0, 0);
+ test("abcde", 0, 0, "abcde", 0, 0, 0);
+ test("abcde", 0, 0, "abcde", 0, 1, -1);
+ test("abcde", 0, 0, "abcde", 0, 2, -2);
+ test("abcde", 0, 0, "abcde", 0, 4, -4);
+ test("abcde", 0, 0, "abcde", 0, 5, -5);
+ test("abcde", 0, 0, "abcde", 0, 6, -5);
+ test("abcde", 0, 0, "abcde", 1, 0, 0);
+ test("abcde", 0, 0, "abcde", 1, 1, -1);
+ test("abcde", 0, 0, "abcde", 1, 2, -2);
+ test("abcde", 0, 0, "abcde", 1, 3, -3);
+ test("abcde", 0, 0, "abcde", 1, 4, -4);
+ test("abcde", 0, 0, "abcde", 1, 5, -4);
+ test("abcde", 0, 0, "abcde", 2, 0, 0);
+ test("abcde", 0, 0, "abcde", 2, 1, -1);
+ test("abcde", 0, 0, "abcde", 2, 2, -2);
+ test("abcde", 0, 0, "abcde", 2, 3, -3);
+ test("abcde", 0, 0, "abcde", 2, 4, -3);
+ test("abcde", 0, 0, "abcde", 4, 0, 0);
+ test("abcde", 0, 0, "abcde", 4, 1, -1);
+ test("abcde", 0, 0, "abcde", 4, 2, -1);
+ test("abcde", 0, 0, "abcde", 5, 0, 0);
+ test("abcde", 0, 0, "abcde", 5, 1, 0);
+ test("abcde", 0, 0, "abcde", 6, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 0, 1, -1);
+ test("abcde", 0, 0, "abcdefghij", 0, 5, -5);
+ test("abcde", 0, 0, "abcdefghij", 0, 9, -9);
+ test("abcde", 0, 0, "abcdefghij", 0, 10, -10);
+ test("abcde", 0, 0, "abcdefghij", 0, 11, -10);
+ test("abcde", 0, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 0, "abcdefghij", 1, 4, -4);
+ test("abcde", 0, 0, "abcdefghij", 1, 8, -8);
+ test("abcde", 0, 0, "abcdefghij", 1, 9, -9);
+ test("abcde", 0, 0, "abcdefghij", 1, 10, -9);
+ test("abcde", 0, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 5, 1, -1);
+ test("abcde", 0, 0, "abcdefghij", 5, 2, -2);
+ test("abcde", 0, 0, "abcdefghij", 5, 4, -4);
+ test("abcde", 0, 0, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 0, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 9, 1, -1);
+ test("abcde", 0, 0, "abcdefghij", 9, 2, -1);
+ test("abcde", 0, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 0, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 0, 0, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 1, "", 0, 0, 1);
+ test("abcde", 0, 1, "", 0, 1, 1);
+ test("abcde", 0, 1, "", 1, 0, 0);
+ test("abcde", 0, 1, "abcde", 0, 0, 1);
+}
+
+void test3()
+{
+ test("abcde", 0, 1, "abcde", 0, 1, 0);
+ test("abcde", 0, 1, "abcde", 0, 2, -1);
+ test("abcde", 0, 1, "abcde", 0, 4, -3);
+ test("abcde", 0, 1, "abcde", 0, 5, -4);
+ test("abcde", 0, 1, "abcde", 0, 6, -4);
+ test("abcde", 0, 1, "abcde", 1, 0, 1);
+ test("abcde", 0, 1, "abcde", 1, 1, -1);
+ test("abcde", 0, 1, "abcde", 1, 2, -1);
+ test("abcde", 0, 1, "abcde", 1, 3, -1);
+ test("abcde", 0, 1, "abcde", 1, 4, -1);
+ test("abcde", 0, 1, "abcde", 1, 5, -1);
+ test("abcde", 0, 1, "abcde", 2, 0, 1);
+ test("abcde", 0, 1, "abcde", 2, 1, -2);
+ test("abcde", 0, 1, "abcde", 2, 2, -2);
+ test("abcde", 0, 1, "abcde", 2, 3, -2);
+ test("abcde", 0, 1, "abcde", 2, 4, -2);
+ test("abcde", 0, 1, "abcde", 4, 0, 1);
+ test("abcde", 0, 1, "abcde", 4, 1, -4);
+ test("abcde", 0, 1, "abcde", 4, 2, -4);
+ test("abcde", 0, 1, "abcde", 5, 0, 1);
+ test("abcde", 0, 1, "abcde", 5, 1, 1);
+ test("abcde", 0, 1, "abcde", 6, 0, 0);
+ test("abcde", 0, 1, "abcdefghij", 0, 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 0, 1, 0);
+ test("abcde", 0, 1, "abcdefghij", 0, 5, -4);
+ test("abcde", 0, 1, "abcdefghij", 0, 9, -8);
+ test("abcde", 0, 1, "abcdefghij", 0, 10, -9);
+ test("abcde", 0, 1, "abcdefghij", 0, 11, -9);
+ test("abcde", 0, 1, "abcdefghij", 1, 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 1, "abcdefghij", 1, 4, -1);
+ test("abcde", 0, 1, "abcdefghij", 1, 8, -1);
+ test("abcde", 0, 1, "abcdefghij", 1, 9, -1);
+ test("abcde", 0, 1, "abcdefghij", 1, 10, -1);
+ test("abcde", 0, 1, "abcdefghij", 5, 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 5, 1, -5);
+ test("abcde", 0, 1, "abcdefghij", 5, 2, -5);
+ test("abcde", 0, 1, "abcdefghij", 5, 4, -5);
+ test("abcde", 0, 1, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 1, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 1, "abcdefghij", 9, 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 9, 1, -9);
+ test("abcde", 0, 1, "abcdefghij", 9, 2, -9);
+ test("abcde", 0, 1, "abcdefghij", 10, 0, 1);
+ test("abcde", 0, 1, "abcdefghij", 10, 1, 1);
+ test("abcde", 0, 1, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcde", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 2, "", 0, 0, 2);
+ test("abcde", 0, 2, "", 0, 1, 2);
+ test("abcde", 0, 2, "", 1, 0, 0);
+ test("abcde", 0, 2, "abcde", 0, 0, 2);
+ test("abcde", 0, 2, "abcde", 0, 1, 1);
+ test("abcde", 0, 2, "abcde", 0, 2, 0);
+ test("abcde", 0, 2, "abcde", 0, 4, -2);
+ test("abcde", 0, 2, "abcde", 0, 5, -3);
+ test("abcde", 0, 2, "abcde", 0, 6, -3);
+ test("abcde", 0, 2, "abcde", 1, 0, 2);
+ test("abcde", 0, 2, "abcde", 1, 1, -1);
+ test("abcde", 0, 2, "abcde", 1, 2, -1);
+ test("abcde", 0, 2, "abcde", 1, 3, -1);
+ test("abcde", 0, 2, "abcde", 1, 4, -1);
+ test("abcde", 0, 2, "abcde", 1, 5, -1);
+ test("abcde", 0, 2, "abcde", 2, 0, 2);
+ test("abcde", 0, 2, "abcde", 2, 1, -2);
+ test("abcde", 0, 2, "abcde", 2, 2, -2);
+ test("abcde", 0, 2, "abcde", 2, 3, -2);
+ test("abcde", 0, 2, "abcde", 2, 4, -2);
+ test("abcde", 0, 2, "abcde", 4, 0, 2);
+ test("abcde", 0, 2, "abcde", 4, 1, -4);
+ test("abcde", 0, 2, "abcde", 4, 2, -4);
+ test("abcde", 0, 2, "abcde", 5, 0, 2);
+ test("abcde", 0, 2, "abcde", 5, 1, 2);
+ test("abcde", 0, 2, "abcde", 6, 0, 0);
+ test("abcde", 0, 2, "abcdefghij", 0, 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 0, 1, 1);
+ test("abcde", 0, 2, "abcdefghij", 0, 5, -3);
+ test("abcde", 0, 2, "abcdefghij", 0, 9, -7);
+}
+
+void test4()
+{
+ test("abcde", 0, 2, "abcdefghij", 0, 10, -8);
+ test("abcde", 0, 2, "abcdefghij", 0, 11, -8);
+ test("abcde", 0, 2, "abcdefghij", 1, 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 2, "abcdefghij", 1, 4, -1);
+ test("abcde", 0, 2, "abcdefghij", 1, 8, -1);
+ test("abcde", 0, 2, "abcdefghij", 1, 9, -1);
+ test("abcde", 0, 2, "abcdefghij", 1, 10, -1);
+ test("abcde", 0, 2, "abcdefghij", 5, 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 5, 1, -5);
+ test("abcde", 0, 2, "abcdefghij", 5, 2, -5);
+ test("abcde", 0, 2, "abcdefghij", 5, 4, -5);
+ test("abcde", 0, 2, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 2, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 2, "abcdefghij", 9, 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 9, 1, -9);
+ test("abcde", 0, 2, "abcdefghij", 9, 2, -9);
+ test("abcde", 0, 2, "abcdefghij", 10, 0, 2);
+ test("abcde", 0, 2, "abcdefghij", 10, 1, 2);
+ test("abcde", 0, 2, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 10, -8);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 19, -17);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 20, -18);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 0, 21, -18);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, 0, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 20, 1, 2);
+ test("abcde", 0, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 4, "", 0, 0, 4);
+ test("abcde", 0, 4, "", 0, 1, 4);
+ test("abcde", 0, 4, "", 1, 0, 0);
+ test("abcde", 0, 4, "abcde", 0, 0, 4);
+ test("abcde", 0, 4, "abcde", 0, 1, 3);
+ test("abcde", 0, 4, "abcde", 0, 2, 2);
+ test("abcde", 0, 4, "abcde", 0, 4, 0);
+ test("abcde", 0, 4, "abcde", 0, 5, -1);
+ test("abcde", 0, 4, "abcde", 0, 6, -1);
+ test("abcde", 0, 4, "abcde", 1, 0, 4);
+ test("abcde", 0, 4, "abcde", 1, 1, -1);
+ test("abcde", 0, 4, "abcde", 1, 2, -1);
+ test("abcde", 0, 4, "abcde", 1, 3, -1);
+ test("abcde", 0, 4, "abcde", 1, 4, -1);
+ test("abcde", 0, 4, "abcde", 1, 5, -1);
+ test("abcde", 0, 4, "abcde", 2, 0, 4);
+ test("abcde", 0, 4, "abcde", 2, 1, -2);
+ test("abcde", 0, 4, "abcde", 2, 2, -2);
+ test("abcde", 0, 4, "abcde", 2, 3, -2);
+ test("abcde", 0, 4, "abcde", 2, 4, -2);
+ test("abcde", 0, 4, "abcde", 4, 0, 4);
+ test("abcde", 0, 4, "abcde", 4, 1, -4);
+ test("abcde", 0, 4, "abcde", 4, 2, -4);
+ test("abcde", 0, 4, "abcde", 5, 0, 4);
+ test("abcde", 0, 4, "abcde", 5, 1, 4);
+ test("abcde", 0, 4, "abcde", 6, 0, 0);
+ test("abcde", 0, 4, "abcdefghij", 0, 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 0, 1, 3);
+ test("abcde", 0, 4, "abcdefghij", 0, 5, -1);
+ test("abcde", 0, 4, "abcdefghij", 0, 9, -5);
+ test("abcde", 0, 4, "abcdefghij", 0, 10, -6);
+ test("abcde", 0, 4, "abcdefghij", 0, 11, -6);
+ test("abcde", 0, 4, "abcdefghij", 1, 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 4, "abcdefghij", 1, 4, -1);
+ test("abcde", 0, 4, "abcdefghij", 1, 8, -1);
+ test("abcde", 0, 4, "abcdefghij", 1, 9, -1);
+ test("abcde", 0, 4, "abcdefghij", 1, 10, -1);
+ test("abcde", 0, 4, "abcdefghij", 5, 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 5, 1, -5);
+ test("abcde", 0, 4, "abcdefghij", 5, 2, -5);
+ test("abcde", 0, 4, "abcdefghij", 5, 4, -5);
+ test("abcde", 0, 4, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 4, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 4, "abcdefghij", 9, 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 9, 1, -9);
+ test("abcde", 0, 4, "abcdefghij", 9, 2, -9);
+ test("abcde", 0, 4, "abcdefghij", 10, 0, 4);
+ test("abcde", 0, 4, "abcdefghij", 10, 1, 4);
+ test("abcde", 0, 4, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 1, 3);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 10, -6);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 19, -15);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 20, -16);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 0, 21, -16);
+}
+
+void test5()
+{
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, 0, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 20, 1, 4);
+ test("abcde", 0, 4, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 5, "", 0, 0, 5);
+ test("abcde", 0, 5, "", 0, 1, 5);
+ test("abcde", 0, 5, "", 1, 0, 0);
+ test("abcde", 0, 5, "abcde", 0, 0, 5);
+ test("abcde", 0, 5, "abcde", 0, 1, 4);
+ test("abcde", 0, 5, "abcde", 0, 2, 3);
+ test("abcde", 0, 5, "abcde", 0, 4, 1);
+ test("abcde", 0, 5, "abcde", 0, 5, 0);
+ test("abcde", 0, 5, "abcde", 0, 6, 0);
+ test("abcde", 0, 5, "abcde", 1, 0, 5);
+ test("abcde", 0, 5, "abcde", 1, 1, -1);
+ test("abcde", 0, 5, "abcde", 1, 2, -1);
+ test("abcde", 0, 5, "abcde", 1, 3, -1);
+ test("abcde", 0, 5, "abcde", 1, 4, -1);
+ test("abcde", 0, 5, "abcde", 1, 5, -1);
+ test("abcde", 0, 5, "abcde", 2, 0, 5);
+ test("abcde", 0, 5, "abcde", 2, 1, -2);
+ test("abcde", 0, 5, "abcde", 2, 2, -2);
+ test("abcde", 0, 5, "abcde", 2, 3, -2);
+ test("abcde", 0, 5, "abcde", 2, 4, -2);
+ test("abcde", 0, 5, "abcde", 4, 0, 5);
+ test("abcde", 0, 5, "abcde", 4, 1, -4);
+ test("abcde", 0, 5, "abcde", 4, 2, -4);
+ test("abcde", 0, 5, "abcde", 5, 0, 5);
+ test("abcde", 0, 5, "abcde", 5, 1, 5);
+ test("abcde", 0, 5, "abcde", 6, 0, 0);
+ test("abcde", 0, 5, "abcdefghij", 0, 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 0, 1, 4);
+ test("abcde", 0, 5, "abcdefghij", 0, 5, 0);
+ test("abcde", 0, 5, "abcdefghij", 0, 9, -4);
+ test("abcde", 0, 5, "abcdefghij", 0, 10, -5);
+ test("abcde", 0, 5, "abcdefghij", 0, 11, -5);
+ test("abcde", 0, 5, "abcdefghij", 1, 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 5, "abcdefghij", 1, 4, -1);
+ test("abcde", 0, 5, "abcdefghij", 1, 8, -1);
+ test("abcde", 0, 5, "abcdefghij", 1, 9, -1);
+ test("abcde", 0, 5, "abcdefghij", 1, 10, -1);
+ test("abcde", 0, 5, "abcdefghij", 5, 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 5, 1, -5);
+ test("abcde", 0, 5, "abcdefghij", 5, 2, -5);
+ test("abcde", 0, 5, "abcdefghij", 5, 4, -5);
+ test("abcde", 0, 5, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 5, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 5, "abcdefghij", 9, 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 9, 1, -9);
+ test("abcde", 0, 5, "abcdefghij", 9, 2, -9);
+ test("abcde", 0, 5, "abcdefghij", 10, 0, 5);
+ test("abcde", 0, 5, "abcdefghij", 10, 1, 5);
+ test("abcde", 0, 5, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 1, 4);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 10, -5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 19, -14);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 20, -15);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 0, 21, -15);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcde", 0, 5, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 0, 6, "", 0, 0, 5);
+ test("abcde", 0, 6, "", 0, 1, 5);
+ test("abcde", 0, 6, "", 1, 0, 0);
+ test("abcde", 0, 6, "abcde", 0, 0, 5);
+ test("abcde", 0, 6, "abcde", 0, 1, 4);
+ test("abcde", 0, 6, "abcde", 0, 2, 3);
+ test("abcde", 0, 6, "abcde", 0, 4, 1);
+ test("abcde", 0, 6, "abcde", 0, 5, 0);
+}
+
+void test6()
+{
+ test("abcde", 0, 6, "abcde", 0, 6, 0);
+ test("abcde", 0, 6, "abcde", 1, 0, 5);
+ test("abcde", 0, 6, "abcde", 1, 1, -1);
+ test("abcde", 0, 6, "abcde", 1, 2, -1);
+ test("abcde", 0, 6, "abcde", 1, 3, -1);
+ test("abcde", 0, 6, "abcde", 1, 4, -1);
+ test("abcde", 0, 6, "abcde", 1, 5, -1);
+ test("abcde", 0, 6, "abcde", 2, 0, 5);
+ test("abcde", 0, 6, "abcde", 2, 1, -2);
+ test("abcde", 0, 6, "abcde", 2, 2, -2);
+ test("abcde", 0, 6, "abcde", 2, 3, -2);
+ test("abcde", 0, 6, "abcde", 2, 4, -2);
+ test("abcde", 0, 6, "abcde", 4, 0, 5);
+ test("abcde", 0, 6, "abcde", 4, 1, -4);
+ test("abcde", 0, 6, "abcde", 4, 2, -4);
+ test("abcde", 0, 6, "abcde", 5, 0, 5);
+ test("abcde", 0, 6, "abcde", 5, 1, 5);
+ test("abcde", 0, 6, "abcde", 6, 0, 0);
+ test("abcde", 0, 6, "abcdefghij", 0, 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 0, 1, 4);
+ test("abcde", 0, 6, "abcdefghij", 0, 5, 0);
+ test("abcde", 0, 6, "abcdefghij", 0, 9, -4);
+ test("abcde", 0, 6, "abcdefghij", 0, 10, -5);
+ test("abcde", 0, 6, "abcdefghij", 0, 11, -5);
+ test("abcde", 0, 6, "abcdefghij", 1, 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 1, 1, -1);
+ test("abcde", 0, 6, "abcdefghij", 1, 4, -1);
+ test("abcde", 0, 6, "abcdefghij", 1, 8, -1);
+ test("abcde", 0, 6, "abcdefghij", 1, 9, -1);
+ test("abcde", 0, 6, "abcdefghij", 1, 10, -1);
+ test("abcde", 0, 6, "abcdefghij", 5, 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 5, 1, -5);
+ test("abcde", 0, 6, "abcdefghij", 5, 2, -5);
+ test("abcde", 0, 6, "abcdefghij", 5, 4, -5);
+ test("abcde", 0, 6, "abcdefghij", 5, 5, -5);
+ test("abcde", 0, 6, "abcdefghij", 5, 6, -5);
+ test("abcde", 0, 6, "abcdefghij", 9, 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 9, 1, -9);
+ test("abcde", 0, 6, "abcdefghij", 9, 2, -9);
+ test("abcde", 0, 6, "abcdefghij", 10, 0, 5);
+ test("abcde", 0, 6, "abcdefghij", 10, 1, 5);
+ test("abcde", 0, 6, "abcdefghij", 11, 0, 0);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 1, 4);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 10, -5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 19, -14);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 20, -15);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 0, 21, -15);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcde", 0, 6, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 0, "", 0, 0, 0);
+ test("abcde", 1, 0, "", 0, 1, 0);
+ test("abcde", 1, 0, "", 1, 0, 0);
+ test("abcde", 1, 0, "abcde", 0, 0, 0);
+ test("abcde", 1, 0, "abcde", 0, 1, -1);
+ test("abcde", 1, 0, "abcde", 0, 2, -2);
+ test("abcde", 1, 0, "abcde", 0, 4, -4);
+ test("abcde", 1, 0, "abcde", 0, 5, -5);
+ test("abcde", 1, 0, "abcde", 0, 6, -5);
+ test("abcde", 1, 0, "abcde", 1, 0, 0);
+ test("abcde", 1, 0, "abcde", 1, 1, -1);
+ test("abcde", 1, 0, "abcde", 1, 2, -2);
+ test("abcde", 1, 0, "abcde", 1, 3, -3);
+ test("abcde", 1, 0, "abcde", 1, 4, -4);
+ test("abcde", 1, 0, "abcde", 1, 5, -4);
+ test("abcde", 1, 0, "abcde", 2, 0, 0);
+ test("abcde", 1, 0, "abcde", 2, 1, -1);
+ test("abcde", 1, 0, "abcde", 2, 2, -2);
+ test("abcde", 1, 0, "abcde", 2, 3, -3);
+ test("abcde", 1, 0, "abcde", 2, 4, -3);
+ test("abcde", 1, 0, "abcde", 4, 0, 0);
+ test("abcde", 1, 0, "abcde", 4, 1, -1);
+ test("abcde", 1, 0, "abcde", 4, 2, -1);
+ test("abcde", 1, 0, "abcde", 5, 0, 0);
+ test("abcde", 1, 0, "abcde", 5, 1, 0);
+ test("abcde", 1, 0, "abcde", 6, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 0, 1, -1);
+ test("abcde", 1, 0, "abcdefghij", 0, 5, -5);
+ test("abcde", 1, 0, "abcdefghij", 0, 9, -9);
+ test("abcde", 1, 0, "abcdefghij", 0, 10, -10);
+ test("abcde", 1, 0, "abcdefghij", 0, 11, -10);
+ test("abcde", 1, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 1, 1, -1);
+}
+
+void test7()
+{
+ test("abcde", 1, 0, "abcdefghij", 1, 4, -4);
+ test("abcde", 1, 0, "abcdefghij", 1, 8, -8);
+ test("abcde", 1, 0, "abcdefghij", 1, 9, -9);
+ test("abcde", 1, 0, "abcdefghij", 1, 10, -9);
+ test("abcde", 1, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 5, 1, -1);
+ test("abcde", 1, 0, "abcdefghij", 5, 2, -2);
+ test("abcde", 1, 0, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 0, "abcdefghij", 5, 5, -5);
+ test("abcde", 1, 0, "abcdefghij", 5, 6, -5);
+ test("abcde", 1, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 9, 1, -1);
+ test("abcde", 1, 0, "abcdefghij", 9, 2, -1);
+ test("abcde", 1, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 1, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 1, 0, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 1, "", 0, 0, 1);
+ test("abcde", 1, 1, "", 0, 1, 1);
+ test("abcde", 1, 1, "", 1, 0, 0);
+ test("abcde", 1, 1, "abcde", 0, 0, 1);
+ test("abcde", 1, 1, "abcde", 0, 1, 1);
+ test("abcde", 1, 1, "abcde", 0, 2, 1);
+ test("abcde", 1, 1, "abcde", 0, 4, 1);
+ test("abcde", 1, 1, "abcde", 0, 5, 1);
+ test("abcde", 1, 1, "abcde", 0, 6, 1);
+ test("abcde", 1, 1, "abcde", 1, 0, 1);
+ test("abcde", 1, 1, "abcde", 1, 1, 0);
+ test("abcde", 1, 1, "abcde", 1, 2, -1);
+ test("abcde", 1, 1, "abcde", 1, 3, -2);
+ test("abcde", 1, 1, "abcde", 1, 4, -3);
+ test("abcde", 1, 1, "abcde", 1, 5, -3);
+ test("abcde", 1, 1, "abcde", 2, 0, 1);
+ test("abcde", 1, 1, "abcde", 2, 1, -1);
+ test("abcde", 1, 1, "abcde", 2, 2, -1);
+ test("abcde", 1, 1, "abcde", 2, 3, -1);
+ test("abcde", 1, 1, "abcde", 2, 4, -1);
+ test("abcde", 1, 1, "abcde", 4, 0, 1);
+ test("abcde", 1, 1, "abcde", 4, 1, -3);
+ test("abcde", 1, 1, "abcde", 4, 2, -3);
+ test("abcde", 1, 1, "abcde", 5, 0, 1);
+ test("abcde", 1, 1, "abcde", 5, 1, 1);
+ test("abcde", 1, 1, "abcde", 6, 0, 0);
+ test("abcde", 1, 1, "abcdefghij", 0, 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 1, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 5, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 9, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 10, 1);
+ test("abcde", 1, 1, "abcdefghij", 0, 11, 1);
+ test("abcde", 1, 1, "abcdefghij", 1, 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 1, 1, 0);
+ test("abcde", 1, 1, "abcdefghij", 1, 4, -3);
+ test("abcde", 1, 1, "abcdefghij", 1, 8, -7);
+ test("abcde", 1, 1, "abcdefghij", 1, 9, -8);
+ test("abcde", 1, 1, "abcdefghij", 1, 10, -8);
+ test("abcde", 1, 1, "abcdefghij", 5, 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 5, 1, -4);
+ test("abcde", 1, 1, "abcdefghij", 5, 2, -4);
+ test("abcde", 1, 1, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 1, "abcdefghij", 5, 5, -4);
+ test("abcde", 1, 1, "abcdefghij", 5, 6, -4);
+ test("abcde", 1, 1, "abcdefghij", 9, 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 9, 1, -8);
+ test("abcde", 1, 1, "abcdefghij", 9, 2, -8);
+ test("abcde", 1, 1, "abcdefghij", 10, 0, 1);
+ test("abcde", 1, 1, "abcdefghij", 10, 1, 1);
+ test("abcde", 1, 1, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17);
+}
+
+void test8()
+{
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcde", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 2, "", 0, 0, 2);
+ test("abcde", 1, 2, "", 0, 1, 2);
+ test("abcde", 1, 2, "", 1, 0, 0);
+ test("abcde", 1, 2, "abcde", 0, 0, 2);
+ test("abcde", 1, 2, "abcde", 0, 1, 1);
+ test("abcde", 1, 2, "abcde", 0, 2, 1);
+ test("abcde", 1, 2, "abcde", 0, 4, 1);
+ test("abcde", 1, 2, "abcde", 0, 5, 1);
+ test("abcde", 1, 2, "abcde", 0, 6, 1);
+ test("abcde", 1, 2, "abcde", 1, 0, 2);
+ test("abcde", 1, 2, "abcde", 1, 1, 1);
+ test("abcde", 1, 2, "abcde", 1, 2, 0);
+ test("abcde", 1, 2, "abcde", 1, 3, -1);
+ test("abcde", 1, 2, "abcde", 1, 4, -2);
+ test("abcde", 1, 2, "abcde", 1, 5, -2);
+ test("abcde", 1, 2, "abcde", 2, 0, 2);
+ test("abcde", 1, 2, "abcde", 2, 1, -1);
+ test("abcde", 1, 2, "abcde", 2, 2, -1);
+ test("abcde", 1, 2, "abcde", 2, 3, -1);
+ test("abcde", 1, 2, "abcde", 2, 4, -1);
+ test("abcde", 1, 2, "abcde", 4, 0, 2);
+ test("abcde", 1, 2, "abcde", 4, 1, -3);
+ test("abcde", 1, 2, "abcde", 4, 2, -3);
+ test("abcde", 1, 2, "abcde", 5, 0, 2);
+ test("abcde", 1, 2, "abcde", 5, 1, 2);
+ test("abcde", 1, 2, "abcde", 6, 0, 0);
+ test("abcde", 1, 2, "abcdefghij", 0, 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 0, 1, 1);
+ test("abcde", 1, 2, "abcdefghij", 0, 5, 1);
+ test("abcde", 1, 2, "abcdefghij", 0, 9, 1);
+ test("abcde", 1, 2, "abcdefghij", 0, 10, 1);
+ test("abcde", 1, 2, "abcdefghij", 0, 11, 1);
+ test("abcde", 1, 2, "abcdefghij", 1, 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 1, 1, 1);
+ test("abcde", 1, 2, "abcdefghij", 1, 4, -2);
+ test("abcde", 1, 2, "abcdefghij", 1, 8, -6);
+ test("abcde", 1, 2, "abcdefghij", 1, 9, -7);
+ test("abcde", 1, 2, "abcdefghij", 1, 10, -7);
+ test("abcde", 1, 2, "abcdefghij", 5, 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 5, 1, -4);
+ test("abcde", 1, 2, "abcdefghij", 5, 2, -4);
+ test("abcde", 1, 2, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 2, "abcdefghij", 5, 5, -4);
+ test("abcde", 1, 2, "abcdefghij", 5, 6, -4);
+ test("abcde", 1, 2, "abcdefghij", 9, 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 9, 1, -8);
+ test("abcde", 1, 2, "abcdefghij", 9, 2, -8);
+ test("abcde", 1, 2, "abcdefghij", 10, 0, 2);
+ test("abcde", 1, 2, "abcdefghij", 10, 1, 2);
+ test("abcde", 1, 2, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 1, 1);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 9, -7);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 18, -16);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 19, -17);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 1, 20, -17);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 0, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 20, 1, 2);
+ test("abcde", 1, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 3, "", 0, 0, 3);
+ test("abcde", 1, 3, "", 0, 1, 3);
+ test("abcde", 1, 3, "", 1, 0, 0);
+ test("abcde", 1, 3, "abcde", 0, 0, 3);
+ test("abcde", 1, 3, "abcde", 0, 1, 1);
+ test("abcde", 1, 3, "abcde", 0, 2, 1);
+ test("abcde", 1, 3, "abcde", 0, 4, 1);
+ test("abcde", 1, 3, "abcde", 0, 5, 1);
+ test("abcde", 1, 3, "abcde", 0, 6, 1);
+ test("abcde", 1, 3, "abcde", 1, 0, 3);
+ test("abcde", 1, 3, "abcde", 1, 1, 2);
+ test("abcde", 1, 3, "abcde", 1, 2, 1);
+}
+
+void test9()
+{
+ test("abcde", 1, 3, "abcde", 1, 3, 0);
+ test("abcde", 1, 3, "abcde", 1, 4, -1);
+ test("abcde", 1, 3, "abcde", 1, 5, -1);
+ test("abcde", 1, 3, "abcde", 2, 0, 3);
+ test("abcde", 1, 3, "abcde", 2, 1, -1);
+ test("abcde", 1, 3, "abcde", 2, 2, -1);
+ test("abcde", 1, 3, "abcde", 2, 3, -1);
+ test("abcde", 1, 3, "abcde", 2, 4, -1);
+ test("abcde", 1, 3, "abcde", 4, 0, 3);
+ test("abcde", 1, 3, "abcde", 4, 1, -3);
+ test("abcde", 1, 3, "abcde", 4, 2, -3);
+ test("abcde", 1, 3, "abcde", 5, 0, 3);
+ test("abcde", 1, 3, "abcde", 5, 1, 3);
+ test("abcde", 1, 3, "abcde", 6, 0, 0);
+ test("abcde", 1, 3, "abcdefghij", 0, 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 0, 1, 1);
+ test("abcde", 1, 3, "abcdefghij", 0, 5, 1);
+ test("abcde", 1, 3, "abcdefghij", 0, 9, 1);
+ test("abcde", 1, 3, "abcdefghij", 0, 10, 1);
+ test("abcde", 1, 3, "abcdefghij", 0, 11, 1);
+ test("abcde", 1, 3, "abcdefghij", 1, 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 1, 1, 2);
+ test("abcde", 1, 3, "abcdefghij", 1, 4, -1);
+ test("abcde", 1, 3, "abcdefghij", 1, 8, -5);
+ test("abcde", 1, 3, "abcdefghij", 1, 9, -6);
+ test("abcde", 1, 3, "abcdefghij", 1, 10, -6);
+ test("abcde", 1, 3, "abcdefghij", 5, 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 5, 1, -4);
+ test("abcde", 1, 3, "abcdefghij", 5, 2, -4);
+ test("abcde", 1, 3, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 3, "abcdefghij", 5, 5, -4);
+ test("abcde", 1, 3, "abcdefghij", 5, 6, -4);
+ test("abcde", 1, 3, "abcdefghij", 9, 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 9, 1, -8);
+ test("abcde", 1, 3, "abcdefghij", 9, 2, -8);
+ test("abcde", 1, 3, "abcdefghij", 10, 0, 3);
+ test("abcde", 1, 3, "abcdefghij", 10, 1, 3);
+ test("abcde", 1, 3, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 1, 2);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 9, -6);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 18, -15);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 19, -16);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 1, 20, -16);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 0, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 20, 1, 3);
+ test("abcde", 1, 3, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 4, "", 0, 0, 4);
+ test("abcde", 1, 4, "", 0, 1, 4);
+ test("abcde", 1, 4, "", 1, 0, 0);
+ test("abcde", 1, 4, "abcde", 0, 0, 4);
+ test("abcde", 1, 4, "abcde", 0, 1, 1);
+ test("abcde", 1, 4, "abcde", 0, 2, 1);
+ test("abcde", 1, 4, "abcde", 0, 4, 1);
+ test("abcde", 1, 4, "abcde", 0, 5, 1);
+ test("abcde", 1, 4, "abcde", 0, 6, 1);
+ test("abcde", 1, 4, "abcde", 1, 0, 4);
+ test("abcde", 1, 4, "abcde", 1, 1, 3);
+ test("abcde", 1, 4, "abcde", 1, 2, 2);
+ test("abcde", 1, 4, "abcde", 1, 3, 1);
+ test("abcde", 1, 4, "abcde", 1, 4, 0);
+ test("abcde", 1, 4, "abcde", 1, 5, 0);
+ test("abcde", 1, 4, "abcde", 2, 0, 4);
+ test("abcde", 1, 4, "abcde", 2, 1, -1);
+ test("abcde", 1, 4, "abcde", 2, 2, -1);
+ test("abcde", 1, 4, "abcde", 2, 3, -1);
+ test("abcde", 1, 4, "abcde", 2, 4, -1);
+ test("abcde", 1, 4, "abcde", 4, 0, 4);
+ test("abcde", 1, 4, "abcde", 4, 1, -3);
+ test("abcde", 1, 4, "abcde", 4, 2, -3);
+ test("abcde", 1, 4, "abcde", 5, 0, 4);
+ test("abcde", 1, 4, "abcde", 5, 1, 4);
+ test("abcde", 1, 4, "abcde", 6, 0, 0);
+ test("abcde", 1, 4, "abcdefghij", 0, 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 0, 1, 1);
+ test("abcde", 1, 4, "abcdefghij", 0, 5, 1);
+ test("abcde", 1, 4, "abcdefghij", 0, 9, 1);
+ test("abcde", 1, 4, "abcdefghij", 0, 10, 1);
+ test("abcde", 1, 4, "abcdefghij", 0, 11, 1);
+ test("abcde", 1, 4, "abcdefghij", 1, 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 1, 1, 3);
+ test("abcde", 1, 4, "abcdefghij", 1, 4, 0);
+ test("abcde", 1, 4, "abcdefghij", 1, 8, -4);
+ test("abcde", 1, 4, "abcdefghij", 1, 9, -5);
+ test("abcde", 1, 4, "abcdefghij", 1, 10, -5);
+}
+
+void test10()
+{
+ test("abcde", 1, 4, "abcdefghij", 5, 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 5, 1, -4);
+ test("abcde", 1, 4, "abcdefghij", 5, 2, -4);
+ test("abcde", 1, 4, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 4, "abcdefghij", 5, 5, -4);
+ test("abcde", 1, 4, "abcdefghij", 5, 6, -4);
+ test("abcde", 1, 4, "abcdefghij", 9, 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 9, 1, -8);
+ test("abcde", 1, 4, "abcdefghij", 9, 2, -8);
+ test("abcde", 1, 4, "abcdefghij", 10, 0, 4);
+ test("abcde", 1, 4, "abcdefghij", 10, 1, 4);
+ test("abcde", 1, 4, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 1, 3);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 9, -5);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 18, -14);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 19, -15);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 1, 20, -15);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 0, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 20, 1, 4);
+ test("abcde", 1, 4, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 1, 5, "", 0, 0, 4);
+ test("abcde", 1, 5, "", 0, 1, 4);
+ test("abcde", 1, 5, "", 1, 0, 0);
+ test("abcde", 1, 5, "abcde", 0, 0, 4);
+ test("abcde", 1, 5, "abcde", 0, 1, 1);
+ test("abcde", 1, 5, "abcde", 0, 2, 1);
+ test("abcde", 1, 5, "abcde", 0, 4, 1);
+ test("abcde", 1, 5, "abcde", 0, 5, 1);
+ test("abcde", 1, 5, "abcde", 0, 6, 1);
+ test("abcde", 1, 5, "abcde", 1, 0, 4);
+ test("abcde", 1, 5, "abcde", 1, 1, 3);
+ test("abcde", 1, 5, "abcde", 1, 2, 2);
+ test("abcde", 1, 5, "abcde", 1, 3, 1);
+ test("abcde", 1, 5, "abcde", 1, 4, 0);
+ test("abcde", 1, 5, "abcde", 1, 5, 0);
+ test("abcde", 1, 5, "abcde", 2, 0, 4);
+ test("abcde", 1, 5, "abcde", 2, 1, -1);
+ test("abcde", 1, 5, "abcde", 2, 2, -1);
+ test("abcde", 1, 5, "abcde", 2, 3, -1);
+ test("abcde", 1, 5, "abcde", 2, 4, -1);
+ test("abcde", 1, 5, "abcde", 4, 0, 4);
+ test("abcde", 1, 5, "abcde", 4, 1, -3);
+ test("abcde", 1, 5, "abcde", 4, 2, -3);
+ test("abcde", 1, 5, "abcde", 5, 0, 4);
+ test("abcde", 1, 5, "abcde", 5, 1, 4);
+ test("abcde", 1, 5, "abcde", 6, 0, 0);
+ test("abcde", 1, 5, "abcdefghij", 0, 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 0, 1, 1);
+ test("abcde", 1, 5, "abcdefghij", 0, 5, 1);
+ test("abcde", 1, 5, "abcdefghij", 0, 9, 1);
+ test("abcde", 1, 5, "abcdefghij", 0, 10, 1);
+ test("abcde", 1, 5, "abcdefghij", 0, 11, 1);
+ test("abcde", 1, 5, "abcdefghij", 1, 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 1, 1, 3);
+ test("abcde", 1, 5, "abcdefghij", 1, 4, 0);
+ test("abcde", 1, 5, "abcdefghij", 1, 8, -4);
+ test("abcde", 1, 5, "abcdefghij", 1, 9, -5);
+ test("abcde", 1, 5, "abcdefghij", 1, 10, -5);
+ test("abcde", 1, 5, "abcdefghij", 5, 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 5, 1, -4);
+ test("abcde", 1, 5, "abcdefghij", 5, 2, -4);
+ test("abcde", 1, 5, "abcdefghij", 5, 4, -4);
+ test("abcde", 1, 5, "abcdefghij", 5, 5, -4);
+ test("abcde", 1, 5, "abcdefghij", 5, 6, -4);
+ test("abcde", 1, 5, "abcdefghij", 9, 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 9, 1, -8);
+ test("abcde", 1, 5, "abcdefghij", 9, 2, -8);
+ test("abcde", 1, 5, "abcdefghij", 10, 0, 4);
+ test("abcde", 1, 5, "abcdefghij", 10, 1, 4);
+ test("abcde", 1, 5, "abcdefghij", 11, 0, 0);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 1, 3);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 9, -5);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 18, -14);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 19, -15);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 1, 20, -15);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 1, -9);
+}
+
+void test11()
+{
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 0, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 20, 1, 4);
+ test("abcde", 1, 5, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 2, 0, "", 0, 0, 0);
+ test("abcde", 2, 0, "", 0, 1, 0);
+ test("abcde", 2, 0, "", 1, 0, 0);
+ test("abcde", 2, 0, "abcde", 0, 0, 0);
+ test("abcde", 2, 0, "abcde", 0, 1, -1);
+ test("abcde", 2, 0, "abcde", 0, 2, -2);
+ test("abcde", 2, 0, "abcde", 0, 4, -4);
+ test("abcde", 2, 0, "abcde", 0, 5, -5);
+ test("abcde", 2, 0, "abcde", 0, 6, -5);
+ test("abcde", 2, 0, "abcde", 1, 0, 0);
+ test("abcde", 2, 0, "abcde", 1, 1, -1);
+ test("abcde", 2, 0, "abcde", 1, 2, -2);
+ test("abcde", 2, 0, "abcde", 1, 3, -3);
+ test("abcde", 2, 0, "abcde", 1, 4, -4);
+ test("abcde", 2, 0, "abcde", 1, 5, -4);
+ test("abcde", 2, 0, "abcde", 2, 0, 0);
+ test("abcde", 2, 0, "abcde", 2, 1, -1);
+ test("abcde", 2, 0, "abcde", 2, 2, -2);
+ test("abcde", 2, 0, "abcde", 2, 3, -3);
+ test("abcde", 2, 0, "abcde", 2, 4, -3);
+ test("abcde", 2, 0, "abcde", 4, 0, 0);
+ test("abcde", 2, 0, "abcde", 4, 1, -1);
+ test("abcde", 2, 0, "abcde", 4, 2, -1);
+ test("abcde", 2, 0, "abcde", 5, 0, 0);
+ test("abcde", 2, 0, "abcde", 5, 1, 0);
+ test("abcde", 2, 0, "abcde", 6, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 0, 1, -1);
+ test("abcde", 2, 0, "abcdefghij", 0, 5, -5);
+ test("abcde", 2, 0, "abcdefghij", 0, 9, -9);
+ test("abcde", 2, 0, "abcdefghij", 0, 10, -10);
+ test("abcde", 2, 0, "abcdefghij", 0, 11, -10);
+ test("abcde", 2, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 1, 1, -1);
+ test("abcde", 2, 0, "abcdefghij", 1, 4, -4);
+ test("abcde", 2, 0, "abcdefghij", 1, 8, -8);
+ test("abcde", 2, 0, "abcdefghij", 1, 9, -9);
+ test("abcde", 2, 0, "abcdefghij", 1, 10, -9);
+ test("abcde", 2, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 5, 1, -1);
+ test("abcde", 2, 0, "abcdefghij", 5, 2, -2);
+ test("abcde", 2, 0, "abcdefghij", 5, 4, -4);
+ test("abcde", 2, 0, "abcdefghij", 5, 5, -5);
+ test("abcde", 2, 0, "abcdefghij", 5, 6, -5);
+ test("abcde", 2, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 9, 1, -1);
+ test("abcde", 2, 0, "abcdefghij", 9, 2, -1);
+ test("abcde", 2, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 2, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 2, 0, "abcdefghij", 11, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 2, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 2, 1, "", 0, 0, 1);
+ test("abcde", 2, 1, "", 0, 1, 1);
+ test("abcde", 2, 1, "", 1, 0, 0);
+ test("abcde", 2, 1, "abcde", 0, 0, 1);
+ test("abcde", 2, 1, "abcde", 0, 1, 2);
+ test("abcde", 2, 1, "abcde", 0, 2, 2);
+ test("abcde", 2, 1, "abcde", 0, 4, 2);
+ test("abcde", 2, 1, "abcde", 0, 5, 2);
+ test("abcde", 2, 1, "abcde", 0, 6, 2);
+ test("abcde", 2, 1, "abcde", 1, 0, 1);
+ test("abcde", 2, 1, "abcde", 1, 1, 1);
+ test("abcde", 2, 1, "abcde", 1, 2, 1);
+ test("abcde", 2, 1, "abcde", 1, 3, 1);
+ test("abcde", 2, 1, "abcde", 1, 4, 1);
+ test("abcde", 2, 1, "abcde", 1, 5, 1);
+ test("abcde", 2, 1, "abcde", 2, 0, 1);
+}
+
+void test12()
+{
+ test("abcde", 2, 1, "abcde", 2, 1, 0);
+ test("abcde", 2, 1, "abcde", 2, 2, -1);
+ test("abcde", 2, 1, "abcde", 2, 3, -2);
+ test("abcde", 2, 1, "abcde", 2, 4, -2);
+ test("abcde", 2, 1, "abcde", 4, 0, 1);
+ test("abcde", 2, 1, "abcde", 4, 1, -2);
+ test("abcde", 2, 1, "abcde", 4, 2, -2);
+ test("abcde", 2, 1, "abcde", 5, 0, 1);
+ test("abcde", 2, 1, "abcde", 5, 1, 1);
+ test("abcde", 2, 1, "abcde", 6, 0, 0);
+ test("abcde", 2, 1, "abcdefghij", 0, 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 0, 1, 2);
+ test("abcde", 2, 1, "abcdefghij", 0, 5, 2);
+ test("abcde", 2, 1, "abcdefghij", 0, 9, 2);
+ test("abcde", 2, 1, "abcdefghij", 0, 10, 2);
+ test("abcde", 2, 1, "abcdefghij", 0, 11, 2);
+ test("abcde", 2, 1, "abcdefghij", 1, 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 1, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 4, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 8, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 9, 1);
+ test("abcde", 2, 1, "abcdefghij", 1, 10, 1);
+ test("abcde", 2, 1, "abcdefghij", 5, 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 5, 1, -3);
+ test("abcde", 2, 1, "abcdefghij", 5, 2, -3);
+ test("abcde", 2, 1, "abcdefghij", 5, 4, -3);
+ test("abcde", 2, 1, "abcdefghij", 5, 5, -3);
+ test("abcde", 2, 1, "abcdefghij", 5, 6, -3);
+ test("abcde", 2, 1, "abcdefghij", 9, 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 9, 1, -7);
+ test("abcde", 2, 1, "abcdefghij", 9, 2, -7);
+ test("abcde", 2, 1, "abcdefghij", 10, 0, 1);
+ test("abcde", 2, 1, "abcdefghij", 10, 1, 1);
+ test("abcde", 2, 1, "abcdefghij", 11, 0, 0);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 1, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 10, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 19, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 20, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 0, 21, 2);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 1, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 9, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 18, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 19, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 1, 20, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 1, -8);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 5, -8);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 9, -8);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 10, -8);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 10, 11, -8);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 1, -17);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 19, 2, -17);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcde", 2, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 2, 2, "", 0, 0, 2);
+ test("abcde", 2, 2, "", 0, 1, 2);
+ test("abcde", 2, 2, "", 1, 0, 0);
+ test("abcde", 2, 2, "abcde", 0, 0, 2);
+ test("abcde", 2, 2, "abcde", 0, 1, 2);
+ test("abcde", 2, 2, "abcde", 0, 2, 2);
+ test("abcde", 2, 2, "abcde", 0, 4, 2);
+ test("abcde", 2, 2, "abcde", 0, 5, 2);
+ test("abcde", 2, 2, "abcde", 0, 6, 2);
+ test("abcde", 2, 2, "abcde", 1, 0, 2);
+ test("abcde", 2, 2, "abcde", 1, 1, 1);
+ test("abcde", 2, 2, "abcde", 1, 2, 1);
+ test("abcde", 2, 2, "abcde", 1, 3, 1);
+ test("abcde", 2, 2, "abcde", 1, 4, 1);
+ test("abcde", 2, 2, "abcde", 1, 5, 1);
+ test("abcde", 2, 2, "abcde", 2, 0, 2);
+ test("abcde", 2, 2, "abcde", 2, 1, 1);
+ test("abcde", 2, 2, "abcde", 2, 2, 0);
+ test("abcde", 2, 2, "abcde", 2, 3, -1);
+ test("abcde", 2, 2, "abcde", 2, 4, -1);
+ test("abcde", 2, 2, "abcde", 4, 0, 2);
+ test("abcde", 2, 2, "abcde", 4, 1, -2);
+ test("abcde", 2, 2, "abcde", 4, 2, -2);
+ test("abcde", 2, 2, "abcde", 5, 0, 2);
+ test("abcde", 2, 2, "abcde", 5, 1, 2);
+ test("abcde", 2, 2, "abcde", 6, 0, 0);
+ test("abcde", 2, 2, "abcdefghij", 0, 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 1, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 5, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 9, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 10, 2);
+ test("abcde", 2, 2, "abcdefghij", 0, 11, 2);
+ test("abcde", 2, 2, "abcdefghij", 1, 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 1, 1, 1);
+ test("abcde", 2, 2, "abcdefghij", 1, 4, 1);
+ test("abcde", 2, 2, "abcdefghij", 1, 8, 1);
+ test("abcde", 2, 2, "abcdefghij", 1, 9, 1);
+ test("abcde", 2, 2, "abcdefghij", 1, 10, 1);
+ test("abcde", 2, 2, "abcdefghij", 5, 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 5, 1, -3);
+ test("abcde", 2, 2, "abcdefghij", 5, 2, -3);
+ test("abcde", 2, 2, "abcdefghij", 5, 4, -3);
+}
+
+void test13()
+{
+ test("abcde", 2, 2, "abcdefghij", 5, 5, -3);
+ test("abcde", 2, 2, "abcdefghij", 5, 6, -3);
+ test("abcde", 2, 2, "abcdefghij", 9, 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 9, 1, -7);
+ test("abcde", 2, 2, "abcdefghij", 9, 2, -7);
+ test("abcde", 2, 2, "abcdefghij", 10, 0, 2);
+ test("abcde", 2, 2, "abcdefghij", 10, 1, 2);
+ test("abcde", 2, 2, "abcdefghij", 11, 0, 0);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 1, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 10, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 19, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 20, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 0, 21, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 1, 1);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 9, 1);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 18, 1);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 19, 1);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 1, 20, 1);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 1, -8);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 5, -8);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 9, -8);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 10, -8);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 10, 11, -8);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 1, -17);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 19, 2, -17);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 0, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 20, 1, 2);
+ test("abcde", 2, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 2, 3, "", 0, 0, 3);
+ test("abcde", 2, 3, "", 0, 1, 3);
+ test("abcde", 2, 3, "", 1, 0, 0);
+ test("abcde", 2, 3, "abcde", 0, 0, 3);
+ test("abcde", 2, 3, "abcde", 0, 1, 2);
+ test("abcde", 2, 3, "abcde", 0, 2, 2);
+ test("abcde", 2, 3, "abcde", 0, 4, 2);
+ test("abcde", 2, 3, "abcde", 0, 5, 2);
+ test("abcde", 2, 3, "abcde", 0, 6, 2);
+ test("abcde", 2, 3, "abcde", 1, 0, 3);
+ test("abcde", 2, 3, "abcde", 1, 1, 1);
+ test("abcde", 2, 3, "abcde", 1, 2, 1);
+ test("abcde", 2, 3, "abcde", 1, 3, 1);
+ test("abcde", 2, 3, "abcde", 1, 4, 1);
+ test("abcde", 2, 3, "abcde", 1, 5, 1);
+ test("abcde", 2, 3, "abcde", 2, 0, 3);
+ test("abcde", 2, 3, "abcde", 2, 1, 2);
+ test("abcde", 2, 3, "abcde", 2, 2, 1);
+ test("abcde", 2, 3, "abcde", 2, 3, 0);
+ test("abcde", 2, 3, "abcde", 2, 4, 0);
+ test("abcde", 2, 3, "abcde", 4, 0, 3);
+ test("abcde", 2, 3, "abcde", 4, 1, -2);
+ test("abcde", 2, 3, "abcde", 4, 2, -2);
+ test("abcde", 2, 3, "abcde", 5, 0, 3);
+ test("abcde", 2, 3, "abcde", 5, 1, 3);
+ test("abcde", 2, 3, "abcde", 6, 0, 0);
+ test("abcde", 2, 3, "abcdefghij", 0, 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 0, 1, 2);
+ test("abcde", 2, 3, "abcdefghij", 0, 5, 2);
+ test("abcde", 2, 3, "abcdefghij", 0, 9, 2);
+ test("abcde", 2, 3, "abcdefghij", 0, 10, 2);
+ test("abcde", 2, 3, "abcdefghij", 0, 11, 2);
+ test("abcde", 2, 3, "abcdefghij", 1, 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 1, 1, 1);
+ test("abcde", 2, 3, "abcdefghij", 1, 4, 1);
+ test("abcde", 2, 3, "abcdefghij", 1, 8, 1);
+ test("abcde", 2, 3, "abcdefghij", 1, 9, 1);
+ test("abcde", 2, 3, "abcdefghij", 1, 10, 1);
+ test("abcde", 2, 3, "abcdefghij", 5, 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 5, 1, -3);
+ test("abcde", 2, 3, "abcdefghij", 5, 2, -3);
+ test("abcde", 2, 3, "abcdefghij", 5, 4, -3);
+ test("abcde", 2, 3, "abcdefghij", 5, 5, -3);
+ test("abcde", 2, 3, "abcdefghij", 5, 6, -3);
+ test("abcde", 2, 3, "abcdefghij", 9, 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 9, 1, -7);
+ test("abcde", 2, 3, "abcdefghij", 9, 2, -7);
+ test("abcde", 2, 3, "abcdefghij", 10, 0, 3);
+ test("abcde", 2, 3, "abcdefghij", 10, 1, 3);
+ test("abcde", 2, 3, "abcdefghij", 11, 0, 0);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 0, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 1, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 10, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 19, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 20, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 0, 21, 2);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 0, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 1, 1);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 9, 1);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 18, 1);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 19, 1);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 1, 20, 1);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 0, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 1, -8);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 5, -8);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 9, -8);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 10, -8);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 10, 11, -8);
+}
+
+void test14()
+{
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 0, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 1, -17);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 19, 2, -17);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 0, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 20, 1, 3);
+ test("abcde", 2, 3, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 2, 4, "", 0, 0, 3);
+ test("abcde", 2, 4, "", 0, 1, 3);
+ test("abcde", 2, 4, "", 1, 0, 0);
+ test("abcde", 2, 4, "abcde", 0, 0, 3);
+ test("abcde", 2, 4, "abcde", 0, 1, 2);
+ test("abcde", 2, 4, "abcde", 0, 2, 2);
+ test("abcde", 2, 4, "abcde", 0, 4, 2);
+ test("abcde", 2, 4, "abcde", 0, 5, 2);
+ test("abcde", 2, 4, "abcde", 0, 6, 2);
+ test("abcde", 2, 4, "abcde", 1, 0, 3);
+ test("abcde", 2, 4, "abcde", 1, 1, 1);
+ test("abcde", 2, 4, "abcde", 1, 2, 1);
+ test("abcde", 2, 4, "abcde", 1, 3, 1);
+ test("abcde", 2, 4, "abcde", 1, 4, 1);
+ test("abcde", 2, 4, "abcde", 1, 5, 1);
+ test("abcde", 2, 4, "abcde", 2, 0, 3);
+ test("abcde", 2, 4, "abcde", 2, 1, 2);
+ test("abcde", 2, 4, "abcde", 2, 2, 1);
+ test("abcde", 2, 4, "abcde", 2, 3, 0);
+ test("abcde", 2, 4, "abcde", 2, 4, 0);
+ test("abcde", 2, 4, "abcde", 4, 0, 3);
+ test("abcde", 2, 4, "abcde", 4, 1, -2);
+ test("abcde", 2, 4, "abcde", 4, 2, -2);
+ test("abcde", 2, 4, "abcde", 5, 0, 3);
+ test("abcde", 2, 4, "abcde", 5, 1, 3);
+ test("abcde", 2, 4, "abcde", 6, 0, 0);
+ test("abcde", 2, 4, "abcdefghij", 0, 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 0, 1, 2);
+ test("abcde", 2, 4, "abcdefghij", 0, 5, 2);
+ test("abcde", 2, 4, "abcdefghij", 0, 9, 2);
+ test("abcde", 2, 4, "abcdefghij", 0, 10, 2);
+ test("abcde", 2, 4, "abcdefghij", 0, 11, 2);
+ test("abcde", 2, 4, "abcdefghij", 1, 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 1, 1, 1);
+ test("abcde", 2, 4, "abcdefghij", 1, 4, 1);
+ test("abcde", 2, 4, "abcdefghij", 1, 8, 1);
+ test("abcde", 2, 4, "abcdefghij", 1, 9, 1);
+ test("abcde", 2, 4, "abcdefghij", 1, 10, 1);
+ test("abcde", 2, 4, "abcdefghij", 5, 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 5, 1, -3);
+ test("abcde", 2, 4, "abcdefghij", 5, 2, -3);
+ test("abcde", 2, 4, "abcdefghij", 5, 4, -3);
+ test("abcde", 2, 4, "abcdefghij", 5, 5, -3);
+ test("abcde", 2, 4, "abcdefghij", 5, 6, -3);
+ test("abcde", 2, 4, "abcdefghij", 9, 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 9, 1, -7);
+ test("abcde", 2, 4, "abcdefghij", 9, 2, -7);
+ test("abcde", 2, 4, "abcdefghij", 10, 0, 3);
+ test("abcde", 2, 4, "abcdefghij", 10, 1, 3);
+ test("abcde", 2, 4, "abcdefghij", 11, 0, 0);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 1, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 10, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 19, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 20, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 0, 21, 2);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 1, 1);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 9, 1);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 18, 1);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 19, 1);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 1, 20, 1);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 1, -8);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 5, -8);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 9, -8);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 10, -8);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 10, 11, -8);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 1, -17);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 19, 2, -17);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 0, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 20, 1, 3);
+ test("abcde", 2, 4, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 4, 0, "", 0, 0, 0);
+ test("abcde", 4, 0, "", 0, 1, 0);
+ test("abcde", 4, 0, "", 1, 0, 0);
+ test("abcde", 4, 0, "abcde", 0, 0, 0);
+ test("abcde", 4, 0, "abcde", 0, 1, -1);
+ test("abcde", 4, 0, "abcde", 0, 2, -2);
+ test("abcde", 4, 0, "abcde", 0, 4, -4);
+ test("abcde", 4, 0, "abcde", 0, 5, -5);
+ test("abcde", 4, 0, "abcde", 0, 6, -5);
+ test("abcde", 4, 0, "abcde", 1, 0, 0);
+ test("abcde", 4, 0, "abcde", 1, 1, -1);
+ test("abcde", 4, 0, "abcde", 1, 2, -2);
+ test("abcde", 4, 0, "abcde", 1, 3, -3);
+ test("abcde", 4, 0, "abcde", 1, 4, -4);
+ test("abcde", 4, 0, "abcde", 1, 5, -4);
+ test("abcde", 4, 0, "abcde", 2, 0, 0);
+ test("abcde", 4, 0, "abcde", 2, 1, -1);
+ test("abcde", 4, 0, "abcde", 2, 2, -2);
+ test("abcde", 4, 0, "abcde", 2, 3, -3);
+ test("abcde", 4, 0, "abcde", 2, 4, -3);
+}
+
+void test15()
+{
+ test("abcde", 4, 0, "abcde", 4, 0, 0);
+ test("abcde", 4, 0, "abcde", 4, 1, -1);
+ test("abcde", 4, 0, "abcde", 4, 2, -1);
+ test("abcde", 4, 0, "abcde", 5, 0, 0);
+ test("abcde", 4, 0, "abcde", 5, 1, 0);
+ test("abcde", 4, 0, "abcde", 6, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 0, 1, -1);
+ test("abcde", 4, 0, "abcdefghij", 0, 5, -5);
+ test("abcde", 4, 0, "abcdefghij", 0, 9, -9);
+ test("abcde", 4, 0, "abcdefghij", 0, 10, -10);
+ test("abcde", 4, 0, "abcdefghij", 0, 11, -10);
+ test("abcde", 4, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 1, 1, -1);
+ test("abcde", 4, 0, "abcdefghij", 1, 4, -4);
+ test("abcde", 4, 0, "abcdefghij", 1, 8, -8);
+ test("abcde", 4, 0, "abcdefghij", 1, 9, -9);
+ test("abcde", 4, 0, "abcdefghij", 1, 10, -9);
+ test("abcde", 4, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 5, 1, -1);
+ test("abcde", 4, 0, "abcdefghij", 5, 2, -2);
+ test("abcde", 4, 0, "abcdefghij", 5, 4, -4);
+ test("abcde", 4, 0, "abcdefghij", 5, 5, -5);
+ test("abcde", 4, 0, "abcdefghij", 5, 6, -5);
+ test("abcde", 4, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 9, 1, -1);
+ test("abcde", 4, 0, "abcdefghij", 9, 2, -1);
+ test("abcde", 4, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 4, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 4, 0, "abcdefghij", 11, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 4, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 4, 1, "", 0, 0, 1);
+ test("abcde", 4, 1, "", 0, 1, 1);
+ test("abcde", 4, 1, "", 1, 0, 0);
+ test("abcde", 4, 1, "abcde", 0, 0, 1);
+ test("abcde", 4, 1, "abcde", 0, 1, 4);
+ test("abcde", 4, 1, "abcde", 0, 2, 4);
+ test("abcde", 4, 1, "abcde", 0, 4, 4);
+ test("abcde", 4, 1, "abcde", 0, 5, 4);
+ test("abcde", 4, 1, "abcde", 0, 6, 4);
+ test("abcde", 4, 1, "abcde", 1, 0, 1);
+ test("abcde", 4, 1, "abcde", 1, 1, 3);
+ test("abcde", 4, 1, "abcde", 1, 2, 3);
+ test("abcde", 4, 1, "abcde", 1, 3, 3);
+ test("abcde", 4, 1, "abcde", 1, 4, 3);
+ test("abcde", 4, 1, "abcde", 1, 5, 3);
+ test("abcde", 4, 1, "abcde", 2, 0, 1);
+ test("abcde", 4, 1, "abcde", 2, 1, 2);
+ test("abcde", 4, 1, "abcde", 2, 2, 2);
+ test("abcde", 4, 1, "abcde", 2, 3, 2);
+ test("abcde", 4, 1, "abcde", 2, 4, 2);
+ test("abcde", 4, 1, "abcde", 4, 0, 1);
+ test("abcde", 4, 1, "abcde", 4, 1, 0);
+ test("abcde", 4, 1, "abcde", 4, 2, 0);
+ test("abcde", 4, 1, "abcde", 5, 0, 1);
+ test("abcde", 4, 1, "abcde", 5, 1, 1);
+ test("abcde", 4, 1, "abcde", 6, 0, 0);
+ test("abcde", 4, 1, "abcdefghij", 0, 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 0, 1, 4);
+ test("abcde", 4, 1, "abcdefghij", 0, 5, 4);
+ test("abcde", 4, 1, "abcdefghij", 0, 9, 4);
+ test("abcde", 4, 1, "abcdefghij", 0, 10, 4);
+ test("abcde", 4, 1, "abcdefghij", 0, 11, 4);
+ test("abcde", 4, 1, "abcdefghij", 1, 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 1, 1, 3);
+ test("abcde", 4, 1, "abcdefghij", 1, 4, 3);
+ test("abcde", 4, 1, "abcdefghij", 1, 8, 3);
+ test("abcde", 4, 1, "abcdefghij", 1, 9, 3);
+ test("abcde", 4, 1, "abcdefghij", 1, 10, 3);
+ test("abcde", 4, 1, "abcdefghij", 5, 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 5, 1, -1);
+ test("abcde", 4, 1, "abcdefghij", 5, 2, -1);
+ test("abcde", 4, 1, "abcdefghij", 5, 4, -1);
+ test("abcde", 4, 1, "abcdefghij", 5, 5, -1);
+ test("abcde", 4, 1, "abcdefghij", 5, 6, -1);
+ test("abcde", 4, 1, "abcdefghij", 9, 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 9, 1, -5);
+}
+
+void test16()
+{
+ test("abcde", 4, 1, "abcdefghij", 9, 2, -5);
+ test("abcde", 4, 1, "abcdefghij", 10, 0, 1);
+ test("abcde", 4, 1, "abcdefghij", 10, 1, 1);
+ test("abcde", 4, 1, "abcdefghij", 11, 0, 0);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 1, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 10, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 19, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 20, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 0, 21, 4);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 1, 3);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 9, 3);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 18, 3);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 19, 3);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 1, 20, 3);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 1, -6);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 5, -6);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 9, -6);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 10, -6);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 10, 11, -6);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 1, -15);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 19, 2, -15);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcde", 4, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 4, 2, "", 0, 0, 1);
+ test("abcde", 4, 2, "", 0, 1, 1);
+ test("abcde", 4, 2, "", 1, 0, 0);
+ test("abcde", 4, 2, "abcde", 0, 0, 1);
+ test("abcde", 4, 2, "abcde", 0, 1, 4);
+ test("abcde", 4, 2, "abcde", 0, 2, 4);
+ test("abcde", 4, 2, "abcde", 0, 4, 4);
+ test("abcde", 4, 2, "abcde", 0, 5, 4);
+ test("abcde", 4, 2, "abcde", 0, 6, 4);
+ test("abcde", 4, 2, "abcde", 1, 0, 1);
+ test("abcde", 4, 2, "abcde", 1, 1, 3);
+ test("abcde", 4, 2, "abcde", 1, 2, 3);
+ test("abcde", 4, 2, "abcde", 1, 3, 3);
+ test("abcde", 4, 2, "abcde", 1, 4, 3);
+ test("abcde", 4, 2, "abcde", 1, 5, 3);
+ test("abcde", 4, 2, "abcde", 2, 0, 1);
+ test("abcde", 4, 2, "abcde", 2, 1, 2);
+ test("abcde", 4, 2, "abcde", 2, 2, 2);
+ test("abcde", 4, 2, "abcde", 2, 3, 2);
+ test("abcde", 4, 2, "abcde", 2, 4, 2);
+ test("abcde", 4, 2, "abcde", 4, 0, 1);
+ test("abcde", 4, 2, "abcde", 4, 1, 0);
+ test("abcde", 4, 2, "abcde", 4, 2, 0);
+ test("abcde", 4, 2, "abcde", 5, 0, 1);
+ test("abcde", 4, 2, "abcde", 5, 1, 1);
+ test("abcde", 4, 2, "abcde", 6, 0, 0);
+ test("abcde", 4, 2, "abcdefghij", 0, 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 0, 1, 4);
+ test("abcde", 4, 2, "abcdefghij", 0, 5, 4);
+ test("abcde", 4, 2, "abcdefghij", 0, 9, 4);
+ test("abcde", 4, 2, "abcdefghij", 0, 10, 4);
+ test("abcde", 4, 2, "abcdefghij", 0, 11, 4);
+ test("abcde", 4, 2, "abcdefghij", 1, 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 1, 1, 3);
+ test("abcde", 4, 2, "abcdefghij", 1, 4, 3);
+ test("abcde", 4, 2, "abcdefghij", 1, 8, 3);
+ test("abcde", 4, 2, "abcdefghij", 1, 9, 3);
+ test("abcde", 4, 2, "abcdefghij", 1, 10, 3);
+ test("abcde", 4, 2, "abcdefghij", 5, 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 5, 1, -1);
+ test("abcde", 4, 2, "abcdefghij", 5, 2, -1);
+ test("abcde", 4, 2, "abcdefghij", 5, 4, -1);
+ test("abcde", 4, 2, "abcdefghij", 5, 5, -1);
+ test("abcde", 4, 2, "abcdefghij", 5, 6, -1);
+ test("abcde", 4, 2, "abcdefghij", 9, 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 9, 1, -5);
+ test("abcde", 4, 2, "abcdefghij", 9, 2, -5);
+ test("abcde", 4, 2, "abcdefghij", 10, 0, 1);
+ test("abcde", 4, 2, "abcdefghij", 10, 1, 1);
+ test("abcde", 4, 2, "abcdefghij", 11, 0, 0);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 1, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 10, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 19, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 20, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 0, 21, 4);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 1, 3);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 9, 3);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 18, 3);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 19, 3);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 1, 20, 3);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 1, -6);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 5, -6);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 9, -6);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 10, -6);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 10, 11, -6);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 1, -15);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 19, 2, -15);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 0, 1);
+}
+
+void test17()
+{
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcde", 4, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 5, 0, "", 0, 0, 0);
+ test("abcde", 5, 0, "", 0, 1, 0);
+ test("abcde", 5, 0, "", 1, 0, 0);
+ test("abcde", 5, 0, "abcde", 0, 0, 0);
+ test("abcde", 5, 0, "abcde", 0, 1, -1);
+ test("abcde", 5, 0, "abcde", 0, 2, -2);
+ test("abcde", 5, 0, "abcde", 0, 4, -4);
+ test("abcde", 5, 0, "abcde", 0, 5, -5);
+ test("abcde", 5, 0, "abcde", 0, 6, -5);
+ test("abcde", 5, 0, "abcde", 1, 0, 0);
+ test("abcde", 5, 0, "abcde", 1, 1, -1);
+ test("abcde", 5, 0, "abcde", 1, 2, -2);
+ test("abcde", 5, 0, "abcde", 1, 3, -3);
+ test("abcde", 5, 0, "abcde", 1, 4, -4);
+ test("abcde", 5, 0, "abcde", 1, 5, -4);
+ test("abcde", 5, 0, "abcde", 2, 0, 0);
+ test("abcde", 5, 0, "abcde", 2, 1, -1);
+ test("abcde", 5, 0, "abcde", 2, 2, -2);
+ test("abcde", 5, 0, "abcde", 2, 3, -3);
+ test("abcde", 5, 0, "abcde", 2, 4, -3);
+ test("abcde", 5, 0, "abcde", 4, 0, 0);
+ test("abcde", 5, 0, "abcde", 4, 1, -1);
+ test("abcde", 5, 0, "abcde", 4, 2, -1);
+ test("abcde", 5, 0, "abcde", 5, 0, 0);
+ test("abcde", 5, 0, "abcde", 5, 1, 0);
+ test("abcde", 5, 0, "abcde", 6, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 0, 1, -1);
+ test("abcde", 5, 0, "abcdefghij", 0, 5, -5);
+ test("abcde", 5, 0, "abcdefghij", 0, 9, -9);
+ test("abcde", 5, 0, "abcdefghij", 0, 10, -10);
+ test("abcde", 5, 0, "abcdefghij", 0, 11, -10);
+ test("abcde", 5, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 1, 1, -1);
+ test("abcde", 5, 0, "abcdefghij", 1, 4, -4);
+ test("abcde", 5, 0, "abcdefghij", 1, 8, -8);
+ test("abcde", 5, 0, "abcdefghij", 1, 9, -9);
+ test("abcde", 5, 0, "abcdefghij", 1, 10, -9);
+ test("abcde", 5, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 5, 1, -1);
+ test("abcde", 5, 0, "abcdefghij", 5, 2, -2);
+ test("abcde", 5, 0, "abcdefghij", 5, 4, -4);
+ test("abcde", 5, 0, "abcdefghij", 5, 5, -5);
+ test("abcde", 5, 0, "abcdefghij", 5, 6, -5);
+ test("abcde", 5, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 9, 1, -1);
+ test("abcde", 5, 0, "abcdefghij", 9, 2, -1);
+ test("abcde", 5, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 5, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 5, 0, "abcdefghij", 11, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 5, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 5, 1, "", 0, 0, 0);
+ test("abcde", 5, 1, "", 0, 1, 0);
+ test("abcde", 5, 1, "", 1, 0, 0);
+ test("abcde", 5, 1, "abcde", 0, 0, 0);
+ test("abcde", 5, 1, "abcde", 0, 1, -1);
+ test("abcde", 5, 1, "abcde", 0, 2, -2);
+ test("abcde", 5, 1, "abcde", 0, 4, -4);
+ test("abcde", 5, 1, "abcde", 0, 5, -5);
+ test("abcde", 5, 1, "abcde", 0, 6, -5);
+ test("abcde", 5, 1, "abcde", 1, 0, 0);
+ test("abcde", 5, 1, "abcde", 1, 1, -1);
+ test("abcde", 5, 1, "abcde", 1, 2, -2);
+ test("abcde", 5, 1, "abcde", 1, 3, -3);
+ test("abcde", 5, 1, "abcde", 1, 4, -4);
+ test("abcde", 5, 1, "abcde", 1, 5, -4);
+ test("abcde", 5, 1, "abcde", 2, 0, 0);
+ test("abcde", 5, 1, "abcde", 2, 1, -1);
+ test("abcde", 5, 1, "abcde", 2, 2, -2);
+ test("abcde", 5, 1, "abcde", 2, 3, -3);
+ test("abcde", 5, 1, "abcde", 2, 4, -3);
+ test("abcde", 5, 1, "abcde", 4, 0, 0);
+ test("abcde", 5, 1, "abcde", 4, 1, -1);
+ test("abcde", 5, 1, "abcde", 4, 2, -1);
+ test("abcde", 5, 1, "abcde", 5, 0, 0);
+}
+
+void test18()
+{
+ test("abcde", 5, 1, "abcde", 5, 1, 0);
+ test("abcde", 5, 1, "abcde", 6, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 0, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 0, 1, -1);
+ test("abcde", 5, 1, "abcdefghij", 0, 5, -5);
+ test("abcde", 5, 1, "abcdefghij", 0, 9, -9);
+ test("abcde", 5, 1, "abcdefghij", 0, 10, -10);
+ test("abcde", 5, 1, "abcdefghij", 0, 11, -10);
+ test("abcde", 5, 1, "abcdefghij", 1, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 1, 1, -1);
+ test("abcde", 5, 1, "abcdefghij", 1, 4, -4);
+ test("abcde", 5, 1, "abcdefghij", 1, 8, -8);
+ test("abcde", 5, 1, "abcdefghij", 1, 9, -9);
+ test("abcde", 5, 1, "abcdefghij", 1, 10, -9);
+ test("abcde", 5, 1, "abcdefghij", 5, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 5, 1, -1);
+ test("abcde", 5, 1, "abcdefghij", 5, 2, -2);
+ test("abcde", 5, 1, "abcdefghij", 5, 4, -4);
+ test("abcde", 5, 1, "abcdefghij", 5, 5, -5);
+ test("abcde", 5, 1, "abcdefghij", 5, 6, -5);
+ test("abcde", 5, 1, "abcdefghij", 9, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 9, 1, -1);
+ test("abcde", 5, 1, "abcdefghij", 9, 2, -1);
+ test("abcde", 5, 1, "abcdefghij", 10, 0, 0);
+ test("abcde", 5, 1, "abcdefghij", 10, 1, 0);
+ test("abcde", 5, 1, "abcdefghij", 11, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 5, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcde", 6, 0, "", 0, 0, 0);
+ test("abcde", 6, 0, "", 0, 1, 0);
+ test("abcde", 6, 0, "", 1, 0, 0);
+ test("abcde", 6, 0, "abcde", 0, 0, 0);
+ test("abcde", 6, 0, "abcde", 0, 1, 0);
+ test("abcde", 6, 0, "abcde", 0, 2, 0);
+ test("abcde", 6, 0, "abcde", 0, 4, 0);
+ test("abcde", 6, 0, "abcde", 0, 5, 0);
+ test("abcde", 6, 0, "abcde", 0, 6, 0);
+ test("abcde", 6, 0, "abcde", 1, 0, 0);
+ test("abcde", 6, 0, "abcde", 1, 1, 0);
+ test("abcde", 6, 0, "abcde", 1, 2, 0);
+ test("abcde", 6, 0, "abcde", 1, 3, 0);
+ test("abcde", 6, 0, "abcde", 1, 4, 0);
+ test("abcde", 6, 0, "abcde", 1, 5, 0);
+ test("abcde", 6, 0, "abcde", 2, 0, 0);
+ test("abcde", 6, 0, "abcde", 2, 1, 0);
+ test("abcde", 6, 0, "abcde", 2, 2, 0);
+ test("abcde", 6, 0, "abcde", 2, 3, 0);
+ test("abcde", 6, 0, "abcde", 2, 4, 0);
+ test("abcde", 6, 0, "abcde", 4, 0, 0);
+ test("abcde", 6, 0, "abcde", 4, 1, 0);
+ test("abcde", 6, 0, "abcde", 4, 2, 0);
+ test("abcde", 6, 0, "abcde", 5, 0, 0);
+ test("abcde", 6, 0, "abcde", 5, 1, 0);
+ test("abcde", 6, 0, "abcde", 6, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 5, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 9, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 10, 0);
+ test("abcde", 6, 0, "abcdefghij", 0, 11, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 4, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 8, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 9, 0);
+ test("abcde", 6, 0, "abcdefghij", 1, 10, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 2, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 4, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 5, 0);
+ test("abcde", 6, 0, "abcdefghij", 5, 6, 0);
+ test("abcde", 6, 0, "abcdefghij", 9, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 9, 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 9, 2, 0);
+ test("abcde", 6, 0, "abcdefghij", 10, 0, 0);
+ test("abcde", 6, 0, "abcdefghij", 10, 1, 0);
+ test("abcde", 6, 0, "abcdefghij", 11, 0, 0);
+}
+
+void test19()
+{
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 19, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 18, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 5, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 9, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcde", 6, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 0, "", 0, 0, 0);
+ test("abcdefghij", 0, 0, "", 0, 1, 0);
+ test("abcdefghij", 0, 0, "", 1, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 0, 1, -1);
+ test("abcdefghij", 0, 0, "abcde", 0, 2, -2);
+ test("abcdefghij", 0, 0, "abcde", 0, 4, -4);
+ test("abcdefghij", 0, 0, "abcde", 0, 5, -5);
+ test("abcdefghij", 0, 0, "abcde", 0, 6, -5);
+ test("abcdefghij", 0, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 0, "abcde", 1, 2, -2);
+ test("abcdefghij", 0, 0, "abcde", 1, 3, -3);
+ test("abcdefghij", 0, 0, "abcde", 1, 4, -4);
+ test("abcdefghij", 0, 0, "abcde", 1, 5, -4);
+ test("abcdefghij", 0, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 2, 1, -1);
+ test("abcdefghij", 0, 0, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 0, "abcde", 2, 3, -3);
+ test("abcdefghij", 0, 0, "abcde", 2, 4, -3);
+ test("abcdefghij", 0, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 4, 1, -1);
+ test("abcdefghij", 0, 0, "abcde", 4, 2, -1);
+ test("abcdefghij", 0, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 0, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 0, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 0, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 0, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 0, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 0, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 1, "", 0, 0, 1);
+ test("abcdefghij", 0, 1, "", 0, 1, 1);
+}
+
+void test20()
+{
+ test("abcdefghij", 0, 1, "", 1, 0, 0);
+ test("abcdefghij", 0, 1, "abcde", 0, 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 0, 1, 0);
+ test("abcdefghij", 0, 1, "abcde", 0, 2, -1);
+ test("abcdefghij", 0, 1, "abcde", 0, 4, -3);
+ test("abcdefghij", 0, 1, "abcde", 0, 5, -4);
+ test("abcdefghij", 0, 1, "abcde", 0, 6, -4);
+ test("abcdefghij", 0, 1, "abcde", 1, 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 1, "abcde", 1, 2, -1);
+ test("abcdefghij", 0, 1, "abcde", 1, 3, -1);
+ test("abcdefghij", 0, 1, "abcde", 1, 4, -1);
+ test("abcdefghij", 0, 1, "abcde", 1, 5, -1);
+ test("abcdefghij", 0, 1, "abcde", 2, 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 2, 1, -2);
+ test("abcdefghij", 0, 1, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 1, "abcde", 2, 3, -2);
+ test("abcdefghij", 0, 1, "abcde", 2, 4, -2);
+ test("abcdefghij", 0, 1, "abcde", 4, 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 4, 1, -4);
+ test("abcdefghij", 0, 1, "abcde", 4, 2, -4);
+ test("abcdefghij", 0, 1, "abcde", 5, 0, 1);
+ test("abcdefghij", 0, 1, "abcde", 5, 1, 1);
+ test("abcdefghij", 0, 1, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 1, 0);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 5, -4);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 9, -8);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 10, -9);
+ test("abcdefghij", 0, 1, "abcdefghij", 0, 11, -9);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 4, -1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 8, -1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 0, 1, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 1, -5);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 2, -5);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 4, -5);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 1, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 9, 1, -9);
+ test("abcdefghij", 0, 1, "abcdefghij", 9, 2, -9);
+ test("abcdefghij", 0, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghij", 0, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghij", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 5, "", 0, 0, 5);
+ test("abcdefghij", 0, 5, "", 0, 1, 5);
+ test("abcdefghij", 0, 5, "", 1, 0, 0);
+ test("abcdefghij", 0, 5, "abcde", 0, 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 0, 1, 4);
+ test("abcdefghij", 0, 5, "abcde", 0, 2, 3);
+ test("abcdefghij", 0, 5, "abcde", 0, 4, 1);
+ test("abcdefghij", 0, 5, "abcde", 0, 5, 0);
+ test("abcdefghij", 0, 5, "abcde", 0, 6, 0);
+ test("abcdefghij", 0, 5, "abcde", 1, 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 5, "abcde", 1, 2, -1);
+ test("abcdefghij", 0, 5, "abcde", 1, 3, -1);
+ test("abcdefghij", 0, 5, "abcde", 1, 4, -1);
+ test("abcdefghij", 0, 5, "abcde", 1, 5, -1);
+ test("abcdefghij", 0, 5, "abcde", 2, 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 2, 1, -2);
+ test("abcdefghij", 0, 5, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 5, "abcde", 2, 3, -2);
+ test("abcdefghij", 0, 5, "abcde", 2, 4, -2);
+ test("abcdefghij", 0, 5, "abcde", 4, 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 4, 1, -4);
+ test("abcdefghij", 0, 5, "abcde", 4, 2, -4);
+ test("abcdefghij", 0, 5, "abcde", 5, 0, 5);
+ test("abcdefghij", 0, 5, "abcde", 5, 1, 5);
+ test("abcdefghij", 0, 5, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 1, 4);
+}
+
+void test21()
+{
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 5, 0);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 9, -4);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 10, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 0, 11, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 4, -1);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 8, -1);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 0, 5, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 1, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 2, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 4, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 5, "abcdefghij", 9, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 9, 1, -9);
+ test("abcdefghij", 0, 5, "abcdefghij", 9, 2, -9);
+ test("abcdefghij", 0, 5, "abcdefghij", 10, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 10, 1, 5);
+ test("abcdefghij", 0, 5, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 1, 4);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 10, -5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 19, -14);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 20, -15);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 0, 21, -15);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcdefghij", 0, 5, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 9, "", 0, 0, 9);
+ test("abcdefghij", 0, 9, "", 0, 1, 9);
+ test("abcdefghij", 0, 9, "", 1, 0, 0);
+ test("abcdefghij", 0, 9, "abcde", 0, 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 0, 1, 8);
+ test("abcdefghij", 0, 9, "abcde", 0, 2, 7);
+ test("abcdefghij", 0, 9, "abcde", 0, 4, 5);
+ test("abcdefghij", 0, 9, "abcde", 0, 5, 4);
+ test("abcdefghij", 0, 9, "abcde", 0, 6, 4);
+ test("abcdefghij", 0, 9, "abcde", 1, 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 9, "abcde", 1, 2, -1);
+ test("abcdefghij", 0, 9, "abcde", 1, 3, -1);
+ test("abcdefghij", 0, 9, "abcde", 1, 4, -1);
+ test("abcdefghij", 0, 9, "abcde", 1, 5, -1);
+ test("abcdefghij", 0, 9, "abcde", 2, 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 2, 1, -2);
+ test("abcdefghij", 0, 9, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 9, "abcde", 2, 3, -2);
+ test("abcdefghij", 0, 9, "abcde", 2, 4, -2);
+ test("abcdefghij", 0, 9, "abcde", 4, 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 4, 1, -4);
+ test("abcdefghij", 0, 9, "abcde", 4, 2, -4);
+ test("abcdefghij", 0, 9, "abcde", 5, 0, 9);
+ test("abcdefghij", 0, 9, "abcde", 5, 1, 9);
+ test("abcdefghij", 0, 9, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 1, 8);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 5, 4);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 9, 0);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 10, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 0, 11, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 4, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 8, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 1, -5);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 2, -5);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 4, -5);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 9, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 9, "abcdefghij", 9, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 9, 1, -9);
+ test("abcdefghij", 0, 9, "abcdefghij", 9, 2, -9);
+ test("abcdefghij", 0, 9, "abcdefghij", 10, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 10, 1, 9);
+ test("abcdefghij", 0, 9, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 1, 8);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 10, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 19, -10);
+}
+
+void test22()
+{
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 20, -11);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 0, 21, -11);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, 0, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 20, 1, 9);
+ test("abcdefghij", 0, 9, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 10, "", 0, 0, 10);
+ test("abcdefghij", 0, 10, "", 0, 1, 10);
+ test("abcdefghij", 0, 10, "", 1, 0, 0);
+ test("abcdefghij", 0, 10, "abcde", 0, 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 0, 1, 9);
+ test("abcdefghij", 0, 10, "abcde", 0, 2, 8);
+ test("abcdefghij", 0, 10, "abcde", 0, 4, 6);
+ test("abcdefghij", 0, 10, "abcde", 0, 5, 5);
+ test("abcdefghij", 0, 10, "abcde", 0, 6, 5);
+ test("abcdefghij", 0, 10, "abcde", 1, 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 10, "abcde", 1, 2, -1);
+ test("abcdefghij", 0, 10, "abcde", 1, 3, -1);
+ test("abcdefghij", 0, 10, "abcde", 1, 4, -1);
+ test("abcdefghij", 0, 10, "abcde", 1, 5, -1);
+ test("abcdefghij", 0, 10, "abcde", 2, 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 2, 1, -2);
+ test("abcdefghij", 0, 10, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 10, "abcde", 2, 3, -2);
+ test("abcdefghij", 0, 10, "abcde", 2, 4, -2);
+ test("abcdefghij", 0, 10, "abcde", 4, 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 4, 1, -4);
+ test("abcdefghij", 0, 10, "abcde", 4, 2, -4);
+ test("abcdefghij", 0, 10, "abcde", 5, 0, 10);
+ test("abcdefghij", 0, 10, "abcde", 5, 1, 10);
+ test("abcdefghij", 0, 10, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 1, 9);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 10, 0);
+ test("abcdefghij", 0, 10, "abcdefghij", 0, 11, 0);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 4, -1);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 8, -1);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 0, 10, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 1, -5);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 2, -5);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 4, -5);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 10, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 10, "abcdefghij", 9, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 9, 1, -9);
+ test("abcdefghij", 0, 10, "abcdefghij", 9, 2, -9);
+ test("abcdefghij", 0, 10, "abcdefghij", 10, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 10, 1, 10);
+ test("abcdefghij", 0, 10, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 1, 9);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 19, -9);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 20, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 0, 21, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, 0, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 20, 1, 10);
+ test("abcdefghij", 0, 10, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 0, 11, "", 0, 0, 10);
+ test("abcdefghij", 0, 11, "", 0, 1, 10);
+ test("abcdefghij", 0, 11, "", 1, 0, 0);
+ test("abcdefghij", 0, 11, "abcde", 0, 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 0, 1, 9);
+ test("abcdefghij", 0, 11, "abcde", 0, 2, 8);
+}
+
+void test23()
+{
+ test("abcdefghij", 0, 11, "abcde", 0, 4, 6);
+ test("abcdefghij", 0, 11, "abcde", 0, 5, 5);
+ test("abcdefghij", 0, 11, "abcde", 0, 6, 5);
+ test("abcdefghij", 0, 11, "abcde", 1, 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 1, 1, -1);
+ test("abcdefghij", 0, 11, "abcde", 1, 2, -1);
+ test("abcdefghij", 0, 11, "abcde", 1, 3, -1);
+ test("abcdefghij", 0, 11, "abcde", 1, 4, -1);
+ test("abcdefghij", 0, 11, "abcde", 1, 5, -1);
+ test("abcdefghij", 0, 11, "abcde", 2, 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 2, 1, -2);
+ test("abcdefghij", 0, 11, "abcde", 2, 2, -2);
+ test("abcdefghij", 0, 11, "abcde", 2, 3, -2);
+ test("abcdefghij", 0, 11, "abcde", 2, 4, -2);
+ test("abcdefghij", 0, 11, "abcde", 4, 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 4, 1, -4);
+ test("abcdefghij", 0, 11, "abcde", 4, 2, -4);
+ test("abcdefghij", 0, 11, "abcde", 5, 0, 10);
+ test("abcdefghij", 0, 11, "abcde", 5, 1, 10);
+ test("abcdefghij", 0, 11, "abcde", 6, 0, 0);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 1, 9);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 10, 0);
+ test("abcdefghij", 0, 11, "abcdefghij", 0, 11, 0);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 4, -1);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 8, -1);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 0, 11, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 1, -5);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 2, -5);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 4, -5);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 0, 11, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 0, 11, "abcdefghij", 9, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 9, 1, -9);
+ test("abcdefghij", 0, 11, "abcdefghij", 9, 2, -9);
+ test("abcdefghij", 0, 11, "abcdefghij", 10, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 10, 1, 10);
+ test("abcdefghij", 0, 11, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 1, 9);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 19, -9);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 20, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 0, 21, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, 0, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 20, 1, 10);
+ test("abcdefghij", 0, 11, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 0, "", 0, 0, 0);
+ test("abcdefghij", 1, 0, "", 0, 1, 0);
+ test("abcdefghij", 1, 0, "", 1, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 0, 1, -1);
+ test("abcdefghij", 1, 0, "abcde", 0, 2, -2);
+ test("abcdefghij", 1, 0, "abcde", 0, 4, -4);
+ test("abcdefghij", 1, 0, "abcde", 0, 5, -5);
+ test("abcdefghij", 1, 0, "abcde", 0, 6, -5);
+ test("abcdefghij", 1, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 1, 1, -1);
+ test("abcdefghij", 1, 0, "abcde", 1, 2, -2);
+ test("abcdefghij", 1, 0, "abcde", 1, 3, -3);
+ test("abcdefghij", 1, 0, "abcde", 1, 4, -4);
+ test("abcdefghij", 1, 0, "abcde", 1, 5, -4);
+ test("abcdefghij", 1, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 0, "abcde", 2, 2, -2);
+ test("abcdefghij", 1, 0, "abcde", 2, 3, -3);
+ test("abcdefghij", 1, 0, "abcde", 2, 4, -3);
+ test("abcdefghij", 1, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 4, 1, -1);
+ test("abcdefghij", 1, 0, "abcde", 4, 2, -1);
+ test("abcdefghij", 1, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 1, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 1, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 1, 0, "abcdefghij", 0, 11, -10);
+}
+
+void test24()
+{
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 1, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 1, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 1, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 1, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 1, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 1, "", 0, 0, 1);
+ test("abcdefghij", 1, 1, "", 0, 1, 1);
+ test("abcdefghij", 1, 1, "", 1, 0, 0);
+ test("abcdefghij", 1, 1, "abcde", 0, 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 1, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 2, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 4, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 5, 1);
+ test("abcdefghij", 1, 1, "abcde", 0, 6, 1);
+ test("abcdefghij", 1, 1, "abcde", 1, 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 1, 1, 0);
+ test("abcdefghij", 1, 1, "abcde", 1, 2, -1);
+ test("abcdefghij", 1, 1, "abcde", 1, 3, -2);
+ test("abcdefghij", 1, 1, "abcde", 1, 4, -3);
+ test("abcdefghij", 1, 1, "abcde", 1, 5, -3);
+ test("abcdefghij", 1, 1, "abcde", 2, 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 1, "abcde", 2, 2, -1);
+ test("abcdefghij", 1, 1, "abcde", 2, 3, -1);
+ test("abcdefghij", 1, 1, "abcde", 2, 4, -1);
+ test("abcdefghij", 1, 1, "abcde", 4, 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 4, 1, -3);
+ test("abcdefghij", 1, 1, "abcde", 4, 2, -3);
+ test("abcdefghij", 1, 1, "abcde", 5, 0, 1);
+ test("abcdefghij", 1, 1, "abcde", 5, 1, 1);
+ test("abcdefghij", 1, 1, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 5, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 10, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 0, 11, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 1, 0);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 4, -3);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 8, -7);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 9, -8);
+ test("abcdefghij", 1, 1, "abcdefghij", 1, 10, -8);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 1, -4);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 2, -4);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 1, 1, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 1, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 9, 1, -8);
+ test("abcdefghij", 1, 1, "abcdefghij", 9, 2, -8);
+ test("abcdefghij", 1, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0);
+}
+
+void test25()
+{
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghij", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 4, "", 0, 0, 4);
+ test("abcdefghij", 1, 4, "", 0, 1, 4);
+ test("abcdefghij", 1, 4, "", 1, 0, 0);
+ test("abcdefghij", 1, 4, "abcde", 0, 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 0, 1, 1);
+ test("abcdefghij", 1, 4, "abcde", 0, 2, 1);
+ test("abcdefghij", 1, 4, "abcde", 0, 4, 1);
+ test("abcdefghij", 1, 4, "abcde", 0, 5, 1);
+ test("abcdefghij", 1, 4, "abcde", 0, 6, 1);
+ test("abcdefghij", 1, 4, "abcde", 1, 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 1, 1, 3);
+ test("abcdefghij", 1, 4, "abcde", 1, 2, 2);
+ test("abcdefghij", 1, 4, "abcde", 1, 3, 1);
+ test("abcdefghij", 1, 4, "abcde", 1, 4, 0);
+ test("abcdefghij", 1, 4, "abcde", 1, 5, 0);
+ test("abcdefghij", 1, 4, "abcde", 2, 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 4, "abcde", 2, 2, -1);
+ test("abcdefghij", 1, 4, "abcde", 2, 3, -1);
+ test("abcdefghij", 1, 4, "abcde", 2, 4, -1);
+ test("abcdefghij", 1, 4, "abcde", 4, 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 4, 1, -3);
+ test("abcdefghij", 1, 4, "abcde", 4, 2, -3);
+ test("abcdefghij", 1, 4, "abcde", 5, 0, 4);
+ test("abcdefghij", 1, 4, "abcde", 5, 1, 4);
+ test("abcdefghij", 1, 4, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 1, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 5, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 10, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 0, 11, 1);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 1, 3);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 4, 0);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 8, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 9, -5);
+ test("abcdefghij", 1, 4, "abcdefghij", 1, 10, -5);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 1, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 2, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 1, 4, "abcdefghij", 9, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 9, 1, -8);
+ test("abcdefghij", 1, 4, "abcdefghij", 9, 2, -8);
+ test("abcdefghij", 1, 4, "abcdefghij", 10, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 10, 1, 4);
+ test("abcdefghij", 1, 4, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 1, 3);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 9, -5);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 18, -14);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 19, -15);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 1, 20, -15);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 0, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 20, 1, 4);
+ test("abcdefghij", 1, 4, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 8, "", 0, 0, 8);
+ test("abcdefghij", 1, 8, "", 0, 1, 8);
+ test("abcdefghij", 1, 8, "", 1, 0, 0);
+ test("abcdefghij", 1, 8, "abcde", 0, 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 0, 1, 1);
+ test("abcdefghij", 1, 8, "abcde", 0, 2, 1);
+ test("abcdefghij", 1, 8, "abcde", 0, 4, 1);
+ test("abcdefghij", 1, 8, "abcde", 0, 5, 1);
+ test("abcdefghij", 1, 8, "abcde", 0, 6, 1);
+ test("abcdefghij", 1, 8, "abcde", 1, 0, 8);
+}
+
+void test26()
+{
+ test("abcdefghij", 1, 8, "abcde", 1, 1, 7);
+ test("abcdefghij", 1, 8, "abcde", 1, 2, 6);
+ test("abcdefghij", 1, 8, "abcde", 1, 3, 5);
+ test("abcdefghij", 1, 8, "abcde", 1, 4, 4);
+ test("abcdefghij", 1, 8, "abcde", 1, 5, 4);
+ test("abcdefghij", 1, 8, "abcde", 2, 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 8, "abcde", 2, 2, -1);
+ test("abcdefghij", 1, 8, "abcde", 2, 3, -1);
+ test("abcdefghij", 1, 8, "abcde", 2, 4, -1);
+ test("abcdefghij", 1, 8, "abcde", 4, 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 4, 1, -3);
+ test("abcdefghij", 1, 8, "abcde", 4, 2, -3);
+ test("abcdefghij", 1, 8, "abcde", 5, 0, 8);
+ test("abcdefghij", 1, 8, "abcde", 5, 1, 8);
+ test("abcdefghij", 1, 8, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 1, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 5, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 10, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 0, 11, 1);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 1, 7);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 8, 0);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 9, -1);
+ test("abcdefghij", 1, 8, "abcdefghij", 1, 10, -1);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 1, -4);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 2, -4);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 1, 8, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 1, 8, "abcdefghij", 9, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 9, 1, -8);
+ test("abcdefghij", 1, 8, "abcdefghij", 9, 2, -8);
+ test("abcdefghij", 1, 8, "abcdefghij", 10, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 10, 1, 8);
+ test("abcdefghij", 1, 8, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 1, 7);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 18, -10);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 19, -11);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 1, 20, -11);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 0, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 20, 1, 8);
+ test("abcdefghij", 1, 8, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 9, "", 0, 0, 9);
+ test("abcdefghij", 1, 9, "", 0, 1, 9);
+ test("abcdefghij", 1, 9, "", 1, 0, 0);
+ test("abcdefghij", 1, 9, "abcde", 0, 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 0, 1, 1);
+ test("abcdefghij", 1, 9, "abcde", 0, 2, 1);
+ test("abcdefghij", 1, 9, "abcde", 0, 4, 1);
+ test("abcdefghij", 1, 9, "abcde", 0, 5, 1);
+ test("abcdefghij", 1, 9, "abcde", 0, 6, 1);
+ test("abcdefghij", 1, 9, "abcde", 1, 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 1, 1, 8);
+ test("abcdefghij", 1, 9, "abcde", 1, 2, 7);
+ test("abcdefghij", 1, 9, "abcde", 1, 3, 6);
+ test("abcdefghij", 1, 9, "abcde", 1, 4, 5);
+ test("abcdefghij", 1, 9, "abcde", 1, 5, 5);
+ test("abcdefghij", 1, 9, "abcde", 2, 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 9, "abcde", 2, 2, -1);
+ test("abcdefghij", 1, 9, "abcde", 2, 3, -1);
+ test("abcdefghij", 1, 9, "abcde", 2, 4, -1);
+ test("abcdefghij", 1, 9, "abcde", 4, 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 4, 1, -3);
+ test("abcdefghij", 1, 9, "abcde", 4, 2, -3);
+ test("abcdefghij", 1, 9, "abcde", 5, 0, 9);
+ test("abcdefghij", 1, 9, "abcde", 5, 1, 9);
+ test("abcdefghij", 1, 9, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 1, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 5, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 10, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 0, 11, 1);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 1, 8);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 4, 5);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 8, 1);
+}
+
+void test27()
+{
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 9, 0);
+ test("abcdefghij", 1, 9, "abcdefghij", 1, 10, 0);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 1, -4);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 2, -4);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 1, 9, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 1, 9, "abcdefghij", 9, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 9, 1, -8);
+ test("abcdefghij", 1, 9, "abcdefghij", 9, 2, -8);
+ test("abcdefghij", 1, 9, "abcdefghij", 10, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 10, 1, 9);
+ test("abcdefghij", 1, 9, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 1, 8);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 18, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 19, -10);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 1, 20, -10);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 0, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 20, 1, 9);
+ test("abcdefghij", 1, 9, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 1, 10, "", 0, 0, 9);
+ test("abcdefghij", 1, 10, "", 0, 1, 9);
+ test("abcdefghij", 1, 10, "", 1, 0, 0);
+ test("abcdefghij", 1, 10, "abcde", 0, 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 0, 1, 1);
+ test("abcdefghij", 1, 10, "abcde", 0, 2, 1);
+ test("abcdefghij", 1, 10, "abcde", 0, 4, 1);
+ test("abcdefghij", 1, 10, "abcde", 0, 5, 1);
+ test("abcdefghij", 1, 10, "abcde", 0, 6, 1);
+ test("abcdefghij", 1, 10, "abcde", 1, 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 1, 1, 8);
+ test("abcdefghij", 1, 10, "abcde", 1, 2, 7);
+ test("abcdefghij", 1, 10, "abcde", 1, 3, 6);
+ test("abcdefghij", 1, 10, "abcde", 1, 4, 5);
+ test("abcdefghij", 1, 10, "abcde", 1, 5, 5);
+ test("abcdefghij", 1, 10, "abcde", 2, 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 2, 1, -1);
+ test("abcdefghij", 1, 10, "abcde", 2, 2, -1);
+ test("abcdefghij", 1, 10, "abcde", 2, 3, -1);
+ test("abcdefghij", 1, 10, "abcde", 2, 4, -1);
+ test("abcdefghij", 1, 10, "abcde", 4, 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 4, 1, -3);
+ test("abcdefghij", 1, 10, "abcde", 4, 2, -3);
+ test("abcdefghij", 1, 10, "abcde", 5, 0, 9);
+ test("abcdefghij", 1, 10, "abcde", 5, 1, 9);
+ test("abcdefghij", 1, 10, "abcde", 6, 0, 0);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 1, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 5, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 9, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 10, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 0, 11, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 1, 8);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 4, 5);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 8, 1);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 9, 0);
+ test("abcdefghij", 1, 10, "abcdefghij", 1, 10, 0);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 1, -4);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 2, -4);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 1, 10, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 1, 10, "abcdefghij", 9, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 9, 1, -8);
+ test("abcdefghij", 1, 10, "abcdefghij", 9, 2, -8);
+ test("abcdefghij", 1, 10, "abcdefghij", 10, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 10, 1, 9);
+ test("abcdefghij", 1, 10, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 1, 8);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 18, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 19, -10);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 1, 20, -10);
+}
+
+void test28()
+{
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 0, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 20, 1, 9);
+ test("abcdefghij", 1, 10, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 0, "", 0, 0, 0);
+ test("abcdefghij", 5, 0, "", 0, 1, 0);
+ test("abcdefghij", 5, 0, "", 1, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 0, 1, -1);
+ test("abcdefghij", 5, 0, "abcde", 0, 2, -2);
+ test("abcdefghij", 5, 0, "abcde", 0, 4, -4);
+ test("abcdefghij", 5, 0, "abcde", 0, 5, -5);
+ test("abcdefghij", 5, 0, "abcde", 0, 6, -5);
+ test("abcdefghij", 5, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 1, 1, -1);
+ test("abcdefghij", 5, 0, "abcde", 1, 2, -2);
+ test("abcdefghij", 5, 0, "abcde", 1, 3, -3);
+ test("abcdefghij", 5, 0, "abcde", 1, 4, -4);
+ test("abcdefghij", 5, 0, "abcde", 1, 5, -4);
+ test("abcdefghij", 5, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 2, 1, -1);
+ test("abcdefghij", 5, 0, "abcde", 2, 2, -2);
+ test("abcdefghij", 5, 0, "abcde", 2, 3, -3);
+ test("abcdefghij", 5, 0, "abcde", 2, 4, -3);
+ test("abcdefghij", 5, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 4, 1, -1);
+ test("abcdefghij", 5, 0, "abcde", 4, 2, -1);
+ test("abcdefghij", 5, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 5, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 5, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 5, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 5, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 5, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 5, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 5, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 5, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 5, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 1, "", 0, 0, 1);
+ test("abcdefghij", 5, 1, "", 0, 1, 1);
+ test("abcdefghij", 5, 1, "", 1, 0, 0);
+ test("abcdefghij", 5, 1, "abcde", 0, 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 0, 1, 5);
+ test("abcdefghij", 5, 1, "abcde", 0, 2, 5);
+ test("abcdefghij", 5, 1, "abcde", 0, 4, 5);
+ test("abcdefghij", 5, 1, "abcde", 0, 5, 5);
+ test("abcdefghij", 5, 1, "abcde", 0, 6, 5);
+ test("abcdefghij", 5, 1, "abcde", 1, 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 1, 1, 4);
+ test("abcdefghij", 5, 1, "abcde", 1, 2, 4);
+ test("abcdefghij", 5, 1, "abcde", 1, 3, 4);
+ test("abcdefghij", 5, 1, "abcde", 1, 4, 4);
+}
+
+void test29()
+{
+ test("abcdefghij", 5, 1, "abcde", 1, 5, 4);
+ test("abcdefghij", 5, 1, "abcde", 2, 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 2, 1, 3);
+ test("abcdefghij", 5, 1, "abcde", 2, 2, 3);
+ test("abcdefghij", 5, 1, "abcde", 2, 3, 3);
+ test("abcdefghij", 5, 1, "abcde", 2, 4, 3);
+ test("abcdefghij", 5, 1, "abcde", 4, 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 4, 1, 1);
+ test("abcdefghij", 5, 1, "abcde", 4, 2, 1);
+ test("abcdefghij", 5, 1, "abcde", 5, 0, 1);
+ test("abcdefghij", 5, 1, "abcde", 5, 1, 1);
+ test("abcdefghij", 5, 1, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 1, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 9, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 10, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 0, 11, 5);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 1, 4);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 8, 4);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 9, 4);
+ test("abcdefghij", 5, 1, "abcdefghij", 1, 10, 4);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 1, 0);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 2, -1);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 4, -3);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 5, -4);
+ test("abcdefghij", 5, 1, "abcdefghij", 5, 6, -4);
+ test("abcdefghij", 5, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 9, 1, -4);
+ test("abcdefghij", 5, 1, "abcdefghij", 9, 2, -4);
+ test("abcdefghij", 5, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghij", 5, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 1, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 10, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 19, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 20, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 0, 21, 5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 1, 4);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 9, 4);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 18, 4);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 19, 4);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 1, 20, 4);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 1, -5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 9, -5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 1, -14);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 19, 2, -14);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghij", 5, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 2, "", 0, 0, 2);
+ test("abcdefghij", 5, 2, "", 0, 1, 2);
+ test("abcdefghij", 5, 2, "", 1, 0, 0);
+ test("abcdefghij", 5, 2, "abcde", 0, 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 0, 1, 5);
+ test("abcdefghij", 5, 2, "abcde", 0, 2, 5);
+ test("abcdefghij", 5, 2, "abcde", 0, 4, 5);
+ test("abcdefghij", 5, 2, "abcde", 0, 5, 5);
+ test("abcdefghij", 5, 2, "abcde", 0, 6, 5);
+ test("abcdefghij", 5, 2, "abcde", 1, 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 1, 1, 4);
+ test("abcdefghij", 5, 2, "abcde", 1, 2, 4);
+ test("abcdefghij", 5, 2, "abcde", 1, 3, 4);
+ test("abcdefghij", 5, 2, "abcde", 1, 4, 4);
+ test("abcdefghij", 5, 2, "abcde", 1, 5, 4);
+ test("abcdefghij", 5, 2, "abcde", 2, 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 2, 1, 3);
+ test("abcdefghij", 5, 2, "abcde", 2, 2, 3);
+ test("abcdefghij", 5, 2, "abcde", 2, 3, 3);
+ test("abcdefghij", 5, 2, "abcde", 2, 4, 3);
+ test("abcdefghij", 5, 2, "abcde", 4, 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 4, 1, 1);
+ test("abcdefghij", 5, 2, "abcde", 4, 2, 1);
+ test("abcdefghij", 5, 2, "abcde", 5, 0, 2);
+ test("abcdefghij", 5, 2, "abcde", 5, 1, 2);
+ test("abcdefghij", 5, 2, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 1, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 9, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 10, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 0, 11, 5);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 1, 4);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 8, 4);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 9, 4);
+ test("abcdefghij", 5, 2, "abcdefghij", 1, 10, 4);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 1, 1);
+}
+
+void test30()
+{
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 2, 0);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 4, -2);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 5, -3);
+ test("abcdefghij", 5, 2, "abcdefghij", 5, 6, -3);
+ test("abcdefghij", 5, 2, "abcdefghij", 9, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 9, 1, -4);
+ test("abcdefghij", 5, 2, "abcdefghij", 9, 2, -4);
+ test("abcdefghij", 5, 2, "abcdefghij", 10, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 10, 1, 2);
+ test("abcdefghij", 5, 2, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 1, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 10, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 19, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 20, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 0, 21, 5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 1, 4);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 9, 4);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 18, 4);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 19, 4);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 1, 20, 4);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 1, -5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 9, -5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 1, -14);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 19, 2, -14);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 0, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 20, 1, 2);
+ test("abcdefghij", 5, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 4, "", 0, 0, 4);
+ test("abcdefghij", 5, 4, "", 0, 1, 4);
+ test("abcdefghij", 5, 4, "", 1, 0, 0);
+ test("abcdefghij", 5, 4, "abcde", 0, 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 0, 1, 5);
+ test("abcdefghij", 5, 4, "abcde", 0, 2, 5);
+ test("abcdefghij", 5, 4, "abcde", 0, 4, 5);
+ test("abcdefghij", 5, 4, "abcde", 0, 5, 5);
+ test("abcdefghij", 5, 4, "abcde", 0, 6, 5);
+ test("abcdefghij", 5, 4, "abcde", 1, 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 1, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 2, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 3, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 4, 4);
+ test("abcdefghij", 5, 4, "abcde", 1, 5, 4);
+ test("abcdefghij", 5, 4, "abcde", 2, 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 2, 1, 3);
+ test("abcdefghij", 5, 4, "abcde", 2, 2, 3);
+ test("abcdefghij", 5, 4, "abcde", 2, 3, 3);
+ test("abcdefghij", 5, 4, "abcde", 2, 4, 3);
+ test("abcdefghij", 5, 4, "abcde", 4, 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 4, 1, 1);
+ test("abcdefghij", 5, 4, "abcde", 4, 2, 1);
+ test("abcdefghij", 5, 4, "abcde", 5, 0, 4);
+ test("abcdefghij", 5, 4, "abcde", 5, 1, 4);
+ test("abcdefghij", 5, 4, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 1, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 9, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 10, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 0, 11, 5);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 1, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 8, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 9, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 1, 10, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 1, 3);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 2, 2);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 4, 0);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 5, -1);
+ test("abcdefghij", 5, 4, "abcdefghij", 5, 6, -1);
+ test("abcdefghij", 5, 4, "abcdefghij", 9, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 9, 1, -4);
+ test("abcdefghij", 5, 4, "abcdefghij", 9, 2, -4);
+ test("abcdefghij", 5, 4, "abcdefghij", 10, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 10, 1, 4);
+ test("abcdefghij", 5, 4, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 1, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 10, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 19, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 20, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 0, 21, 5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 1, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 9, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 18, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 19, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 1, 20, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 1, -5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 9, -5);
+}
+
+void test31()
+{
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 1, -14);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 19, 2, -14);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 0, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 20, 1, 4);
+ test("abcdefghij", 5, 4, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 5, "", 0, 0, 5);
+ test("abcdefghij", 5, 5, "", 0, 1, 5);
+ test("abcdefghij", 5, 5, "", 1, 0, 0);
+ test("abcdefghij", 5, 5, "abcde", 0, 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 1, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 2, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 4, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 5, 5);
+ test("abcdefghij", 5, 5, "abcde", 0, 6, 5);
+ test("abcdefghij", 5, 5, "abcde", 1, 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 1, 1, 4);
+ test("abcdefghij", 5, 5, "abcde", 1, 2, 4);
+ test("abcdefghij", 5, 5, "abcde", 1, 3, 4);
+ test("abcdefghij", 5, 5, "abcde", 1, 4, 4);
+ test("abcdefghij", 5, 5, "abcde", 1, 5, 4);
+ test("abcdefghij", 5, 5, "abcde", 2, 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 2, 1, 3);
+ test("abcdefghij", 5, 5, "abcde", 2, 2, 3);
+ test("abcdefghij", 5, 5, "abcde", 2, 3, 3);
+ test("abcdefghij", 5, 5, "abcde", 2, 4, 3);
+ test("abcdefghij", 5, 5, "abcde", 4, 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 4, 1, 1);
+ test("abcdefghij", 5, 5, "abcde", 4, 2, 1);
+ test("abcdefghij", 5, 5, "abcde", 5, 0, 5);
+ test("abcdefghij", 5, 5, "abcde", 5, 1, 5);
+ test("abcdefghij", 5, 5, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 9, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 10, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 0, 11, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 1, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 8, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 9, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 1, 10, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 1, 4);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 2, 3);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 4, 1);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 5, 0);
+ test("abcdefghij", 5, 5, "abcdefghij", 5, 6, 0);
+ test("abcdefghij", 5, 5, "abcdefghij", 9, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 9, 1, -4);
+ test("abcdefghij", 5, 5, "abcdefghij", 9, 2, -4);
+ test("abcdefghij", 5, 5, "abcdefghij", 10, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 10, 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 10, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 19, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 20, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 0, 21, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 1, 4);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 9, 4);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 18, 4);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 19, 4);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 1, 20, 4);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 1, -5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 9, -5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 1, -14);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 19, 2, -14);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcdefghij", 5, 5, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 5, 6, "", 0, 0, 5);
+ test("abcdefghij", 5, 6, "", 0, 1, 5);
+ test("abcdefghij", 5, 6, "", 1, 0, 0);
+ test("abcdefghij", 5, 6, "abcde", 0, 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 1, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 2, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 4, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 5, 5);
+ test("abcdefghij", 5, 6, "abcde", 0, 6, 5);
+ test("abcdefghij", 5, 6, "abcde", 1, 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 1, 1, 4);
+ test("abcdefghij", 5, 6, "abcde", 1, 2, 4);
+ test("abcdefghij", 5, 6, "abcde", 1, 3, 4);
+ test("abcdefghij", 5, 6, "abcde", 1, 4, 4);
+ test("abcdefghij", 5, 6, "abcde", 1, 5, 4);
+ test("abcdefghij", 5, 6, "abcde", 2, 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 2, 1, 3);
+ test("abcdefghij", 5, 6, "abcde", 2, 2, 3);
+}
+
+void test32()
+{
+ test("abcdefghij", 5, 6, "abcde", 2, 3, 3);
+ test("abcdefghij", 5, 6, "abcde", 2, 4, 3);
+ test("abcdefghij", 5, 6, "abcde", 4, 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 4, 1, 1);
+ test("abcdefghij", 5, 6, "abcde", 4, 2, 1);
+ test("abcdefghij", 5, 6, "abcde", 5, 0, 5);
+ test("abcdefghij", 5, 6, "abcde", 5, 1, 5);
+ test("abcdefghij", 5, 6, "abcde", 6, 0, 0);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 5, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 9, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 10, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 0, 11, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 1, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 4, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 8, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 9, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 1, 10, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 1, 4);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 2, 3);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 4, 1);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 5, 0);
+ test("abcdefghij", 5, 6, "abcdefghij", 5, 6, 0);
+ test("abcdefghij", 5, 6, "abcdefghij", 9, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 9, 1, -4);
+ test("abcdefghij", 5, 6, "abcdefghij", 9, 2, -4);
+ test("abcdefghij", 5, 6, "abcdefghij", 10, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 10, 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 10, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 19, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 20, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 0, 21, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 1, 4);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 9, 4);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 18, 4);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 19, 4);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 1, 20, 4);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 1, -5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 9, -5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 1, -14);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 19, 2, -14);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcdefghij", 5, 6, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 9, 0, "", 0, 0, 0);
+ test("abcdefghij", 9, 0, "", 0, 1, 0);
+ test("abcdefghij", 9, 0, "", 1, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 0, 1, -1);
+ test("abcdefghij", 9, 0, "abcde", 0, 2, -2);
+ test("abcdefghij", 9, 0, "abcde", 0, 4, -4);
+ test("abcdefghij", 9, 0, "abcde", 0, 5, -5);
+ test("abcdefghij", 9, 0, "abcde", 0, 6, -5);
+ test("abcdefghij", 9, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 1, 1, -1);
+ test("abcdefghij", 9, 0, "abcde", 1, 2, -2);
+ test("abcdefghij", 9, 0, "abcde", 1, 3, -3);
+ test("abcdefghij", 9, 0, "abcde", 1, 4, -4);
+ test("abcdefghij", 9, 0, "abcde", 1, 5, -4);
+ test("abcdefghij", 9, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 2, 1, -1);
+ test("abcdefghij", 9, 0, "abcde", 2, 2, -2);
+ test("abcdefghij", 9, 0, "abcde", 2, 3, -3);
+ test("abcdefghij", 9, 0, "abcde", 2, 4, -3);
+ test("abcdefghij", 9, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 4, 1, -1);
+ test("abcdefghij", 9, 0, "abcde", 4, 2, -1);
+ test("abcdefghij", 9, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 9, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 9, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 9, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 9, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 9, 0, "abcdefghij", 5, 6, -5);
+}
+
+void test33()
+{
+ test("abcdefghij", 9, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 9, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 9, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 9, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 9, 1, "", 0, 0, 1);
+ test("abcdefghij", 9, 1, "", 0, 1, 1);
+ test("abcdefghij", 9, 1, "", 1, 0, 0);
+ test("abcdefghij", 9, 1, "abcde", 0, 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 0, 1, 9);
+ test("abcdefghij", 9, 1, "abcde", 0, 2, 9);
+ test("abcdefghij", 9, 1, "abcde", 0, 4, 9);
+ test("abcdefghij", 9, 1, "abcde", 0, 5, 9);
+ test("abcdefghij", 9, 1, "abcde", 0, 6, 9);
+ test("abcdefghij", 9, 1, "abcde", 1, 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 1, 1, 8);
+ test("abcdefghij", 9, 1, "abcde", 1, 2, 8);
+ test("abcdefghij", 9, 1, "abcde", 1, 3, 8);
+ test("abcdefghij", 9, 1, "abcde", 1, 4, 8);
+ test("abcdefghij", 9, 1, "abcde", 1, 5, 8);
+ test("abcdefghij", 9, 1, "abcde", 2, 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 2, 1, 7);
+ test("abcdefghij", 9, 1, "abcde", 2, 2, 7);
+ test("abcdefghij", 9, 1, "abcde", 2, 3, 7);
+ test("abcdefghij", 9, 1, "abcde", 2, 4, 7);
+ test("abcdefghij", 9, 1, "abcde", 4, 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 4, 1, 5);
+ test("abcdefghij", 9, 1, "abcde", 4, 2, 5);
+ test("abcdefghij", 9, 1, "abcde", 5, 0, 1);
+ test("abcdefghij", 9, 1, "abcde", 5, 1, 1);
+ test("abcdefghij", 9, 1, "abcde", 6, 0, 0);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 1, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 5, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 9, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 10, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 0, 11, 9);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 1, 8);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 4, 8);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 8, 8);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 9, 8);
+ test("abcdefghij", 9, 1, "abcdefghij", 1, 10, 8);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 1, 4);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 2, 4);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 4, 4);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 5, 4);
+ test("abcdefghij", 9, 1, "abcdefghij", 5, 6, 4);
+ test("abcdefghij", 9, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 9, 1, 0);
+ test("abcdefghij", 9, 1, "abcdefghij", 9, 2, 0);
+ test("abcdefghij", 9, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghij", 9, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 1, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 10, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 19, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 20, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 0, 21, 9);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 1, 8);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 9, 8);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 18, 8);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 19, 8);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 1, 20, 8);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 5, -1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 9, -1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 10, -1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 10, 11, -1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 1, -10);
+}
+
+void test34()
+{
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 19, 2, -10);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghij", 9, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 9, 2, "", 0, 0, 1);
+ test("abcdefghij", 9, 2, "", 0, 1, 1);
+ test("abcdefghij", 9, 2, "", 1, 0, 0);
+ test("abcdefghij", 9, 2, "abcde", 0, 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 0, 1, 9);
+ test("abcdefghij", 9, 2, "abcde", 0, 2, 9);
+ test("abcdefghij", 9, 2, "abcde", 0, 4, 9);
+ test("abcdefghij", 9, 2, "abcde", 0, 5, 9);
+ test("abcdefghij", 9, 2, "abcde", 0, 6, 9);
+ test("abcdefghij", 9, 2, "abcde", 1, 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 1, 1, 8);
+ test("abcdefghij", 9, 2, "abcde", 1, 2, 8);
+ test("abcdefghij", 9, 2, "abcde", 1, 3, 8);
+ test("abcdefghij", 9, 2, "abcde", 1, 4, 8);
+ test("abcdefghij", 9, 2, "abcde", 1, 5, 8);
+ test("abcdefghij", 9, 2, "abcde", 2, 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 2, 1, 7);
+ test("abcdefghij", 9, 2, "abcde", 2, 2, 7);
+ test("abcdefghij", 9, 2, "abcde", 2, 3, 7);
+ test("abcdefghij", 9, 2, "abcde", 2, 4, 7);
+ test("abcdefghij", 9, 2, "abcde", 4, 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 4, 1, 5);
+ test("abcdefghij", 9, 2, "abcde", 4, 2, 5);
+ test("abcdefghij", 9, 2, "abcde", 5, 0, 1);
+ test("abcdefghij", 9, 2, "abcde", 5, 1, 1);
+ test("abcdefghij", 9, 2, "abcde", 6, 0, 0);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 1, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 5, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 9, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 10, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 0, 11, 9);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 1, 8);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 4, 8);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 8, 8);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 9, 8);
+ test("abcdefghij", 9, 2, "abcdefghij", 1, 10, 8);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 1, 4);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 2, 4);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 4, 4);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 5, 4);
+ test("abcdefghij", 9, 2, "abcdefghij", 5, 6, 4);
+ test("abcdefghij", 9, 2, "abcdefghij", 9, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 9, 1, 0);
+ test("abcdefghij", 9, 2, "abcdefghij", 9, 2, 0);
+ test("abcdefghij", 9, 2, "abcdefghij", 10, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 10, 1, 1);
+ test("abcdefghij", 9, 2, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 1, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 10, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 19, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 20, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 0, 21, 9);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 1, 8);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 9, 8);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 18, 8);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 19, 8);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 1, 20, 8);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 5, -1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 9, -1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 10, -1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 10, 11, -1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 1, -10);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 19, 2, -10);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghij", 9, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 10, 0, "", 0, 0, 0);
+ test("abcdefghij", 10, 0, "", 0, 1, 0);
+ test("abcdefghij", 10, 0, "", 1, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 0, 1, -1);
+ test("abcdefghij", 10, 0, "abcde", 0, 2, -2);
+ test("abcdefghij", 10, 0, "abcde", 0, 4, -4);
+ test("abcdefghij", 10, 0, "abcde", 0, 5, -5);
+ test("abcdefghij", 10, 0, "abcde", 0, 6, -5);
+ test("abcdefghij", 10, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 1, 1, -1);
+ test("abcdefghij", 10, 0, "abcde", 1, 2, -2);
+ test("abcdefghij", 10, 0, "abcde", 1, 3, -3);
+ test("abcdefghij", 10, 0, "abcde", 1, 4, -4);
+ test("abcdefghij", 10, 0, "abcde", 1, 5, -4);
+ test("abcdefghij", 10, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 2, 1, -1);
+ test("abcdefghij", 10, 0, "abcde", 2, 2, -2);
+ test("abcdefghij", 10, 0, "abcde", 2, 3, -3);
+ test("abcdefghij", 10, 0, "abcde", 2, 4, -3);
+ test("abcdefghij", 10, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 4, 1, -1);
+}
+
+void test35()
+{
+ test("abcdefghij", 10, 0, "abcde", 4, 2, -1);
+ test("abcdefghij", 10, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 10, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 10, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 10, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 10, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 10, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 10, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 10, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 10, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 10, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 10, 1, "", 0, 0, 0);
+ test("abcdefghij", 10, 1, "", 0, 1, 0);
+ test("abcdefghij", 10, 1, "", 1, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 0, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 0, 1, -1);
+ test("abcdefghij", 10, 1, "abcde", 0, 2, -2);
+ test("abcdefghij", 10, 1, "abcde", 0, 4, -4);
+ test("abcdefghij", 10, 1, "abcde", 0, 5, -5);
+ test("abcdefghij", 10, 1, "abcde", 0, 6, -5);
+ test("abcdefghij", 10, 1, "abcde", 1, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 1, 1, -1);
+ test("abcdefghij", 10, 1, "abcde", 1, 2, -2);
+ test("abcdefghij", 10, 1, "abcde", 1, 3, -3);
+ test("abcdefghij", 10, 1, "abcde", 1, 4, -4);
+ test("abcdefghij", 10, 1, "abcde", 1, 5, -4);
+ test("abcdefghij", 10, 1, "abcde", 2, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 2, 1, -1);
+ test("abcdefghij", 10, 1, "abcde", 2, 2, -2);
+ test("abcdefghij", 10, 1, "abcde", 2, 3, -3);
+ test("abcdefghij", 10, 1, "abcde", 2, 4, -3);
+ test("abcdefghij", 10, 1, "abcde", 4, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 4, 1, -1);
+ test("abcdefghij", 10, 1, "abcde", 4, 2, -1);
+ test("abcdefghij", 10, 1, "abcde", 5, 0, 0);
+ test("abcdefghij", 10, 1, "abcde", 5, 1, 0);
+ test("abcdefghij", 10, 1, "abcde", 6, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 5, -5);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 9, -9);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 10, -10);
+ test("abcdefghij", 10, 1, "abcdefghij", 0, 11, -10);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 4, -4);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 8, -8);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 9, -9);
+ test("abcdefghij", 10, 1, "abcdefghij", 1, 10, -9);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 2, -2);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 4, -4);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 5, -5);
+ test("abcdefghij", 10, 1, "abcdefghij", 5, 6, -5);
+ test("abcdefghij", 10, 1, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 9, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 9, 2, -1);
+ test("abcdefghij", 10, 1, "abcdefghij", 10, 0, 0);
+}
+
+void test36()
+{
+ test("abcdefghij", 10, 1, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 10, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 10, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghij", 11, 0, "", 0, 0, 0);
+ test("abcdefghij", 11, 0, "", 0, 1, 0);
+ test("abcdefghij", 11, 0, "", 1, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 2, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 4, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 5, 0);
+ test("abcdefghij", 11, 0, "abcde", 0, 6, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 2, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 3, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 4, 0);
+ test("abcdefghij", 11, 0, "abcde", 1, 5, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 2, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 3, 0);
+ test("abcdefghij", 11, 0, "abcde", 2, 4, 0);
+ test("abcdefghij", 11, 0, "abcde", 4, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 4, 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 4, 2, 0);
+ test("abcdefghij", 11, 0, "abcde", 5, 0, 0);
+ test("abcdefghij", 11, 0, "abcde", 5, 1, 0);
+ test("abcdefghij", 11, 0, "abcde", 6, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 5, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 9, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 0, 11, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 4, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 8, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 9, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 1, 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 2, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 4, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 5, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 5, 6, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 9, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 9, 2, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 19, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 18, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 5, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 9, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghij", 11, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+}
+
+void test37()
+{
+ test("abcdefghijklmnopqrst", 0, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 4, -3);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 5, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 0, 6, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 3, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 1, 5, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 1, -2);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 3, -2);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 2, 4, -2);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 1, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 4, 2, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 5, 1, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcde", 6, 0, 0);
+}
+
+void test38()
+{
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 5, -4);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 9, -8);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 10, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 0, 11, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 8, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 1, 10, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 1, -5);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 2, -5);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 4, -5);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 1, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 9, 2, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 10, -9);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 19, -18);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 20, -19);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 0, 21, -19);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghijklmnopqrst", 0, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 1, 9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 2, 8);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 4, 6);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 5, 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 0, 6, 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 3, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 1, 5, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 1, -2);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 3, -2);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 2, 4, -2);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 1, -4);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 4, 2, -4);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 5, 1, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 1, 9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 5, 5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 10, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 0, 11, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 8, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 1, 10, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 1, -5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 2, -5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 4, -5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 1, -9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 9, 2, -9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 10, 1, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 1, 9);
+}
+
+void test39()
+{
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 19, -9);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 20, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 0, 21, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, 0, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 20, 1, 10);
+ test("abcdefghijklmnopqrst", 0, 10, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 2, 17);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 4, 15);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 5, 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 0, 6, 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 3, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 1, 5, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 1, -2);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 3, -2);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 2, 4, -2);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 1, -4);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 4, 2, -4);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 5, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 5, 14);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 10, 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 0, 11, 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 8, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 1, 10, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 1, -5);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 2, -5);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 4, -5);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 1, -9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 9, 2, -9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 10, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 1, 18);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 10, 9);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 19, 0);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 0, 21, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, 0, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 20, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 19, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "", 0, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 0, 20);
+}
+
+void test40()
+{
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 2, 18);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 4, 16);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 5, 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 0, 6, 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 3, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 1, 5, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 1, -2);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 3, -2);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 2, 4, -2);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 1, -4);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 4, 2, -4);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 5, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 5, 15);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 9, 11);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 8, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 1, 10, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 1, -5);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 2, -5);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 4, -5);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 1, -9);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 9, 2, -9);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 10, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 20, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 20, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "", 0, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 2, 18);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 4, 16);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 5, 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 0, 6, 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 3, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 1, 5, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 1, -2);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 3, -2);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 2, 4, -2);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 1, -4);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 4, 2, -4);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 5, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 5, 15);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 9, 11);
+}
+
+void test41()
+{
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 4, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 8, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 1, 10, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 1, -5);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 2, -5);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 4, -5);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 1, -9);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 9, 2, -9);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 10, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 9, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 18, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 1, -10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 5, -10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 9, -10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 1, -19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 19, 2, -19);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 0, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 20, 1, 20);
+ test("abcdefghijklmnopqrst", 0, 21, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 2, -2);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+}
+
+void test42()
+{
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 2, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 4, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 0, 6, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 3, -2);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 4, -3);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 1, 5, -3);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 3, -1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 2, 4, -1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 1, -3);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 4, 2, -3);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 5, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 0, 11, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 4, -3);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 8, -7);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 9, -8);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 1, 10, -8);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 1, -4);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 2, -4);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 5, 6, -4);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 1, -8);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 9, 2, -8);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 9, -8);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 18, -17);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 19, -18);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 1, 20, -18);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "", 0, 1, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 2, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 4, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 5, 1);
+}
+
+void test43()
+{
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 0, 6, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 1, 8);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 2, 7);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 3, 6);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 4, 5);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 1, 5, 5);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 3, -1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 2, 4, -1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 1, -3);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 4, 2, -3);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 5, 1, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 0, 11, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 1, 8);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 4, 5);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 8, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 9, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 1, 10, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 1, -4);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 2, -4);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 5, 6, -4);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 1, -8);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 9, 2, -8);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 1, 8);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 18, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 19, -10);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 1, 20, -10);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 0, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 20, 1, 9);
+ test("abcdefghijklmnopqrst", 1, 9, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 18, "", 0, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "", 0, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 2, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 4, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 0, 6, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 1, 17);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 2, 16);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 3, 15);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 4, 14);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 1, 5, 14);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 3, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 2, 4, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 1, -3);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 4, 2, -3);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 5, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 0, 11, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 1, 17);
+}
+
+void test44()
+{
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 4, 14);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 8, 10);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 1, 10, 9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 1, -4);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 2, -4);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 5, 6, -4);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 1, -8);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 9, 2, -8);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 10, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 1, 17);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 18, 0);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 19, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 1, 20, -1);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 0, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 20, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 18, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 2, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 4, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 0, 6, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 2, 17);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 3, 16);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 4, 15);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 1, 5, 15);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 3, -1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 2, 4, -1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 1, -3);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 4, 2, -3);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 5, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 0, 11, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 4, 15);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 8, 11);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 9, 10);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 1, 10, 10);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 1, -4);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 2, -4);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 5, 6, -4);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 1, -8);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 9, 2, -8);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 10, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 9, 10);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 18, 1);
+}
+
+void test45()
+{
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 20, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 19, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 2, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 4, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 0, 6, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 2, 17);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 3, 16);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 4, 15);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 1, 5, 15);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 2, -1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 3, -1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 2, 4, -1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 1, -3);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 4, 2, -3);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 5, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 5, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 9, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 0, 11, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 4, 15);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 8, 11);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 9, 10);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 1, 10, 10);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 1, -4);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 2, -4);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 5, -4);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 5, 6, -4);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 1, -8);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 9, 2, -8);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 10, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 10, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 19, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 20, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 0, 21, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 9, 10);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 18, 1);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 1, -9);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 5, -9);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 1, -18);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 19, 2, -18);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 0, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 20, 1, 19);
+ test("abcdefghijklmnopqrst", 1, 20, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 2, -2);
+}
+
+void test46()
+{
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 10, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 1, "", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 2, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 4, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 0, 6, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 2, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 3, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 1, 5, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 2, 8);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 3, 8);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 2, 4, 8);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 1, 6);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 4, 2, 6);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 5, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 8, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 1, 10, 9);
+}
+
+void test47()
+{
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 2, 5);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 4, 5);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 5, 6, 5);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 9, 2, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 19, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 20, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 0, 21, 10);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 18, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 19, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 1, 20, 9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 5, -4);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 9, -8);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 10, -9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 10, 11, -9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 1, -9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 19, 2, -9);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 5, "", 0, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "", 0, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 2, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 4, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 0, 6, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 2, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 3, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 1, 5, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 2, 8);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 3, 8);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 2, 4, 8);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 1, 6);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 4, 2, 6);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 8, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 1, 10, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 2, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 4, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 5, 6, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 9, 2, 1);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 10, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 19, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 20, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 0, 21, 10);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 18, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 19, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 1, 20, 9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 1, 4);
+}
+
+void test48()
+{
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 5, 0);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 9, -4);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 10, -5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 10, 11, -5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 1, -9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 19, 2, -9);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 0, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 20, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 5, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 9, "", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "", 0, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 2, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 4, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 0, 6, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 2, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 3, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 1, 5, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 2, 8);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 3, 8);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 2, 4, 8);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 1, 6);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 4, 2, 6);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 5, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 8, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 1, 10, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 2, 5);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 4, 5);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 5, 6, 5);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 9, 2, 1);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 19, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 20, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 0, 21, 10);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 18, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 19, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 1, 20, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 5, 4);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 9, 0);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 10, -1);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 10, 11, -1);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 1, -9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 19, 2, -9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 0, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 20, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 9, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 2, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 4, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 0, 6, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 2, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 3, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 1, 5, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 0, 10);
+}
+
+void test49()
+{
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 2, 8);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 3, 8);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 2, 4, 8);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 1, 6);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 4, 2, 6);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 5, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 8, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 1, 10, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 2, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 4, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 5, 6, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 9, 2, 1);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 10, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 19, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 20, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 0, 21, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 18, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 19, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 1, 20, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 9, 1);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 1, -9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 19, 2, -9);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 20, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 10, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 2, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 4, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 0, 6, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 2, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 3, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 1, 5, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 1, 8);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 2, 8);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 3, 8);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 2, 4, 8);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 1, 6);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 4, 2, 6);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 5, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 5, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 9, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 0, 11, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 4, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 8, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 1, 10, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 1, 5);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 2, 5);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 4, 5);
+}
+
+void test50()
+{
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 5, 6, 5);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 1, 1);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 9, 2, 1);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 10, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 10, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 19, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 20, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 0, 21, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 9, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 18, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 19, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 1, 20, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 5, 5);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 9, 1);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 1, -9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 19, 2, -9);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 0, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 20, 1, 10);
+ test("abcdefghijklmnopqrst", 10, 11, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 2, -2);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+}
+
+void test51()
+{
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 2, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 4, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 5, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 0, 6, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 2, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 3, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 4, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 1, 5, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 1, 17);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 2, 17);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 3, 17);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 2, 4, 17);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 1, 15);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 4, 2, 15);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 5, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 5, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 9, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 10, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 0, 11, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 4, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 8, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 9, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 1, 10, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 1, 14);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 2, 14);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 4, 14);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 5, 14);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 5, 6, 14);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 1, 10);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 9, 2, 10);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 10, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 10, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 19, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 20, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 0, 21, 19);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 9, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 18, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 19, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 1, 20, 18);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 5, 9);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 9, 9);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 10, 9);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 10, 11, 9);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "", 0, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 2, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 4, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 5, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 0, 6, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 2, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 3, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 4, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 1, 5, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 1, 17);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 2, 17);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 3, 17);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 2, 4, 17);
+}
+
+void test52()
+{
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 1, 15);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 4, 2, 15);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 5, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 5, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 9, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 10, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 0, 11, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 4, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 8, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 9, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 1, 10, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 1, 14);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 2, 14);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 4, 14);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 5, 14);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 5, 6, 14);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 1, 10);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 9, 2, 10);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 10, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 1, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 10, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 19, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 20, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 0, 21, 19);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 1, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 9, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 18, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 19, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 1, 20, 18);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 1, 9);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 5, 9);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 9, 9);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 10, 9);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 10, 11, 9);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 0, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 20, 1, 1);
+ test("abcdefghijklmnopqrst", 19, 2, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 1, -1);
+}
+
+void test53()
+{
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 0, 6, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 3, -3);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 1, 5, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 3, -3);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 2, 4, -3);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 4, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 0, 11, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 8, -8);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 1, 10, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 2, -2);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 4, -4);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 5, 6, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 9, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 19, -19);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 20, -20);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 0, 21, -20);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 18, -18);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 19, -19);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 1, 20, -19);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 5, -5);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 9, -9);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 10, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 10, 11, -10);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 1, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 19, 2, -1);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, 0, 0);
+}
+
+void test54()
+{
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 20, 1, "abcdefghijklmnopqrst", 21, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 0, 6, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 3, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 1, 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 3, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 2, 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 4, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcde", 6, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 9, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 0, 11, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 8, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 9, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 1, 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 4, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 5, 6, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 9, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghij", 11, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 19, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 20, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 0, 21, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 9, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 18, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 19, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 1, 20, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 5, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 9, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 10, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 10, 11, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 19, 2, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 0, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 20, 1, 0);
+ test("abcdefghijklmnopqrst", 21, 0, "abcdefghijklmnopqrst", 21, 0, 0);
+}
+
+
+int main () {
+ test0();
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
+ test12();
+ test13();
+ test14();
+ test15();
+ test16();
+ test17();
+ test18();
+ test19();
+ test20();
+ test21();
+ test22();
+ test23();
+ test24();
+ test25();
+ test26();
+ test27();
+ test28();
+ test29();
+ test30();
+ test31();
+ test32();
+ test33();
+ test34();
+ test35();
+ test36();
+ test37();
+ test38();
+ test39();
+ test40();
+ test41();
+ test42();
+ test43();
+ test44();
+ test45();
+ test46();
+ test47();
+ test48();
+ test49();
+ test50();
+ test51();
+ test52();
+ test53();
+ test54();
+
+
+ {
+ test("abcde", 5, 1, "", 0, 0, 0);
+ test("abcde", 2, 4, "", 0, 0, 3);
+ test("abcde", 2, 4, "abcde", 3, 4, -2);
+ test("ABCde", 2, 4, "abcde", 2, 4, -1);
+ }
+
+ {
+ test(L"abcde", 5, 1, L"", 0, 0, 0);
+ test(L"abcde", 2, 4, L"", 0, 0, 3);
+ test(L"abcde", 2, 4, L"abcde", 3, 4, -2);
+ test(L"ABCde", 2, 4, L"abcde", 2, 4, -1);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ test(u"abcde", 5, 1, u"", 0, 0, 0);
+ test(u"abcde", 2, 4, u"", 0, 0, 3);
+ test(u"abcde", 2, 4, u"abcde", 3, 4, -2);
+ test(u"ABCde", 2, 4, u"abcde", 2, 4, -1);
+ }
+
+ {
+ test(U"abcde", 5, 1, U"", 0, 0, 0);
+ test(U"abcde", 2, 4, U"", 0, 0, 3);
+ test(U"abcde", 2, 4, U"abcde", 3, 4, -2);
+ test(U"ABCde", 2, 4, U"abcde", 2, 4, -1);
+ }
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1 { "abcde", 5 };
+ static_assert ( sv1.compare(5, 1, "", 0, 0) == 0, "" );
+ static_assert ( sv1.compare(2, 4, "", 0, 0) == 1, "" );
+ static_assert ( sv1.compare(2, 4, "abcde", 3, 4) == -1, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
new file mode 100644
index 000000000000..ddff1dd0afdb
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/compare.sv.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+
+// <string_view>
+// constexpr int compare(basic_string_view str) const noexcept;
+
+#include <string_view>
+#include <cassert>
+
+#include "test_macros.h"
+#include "constexpr_char_traits.hpp"
+
+int sign ( int x ) { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv1,
+ std::basic_string_view<CharT> sv2, int expected ) {
+ assert ( sign( sv1.compare(sv2)) == sign(expected));
+}
+
+
+template<typename CharT>
+void test ( const CharT *s1, const CharT *s2, int expected ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+
+ string_view_t sv1 ( s1 );
+ string_view_t sv2 ( s2 );
+ test1(sv1, sv2, expected);
+}
+
+int main () {
+
+ test("", "", 0);
+ test("", "abcde", -5);
+ test("", "abcdefghij", -10);
+ test("", "abcdefghijklmnopqrst", -20);
+ test("abcde", "", 5);
+ test("abcde", "abcde", 0);
+ test("abcde", "abcdefghij", -5);
+ test("abcde", "abcdefghijklmnopqrst", -15);
+ test("abcdefghij", "", 10);
+ test("abcdefghij", "abcde", 5);
+ test("abcdefghij", "abcdefghij", 0);
+ test("abcdefghij", "abcdefghijklmnopqrst", -10);
+ test("abcdefghijklmnopqrst", "", 20);
+ test("abcdefghijklmnopqrst", "abcde", 15);
+ test("abcdefghijklmnopqrst", "abcdefghij", 10);
+ test("abcdefghijklmnopqrst", "abcdefghijklmnopqrst", 0);
+
+ test(L"", L"", 0);
+ test(L"", L"abcde", -5);
+ test(L"", L"abcdefghij", -10);
+ test(L"", L"abcdefghijklmnopqrst", -20);
+ test(L"abcde", L"", 5);
+ test(L"abcde", L"abcde", 0);
+ test(L"abcde", L"abcdefghij", -5);
+ test(L"abcde", L"abcdefghijklmnopqrst", -15);
+ test(L"abcdefghij", L"", 10);
+ test(L"abcdefghij", L"abcde", 5);
+ test(L"abcdefghij", L"abcdefghij", 0);
+ test(L"abcdefghij", L"abcdefghijklmnopqrst", -10);
+ test(L"abcdefghijklmnopqrst", L"", 20);
+ test(L"abcdefghijklmnopqrst", L"abcde", 15);
+ test(L"abcdefghijklmnopqrst", L"abcdefghij", 10);
+ test(L"abcdefghijklmnopqrst", L"abcdefghijklmnopqrst", 0);
+
+#if TEST_STD_VER >= 11
+ test(u"", u"", 0);
+ test(u"", u"abcde", -5);
+ test(u"", u"abcdefghij", -10);
+ test(u"", u"abcdefghijklmnopqrst", -20);
+ test(u"abcde", u"", 5);
+ test(u"abcde", u"abcde", 0);
+ test(u"abcde", u"abcdefghij", -5);
+ test(u"abcde", u"abcdefghijklmnopqrst", -15);
+ test(u"abcdefghij", u"", 10);
+ test(u"abcdefghij", u"abcde", 5);
+ test(u"abcdefghij", u"abcdefghij", 0);
+ test(u"abcdefghij", u"abcdefghijklmnopqrst", -10);
+ test(u"abcdefghijklmnopqrst", u"", 20);
+ test(u"abcdefghijklmnopqrst", u"abcde", 15);
+ test(u"abcdefghijklmnopqrst", u"abcdefghij", 10);
+ test(u"abcdefghijklmnopqrst", u"abcdefghijklmnopqrst", 0);
+
+ test(U"", U"", 0);
+ test(U"", U"abcde", -5);
+ test(U"", U"abcdefghij", -10);
+ test(U"", U"abcdefghijklmnopqrst", -20);
+ test(U"abcde", U"", 5);
+ test(U"abcde", U"abcde", 0);
+ test(U"abcde", U"abcdefghij", -5);
+ test(U"abcde", U"abcdefghijklmnopqrst", -15);
+ test(U"abcdefghij", U"", 10);
+ test(U"abcdefghij", U"abcde", 5);
+ test(U"abcdefghij", U"abcdefghij", 0);
+ test(U"abcdefghij", U"abcdefghijklmnopqrst", -10);
+ test(U"abcdefghijklmnopqrst", U"", 20);
+ test(U"abcdefghijklmnopqrst", U"abcde", 15);
+ test(U"abcdefghijklmnopqrst", U"abcdefghij", 10);
+ test(U"abcdefghijklmnopqrst", U"abcdefghijklmnopqrst", 0);
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::basic_string_view<char, constexpr_char_traits<char>> SV;
+ constexpr SV sv1 { "abcde", 5 };
+ constexpr SV sv2 { "abcde", 5 };
+ constexpr SV sv3 { "edcba0", 6 };
+ static_assert ( sv1.compare(sv2) == 0, "" );
+ static_assert ( sv2.compare(sv1) == 0, "" );
+ static_assert ( sv3.compare(sv2) > 0, "" );
+ static_assert ( sv2.compare(sv3) < 0, "" );
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/test/std/strings/string.view/string.view.ops/copy.pass.cpp
new file mode 100644
index 000000000000..41601467b812
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// size_type copy(charT* s, size_type n, size_type pos = 0) const;
+
+// Throws: out_of_range if pos > size().
+// Remarks: Let rlen be the smaller of n and size() - pos.
+// Requires: [s, s+rlen) is a valid range.
+// Effects: Equivalent to std::copy_n(begin() + pos, rlen, s).
+// Returns: rlen.
+
+
+#include <string_view>
+#include <algorithm>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test1 ( std::basic_string_view<CharT> sv, size_t n, size_t pos ) {
+ const size_t rlen = std::min ( n, sv.size() - pos );
+
+ CharT *dest1 = new CharT [rlen + 1]; dest1[rlen] = 0;
+ CharT *dest2 = new CharT [rlen + 1]; dest2[rlen] = 0;
+
+ if (pos > sv.size()) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try {
+ sv.copy(dest1, n, pos);
+ assert(false);
+ } catch (const std::out_of_range&) {
+ } catch (...) {
+ assert(false);
+ }
+#endif
+ } else {
+ sv.copy(dest1, n, pos);
+ std::copy_n(sv.begin() + pos, rlen, dest2);
+ for ( size_t i = 0; i <= rlen; ++i )
+ assert ( dest1[i] == dest2[i] );
+ }
+ delete [] dest1;
+ delete [] dest2;
+}
+
+
+template<typename CharT>
+void test ( const CharT *s ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+
+ string_view_t sv1 ( s );
+
+ test1(sv1, 0, 0);
+ test1(sv1, 1, 0);
+ test1(sv1, 20, 0);
+ test1(sv1, sv1.size(), 0);
+ test1(sv1, 20, string_view_t::npos);
+
+ test1(sv1, 0, 3);
+ test1(sv1, 2, 3);
+ test1(sv1, 100, 3);
+ test1(sv1, 100, string_view_t::npos);
+
+ test1(sv1, sv1.size(), string_view_t::npos);
+
+ test1(sv1, sv1.size() + 1, 0);
+ test1(sv1, sv1.size() + 1, 1);
+ test1(sv1, sv1.size() + 1, string_view_t::npos);
+
+}
+
+int main () {
+ test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( "ABCDE");
+ test ( "a" );
+ test ( "" );
+
+ test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( L"ABCDE" );
+ test ( L"a" );
+ test ( L"" );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( u"ABCDE" );
+ test ( u"a" );
+ test ( u"" );
+
+ test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( U"ABCDE" );
+ test ( U"a" );
+ test ( U"" );
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.ops/substr.pass.cpp b/test/std/strings/string.view/string.view.ops/substr.pass.cpp
new file mode 100644
index 000000000000..5f9a60067b43
--- /dev/null
+++ b/test/std/strings/string.view/string.view.ops/substr.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string_view>
+
+// constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
+
+// Throws: out_of_range if pos > size().
+// Effects: Determines the effective length rlen of the string to reference as the smaller of n and size() - pos.
+// Returns: basic_string_view(data()+pos, rlen).
+
+#include <string_view>
+#include <algorithm>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+
+template<typename CharT>
+void test1(std::basic_string_view<CharT> sv, size_t n, size_t pos) {
+ std::basic_string_view<CharT> sv1;
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (pos > sv.size())
+ return ; // would throw if exceptions were enabled
+ sv1 = sv.substr(pos, n);
+#else
+ try {
+ sv1 = sv.substr(pos, n);
+ assert(pos <= sv.size());
+ }
+ catch (const std::out_of_range&) {
+ assert(pos > sv.size());
+ return ;
+ }
+#endif
+ const size_t rlen = std::min(n, sv.size() - pos);
+ assert (sv1.size() == rlen);
+ for (size_t i = 0; i < rlen; ++i)
+ assert(sv[pos+i] == sv1[i]);
+}
+
+
+template<typename CharT>
+void test ( const CharT *s ) {
+ typedef std::basic_string_view<CharT> string_view_t;
+
+ string_view_t sv1 ( s );
+
+ test1(sv1, 0, 0);
+ test1(sv1, 1, 0);
+ test1(sv1, 20, 0);
+ test1(sv1, sv1.size(), 0);
+
+ test1(sv1, 0, 3);
+ test1(sv1, 2, 3);
+ test1(sv1, 100, 3);
+
+ test1(sv1, 0, string_view_t::npos);
+ test1(sv1, 2, string_view_t::npos);
+ test1(sv1, sv1.size(), string_view_t::npos);
+
+ test1(sv1, sv1.size() + 1, 0);
+ test1(sv1, sv1.size() + 1, 1);
+ test1(sv1, sv1.size() + 1, string_view_t::npos);
+}
+
+int main () {
+ test ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( "ABCDE");
+ test ( "a" );
+ test ( "" );
+
+ test ( L"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( L"ABCDE" );
+ test ( L"a" );
+ test ( L"" );
+
+#if TEST_STD_VER >= 11
+ test ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( u"ABCDE" );
+ test ( u"a" );
+ test ( u"" );
+
+ test ( U"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE" );
+ test ( U"ABCDE" );
+ test ( U"a" );
+ test ( U"" );
+#endif
+
+#if TEST_STD_VER > 11
+ {
+ constexpr std::string_view sv1 { "ABCDE", 5 };
+
+ {
+ constexpr std::string_view sv2 = sv1.substr ( 0, 3 );
+ static_assert ( sv2.size() == 3, "" );
+ static_assert ( sv2[0] == 'A', "" );
+ static_assert ( sv2[1] == 'B', "" );
+ static_assert ( sv2[2] == 'C', "" );
+ }
+
+ {
+ constexpr std::string_view sv2 = sv1.substr ( 3, 0 );
+ static_assert ( sv2.size() == 0, "" );
+ }
+
+ {
+ constexpr std::string_view sv2 = sv1.substr ( 3, 3 );
+ static_assert ( sv2.size() == 2, "" );
+ static_assert ( sv2[0] == 'D', "" );
+ static_assert ( sv2[1] == 'E', "" );
+ }
+ }
+#endif
+}
diff --git a/test/std/strings/string.view/string.view.synop/nothing_to_do.pass.cpp b/test/std/strings/string.view/string.view.synop/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..353dd98f415e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.synop/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <string_view>
+
+int main () {}
diff --git a/test/std/strings/string.view/string.view.template/nothing_to_do.pass.cpp b/test/std/strings/string.view/string.view.template/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..353dd98f415e
--- /dev/null
+++ b/test/std/strings/string.view/string.view.template/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <string_view>
+
+int main () {}
diff --git a/test/std/thread/futures/futures.async/async.pass.cpp b/test/std/thread/futures/futures.async/async.pass.cpp
index 5cb824d48224..9adebb285111 100644
--- a/test/std/thread/futures/futures.async/async.pass.cpp
+++ b/test/std/thread/futures/futures.async/async.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -73,7 +72,8 @@ std::unique_ptr<int> f4(std::unique_ptr<int>&& p)
void f5(int j)
{
std::this_thread::sleep_for(ms(200));
- throw j;
+ ((void)j);
+ TEST_THROW(j);
}
template <class Ret, class CheckLamdba, class ...Args>
@@ -140,6 +140,7 @@ int main()
test<Ret>(checkUPtr, DPID, f3, 3);
test<Ret>(checkUPtr, DPID, f4, std::unique_ptr<int>(new int(3)));
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::future<void> f = std::async(f5, 3);
std::this_thread::sleep_for(ms(300));
@@ -150,4 +151,5 @@ int main()
std::this_thread::sleep_for(ms(300));
try { f.get(); assert (false); } catch ( int ) {}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.future_error/code.pass.cpp b/test/std/thread/futures/futures.future_error/code.pass.cpp
index e02af486fc39..35d44df5bbbf 100644
--- a/test/std/thread/futures/futures.future_error/code.pass.cpp
+++ b/test/std/thread/futures/futures.future_error/code.pass.cpp
@@ -12,12 +12,16 @@
// <future>
// class future_error
+// future_error(error_code __ec); // exposition only
+// explicit future_error(future_errc _Ev) : __ec_(make_error_code(_Ev)) {} // C++17
// const error_code& code() const throw();
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -40,4 +44,14 @@ int main()
std::future_error f(ec);
assert(f.code() == ec);
}
+#if TEST_STD_VER > 14
+ {
+ std::future_error f(std::future_errc::broken_promise);
+ assert(f.code() == std::make_error_code(std::future_errc::broken_promise));
+ }
+ {
+ std::future_error f(std::future_errc::no_state);
+ assert(f.code() == std::make_error_code(std::future_errc::no_state));
+ }
+#endif
}
diff --git a/test/std/thread/futures/futures.future_error/what.pass.cpp b/test/std/thread/futures/futures.future_error/what.pass.cpp
index 52d2e944a684..a44f8af7d41b 100644
--- a/test/std/thread/futures/futures.future_error/what.pass.cpp
+++ b/test/std/thread/futures/futures.future_error/what.pass.cpp
@@ -26,25 +26,27 @@
#include <cstring>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
std::future_error f(std::make_error_code(std::future_errc::broken_promise));
- assert(std::strcmp(f.what(), "The associated promise has been destructed prior "
+ LIBCPP_ASSERT(std::strcmp(f.what(), "The associated promise has been destructed prior "
"to the associated state becoming ready.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved));
- assert(std::strcmp(f.what(), "The future has already been retrieved from "
+ LIBCPP_ASSERT(std::strcmp(f.what(), "The future has already been retrieved from "
"the promise or packaged_task.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied));
- assert(std::strcmp(f.what(), "The state of the promise has already been set.") == 0);
+ LIBCPP_ASSERT(std::strcmp(f.what(), "The state of the promise has already been set.") == 0);
}
{
std::future_error f(std::make_error_code(std::future_errc::no_state));
- assert(std::strcmp(f.what(), "Operation not permitted on an object without "
+ LIBCPP_ASSERT(std::strcmp(f.what(), "Operation not permitted on an object without "
"an associated state.") == 0);
}
}
diff --git a/test/std/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp b/test/std/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
index 499de52598b6..8a3987cb5127 100644
--- a/test/std/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
+++ b/test/std/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
@@ -14,8 +14,12 @@
// template <> struct is_error_code_enum<future_errc> : public true_type {};
#include <future>
+#include "test_macros.h"
int main()
{
- static_assert(std::is_error_code_enum<std::future_errc>::value, "");
+ static_assert(std::is_error_code_enum <std::future_errc>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(std::is_error_code_enum_v<std::future_errc>, "");
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/dtor.pass.cpp b/test/std/thread/futures/futures.promise/dtor.pass.cpp
index e3151ab38322..49010a67b39e 100644
--- a/test/std/thread/futures/futures.promise/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/dtor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -32,6 +33,7 @@ int main()
}
assert(f.get() == 3);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef int T;
std::future<T> f;
@@ -42,6 +44,7 @@ int main()
try
{
T i = f.get();
+ ((void)i); // Prevent unused warning
assert(false);
}
catch (const std::future_error& e)
@@ -49,6 +52,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::broken_promise));
}
}
+#endif
{
typedef int& T;
@@ -61,6 +65,7 @@ int main()
}
assert(&f.get() == &i);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef int& T;
std::future<T> f;
@@ -71,6 +76,7 @@ int main()
try
{
T i = f.get();
+ ((void)i); // Prevent unused warning
assert(false);
}
catch (const std::future_error& e)
@@ -78,6 +84,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::broken_promise));
}
}
+#endif
{
typedef void T;
@@ -90,6 +97,7 @@ int main()
f.get();
assert(true);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
typedef void T;
std::future<T> f;
@@ -115,4 +123,5 @@ int main()
e.code() == std::error_code(0, std::future_category()));
}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/get_future.pass.cpp b/test/std/thread/futures/futures.promise/get_future.pass.cpp
index bc45e28a9f96..fc606c6c8366 100644
--- a/test/std/thread/futures/futures.promise/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.promise/get_future.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -28,6 +29,7 @@ int main()
p.set_value(105.5);
assert(f.get() == 105.5);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<double> p;
std::future<double> f = p.get_future();
@@ -54,4 +56,5 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/move_assign.pass.cpp b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
index 9dd8a9daef80..ad72bf78e0a4 100644
--- a/test/std/thread/futures/futures.promise/move_assign.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,7 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
int main()
@@ -34,6 +34,7 @@ int main()
std::future<int> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -43,6 +44,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
+#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);
@@ -55,6 +57,7 @@ int main()
std::future<int&> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -64,6 +67,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
+#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);
@@ -76,6 +80,7 @@ int main()
std::future<void> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -85,6 +90,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
+#endif
assert(test_alloc_base::alloc_count == 1);
}
assert(test_alloc_base::alloc_count == 0);
diff --git a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
index 9a68b5c1b4e1..c9971b0a3f04 100644
--- a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,7 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
int main()
@@ -32,6 +32,7 @@ int main()
std::future<int> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -42,6 +43,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
assert(test_alloc_base::alloc_count == 1);
+#endif
}
assert(test_alloc_base::alloc_count == 0);
{
@@ -51,6 +53,7 @@ int main()
std::future<int&> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -61,6 +64,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
assert(test_alloc_base::alloc_count == 1);
+#endif
}
assert(test_alloc_base::alloc_count == 0);
{
@@ -70,6 +74,7 @@ int main()
std::future<void> f = p.get_future();
assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
f = p0.get_future();
@@ -80,6 +85,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
assert(test_alloc_base::alloc_count == 1);
+#endif
}
assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/set_exception.pass.cpp b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
index 6ef41af94545..8788c6314d0f 100644
--- a/test/std/thread/futures/futures.promise/set_exception.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
diff --git a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
index f54d7cd16bdb..1cdeadf84958 100644
--- a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -22,7 +22,6 @@
void func(std::promise<int> p)
{
- const int i = 5;
p.set_exception_at_thread_exit(std::make_exception_ptr(3));
}
diff --git a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
index 98394871e703..6e2a4a5d9109 100644
--- a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -32,6 +33,7 @@ int main()
assert(j == 3);
++i;
assert(j == 4);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
p.set_value(i);
@@ -41,5 +43,6 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
+#endif
}
}
diff --git a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
index db7465ceab85..9c670c1e3f77 100644
--- a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,10 +19,14 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
struct A
{
A() {}
- A(const A&) {throw 10;}
+ A(const A&) {
+ TEST_THROW(10);
+ }
};
int main()
@@ -36,6 +39,7 @@ int main()
p.set_value(i);
++i;
assert(f.get() == 3);
+#ifndef TEST_HAS_NO_EXCEPTIONS
--i;
try
{
@@ -46,12 +50,14 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
+#endif
}
{
typedef A T;
T i;
std::promise<T> p;
std::future<T> f = p.get_future();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
p.set_value(i);
@@ -61,5 +67,6 @@ int main()
{
assert(j == 10);
}
+#endif
}
}
diff --git a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
index 87be8cd60a5e..30c6853c973b 100644
--- a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
diff --git a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
index 3f9e945dddaf..abb9928e88a1 100644
--- a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
@@ -15,10 +15,13 @@
// class shared_future<R>
// shared_future& operator=(const shared_future& rhs);
+// noexcept in C++17
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -27,6 +30,9 @@ int main()
std::shared_future<T> f0 = p.get_future();
std::shared_future<T> f;
f = f0;
+#if TEST_STD_VER > 14
+ static_assert(noexcept(f = f0), "" );
+#endif
assert(f0.valid());
assert(f.valid());
}
diff --git a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
index 1da08808db2e..2b6633138879 100644
--- a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
@@ -15,10 +15,13 @@
// class shared_future<R>
// shared_future(const shared_future& rhs);
+// noexcept in C++17
#include <future>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -26,6 +29,9 @@ int main()
std::promise<T> p;
std::shared_future<T> f0 = p.get_future();
std::shared_future<T> f = f0;
+#if TEST_STD_VER > 14
+ static_assert(noexcept(std::shared_future<T>{f0}), "" );
+#endif
assert(f0.valid());
assert(f.valid());
}
diff --git a/test/std/thread/futures/futures.shared_future/get.pass.cpp b/test/std/thread/futures/futures.shared_future/get.pass.cpp
index 6eea1d889b6d..23d33138e3bc 100644
--- a/test/std/thread/futures/futures.shared_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/get.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -22,6 +21,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
@@ -73,6 +74,7 @@ int main()
assert(f.get() == 3);
assert(f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::shared_future<T> f = p.get_future();
@@ -89,6 +91,7 @@ int main()
}
assert(f.valid());
}
+#endif
}
{
typedef int& T;
@@ -100,6 +103,7 @@ int main()
assert(f.get() == 5);
assert(f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::shared_future<T> f = p.get_future();
@@ -116,6 +120,7 @@ int main()
}
assert(f.valid());
}
+#endif
}
{
typedef void T;
@@ -127,6 +132,7 @@ int main()
f.get();
assert(f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::shared_future<T> f = p.get_future();
@@ -143,5 +149,6 @@ int main()
}
assert(f.valid());
}
+#endif
}
}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp
index 6d7d734bd5e7..9d1ad61cef69 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/ctor1.fail.cpp
@@ -28,6 +28,9 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
- PT p { VPT{} }; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
- // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
+ VPT init{};
+ auto const& c_init = init;
+ PT p1{init}; // expected-error {{no matching constructor}}
+ PT p2{c_init}; // expected-error {{no matching constructor}}
+ PT p3{std::move(init)}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
index 7fafd1005649..07eeaaa46afe 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
class A
{
long data_;
@@ -30,7 +31,7 @@ public:
long operator()(long i, long j) const {return data_ + i + j;}
};
-void func(std::packaged_task<double(int, char)> p)
+void func(std::packaged_task<double(int, char)>)
{
}
@@ -41,6 +42,7 @@ void func2(std::packaged_task<double(int, char)> p)
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::packaged_task<double(int, char)> p(A(5));
std::future<double> f = p.get_future();
@@ -48,6 +50,7 @@ int main()
try
{
double i = f.get();
+ ((void)i); // Prevent unused warning
assert(false);
}
catch (const std::future_error& e)
@@ -55,6 +58,7 @@ int main()
assert(e.code() == make_error_code(std::future_errc::broken_promise));
}
}
+#endif
{
std::packaged_task<double(int, char)> p(A(5));
std::future<double> f = p.get_future();
diff --git a/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
index c8e5d6efd6b4..8f51dccd8d30 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/get_future.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
class A
{
long data_;
@@ -38,6 +39,7 @@ int main()
p(3, 'a');
assert(f.get() == 105.0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::packaged_task<double(int, char)> p(A(5));
std::future<double> f = p.get_future();
@@ -63,4 +65,5 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
index 54ac64458248..a597c9d8304d 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/make_ready_at_thread_exit.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
class A
{
long data_;
@@ -30,7 +31,7 @@ public:
long operator()(long i, long j) const
{
if (j == 'z')
- throw A(6);
+ TEST_THROW(A(6));
return data_ + i + j;
}
};
@@ -49,6 +50,7 @@ void func1(std::packaged_task<double(int, char)> p)
void func2(std::packaged_task<double(int, char)> p)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
p.make_ready_at_thread_exit(3, 'a');
try
{
@@ -58,10 +60,14 @@ void func2(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
+#else
+ ((void)p);
+#endif
}
void func3(std::packaged_task<double(int, char)> p)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
p.make_ready_at_thread_exit(3, 'a');
@@ -70,6 +76,9 @@ void func3(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
+#else
+ ((void)p);
+#endif
}
int main()
@@ -80,6 +89,7 @@ int main()
std::thread(func0, std::move(p)).detach();
assert(f.get() == 105.0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::packaged_task<double(int, char)> p(A(5));
std::future<double> f = p.get_future();
@@ -105,4 +115,5 @@ int main()
std::thread t(func3, std::move(p));
t.join();
}
+#endif
}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
index 9ad1509517f6..6acf8c5a619b 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/operator.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
class A
{
long data_;
@@ -30,7 +31,7 @@ public:
long operator()(long i, long j) const
{
if (j == 'z')
- throw A(6);
+ TEST_THROW(A(6));
return data_ + i + j;
}
};
@@ -49,6 +50,7 @@ void func1(std::packaged_task<double(int, char)> p)
void func2(std::packaged_task<double(int, char)> p)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
p(3, 'a');
try
{
@@ -58,10 +60,14 @@ void func2(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
}
+#else
+ ((void)p);
+#endif
}
void func3(std::packaged_task<double(int, char)> p)
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
p(3, 'a');
@@ -70,6 +76,9 @@ void func3(std::packaged_task<double(int, char)> p)
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
+#else
+ ((void)p);
+#endif
}
int main()
@@ -80,6 +89,7 @@ int main()
std::thread(func0, std::move(p)).detach();
assert(f.get() == 105.0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::packaged_task<double(int, char)> p(A(5));
std::future<double> f = p.get_future();
@@ -106,4 +116,5 @@ int main()
std::thread t(func3, std::move(p));
t.join();
}
+#endif
}
diff --git a/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
index 02a567500ee2..190afdc6af66 100644
--- a/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
+++ b/test/std/thread/futures/futures.task/futures.task.members/reset.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -20,6 +19,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
class A
{
long data_;
@@ -29,8 +30,6 @@ public:
long operator()(long i, long j) const
{
- if (j == 'z')
- throw A(6);
return data_ + i + j;
}
};
@@ -47,6 +46,7 @@ int main()
f = p.get_future();
assert(f.get() == 106.0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::packaged_task<double(int, char)> p;
try
@@ -59,4 +59,5 @@ int main()
assert(e.code() == make_error_code(std::future_errc::no_state));
}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.unique_future/get.pass.cpp b/test/std/thread/futures/futures.unique_future/get.pass.cpp
index 67b1052c175d..87a54251ecde 100644
--- a/test/std/thread/futures/futures.unique_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/get.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
@@ -22,6 +21,8 @@
#include <future>
#include <cassert>
+#include "test_macros.h"
+
void func1(std::promise<int> p)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
@@ -73,6 +74,7 @@ int main()
assert(f.get() == 3);
assert(!f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::future<T> f = p.get_future();
@@ -89,6 +91,7 @@ int main()
}
assert(!f.valid());
}
+#endif
}
{
typedef int& T;
@@ -100,6 +103,7 @@ int main()
assert(f.get() == 5);
assert(!f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::future<T> f = p.get_future();
@@ -116,6 +120,7 @@ int main()
}
assert(!f.valid());
}
+#endif
}
{
typedef void T;
@@ -127,6 +132,7 @@ int main()
f.get();
assert(!f.valid());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::promise<T> p;
std::future<T> f = p.get_future();
@@ -143,5 +149,6 @@ int main()
}
assert(!f.valid());
}
+#endif
}
}
diff --git a/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
new file mode 100644
index 000000000000..d60e42918860
--- /dev/null
+++ b/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// notify_all_at_thread_exit(...) requires move semantics to transfer the
+// unique_lock.
+// UNSUPPORTED: c++98, c++03
+
+// <condition_variable>
+
+// void
+// notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
+
+// Test that this function works with threads that were not created by
+// std::thread. See http://llvm.org/PR30202.
+
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+#include <pthread.h>
+
+std::condition_variable cv;
+std::mutex mut;
+bool exited = false;
+
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::high_resolution_clock Clock;
+
+void* func(void*)
+{
+ std::unique_lock<std::mutex> lk(mut);
+ std::notify_all_at_thread_exit(cv, std::move(lk));
+ std::this_thread::sleep_for(ms(300));
+ exited = true;
+ return nullptr;
+}
+
+int main()
+{
+ {
+ std::unique_lock<std::mutex> lk(mut);
+ pthread_t id;
+ int res = pthread_create(&id, 0, &func, nullptr);
+ assert(res == 0);
+ Clock::time_point t0 = Clock::now();
+ assert(exited == false);
+ cv.wait(lk);
+ Clock::time_point t1 = Clock::now();
+ assert(exited);
+ assert(t1-t0 > ms(250));
+ pthread_join(id, 0);
+ }
+ exited = false;
+ {
+ std::unique_lock<std::mutex> lk(mut);
+ std::thread t(&func, nullptr);
+ Clock::time_point t0 = Clock::now();
+ assert(exited == false);
+ cv.wait(lk);
+ Clock::time_point t1 = Clock::now();
+ assert(exited);
+ assert(t1-t0 > ms(250));
+ t.join();
+ }
+}
diff --git a/test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
index 0ee40d161b7b..9c0af808686e 100644
--- a/test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
@@ -52,6 +52,7 @@ void f()
cv.notify_one();
Clock::time_point t0 = Clock::now();
bool r = cv.wait_for(lk, milliseconds(250), Pred(test2));
+ ((void)r); // Prevent unused warning
Clock::time_point t1 = Clock::now();
if (runs == 0)
{
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
index b2403079275d..47da788335c2 100644
--- a/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
@@ -44,6 +44,7 @@ int test1 = 0;
int test2 = 0;
int runs = 0;
+bool expect_result = false;
void f()
{
@@ -54,7 +55,8 @@ void f()
test1 = 1;
cv.notify_one();
Clock::time_point t0 = Clock::now();
- bool r = cv.wait_for(lk, milliseconds(250), Pred(test2));
+ bool result = cv.wait_for(lk, milliseconds(250), Pred(test2));
+ assert(result == expect_result);
Clock::time_point t1 = Clock::now();
if (runs == 0)
{
@@ -72,6 +74,7 @@ void f()
int main()
{
{
+ expect_result = true;
L1 lk(m0);
std::thread t(f);
assert(test1 == 0);
@@ -86,6 +89,7 @@ int main()
test1 = 0;
test2 = 0;
{
+ expect_result = false;
L1 lk(m0);
std::thread t(f);
assert(test1 == 0);
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
index f9a35cc905c7..a2b7061c2546 100644
--- a/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <condition_variable>
diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
index eac7600b5d11..46d04cdac350 100644
--- a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
@@ -7,9 +7,13 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// This test hangs forever when built against libstdc++. In order to allow
+// validation of the test suite against other STLs we have to mark it
+// unsupported.
+// UNSUPPORTED: libstdc++
+
// <mutex>
// template <class L1, class L2, class... L3>
@@ -18,6 +22,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
class L0
{
bool locked_;
@@ -73,12 +79,12 @@ public:
void lock()
{
- throw 1;
+ TEST_THROW(1);
}
bool try_lock()
{
- throw 1;
+ TEST_THROW(1);
return locked_;
}
@@ -110,6 +116,7 @@ int main()
assert(l0.locked());
assert(l1.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L2 l1;
@@ -180,6 +187,7 @@ int main()
assert(!l1.locked());
}
}
+#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
L0 l0;
@@ -190,6 +198,7 @@ int main()
assert(l1.locked());
assert(l2.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L2 l0;
L2 l1;
@@ -206,6 +215,7 @@ int main()
assert(!l2.locked());
}
}
+#endif
{
L0 l0;
L0 l1;
@@ -233,6 +243,7 @@ int main()
assert(l1.locked());
assert(l2.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -377,6 +388,7 @@ int main()
assert(!l2.locked());
}
}
+#endif // TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -432,6 +444,7 @@ int main()
assert(l2.locked());
assert(l3.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -504,5 +517,6 @@ int main()
assert(!l3.locked());
}
}
+#endif // TEST_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_VARIADICS
}
diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
index 8889408be2d7..fb563cbe0b14 100644
--- a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -18,6 +17,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
class L0
{
bool locked_;
@@ -63,7 +64,7 @@ public:
bool try_lock()
{
- throw 1;
+ TEST_THROW(1);
return locked_;
}
@@ -95,6 +96,7 @@ int main()
assert(!l0.locked());
assert(!l1.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L2 l1;
@@ -123,6 +125,7 @@ int main()
assert(!l1.locked());
}
}
+#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
L0 l0;
@@ -142,6 +145,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L2 l0;
L2 l1;
@@ -167,6 +171,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
+#endif
{
L0 l0;
L0 l1;
@@ -194,6 +199,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
@@ -242,6 +248,7 @@ int main()
assert(!l2.locked());
}
}
+#endif
{
L1 l0;
L1 l1;
@@ -269,6 +276,7 @@ int main()
assert(!l1.locked());
assert(!l2.locked());
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
L1 l0;
L1 l1;
@@ -458,6 +466,7 @@ int main()
assert(!l2.locked());
}
}
+#endif // TEST_HAS_NO_EXCEPTIONS
{
L0 l0;
L0 l1;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
index 840af6788d04..81fc0d368f6a 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
@@ -16,6 +16,7 @@
// lock_guard(Mutex&..., adopt_lock_t);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
index 18193e000edc..1b4c9d4bfd5d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
@@ -16,6 +16,7 @@
// lock_guard& operator=(lock_guard const&) = delete;
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
index 6dc37e970fb6..c7fd0e94b771 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
@@ -16,6 +16,7 @@
// lock_guard(lock_guard const&) = delete;
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
index 866538a2834f..1eef7e268fb2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
@@ -16,6 +16,7 @@
// explicit lock_guard(Mutex&...);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
index 4910d837cae3..8d83ddf98c6d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
@@ -16,6 +16,7 @@
// explicit lock_guard(mutex_type& m);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
index 3c134e0b8861..0ad16e2856fd 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-
// <mutex>
// template <class ...Mutex> class lock_guard;
@@ -17,5 +16,6 @@
// dialects, including C++03, even though it is forward declared using
// variadic templates.
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include "mutex.pass.cpp" // Use the existing non-variadic test
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
index 2b06742a673e..600399d9793e 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
@@ -20,6 +20,7 @@
// ...
// };
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <type_traits>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
index 12bef34cf87b..f9a537085c30 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// template <class Mutex> class shared_lock;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
index 84f868d6810b..839e12dba685 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
index 9359731486dd..9401cea2ed10 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
index 5c3513c98e03..25d78ab19021 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -54,6 +53,7 @@ void f()
assert(lk.owns_lock() == true);
ns d = t1 - t0 - WaitTime;
assert(d < Tolerance); // within tolerance
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -63,8 +63,10 @@ void f()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -74,6 +76,7 @@ void f()
{
assert(e.code().value() == EPERM);
}
+#endif
}
int main()
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
index 01693c77ea39..947b1ad012ec 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -20,6 +19,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_called = false;
struct mutex
@@ -36,11 +37,11 @@ mutex m;
int main()
{
-
std::shared_lock<mutex> lk(m, std::defer_lock);
assert(lk.try_lock() == true);
assert(try_lock_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -50,11 +51,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock() == false);
assert(try_lock_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -64,4 +67,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
index 852a94eb65ec..5cb805412563 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -21,6 +20,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_for_called = false;
typedef std::chrono::milliseconds ms;
@@ -45,6 +46,7 @@ int main()
assert(lk.try_lock_for(ms(5)) == true);
assert(try_lock_for_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -54,11 +56,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_for(ms(5)) == false);
assert(try_lock_for_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -68,4 +72,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
index 31574afd7d8f..3ba4128d719c 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -21,6 +20,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_until_called = false;
struct mutex
@@ -45,6 +46,7 @@ int main()
assert(lk.try_lock_until(Clock::now()) == true);
assert(try_lock_until_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -54,11 +56,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_until(Clock::now()) == false);
assert(try_lock_until_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -68,4 +72,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
index 6a7385ed42a6..903b53ace0f2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -20,6 +19,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool unlock_called = false;
struct mutex
@@ -36,6 +37,7 @@ int main()
lk.unlock();
assert(unlock_called == true);
assert(lk.owns_lock() == false);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -45,7 +47,9 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -55,4 +59,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
index 33e400b0da80..0939a5792644 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
+
// <mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
index 2ead67097730..ceb29370182d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
+
// <mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
index 6ce33761068f..cb5c55925eef 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -21,6 +20,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::mutex m;
typedef std::chrono::system_clock Clock;
@@ -38,6 +39,7 @@ void f()
assert(lk.owns_lock() == true);
ns d = t1 - t0 - ms(250);
assert(d < ms(25)); // within 25ms
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -47,8 +49,10 @@ void f()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -58,6 +62,7 @@ void f()
{
assert(e.code().value() == EPERM);
}
+#endif
}
int main()
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
index 27d0562de31f..709c56978af8 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -19,6 +18,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_called = false;
struct mutex
@@ -39,6 +40,7 @@ int main()
assert(lk.try_lock() == true);
assert(try_lock_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -48,11 +50,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock() == false);
assert(try_lock_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -62,4 +66,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
index 6f0a7219d2d8..6c981787d4b4 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -20,6 +19,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_for_called = false;
typedef std::chrono::milliseconds ms;
@@ -44,6 +45,7 @@ int main()
assert(lk.try_lock_for(ms(5)) == true);
assert(try_lock_for_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -53,11 +55,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_for(ms(5)) == false);
assert(try_lock_for_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -67,4 +71,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
index b7e87249b596..57231b207a72 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -20,6 +19,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_until_called = false;
struct mutex
@@ -44,6 +45,7 @@ int main()
assert(lk.try_lock_until(Clock::now()) == true);
assert(try_lock_until_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -53,11 +55,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_until(Clock::now()) == false);
assert(try_lock_until_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -67,4 +71,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
index 62497c9ec45a..124ff551f947 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -19,6 +18,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool unlock_called = false;
struct mutex
@@ -35,6 +36,7 @@ int main()
lk.unlock();
assert(unlock_called == true);
assert(lk.owns_lock() == false);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -44,7 +46,9 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -54,4 +58,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
index 64df0680b0b9..5baaee533a6a 100644
--- a/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
@@ -28,7 +28,7 @@ int main()
typedef std::try_to_lock_t T2;
typedef std::adopt_lock_t T3;
- T1 t1 = std::defer_lock;
- T2 t2 = std::try_to_lock;
- T3 t3 = std::adopt_lock;
+ T1 t1 = std::defer_lock; ((void)t1);
+ T2 t2 = std::try_to_lock; ((void)t2);
+ T3 t3 = std::adopt_lock; ((void)t3);
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
index 75ddebff0ed9..0a6d6e3683ed 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
index 6b5089d38859..b7edc50978d2 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
index 52007155ba5f..f615981bc94d 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11, c++14
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
index 2818bd617542..83979d4c4e51 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
index 77a9107de923..516f43192580 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
index 320a268ae77d..3d36911889b1 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
index 3d5604d886cb..452fc3c19d65 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
index 4cdb5873f9a1..f478a29367a1 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
index f7ddbaeef498..f33edfc1a534 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
index 1560af2c9ecc..d5715c76f458 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++98, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index 71b054fced88..138b657196da 100644
--- a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -50,12 +49,13 @@ void init3()
++init3_called;
std::this_thread::sleep_for(ms(250));
if (init3_called == 1)
- throw 1;
+ TEST_THROW(1);
++init3_completed;
}
void f3()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::call_once(flg3, init3);
@@ -63,6 +63,7 @@ void f3()
catch (...)
{
}
+#endif
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -197,6 +198,7 @@ int main()
t1.join();
assert(init0_called == 1);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
// check basic exception safety
{
std::thread t0(f3);
@@ -206,6 +208,7 @@ int main()
assert(init3_called == 2);
assert(init3_completed == 1);
}
+#endif
// check deadlock avoidance
{
std::thread t0(f41);
diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.pass.cpp
new file mode 100644
index 000000000000..33215819f585
--- /dev/null
+++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/race.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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <mutex>
+
+// struct once_flag;
+
+// template<class Callable, class ...Args>
+// void call_once(once_flag& flag, Callable&& func, Args&&... args);
+
+// This test is supposed to be run with ThreadSanitizer and verifies that
+// call_once properly synchronizes user state, a data race that was fixed
+// in r280621.
+
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::once_flag flg0;
+long global = 0;
+
+void init0()
+{
+ ++global;
+}
+
+void f0()
+{
+ std::call_once(flg0, init0);
+ assert(global == 1);
+}
+
+int main()
+{
+ std::thread t0(f0);
+ std::thread t1(f0);
+ t0.join();
+ t1.join();
+ assert(global == 1);
+}
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
index 6c31df593c0e..e452ac98c49e 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
@@ -58,7 +58,6 @@ int main()
{
G g;
std::thread t0(g, 5, 5.5);
- std::thread::id id = t0.get_id();
std::thread t1;
t0 = std::move(t1);
assert(false);
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
index 5dd6a40a0eb7..437b42037913 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <thread>
@@ -30,10 +29,10 @@ std::atomic<unsigned> throw_one(0xFFFF);
std::atomic<unsigned> outstanding_new(0);
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
if (throw_one == 0)
- throw std::bad_alloc();
+ TEST_THROW(std::bad_alloc());
--throw_one;
++outstanding_new;
void* ret = std::malloc(s);
@@ -41,7 +40,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
--outstanding_new;
std::free(p);
@@ -118,6 +117,7 @@ public:
// 3 Finally check that a thread runs successfully if we throw after 'N+1'
// allocations.
void test_throwing_new_during_thread_creation() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
throw_one = 0xFFF;
{
std::thread t(f);
@@ -142,6 +142,7 @@ void test_throwing_new_during_thread_creation() {
}
f_run = false;
throw_one = 0xFFF;
+#endif
}
int main()
@@ -162,6 +163,7 @@ int main()
assert(G::op_run);
}
G::op_run = false;
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
try
{
@@ -178,6 +180,7 @@ int main()
assert(!G::op_run);
}
}
+#endif
#if TEST_STD_VER >= 11
{
assert(G::n_alive == 0);
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
index 5cca7b0b66b8..f9f38c85f0e9 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
@@ -50,7 +50,8 @@ int main()
std::thread::id id0 = t0.get_id();
std::thread t1;
std::thread::id id1 = t1.get_id();
- assert(t0.get_id() != id1);
+ assert(t0.get_id() == id0);
+ assert(id0 != id1);
assert(t1.get_id() == std::thread::id());
t0.join();
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
index a5663a2e063e..0aef2af85ccf 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -23,8 +25,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A1<int> a3(3);
@@ -108,5 +108,4 @@ int main()
std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(5), A3<int>(6))));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
index 9d40cf55a144..8fbbcebe1268 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -23,8 +25,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<double>> B;
typedef std::scoped_allocator_adaptor<A1<int>> A;
@@ -65,5 +65,4 @@ int main()
assert(a2 == a1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
index 02e9dff7d7d3..8b585e5f6243 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -23,8 +25,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<double>> B;
typedef std::scoped_allocator_adaptor<A1<int>> A;
@@ -70,6 +70,4 @@ int main()
assert(A3<int>::move_called == true);
assert(a2 == a1);
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
index 21055325112f..86f16891ac3c 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@@ -65,6 +65,4 @@ int main()
assert(A3<int>::move_called == false);
assert(a2 == a1);
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
index 2a1d781eb9cd..b335935e333d 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@@ -54,5 +54,4 @@ int main()
assert(A3<int>::move_called == false);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
index 727907e3ec76..dd8cf4273272 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@@ -45,5 +45,4 @@ int main()
assert(A1<int>::allocate_called == true);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
index cae42de66905..f5ce83aa4f6c 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a;
@@ -66,5 +66,4 @@ int main()
assert(a.allocate(10, (const void*)20) == (int*)20);
assert(A2<int>::allocate_called == true);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
index f94b0e19ac90..dc629edec54a 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -20,8 +22,6 @@
#include "allocators.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
struct B
{
static bool constructed;
@@ -111,11 +111,8 @@ struct F
bool F::constructed = false;
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<std::string>> A;
@@ -188,6 +185,4 @@ int main()
assert(A3<F>::constructed);
s->~S();
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
new file mode 100644
index 000000000000..4e73d8064317
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp
@@ -0,0 +1,139 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class U1, class U2>
+// void scoped_allocator_adaptor::construct(pair<U1, U2>*)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+
+void test_no_inner_alloc()
+{
+ using VoidAlloc = CountingAllocator<void>;
+ AllocController P;
+ {
+ using T = UsesAllocatorV1<VoidAlloc, 0>;
+ using U = UsesAllocatorV2<VoidAlloc, 0>;
+ using Pair = std::pair<T, U>;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr);
+ assert(checkConstruct<>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<>(ptr->second, UA_AllocLast, CA));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&>&&,
+ std::tuple<SA&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+
+ }
+ P.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc, 0>;
+ using U = NotUsesAllocator<VoidAlloc, 0>;
+ using Pair = std::pair<T, U>;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr);
+ assert(checkConstruct<>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<>(ptr->second, UA_None));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&>&&,
+ std::tuple<>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+
+void test_with_inner_alloc()
+{
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 0>;
+ using U = UsesAllocatorV2<VoidAlloc2, 0>;
+ using Pair = std::pair<T, U>;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr);
+ assert(checkConstruct<>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<>(ptr->second, UA_AllocLast));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&>&&,
+ std::tuple<SAInner&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc2, 0>;
+ using U = NotUsesAllocator<VoidAlloc2, 0>;
+ using Pair = std::pair<T, U>;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr);
+ assert(checkConstruct<>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<>(ptr->second, UA_None));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&>&&,
+ std::tuple<>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+int main() {
+ test_no_inner_alloc();
+ test_with_inner_alloc();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp
new file mode 100644
index 000000000000..9effb6eded37
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class U1, class U2>
+// void scoped_allocator_adaptor::construct(pair<U1, U2>*, pair<T1, T2>const&)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+
+void test_no_inner_alloc()
+{
+ using VoidAlloc = CountingAllocator<void>;
+ AllocController P;
+ {
+ using T = UsesAllocatorV1<VoidAlloc, 1>;
+ using U = UsesAllocatorV2<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int&, int const&&>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ const PairIn in(x, std::move(y));
+ A.construct(ptr, in);
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&>(ptr->second, UA_AllocLast, CA));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&>&&,
+ std::tuple<int const&, SA&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+
+ }
+ P.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc, 1>;
+ using U = NotUsesAllocator<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int, int const&>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ const PairIn in(x, y);
+ A.construct(ptr, in);
+ assert(checkConstruct<int const&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int const&>&&,
+ std::tuple<int const&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+
+void test_with_inner_alloc()
+{
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 1>;
+ using U = UsesAllocatorV2<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int&, int const&&>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ const PairIn in(x, std::move(y));
+ A.construct(ptr, in);
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&>(ptr->second, UA_AllocLast));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&>&&,
+ std::tuple<int const&, SAInner&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc2, 1>;
+ using U = NotUsesAllocator<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int, int const &>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ const PairIn in(x, y);
+ A.construct(ptr, in);
+ assert(checkConstruct<int const&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int const&>&&,
+ std::tuple<int const&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+int main() {
+ test_no_inner_alloc();
+ test_with_inner_alloc();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp
new file mode 100644
index 000000000000..4d371f206e65
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp
@@ -0,0 +1,156 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class U1, class U2, class ...Args1, class ...Args2>
+// void scoped_allocator_adaptor::construct(pair<U1, U2>*,
+// piecewise_construct_t, tuple<Args1...>, tuple<Args2...>)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+
+void test_no_inner_alloc()
+{
+ using VoidAlloc = CountingAllocator<void>;
+ AllocController P;
+ {
+ using T = UsesAllocatorV1<VoidAlloc, 1>;
+ using U = UsesAllocatorV2<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr, std::piecewise_construct,
+ std::forward_as_tuple(x),
+ std::forward_as_tuple(std::move(y)));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&&>(ptr->second, UA_AllocLast, CA));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&>&&,
+ std::tuple<int const&&, SA&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+
+ }
+ P.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc, 1>;
+ using U = NotUsesAllocator<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr, std::piecewise_construct,
+ std::forward_as_tuple(std::move(x)),
+ std::forward_as_tuple(y));
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&&>&&,
+ std::tuple<int const&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+
+void test_with_inner_alloc()
+{
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 1>;
+ using U = UsesAllocatorV2<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr, std::piecewise_construct,
+ std::forward_as_tuple(x),
+ std::forward_as_tuple(std::move(y)));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int &&>(ptr->second, UA_AllocLast));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&>&&,
+ std::tuple<int &&, SAInner&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc2, 1>;
+ using U = NotUsesAllocator<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr, std::piecewise_construct,
+ std::forward_as_tuple(std::move(x)),
+ std::forward_as_tuple(std::move(y)));
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&&>(ptr->second, UA_None));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&&>&&,
+ std::tuple<int const&&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+int main() {
+ test_no_inner_alloc();
+ test_with_inner_alloc();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp
new file mode 100644
index 000000000000..1d0fb5157c02
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class U1, class U2>
+// void scoped_allocator_adaptor::construct(pair<U1, U2>*, pair<T1, T2>&&)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+
+void test_no_inner_alloc()
+{
+ using VoidAlloc = CountingAllocator<void>;
+ AllocController P;
+ {
+ using T = UsesAllocatorV1<VoidAlloc, 1>;
+ using U = UsesAllocatorV2<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int&, int const&&>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ PairIn in(x, std::move(y));
+ A.construct(ptr, std::move(in));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&&>(ptr->second, UA_AllocLast, CA));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&>&&,
+ std::tuple<int const&&, SA&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+
+ }
+ P.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc, 1>;
+ using U = NotUsesAllocator<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int, int const&>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ PairIn in(x, y);
+ A.construct(ptr, std::move(in));
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&&>&&,
+ std::tuple<int const&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+
+void test_with_inner_alloc()
+{
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 1>;
+ using U = UsesAllocatorV2<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int&, int const&&>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ PairIn in(x, std::move(y));
+ A.construct(ptr, std::move(in));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&&>(ptr->second, UA_AllocLast));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&>&&,
+ std::tuple<int const&&, SAInner&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc2, 1>;
+ using U = NotUsesAllocator<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ using PairIn = std::pair<int, int const &>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ PairIn in(x, y);
+ A.construct(ptr, std::move(in));
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&&>&&,
+ std::tuple<int const&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+int main() {
+ test_no_inner_alloc();
+ test_with_inner_alloc();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp
new file mode 100644
index 000000000000..840f4ecc616d
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp
@@ -0,0 +1,147 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class U1, class U2, class Tp, class Vp>
+// void scoped_allocator_adaptor::construct(pair<U1, U2>*, Tp&&, Up&&)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+
+void test_no_inner_alloc()
+{
+ using VoidAlloc = CountingAllocator<void>;
+ AllocController P;
+ {
+ using T = UsesAllocatorV1<VoidAlloc, 1>;
+ using U = UsesAllocatorV2<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr, x, std::move(y));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&&>(ptr->second, UA_AllocLast, CA));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&>&&,
+ std::tuple<int const&&, SA&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+
+ }
+ P.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc, 1>;
+ using U = NotUsesAllocator<VoidAlloc, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Alloc = CountingAllocator<Pair>;
+ using SA = std::scoped_allocator_adaptor<Alloc>;
+ static_assert(std::uses_allocator<T, CountingAllocator<T> >::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Alloc CA(P);
+ SA A(CA);
+ A.construct(ptr, std::move(x), y);
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, CA));
+ assert(checkConstruct<int const&>(ptr->second, UA_None));
+ assert((P.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SA&, int&&>&&,
+ std::tuple<int const&>&&
+ >(CA, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+
+void test_with_inner_alloc()
+{
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 1>;
+ using U = UsesAllocatorV2<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr, x, std::move(y));
+ assert(checkConstruct<int&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int &&>(ptr->second, UA_AllocLast));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&>&&,
+ std::tuple<int &&, SAInner&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+ {
+ using T = UsesAllocatorV3<VoidAlloc2, 1>;
+ using U = NotUsesAllocator<VoidAlloc2, 1>;
+ using Pair = std::pair<T, U>;
+ int x = 42;
+ const int y = 101;
+ using Outer = CountingAllocator<Pair, 1>;
+ using Inner = CountingAllocator<Pair, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ Pair * ptr = (Pair*)std::malloc(sizeof(Pair));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ A.construct(ptr, std::move(x), std::move(y));
+ assert(checkConstruct<int&&>(ptr->first, UA_AllocArg, I));
+ assert(checkConstruct<int const&&>(ptr->second, UA_None));
+ assert((POuter.checkConstruct<std::piecewise_construct_t const&,
+ std::tuple<std::allocator_arg_t, SAInner&, int&&>&&,
+ std::tuple<int const&&>&&
+ >(O, ptr)));
+ A.destroy(ptr);
+ std::free(ptr);
+ }
+}
+int main() {
+ test_no_inner_alloc();
+ test_with_inner_alloc();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
new file mode 100644
index 000000000000..867cc74082e7
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
@@ -0,0 +1,139 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <scoped_allocator>
+
+// template <class OtherAlloc, class ...InnerAlloc>
+// class scoped_allocator_adaptor
+
+// template <class T, class ...Args>
+// void scoped_allocator_adaptor::construct(T*, Args&&...)
+
+#include <scoped_allocator>
+#include <type_traits>
+#include <utility>
+#include <tuple>
+#include <cassert>
+#include <cstdlib>
+#include "uses_alloc_types.hpp"
+#include "controlled_allocators.hpp"
+
+// — If uses_allocator_v<T, inner_allocator_type> is false and
+// is_constructible_v<T, Args...> is true, calls
+// OUTERMOST_ALLOC_TRAITS(*this)::construct(
+// OUTERMOST (*this), p, std::forward<Args>(args)...).
+void test_bullet_one() {
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = NotUsesAllocator<VoidAlloc2, 3>;
+ using Outer = CountingAllocator<T, 1>;
+ using Inner = CountingAllocator<T, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(!std::uses_allocator<T, Inner>::value, "");
+ T* ptr = (T*)::operator new(sizeof(T));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ int x = 42;
+ int const& cx = x;
+ A.construct(ptr, x, cx, std::move(x));
+ assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_None)));
+ assert((POuter.checkConstruct<int&, int const&, int&&>(O, ptr)));
+ A.destroy(ptr);
+ ::operator delete((void*)ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+}
+
+
+// Otherwise, if uses_allocator_v<T, inner_allocator_type> is true and
+// is_constructible_v<T, allocator_arg_t, inner_allocator_type&, Args...> is
+// true, calls OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST (*this), p,
+// allocator_arg, inner_allocator(), std::forward<Args>(args)...).
+void test_bullet_two() {
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV1<VoidAlloc2, 3>;
+ using Outer = CountingAllocator<T, 1>;
+ using Inner = CountingAllocator<T, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ T* ptr = (T*)::operator new(sizeof(T));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ int x = 42;
+ int const& cx = x;
+ A.construct(ptr, x, cx, std::move(x));
+ assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocArg, I)));
+ assert((POuter.checkConstruct<std::allocator_arg_t const&,
+ SA::inner_allocator_type&, int&, int const&, int&&>(O, ptr)));
+ A.destroy(ptr);
+ ::operator delete((void*)ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+}
+
+// Otherwise, if uses_allocator_v<T, inner_allocator_type> is true and
+// is_constructible_v<T, Args..., inner_allocator_type&> is true, calls
+// OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST (*this), p,
+// std::forward<Args>(args)..., inner_allocator()).
+void test_bullet_three() {
+ using VoidAlloc1 = CountingAllocator<void, 1>;
+ using VoidAlloc2 = CountingAllocator<void, 2>;
+
+ AllocController POuter;
+ AllocController PInner;
+ {
+ using T = UsesAllocatorV2<VoidAlloc2, 3>;
+ using Outer = CountingAllocator<T, 1>;
+ using Inner = CountingAllocator<T, 2>;
+ using SA = std::scoped_allocator_adaptor<Outer, Inner>;
+ using SAInner = std::scoped_allocator_adaptor<Inner>;
+ static_assert(!std::uses_allocator<T, Outer>::value, "");
+ static_assert(std::uses_allocator<T, Inner>::value, "");
+ T* ptr = (T*)::operator new(sizeof(T));
+ Outer O(POuter);
+ Inner I(PInner);
+ SA A(O, I);
+ int x = 42;
+ int const& cx = x;
+ A.construct(ptr, x, cx, std::move(x));
+ assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocLast, I)));
+ assert((POuter.checkConstruct<
+ int&, int const&, int&&,
+ SA::inner_allocator_type&>(O, ptr)));
+ A.destroy(ptr);
+ ::operator delete((void*)ptr);
+ }
+ PInner.reset();
+ POuter.reset();
+}
+
+int main() {
+ test_bullet_one();
+ test_bullet_two();
+ test_bullet_three();
+}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
index bf77f29f7145..7924140cf2cd 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,7 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
@@ -42,5 +43,4 @@ int main()
assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20)));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
index 0ff3880f9fc1..96850d783b99 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -32,8 +34,6 @@ bool B::constructed = false;
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<B>> A;
A a;
@@ -66,5 +66,4 @@ int main()
assert(A3<S>::destroy_called);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
index 0fb55b692cdb..9b892abd81f3 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -22,8 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a(A1<int>(5));
@@ -41,5 +41,4 @@ int main()
std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8))));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
index a5275ee30253..8b88dcc963dd 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
const A a(A1<int>(100));
@@ -39,5 +39,4 @@ int main()
assert(a.max_size() == 200);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
index 2297612e6098..238d46017b0a 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -22,7 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
@@ -39,6 +40,4 @@ int main()
A a(A1<int>(5), A2<int>(6), A3<int>(8));
assert(a.outer_allocator() == A1<int>(5));
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
index f9f0ffa2ad2a..8ee048bb99f1 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@@ -51,5 +51,4 @@ int main()
assert(a2.inner_allocator().inner_allocator().outer_allocator().id() == -1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
index 4303b95166c7..f4c106014a15 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::inner_allocator_type,
std::scoped_allocator_adaptor<A1<int>>>::value), "");
@@ -34,6 +34,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::inner_allocator_type,
std::scoped_allocator_adaptor<A2<int>, A3<int>>>::value), "");
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
index 90fe944125b5..f8a9ea0f9eca 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/is_always_equal.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -22,8 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
// sanity checks
static_assert( (std::is_same<
std::allocator_traits<A1<int>>::is_always_equal, std::false_type>::value
@@ -69,7 +69,4 @@ int main()
std::allocator_traits<A2<int>>::is_always_equal::value &&
std::allocator_traits<A3<int>>::is_always_equal::value)
), "");
-
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
index ceb941380dc7..4c6aabe2160e 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_copy_assignment,
std::false_type>::value), "");
@@ -35,5 +35,4 @@ int main()
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_copy_assignment,
std::true_type>::value), "");
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
index 04da50706536..f6f092ba575a 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_move_assignment,
std::false_type>::value), "");
@@ -35,5 +35,4 @@ int main()
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_move_assignment,
std::true_type>::value), "");
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
index 4a66bbd46749..6b7273e266be 100644
--- a/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -21,8 +23,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::propagate_on_container_swap,
std::false_type>::value), "");
@@ -34,6 +34,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_swap,
std::true_type>::value), "");
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp
index 72f0e867b1d2..2cf548550e1f 100644
--- a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -22,7 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@@ -68,5 +69,4 @@ int main()
assert(A3<int>::move_called == false);
assert(aN == a1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
index 51dd67f9ffdc..4f7a3af12544 100644
--- a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/eq.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -29,8 +31,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@@ -59,6 +59,4 @@ int main()
assert(a2 != a1);
assert(!(a2 == a1));
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp
index 0dc479c246c9..68f5a7ea2879 100644
--- a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -22,7 +24,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::scoped_allocator_adaptor<A1<int>> A;
A a1(A1<int>(3));
@@ -68,5 +69,4 @@ int main()
assert(A3<int>::move_called == true);
assert(aN == a1);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/allocator.adaptor/types.pass.cpp b/test/std/utilities/allocator.adaptor/types.pass.cpp
index 7beff48bbf46..fcc99b191108 100644
--- a/test/std/utilities/allocator.adaptor/types.pass.cpp
+++ b/test/std/utilities/allocator.adaptor/types.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
@@ -30,8 +32,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
static_assert((std::is_base_of<
A1<int>,
std::scoped_allocator_adaptor<A1<int>>
@@ -97,6 +97,4 @@ int main()
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer,
const void*>::value), "");
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
new file mode 100644
index 000000000000..eba9bc6d5feb
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
@@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any& operator=(any const &);
+
+// Test copy assignment
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+template <class LHS, class RHS>
+void test_copy_assign() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::copied == 1);
+ assert(LHS::count == 0);
+ assert(RHS::count == 2);
+
+ assertContains<RHS>(lhs, 2);
+ assertContains<RHS>(rhs, 2);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class LHS>
+void test_copy_assign_empty() {
+ assert(LHS::count == 0);
+ LHS::reset();
+ {
+ any lhs;
+ any const rhs(LHS(42));
+
+ assert(LHS::count == 1);
+ assert(LHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(LHS::copied == 1);
+ assert(LHS::count == 2);
+
+ assertContains<LHS>(lhs, 42);
+ assertContains<LHS>(rhs, 42);
+ }
+ assert(LHS::count == 0);
+ LHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs;
+
+ assert(LHS::count == 1);
+ assert(LHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(LHS::copied == 0);
+ assert(LHS::count == 0);
+
+ assertEmpty<LHS>(lhs);
+ assertEmpty(rhs);
+ }
+ assert(LHS::count == 0);
+}
+
+void test_copy_assign_self() {
+ // empty
+ {
+ any a;
+ a = a;
+ assertEmpty(a);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ // small
+ {
+ any a((small(1)));
+ assert(small::count == 1);
+
+ a = a;
+
+ assert(small::count == 1);
+ assertContains<small>(a, 1);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ assert(small::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ // large
+ {
+ any a(large(1));
+ assert(large::count == 1);
+
+ a = a;
+
+ assert(large::count == 1);
+ assertContains<large>(a, 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ }
+ assert(large::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+}
+
+template <class Tp>
+void test_copy_assign_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ auto try_throw =
+ [](any& lhs, any const& rhs) {
+ try {
+ lhs = rhs;
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ };
+ // const lvalue to empty
+ {
+ any lhs;
+ any const rhs((Tp(1)));
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(Tp::count == 1);
+ assertEmpty<Tp>(lhs);
+ assertContains<Tp>(rhs, 1);
+ }
+ {
+ any lhs((small(2)));
+ any const rhs((Tp(1)));
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+ assertContains<small>(lhs, 2);
+ assertContains<Tp>(rhs, 1);
+ }
+ {
+ any lhs((large(2)));
+ any const rhs((Tp(1)));
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+ assertContains<large>(lhs, 2);
+ assertContains<Tp>(rhs, 1);
+ }
+#endif
+}
+
+int main() {
+ test_copy_assign<small1, small2>();
+ test_copy_assign<large1, large2>();
+ test_copy_assign<small, large>();
+ test_copy_assign<large, small>();
+ test_copy_assign_empty<small>();
+ test_copy_assign_empty<large>();
+ test_copy_assign_self();
+ test_copy_assign_throws<small_throws_on_copy>();
+ test_copy_assign_throws<large_throws_on_copy>();
+}
diff --git a/test/std/utilities/any/any.class/any.assign/move.pass.cpp b/test/std/utilities/any/any.class/any.assign/move.pass.cpp
new file mode 100644
index 000000000000..2063e4f1e9f1
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.assign/move.pass.cpp
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any& operator=(any &&);
+
+// Test move assignment.
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+template <class LHS, class RHS>
+void test_move_assign() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ {
+ LHS const s1(1);
+ any a(s1);
+ RHS const s2(2);
+ any a2(s2);
+
+ assert(LHS::count == 2);
+ assert(RHS::count == 2);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 2 + a2.has_value());
+ LIBCPP_ASSERT(RHS::count == 2); // libc++ leaves the object empty
+
+ assertContains<RHS>(a, 2);
+ if (a2.has_value())
+ assertContains<RHS>(a2, 0);
+ LIBCPP_ASSERT(!a2.has_value());
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class LHS>
+void test_move_assign_empty() {
+ assert(LHS::count == 0);
+ {
+ any a;
+ any a2((LHS(1)));
+
+ assert(LHS::count == 1);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 1 + a2.has_value());
+ LIBCPP_ASSERT(LHS::count == 1);
+
+ assertContains<LHS>(a, 1);
+ if (a2.has_value())
+ assertContains<LHS>(a2, 0);
+ LIBCPP_ASSERT(!a2.has_value());
+ }
+ assert(LHS::count == 0);
+ {
+ any a((LHS(1)));
+ any a2;
+
+ assert(LHS::count == 1);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 0);
+
+ assertEmpty<LHS>(a);
+ assertEmpty(a2);
+ }
+ assert(LHS::count == 0);
+}
+
+void test_move_assign_noexcept() {
+ any a1;
+ any a2;
+ static_assert(
+ noexcept(a1 = std::move(a2))
+ , "any & operator=(any &&) must be noexcept"
+ );
+}
+
+int main() {
+ test_move_assign_noexcept();
+ test_move_assign<small1, small2>();
+ test_move_assign<large1, large2>();
+ test_move_assign<small, large>();
+ test_move_assign<large, small>();
+ test_move_assign_empty<small>();
+ test_move_assign_empty<large>();
+}
diff --git a/test/std/utilities/any/any.class/any.assign/value.pass.cpp b/test/std/utilities/any/any.class/any.assign/value.pass.cpp
new file mode 100644
index 000000000000..6af481714922
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.assign/value.pass.cpp
@@ -0,0 +1,209 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// any& operator=(ValueType&&);
+
+// Test value copy and move assignment.
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+template <class LHS, class RHS>
+void test_assign_value() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::copied == 1);
+ assert(LHS::count == 0);
+ assert(RHS::count == 2);
+
+ assertContains<RHS>(lhs, 2);
+ assertContains<RHS>(rhs, 2);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::moved == 1);
+
+ lhs = std::move(rhs);
+
+ assert(RHS::moved >= 1);
+ assert(RHS::copied == 0);
+ assert(LHS::count == 0);
+ assert(RHS::count == 1 + rhs.has_value());
+ LIBCPP_ASSERT(!rhs.has_value());
+
+ assertContains<RHS>(lhs, 2);
+ if (rhs.has_value())
+ assertContains<RHS>(rhs, 0);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class RHS>
+void test_assign_value_empty() {
+ assert(RHS::count == 0);
+ RHS::reset();
+ {
+ any lhs;
+ RHS rhs(42);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::count == 2);
+ assert(RHS::copied == 1);
+ assert(RHS::moved >= 0);
+ assertContains<RHS>(lhs, 42);
+ }
+ assert(RHS::count == 0);
+ RHS::reset();
+ {
+ any lhs;
+ RHS rhs(42);
+ assert(RHS::count == 1);
+ assert(RHS::moved == 0);
+
+ lhs = std::move(rhs);
+
+ assert(RHS::count == 2);
+ assert(RHS::copied == 0);
+ assert(RHS::moved >= 1);
+ assertContains<RHS>(lhs, 42);
+ }
+ assert(RHS::count == 0);
+ RHS::reset();
+}
+
+
+template <class Tp, bool Move = false>
+void test_assign_throws() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ auto try_throw =
+ [](any& lhs, auto&& rhs) {
+ try {
+ Move ? lhs = std::move(rhs)
+ : lhs = rhs;
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ };
+ // const lvalue to empty
+ {
+ any lhs;
+ Tp rhs(1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(Tp::count == 1);
+ assertEmpty<Tp>(lhs);
+ }
+ {
+ any lhs((small(2)));
+ Tp rhs(1);
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+ assertContains<small>(lhs, 2);
+ }
+ {
+ any lhs((large(2)));
+ Tp rhs(1);
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+ assertContains<large>(lhs, 2);
+ }
+#endif
+}
+
+
+// Test that any& operator=(ValueType&&) is *never* selected for:
+// * std::in_place type.
+// * Non-copyable types
+void test_sfinae_constraints() {
+ { // Only the constructors are required to SFINAE on in_place_t
+ using Tag = std::in_place_type_t<int>;
+ using RawTag = std::remove_reference_t<Tag>;
+ static_assert(std::is_assignable<std::any, RawTag&&>::value, "");
+ }
+ {
+ struct Dummy { Dummy() = delete; };
+ using T = std::in_place_type_t<Dummy>;
+ static_assert(std::is_assignable<std::any, T>::value, "");
+ }
+ {
+ // Test that the ValueType&& constructor SFINAE's away when the
+ // argument is non-copyable
+ struct NoCopy {
+ NoCopy() = default;
+ NoCopy(NoCopy const&) = delete;
+ NoCopy(NoCopy&&) = default;
+ };
+ static_assert(!std::is_assignable<std::any, NoCopy>::value, "");
+ static_assert(!std::is_assignable<std::any, NoCopy&>::value, "");
+ }
+}
+
+int main() {
+ test_assign_value<small1, small2>();
+ test_assign_value<large1, large2>();
+ test_assign_value<small, large>();
+ test_assign_value<large, small>();
+ test_assign_value_empty<small>();
+ test_assign_value_empty<large>();
+ test_assign_throws<small_throws_on_copy>();
+ test_assign_throws<large_throws_on_copy>();
+ test_assign_throws<throws_on_move, /* Move = */ true>();
+ test_sfinae_constraints();
+}
diff --git a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
new file mode 100644
index 000000000000..021c9e452841
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any(any const &);
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+template <class Type>
+void test_copy_throws() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(Type::count == 0);
+ {
+ any const a((Type(42)));
+ assert(Type::count == 1);
+ try {
+ any const a2(a);
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(Type::count == 1);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+#endif
+}
+
+void test_copy_empty() {
+ DisableAllocationGuard g; ((void)g); // No allocations should occur.
+ any a1;
+ any a2(a1);
+
+ assertEmpty(a1);
+ assertEmpty(a2);
+}
+
+template <class Type>
+void test_copy()
+{
+ // Copying small types should not perform any allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+
+ any a2(a);
+
+ assert(Type::copied == 1);
+ assert(Type::count == 2);
+ assertContains<Type>(a, 42);
+ assertContains<Type>(a2, 42);
+
+ // Modify a and check that a2 is unchanged
+ modifyValue<Type>(a, -1);
+ assertContains<Type>(a, -1);
+ assertContains<Type>(a2, 42);
+
+ // modify a2 and check that a is unchanged
+ modifyValue<Type>(a2, 999);
+ assertContains<Type>(a, -1);
+ assertContains<Type>(a2, 999);
+
+ // clear a and check that a2 is unchanged
+ a.reset();
+ assertEmpty(a);
+ assertContains<Type>(a2, 999);
+ }
+ assert(Type::count == 0);
+}
+
+int main() {
+ test_copy<small>();
+ test_copy<large>();
+ test_copy_empty();
+ test_copy_throws<small_throws_on_copy>();
+ test_copy_throws<large_throws_on_copy>();
+}
diff --git a/test/std/utilities/any/any.class/any.cons/default.pass.cpp b/test/std/utilities/any/any.class/any.cons/default.pass.cpp
new file mode 100644
index 000000000000..ed7a948e00a2
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.cons/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any() noexcept;
+
+#include <any>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "any_helpers.h"
+#include "count_new.hpp"
+
+int main()
+{
+ using std::any;
+ {
+ static_assert(
+ std::is_nothrow_default_constructible<any>::value
+ , "Must be default constructible"
+ );
+ }
+ {
+ struct TestConstexpr : public std::any {
+ constexpr TestConstexpr() : std::any() {}
+ };
+#ifdef _LIBCPP_SAFE_STATIC
+ _LIBCPP_SAFE_STATIC static std::any a;
+ ((void)a);
+#endif
+ }
+ {
+ DisableAllocationGuard g; ((void)g);
+ any const a;
+ assertEmpty(a);
+ }
+}
diff --git a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
new file mode 100644
index 000000000000..4cf5d914f31d
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
@@ -0,0 +1,194 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class T, class ...Args> any(in_place_type_t<T>, Args&&...);
+// template <class T, class U, class ...Args>
+// any(in_place_type_t<T>, initializer_list<U>, Args&&...);
+
+// Test construction from a value.
+// Concerns:
+// ---------
+// 1. The value is properly move/copied depending on the value category.
+// 2. Both small and large values are properly handled.
+
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+#include "test_convertible.hpp"
+
+using std::any;
+using std::any_cast;
+
+template <class Type>
+void test_in_place_type() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Type>);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 0);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ { // Test that the in_place argument is properly decayed
+ any a(std::in_place_type<Type&>);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 0);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Type>, 101);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 101);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Type>, -1, 42, -1);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+}
+
+template <class Type>
+void test_in_place_type_tracked() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ {
+ any a(std::in_place_type<Type>);
+ assertArgsMatch<Type>(a);
+ }
+ {
+ any a(std::in_place_type<Type>, -1, 42, -1);
+ assertArgsMatch<Type, int, int, int>(a);
+ }
+ // initializer_list constructor tests
+ {
+ any a(std::in_place_type<Type>, {-1, 42, -1});
+ assertArgsMatch<Type, std::initializer_list<int>>(a);
+ }
+ {
+ int x = 42;
+ any a(std::in_place_type<Type&>, {-1, 42, -1}, x);
+ assertArgsMatch<Type, std::initializer_list<int>, int&>(a);
+ }
+}
+
+void test_func() {}
+
+void test_in_place_type_decayed() {
+ {
+ using Type = decltype(test_func);
+ using DecayT = void(*)();
+ any a(std::in_place_type<Type>, test_func);
+ assert(containsType<DecayT>(a));
+ assert(any_cast<DecayT>(a) == test_func);
+ }
+ {
+ int my_arr[5];
+ using Type = int(&)[5];
+ using DecayT = int*;
+ any a(std::in_place_type<Type>, my_arr);
+ assert(containsType<DecayT>(a));
+ assert(any_cast<DecayT>(a) == my_arr);
+ }
+ {
+ using Type = int[5];
+ using DecayT = int*;
+ any a(std::in_place_type<Type>);
+ assert(containsType<DecayT>(a));
+ assert(any_cast<DecayT>(a) == nullptr);
+ }
+}
+
+void test_ctor_sfinae() {
+ {
+ // Test that the init-list ctor SFINAE's away properly when
+ // construction would be ill-formed.
+ using IL = std::initializer_list<int>;
+ static_assert(!std::is_constructible<std::any,
+ std::in_place_type_t<int>, IL>::value, "");
+ static_assert(std::is_constructible<std::any,
+ std::in_place_type_t<small_tracked_t>, IL>::value, "");
+ }
+ {
+ // Test that the tagged dispatch constructor SFINAE's away when the
+ // argument is non-copyable
+ struct NoCopy {
+ NoCopy() = default;
+ NoCopy(NoCopy const&) = delete;
+ NoCopy(int) {}
+ NoCopy(std::initializer_list<int>, int) {}
+ };
+ using Tag = std::in_place_type_t<NoCopy>;
+ using RefTag = std::in_place_type_t<NoCopy&>;
+ using IL = std::initializer_list<int>;
+ static_assert(!std::is_constructible<std::any, Tag>::value, "");
+ static_assert(!std::is_constructible<std::any, Tag, int>::value, "");
+ static_assert(!std::is_constructible<std::any, Tag, IL, int>::value, "");
+ static_assert(!std::is_constructible<std::any, RefTag>::value, "");
+ static_assert(!std::is_constructible<std::any, RefTag, int>::value, "");
+ static_assert(!std::is_constructible<std::any, RefTag, IL, int>::value, "");
+ }
+}
+
+struct Implicit {
+ Implicit(int) {}
+ Implicit(int, int, int) {}
+ Implicit(std::initializer_list<int>, int) {}
+};
+
+void test_constructor_explicit() {
+ using I = Implicit;
+ using IT = std::in_place_type_t<I>;
+ static_assert(!test_convertible<std::any, IT, int>(), "");
+ static_assert(std::is_constructible<std::any, IT, int>::value, "");
+ static_assert(!test_convertible<std::any, IT, int, int, int>(), "");
+ static_assert(std::is_constructible<std::any, IT, int, int, int>::value, "");
+ static_assert(!test_convertible<std::any, IT, std::initializer_list<int>&, int>(), "");
+ static_assert(std::is_constructible<std::any, IT, std::initializer_list<int>&, int>::value, "");
+}
+
+int main() {
+ test_in_place_type<small>();
+ test_in_place_type<large>();
+ test_in_place_type<small_throws_on_copy>();
+ test_in_place_type<large_throws_on_copy>();
+ test_in_place_type<throws_on_move>();
+ test_in_place_type_tracked<small_tracked_t>();
+ test_in_place_type_tracked<large_tracked_t>();
+ test_in_place_type_decayed();
+ test_ctor_sfinae();
+ test_constructor_explicit();
+}
diff --git a/test/std/utilities/any/any.class/any.cons/move.pass.cpp b/test/std/utilities/any/any.class/any.cons/move.pass.cpp
new file mode 100644
index 000000000000..fb7dda886fe7
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any(any &&) noexcept;
+
+#include <any>
+#include <utility>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+// Moves are always noexcept. The throws_on_move object
+// must be stored dynamically so the pointer is moved and
+// not the stored object.
+void test_move_does_not_throw()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(throws_on_move::count == 0);
+ {
+ throws_on_move v(42);
+ any a(v);
+ assert(throws_on_move::count == 2);
+ // No allocations should be performed after this point.
+ DisableAllocationGuard g; ((void)g);
+ try {
+ any const a2(std::move(a));
+ assertEmpty(a);
+ assertContains<throws_on_move>(a2, 42);
+ } catch (...) {
+ assert(false);
+ }
+ assert(throws_on_move::count == 1);
+ assertEmpty(a);
+ }
+ assert(throws_on_move::count == 0);
+#endif
+}
+
+void test_move_empty() {
+ DisableAllocationGuard g; ((void)g); // no allocations should be performed.
+
+ any a1;
+ any a2(std::move(a1));
+
+ assertEmpty(a1);
+ assertEmpty(a2);
+}
+
+template <class Type>
+void test_move() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Moving should not perform allocations since it must be noexcept.
+ DisableAllocationGuard g; ((void)g);
+
+ any a2(std::move(a));
+
+ assert(Type::moved == 1 || Type::moved == 2); // zero or more move operations can be performed.
+ assert(Type::copied == 0); // no copies can be performed.
+ assert(Type::count == 1 + a.has_value());
+ assertContains<Type>(a2, 42);
+ LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive.
+ if (a.has_value())
+ assertContains<Type>(a, 0);
+ }
+ assert(Type::count == 0);
+}
+
+int main()
+{
+ // noexcept test
+ {
+ static_assert(
+ std::is_nothrow_move_constructible<any>::value
+ , "any must be nothrow move constructible"
+ );
+ }
+ test_move<small>();
+ test_move<large>();
+ test_move_empty();
+ test_move_does_not_throw();
+}
diff --git a/test/std/utilities/any/any.class/any.cons/value.pass.cpp b/test/std/utilities/any/any.class/any.cons/value.pass.cpp
new file mode 100644
index 000000000000..a164fbeb52fe
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class Value> any(Value &&)
+
+// Test construction from a value.
+// Concerns:
+// ---------
+// 1. The value is properly move/copied depending on the value category.
+// 2. Both small and large values are properly handled.
+
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+template <class Type>
+void test_copy_value_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(Type::count == 0);
+ {
+ Type const t(42);
+ assert(Type::count == 1);
+ try {
+ any const a2(t);
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(Type::count == 1);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 0);
+#endif
+}
+
+void test_move_value_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(throws_on_move::count == 0);
+ {
+ throws_on_move v;
+ assert(throws_on_move::count == 1);
+ try {
+ any const a(std::move(v));
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(throws_on_move::count == 1);
+ }
+ assert(throws_on_move::count == 0);
+#endif
+}
+
+template <class Type>
+void test_copy_move_value() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ Type t(42);
+ assert(Type::count == 1);
+
+ any a(t);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ Type t(42);
+ assert(Type::count == 1);
+
+ any a(std::move(t));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ assertContains<Type>(a, 42);
+ }
+}
+
+// Test that any(ValueType&&) is *never* selected for a std::in_place_type_t specialization.
+void test_sfinae_constraints() {
+ using BadTag = std::in_place_type_t<int>;
+ using OKTag = std::in_place_t;
+ // Test that the tag type is properly handled in SFINAE
+ BadTag t = std::in_place_type<int>;
+ OKTag ot = std::in_place;
+ {
+ std::any a(t);
+ assertContains<int>(a, 0);
+ }
+ {
+ std::any a(std::move(t));
+ assertContains<int>(a, 0);
+ }
+ {
+ std::any a(ot);
+ assert(containsType<OKTag>(a));
+ }
+ {
+ struct Dummy { Dummy() = delete; };
+ using T = std::in_place_type_t<Dummy>;
+ static_assert(!std::is_constructible<std::any, T>::value, "");
+ }
+ {
+ // Test that the ValueType&& constructor SFINAE's away when the
+ // argument is non-copyable
+ struct NoCopy {
+ NoCopy() = default;
+ NoCopy(NoCopy const&) = delete;
+ NoCopy(int) {}
+ };
+ static_assert(!std::is_constructible<std::any, NoCopy>::value, "");
+ static_assert(!std::is_constructible<std::any, NoCopy&>::value, "");
+ static_assert(!std::is_convertible<NoCopy, std::any>::value, "");
+ }
+}
+
+int main() {
+ test_copy_move_value<small>();
+ test_copy_move_value<large>();
+ test_copy_value_throws<small_throws_on_copy>();
+ test_copy_value_throws<large_throws_on_copy>();
+ test_move_value_throws();
+ test_sfinae_constraints();
+} \ No newline at end of file
diff --git a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
new file mode 100644
index 000000000000..65d94fd1e0a4
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
@@ -0,0 +1,262 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class T, class ...Args> emplace(Args&&...);
+// template <class T, class U, class ...Args>
+// void emplace(initializer_list<U>, Args&&...);
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+struct Tracked {
+ static int count;
+ Tracked() {++count;}
+ ~Tracked() { --count; }
+};
+int Tracked::count = 0;
+
+template <class Type>
+void test_emplace_type() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+
+ a.emplace<Type>();
+
+ assert(Tracked::count == 0);
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 0);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+
+ a.emplace<Type>(101);
+
+ assert(Tracked::count == 0);
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 101);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+
+ a.emplace<Type>(-1, 42, -1);
+
+ assert(Tracked::count == 0);
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+}
+
+template <class Type>
+void test_emplace_type_tracked() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+ a.emplace<Type>();
+ assert(Tracked::count == 0);
+ assertArgsMatch<Type>(a);
+ }
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+ a.emplace<Type>(-1, 42, -1);
+ assert(Tracked::count == 0);
+ assertArgsMatch<Type, int, int, int>(a);
+ }
+ // initializer_list constructor tests
+ {
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+ a.emplace<Type>({-1, 42, -1});
+ assert(Tracked::count == 0);
+ assertArgsMatch<Type, std::initializer_list<int>>(a);
+ }
+ {
+ int x = 42;
+ any a(std::in_place_type<Tracked>);
+ assert(Tracked::count == 1);
+ a.emplace<Type>({-1, 42, -1}, x);
+ assert(Tracked::count == 0);
+ assertArgsMatch<Type, std::initializer_list<int>, int&>(a);
+ }
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+struct SmallThrows {
+ SmallThrows(int) { throw 42; }
+ SmallThrows(std::initializer_list<int>, int) { throw 42; }
+};
+static_assert(IsSmallObject<SmallThrows>::value, "");
+
+struct LargeThrows {
+ LargeThrows(int) { throw 42; }
+ LargeThrows(std::initializer_list<int>, int) { throw 42; }
+ int data[sizeof(std::any)];
+};
+static_assert(!IsSmallObject<LargeThrows>::value, "");
+
+template <class Type>
+void test_emplace_throws()
+{
+ // any stores small type
+ {
+ std::any a(small{42});
+ assert(small::count == 1);
+ try {
+ a.emplace<Type>(101);
+ assert(false);
+ } catch (int const&) {
+ }
+ assert(small::count == 0);
+ }
+ {
+ std::any a(small{42});
+ assert(small::count == 1);
+ try {
+ a.emplace<Type>({1, 2, 3}, 101);
+ assert(false);
+ } catch (int const&) {
+ }
+ assert(small::count == 0);
+ }
+ // any stores large type
+ {
+ std::any a(large{42});
+ assert(large::count == 1);
+ try {
+ a.emplace<Type>(101);
+ assert(false);
+ } catch (int const&) {
+ }
+ assert(large::count == 0);
+ }
+ {
+ std::any a(large{42});
+ assert(large::count == 1);
+ try {
+ a.emplace<Type>({1, 2, 3}, 101);
+ assert(false);
+ } catch (int const&) {
+ }
+ assert(large::count == 0);
+ }
+}
+
+#endif
+
+template <class T, class ...Args>
+constexpr auto has_emplace(int)
+ -> decltype(std::any{}.emplace<T>(std::declval<Args>()...), true) { return true; }
+
+template <class ...Args>
+constexpr bool has_emplace(long) { return false; }
+
+template <class ...Args>
+constexpr bool has_emplace() { return has_emplace<Args...>(0); }
+
+
+template <class T, class IT, class ...Args>
+constexpr auto has_emplace_init_list(int)
+ -> decltype(std::any{}.emplace<T>(
+ {std::declval<IT>(), std::declval<IT>(), std::declval<IT>()},
+ std::declval<Args>()...), true) { return true; }
+
+template <class ...Args>
+constexpr bool has_emplace_init_list(long) { return false; }
+
+template <class ...Args>
+constexpr bool has_emplace_init_list() { return has_emplace_init_list<Args...>(0); }
+
+
+void test_emplace_sfinae_constraints() {
+ {
+ static_assert(has_emplace<int>(), "");
+ static_assert(has_emplace<int, int>(), "");
+ static_assert(!has_emplace<int, int, int>(), "not constructible");
+ static_assert(!has_emplace_init_list<int, int>(), "not constructible from il");
+ }
+ {
+ static_assert(has_emplace<small>(), "");
+ static_assert(has_emplace<large>(), "");
+ static_assert(!has_emplace<small, void*>(), "");
+ static_assert(!has_emplace<large, void*>(), "");
+
+ static_assert(has_emplace_init_list<small, int>(), "");
+ static_assert(has_emplace_init_list<large, int>(), "");
+ static_assert(!has_emplace_init_list<small, void*>(), "");
+ static_assert(!has_emplace_init_list<large, void*>(), "");
+ }
+ {
+ // Test that the emplace SFINAE's away when the
+ // argument is non-copyable
+ struct NoCopy {
+ NoCopy() = default;
+ NoCopy(NoCopy const&) = delete;
+ NoCopy(int) {}
+ NoCopy(std::initializer_list<int>, int, int) {}
+ };
+ static_assert(!has_emplace<NoCopy>(), "");
+ static_assert(!has_emplace<NoCopy, int>(), "");
+ static_assert(!has_emplace_init_list<NoCopy, int, int, int>(), "");
+ static_assert(!has_emplace<NoCopy&>(), "");
+ static_assert(!has_emplace<NoCopy&, int>(), "");
+ static_assert(!has_emplace_init_list<NoCopy&, int, int, int>(), "");
+ static_assert(!has_emplace<NoCopy&&>(), "");
+ static_assert(!has_emplace<NoCopy&&, int>(), "");
+ static_assert(!has_emplace_init_list<NoCopy&&, int, int, int>(), "");
+
+ }
+}
+
+int main() {
+ test_emplace_type<small>();
+ test_emplace_type<large>();
+ test_emplace_type<small_throws_on_copy>();
+ test_emplace_type<large_throws_on_copy>();
+ test_emplace_type<throws_on_move>();
+ test_emplace_type_tracked<small_tracked_t>();
+ test_emplace_type_tracked<large_tracked_t>();
+ test_emplace_sfinae_constraints();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ test_emplace_throws<SmallThrows>();
+ test_emplace_throws<LargeThrows>();
+#endif
+}
diff --git a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
new file mode 100644
index 000000000000..45bc70f7a795
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any::reset() noexcept
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+int main()
+{
+ using std::any;
+ using std::any_cast;
+ // empty
+ {
+ any a;
+
+ // noexcept check
+ static_assert(
+ noexcept(a.reset())
+ , "any.reset() must be noexcept"
+ );
+
+ assertEmpty(a);
+
+ a.reset();
+
+ assertEmpty(a);
+ }
+ // small object
+ {
+ any a((small(1)));
+ assert(small::count == 1);
+ assertContains<small>(a, 1);
+
+ a.reset();
+
+ assertEmpty<small>(a);
+ assert(small::count == 0);
+ }
+ // large object
+ {
+ any a(large(1));
+ assert(large::count == 1);
+ assertContains<large>(a, 1);
+
+ a.reset();
+
+ assertEmpty<large>(a);
+ assert(large::count == 0);
+ }
+}
diff --git a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
new file mode 100644
index 000000000000..6fc100943d0f
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -0,0 +1,133 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any::swap(any &) noexcept
+
+// Test swap(large, small) and swap(small, large)
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+using std::any;
+using std::any_cast;
+
+template <class LHS, class RHS>
+void test_swap() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ {
+ any a1((LHS(1)));
+ any a2(RHS{2});
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+
+ a1.swap(a2);
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+
+ assertContains<RHS>(a1, 2);
+ assertContains<LHS>(a2, 1);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ assert(LHS::copied == 0);
+ assert(RHS::copied == 0);
+}
+
+template <class Tp>
+void test_swap_empty() {
+ assert(Tp::count == 0);
+ {
+ any a1((Tp(1)));
+ any a2;
+ assert(Tp::count == 1);
+
+ a1.swap(a2);
+
+ assert(Tp::count == 1);
+
+ assertContains<Tp>(a2, 1);
+ assertEmpty(a1);
+ }
+ assert(Tp::count == 0);
+ {
+ any a1((Tp(1)));
+ any a2;
+ assert(Tp::count == 1);
+
+ a2.swap(a1);
+
+ assert(Tp::count == 1);
+
+ assertContains<Tp>(a2, 1);
+ assertEmpty(a1);
+ }
+ assert(Tp::count == 0);
+ assert(Tp::copied == 0);
+}
+
+void test_noexcept()
+{
+ any a1;
+ any a2;
+ static_assert(
+ noexcept(a1.swap(a2))
+ , "any::swap(any&) must be noexcept"
+ );
+}
+
+void test_self_swap() {
+ {
+ // empty
+ any a;
+ a.swap(a);
+ assertEmpty(a);
+ }
+ { // small
+ using T = small;
+ any a{T{42}};
+ T::reset();
+ a.swap(a);
+ assertContains<T>(a, 42);
+ assert(T::count == 1);
+ assert(T::copied == 0);
+ LIBCPP_ASSERT(T::moved == 0);
+ }
+ assert(small::count == 0);
+ { // large
+ using T = large;
+ any a{T{42}};
+ T::reset();
+ a.swap(a);
+ assertContains<T>(a, 42);
+ assert(T::count == 1);
+ assert(T::copied == 0);
+ LIBCPP_ASSERT(T::moved == 0);
+ }
+ assert(large::count == 0);
+}
+
+int main()
+{
+ test_noexcept();
+ test_swap_empty<small>();
+ test_swap_empty<large>();
+ test_swap<small1, small2>();
+ test_swap<large1, large2>();
+ test_swap<small, large>();
+ test_swap<large, small>();
+ test_self_swap();
+}
diff --git a/test/std/utilities/any/any.class/any.observers/has_value.pass.cpp b/test/std/utilities/any/any.class/any.observers/has_value.pass.cpp
new file mode 100644
index 000000000000..072ac06776c1
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.observers/has_value.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// any::has_value() noexcept
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+int main()
+{
+ using std::any;
+ // noexcept test
+ {
+ any a;
+ static_assert(noexcept(a.has_value()), "any::has_value() must be noexcept");
+ }
+ // empty
+ {
+ any a;
+ assert(!a.has_value());
+
+ a.reset();
+ assert(!a.has_value());
+
+ a = 42;
+ assert(a.has_value());
+ }
+ // small object
+ {
+ small const s(1);
+ any a(s);
+ assert(a.has_value());
+
+ a.reset();
+ assert(!a.has_value());
+
+ a = s;
+ assert(a.has_value());
+ }
+ // large object
+ {
+ large const l(1);
+ any a(l);
+ assert(a.has_value());
+
+ a.reset();
+ assert(!a.has_value());
+
+ a = l;
+ assert(a.has_value());
+ }
+}
diff --git a/test/std/utilities/any/any.class/any.observers/type.pass.cpp b/test/std/utilities/any/any.class/any.observers/type.pass.cpp
new file mode 100644
index 000000000000..984c4137db09
--- /dev/null
+++ b/test/std/utilities/any/any.class/any.observers/type.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// XFAIL: libcpp-no-rtti
+
+// <any>
+
+// any::type() noexcept
+
+#include <any>
+#include <cassert>
+#include "any_helpers.h"
+
+int main()
+{
+ using std::any;
+ {
+ any const a;
+ assert(a.type() == typeid(void));
+ static_assert(noexcept(a.type()), "any::type() must be noexcept");
+ }
+ {
+ small const s(1);
+ any const a(s);
+ assert(a.type() == typeid(small));
+
+ }
+ {
+ large const l(1);
+ any const a(l);
+ assert(a.type() == typeid(large));
+ }
+}
diff --git a/test/std/utilities/any/any.class/not_literal_type.pass.cpp b/test/std/utilities/any/any.class/not_literal_type.pass.cpp
new file mode 100644
index 000000000000..91ef5c970a22
--- /dev/null
+++ b/test/std/utilities/any/any.class/not_literal_type.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// [Note any is a not a literal type --end note]
+
+#include <any>
+#include <type_traits>
+
+int main () {
+ static_assert(!std::is_literal_type<std::any>::value, "");
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
new file mode 100644
index 000000000000..1a5a85482b8f
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType const* any_cast(any const *) noexcept;
+//
+// template <class ValueType>
+// ValueType * any_cast(any *) noexcept;
+
+#include <any>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+
+using std::any;
+using std::any_cast;
+
+// Test that the operators are properly noexcept.
+void test_cast_is_noexcept() {
+ any a;
+ static_assert(noexcept(any_cast<int>(&a)), "");
+
+ any const& ca = a;
+ static_assert(noexcept(any_cast<int>(&ca)), "");
+}
+
+// Test that the return type of any_cast is correct.
+void test_cast_return_type() {
+ any a;
+ static_assert(std::is_same<decltype(any_cast<int>(&a)), int*>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(&a)), int const*>::value, "");
+
+ any const& ca = a;
+ static_assert(std::is_same<decltype(any_cast<int>(&ca)), int const*>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(&ca)), int const*>::value, "");
+}
+
+// Test that any_cast handles null pointers.
+void test_cast_nullptr() {
+ any* a = nullptr;
+ assert(nullptr == any_cast<int>(a));
+ assert(nullptr == any_cast<int const>(a));
+
+ any const* ca = nullptr;
+ assert(nullptr == any_cast<int>(ca));
+ assert(nullptr == any_cast<int const>(ca));
+}
+
+// Test casting an empty object.
+void test_cast_empty() {
+ {
+ any a;
+ assert(nullptr == any_cast<int>(&a));
+ assert(nullptr == any_cast<int const>(&a));
+
+ any const& ca = a;
+ assert(nullptr == any_cast<int>(&ca));
+ assert(nullptr == any_cast<int const>(&ca));
+ }
+ // Create as non-empty, then make empty and run test.
+ {
+ any a(42);
+ a.reset();
+ assert(nullptr == any_cast<int>(&a));
+ assert(nullptr == any_cast<int const>(&a));
+
+ any const& ca = a;
+ assert(nullptr == any_cast<int>(&ca));
+ assert(nullptr == any_cast<int const>(&ca));
+ }
+}
+
+template <class Type>
+void test_cast() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ any const& ca = a;
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ assert(any_cast<int>(&a) == nullptr);
+ assert(any_cast<int const>(&a) == nullptr);
+ assert(any_cast<int const volatile>(&a) == nullptr);
+
+ // Try a cast to the right type, but as a pointer.
+ assert(any_cast<Type*>(&a) == nullptr);
+ assert(any_cast<Type const*>(&a) == nullptr);
+
+ // Check getting a unqualified type from a non-const any.
+ Type* v = any_cast<Type>(&a);
+ assert(v != nullptr);
+ assert(v->value == 42);
+
+ // change the stored value and later check for the new value.
+ v->value = 999;
+
+ // Check getting a const qualified type from a non-const any.
+ Type const* cv = any_cast<Type const>(&a);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check getting a unqualified type from a const any.
+ cv = any_cast<Type>(&ca);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check getting a const-qualified type from a const any.
+ cv = any_cast<Type const>(&ca);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check that no more objects were created, copied or moved.
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ }
+ assert(Type::count == 0);
+}
+
+void test_cast_non_copyable_type()
+{
+ // Even though 'any' never stores non-copyable types
+ // we still need to support any_cast<NoCopy>(ptr)
+ struct NoCopy { NoCopy(NoCopy const&) = delete; };
+ std::any a(42);
+ std::any const& ca = a;
+ assert(std::any_cast<NoCopy>(&a) == nullptr);
+ assert(std::any_cast<NoCopy>(&ca) == nullptr);
+}
+
+void test_fn() {}
+
+void test_cast_function_pointer() {
+ using T = void(*)();
+ std::any a(test_fn);
+ // An any can never store a function type, but we should at least be able
+ // to ask.
+ assert(std::any_cast<void()>(&a) == nullptr);
+ T fn_ptr = std::any_cast<T>(a);
+ assert(fn_ptr == test_fn);
+}
+
+int main() {
+ test_cast_is_noexcept();
+ test_cast_return_type();
+ test_cast_nullptr();
+ test_cast_empty();
+ test_cast<small>();
+ test_cast<large>();
+ test_cast_non_copyable_type();
+ test_cast_function_pointer();
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
new file mode 100644
index 000000000000..af081ecceefd
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -0,0 +1,313 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType const any_cast(any const&);
+//
+// template <class ValueType>
+// ValueType any_cast(any &);
+//
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+#include <any>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+using std::bad_any_cast;
+
+
+// Test that the operators are NOT marked noexcept.
+void test_cast_is_not_noexcept() {
+ any a;
+ static_assert(!noexcept(any_cast<int>(static_cast<any&>(a))), "");
+ static_assert(!noexcept(any_cast<int>(static_cast<any const&>(a))), "");
+ static_assert(!noexcept(any_cast<int>(static_cast<any &&>(a))), "");
+}
+
+// Test that the return type of any_cast is correct.
+void test_cast_return_type() {
+ any a;
+ static_assert(std::is_same<decltype(any_cast<int>(a)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(a)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int&>(a)), int&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(a)), int const&>::value, "");
+
+ static_assert(std::is_same<decltype(any_cast<int&&>(a)), int&&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&&>(a)), int const&&>::value, "");
+
+ static_assert(std::is_same<decltype(any_cast<int>(std::move(a))), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(std::move(a))), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int&>(std::move(a))), int&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(std::move(a))), int const&>::value, "");
+
+ static_assert(std::is_same<decltype(any_cast<int&&>(std::move(a))), int&&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&&>(std::move(a))), int const&&>::value, "");
+
+ any const& ca = a;
+ static_assert(std::is_same<decltype(any_cast<int>(ca)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(ca)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(ca)), int const&>::value, "");
+
+ static_assert(std::is_same<decltype(any_cast<int const&&>(ca)), int const&&>::value, "");
+}
+
+template <class Type, class ConstT = Type>
+void checkThrows(any& a)
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ try {
+ any_cast<Type>(a);
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ any_cast<ConstT>(static_cast<any const&>(a));
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ using RefType = typename std::conditional<
+ std::is_lvalue_reference<Type>::value,
+ typename std::remove_reference<Type>::type&&,
+ Type
+ >::type;
+ any_cast<RefType>(static_cast<any&&>(a));
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+#else
+ ((void)a);
+#endif
+}
+
+void test_cast_empty() {
+ // None of these operations should allocate.
+ DisableAllocationGuard g; ((void)g);
+ any a;
+ checkThrows<int>(a);
+}
+
+template <class Type>
+void test_cast_to_reference() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ any const& ca = a;
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ checkThrows<int>(a);
+ checkThrows<int&, int const&>(a);
+ checkThrows<Type*, Type const*>(a);
+ checkThrows<Type const*>(a);
+
+ // Check getting a type by reference from a non-const lvalue any.
+ {
+ Type& v = any_cast<Type&>(a);
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(a);
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a const lvalue any.
+ {
+ Type const& v = any_cast<Type const&>(ca);
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(ca);
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a const rvalue any.
+ {
+ Type const& v = any_cast<Type const&>(std::move(ca));
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(std::move(ca));
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a const rvalue any.
+ {
+ Type&& v = any_cast<Type&&>(std::move(a));
+ assert(v.value == 42);
+ assert(any_cast<Type&>(a).value == 42);
+
+ Type&& cv = any_cast<Type&&>(std::move(a));
+ assert(&cv == &v);
+ assert(any_cast<Type&>(a).value == 42);
+ }
+ // Check getting a type by reference from a const rvalue any.
+ {
+ Type const&& v = any_cast<Type const&&>(std::move(a));
+ assert(v.value == 42);
+ assert(any_cast<Type&>(a).value == 42);
+
+ Type const&& cv = any_cast<Type const&&>(std::move(a));
+ assert(&cv == &v);
+ assert(any_cast<Type&>(a).value == 42);
+ }
+ // Check that the original object hasn't been changed.
+ assertContains<Type>(a, 42);
+
+ // Check that no objects have been created/copied/moved.
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ }
+ assert(Type::count == 0);
+}
+
+template <class Type>
+void test_cast_to_value() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ checkThrows<int>(a);
+ checkThrows<int&, int const&>(a);
+ checkThrows<Type*, Type const*>(a);
+ checkThrows<Type const*>(a);
+
+ Type::reset(); // NOTE: reset does not modify Type::count
+ // Check getting Type by value from a non-const lvalue any.
+ // This should cause the non-const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(a);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 1);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting const Type by value from a non-const lvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type const>(a);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 1);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a non-const lvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any const&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a non-const rvalue any.
+ // This should cause the non-const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any &&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::moved == 1);
+ assert(Type::copied == 0);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 0);
+ assert(t.value == 42);
+ assert(any_cast<Type&>(a).value == 0);
+ any_cast<Type&>(a).value = 42; // reset the value
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting const Type by value from a non-const rvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type const>(static_cast<any &&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 0);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 1);
+ assert(t.value == 42);
+ assert(any_cast<Type&>(a).value == 0);
+ any_cast<Type&>(a).value = 42; // reset the value
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a const rvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any const&&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ assert(any_cast<Type&>(a).value == 42);
+ }
+ // Ensure we still only have 1 Type object alive.
+ assert(Type::count == 1);
+
+ // Check that the original object hasn't been changed.
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+}
+
+int main() {
+ test_cast_is_not_noexcept();
+ test_cast_return_type();
+ test_cast_empty();
+ test_cast_to_reference<small>();
+ test_cast_to_reference<large>();
+ test_cast_to_value<small>();
+ test_cast_to_value<large>();
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
new file mode 100644
index 000000000000..07578a28e82f
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+// Try and use the rvalue any_cast to cast to an lvalue reference
+
+#include <any>
+
+struct TestType {};
+using std::any;
+using std::any_cast;
+
+void test_const_lvalue_cast_request_non_const_lvalue()
+{
+ const any a;
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
+ any_cast<TestType &>(a); // expected-note {{requested here}}
+
+ const any a2(42);
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
+ any_cast<int&>(a2); // expected-note {{requested here}}
+}
+
+void test_lvalue_any_cast_request_rvalue()
+{
+ any a;
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ any_cast<TestType &&>(a); // expected-note {{requested here}}
+
+ any a2(42);
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ any_cast<int&&>(a2); // expected-note {{requested here}}
+}
+
+void test_rvalue_any_cast_request_lvalue()
+{
+ any a;
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{non-const lvalue reference to type 'TestType' cannot bind to a temporary}}
+ any_cast<TestType &>(std::move(a)); // expected-note {{requested here}}
+
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{non-const lvalue reference to type 'int' cannot bind to a temporary}}
+ any_cast<int&>(42);
+}
+
+int main()
+{
+ test_const_lvalue_cast_request_non_const_lvalue();
+ test_lvalue_any_cast_request_rvalue();
+ test_rvalue_any_cast_request_lvalue();
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
new file mode 100644
index 000000000000..3f6955a8cbce
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType any_cast(any const &);
+
+// Try and cast away const.
+
+#include <any>
+
+struct TestType {};
+struct TestType2 {};
+
+int main()
+{
+ using std::any;
+ using std::any_cast;
+
+ any a;
+
+ // expected-error@any:* {{binding value of type 'const TestType' to reference to type 'TestType' drops 'const' qualifier}}
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
+
+ // expected-error@any:* {{cannot cast from lvalue of type 'const TestType' to rvalue reference type 'TestType &&'; types are not compatible}}
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
+
+ // expected-error@any:* {{binding value of type 'const TestType2' to reference to type 'TestType2' drops 'const' qualifier}}
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
+
+ // expected-error@any:* {{cannot cast from lvalue of type 'const TestType2' to rvalue reference type 'TestType2 &&'; types are not compatible}}
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..ed4b96d644d2
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType const any_cast(any const&);
+//
+// template <class ValueType>
+// ValueType any_cast(any &);
+//
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+// Test instantiating the any_cast with a non-copyable type.
+
+#include <any>
+
+using std::any;
+using std::any_cast;
+
+struct no_copy
+{
+ no_copy() {}
+ no_copy(no_copy &&) {}
+ no_copy(no_copy const &) = delete;
+};
+
+struct no_move {
+ no_move() {}
+ no_move(no_move&&) = delete;
+ no_move(no_move const&) {}
+};
+
+int main() {
+ any a;
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{static_cast from 'no_copy' to 'no_copy' uses deleted function}}
+ any_cast<no_copy>(static_cast<any&>(a)); // expected-note {{requested here}}
+
+ // expected-error@any:* {{static_assert failed "ValueType is required to be a const lvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{static_cast from 'const no_copy' to 'no_copy' uses deleted function}}
+ any_cast<no_copy>(static_cast<any const&>(a)); // expected-note {{requested here}}
+
+ any_cast<no_copy>(static_cast<any &&>(a)); // OK
+
+ // expected-error@any:* {{static_assert failed "ValueType is required to be an rvalue reference or a CopyConstructible type"}}
+ // expected-error@any:* {{static_cast from 'typename remove_reference<no_move &>::type' (aka 'no_move') to 'no_move' uses deleted function}}
+ any_cast<no_move>(static_cast<any &&>(a));
+}
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
new file mode 100644
index 000000000000..99cc029971a8
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class ValueType>
+// ValueType const* any_cast(any const *) noexcept;
+//
+// template <class ValueType>
+// ValueType * any_cast(any *) noexcept;
+
+#include <any>
+
+using std::any;
+using std::any_cast;
+
+int main()
+{
+ any a(1);
+ any_cast<int &>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const&&>(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any const& a2 = a;
+ any_cast<int &>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &&>(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+}
diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
new file mode 100644
index 000000000000..59c06be6aad3
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// template <class T, class ...Args> any make_any(Args&&...);
+// template <class T, class U, class ...Args>
+// any make_any(initializer_list<U>, Args&&...);
+
+#include <any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::any;
+using std::any_cast;
+
+
+template <class Type>
+void test_make_any_type() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a = std::make_any<Type>();
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 0);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a = std::make_any<Type>(101);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 101);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a = std::make_any<Type>(-1, 42, -1);
+
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+}
+
+template <class Type>
+void test_make_any_type_tracked() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ {
+ any a = std::make_any<Type>();
+ assertArgsMatch<Type>(a);
+ }
+ {
+ any a = std::make_any<Type>(-1, 42, -1);
+ assertArgsMatch<Type, int, int, int>(a);
+ }
+ // initializer_list constructor tests
+ {
+ any a = std::make_any<Type>({-1, 42, -1});
+ assertArgsMatch<Type, std::initializer_list<int>>(a);
+ }
+ {
+ int x = 42;
+ any a = std::make_any<Type>({-1, 42, -1}, x);
+ assertArgsMatch<Type, std::initializer_list<int>, int&>(a);
+ }
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+struct SmallThrows {
+ SmallThrows(int) { throw 42; }
+ SmallThrows(std::initializer_list<int>, int) { throw 42; }
+};
+static_assert(IsSmallObject<SmallThrows>::value, "");
+
+struct LargeThrows {
+ LargeThrows(int) { throw 42; }
+ LargeThrows(std::initializer_list<int>, int) { throw 42; }
+ int data[sizeof(std::any)];
+};
+static_assert(!IsSmallObject<LargeThrows>::value, "");
+
+template <class Type>
+void test_make_any_throws()
+{
+ {
+ try {
+ std::make_any<Type>(101);
+ assert(false);
+ } catch (int const&) {
+ }
+ }
+ {
+ try {
+ std::make_any<Type>({1, 2, 3}, 101);
+ assert(false);
+ } catch (int const&) {
+ }
+ }
+}
+
+#endif
+
+int main() {
+ test_make_any_type<small>();
+ test_make_any_type<large>();
+ test_make_any_type<small_throws_on_copy>();
+ test_make_any_type<large_throws_on_copy>();
+ test_make_any_type<throws_on_move>();
+ test_make_any_type_tracked<small_tracked_t>();
+ test_make_any_type_tracked<large_tracked_t>();
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ test_make_any_throws<SmallThrows>();
+ test_make_any_throws<LargeThrows>();
+
+#endif
+}
diff --git a/test/std/utilities/any/any.nonmembers/swap.pass.cpp b/test/std/utilities/any/any.nonmembers/swap.pass.cpp
new file mode 100644
index 000000000000..1b3785bb1c66
--- /dev/null
+++ b/test/std/utilities/any/any.nonmembers/swap.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <any>
+
+// void swap(any &, any &) noexcept
+
+// swap(...) just wraps any::swap(...). That function is tested elsewhere.
+
+#include <any>
+#include <cassert>
+
+using std::any;
+using std::any_cast;
+
+int main()
+{
+
+ { // test noexcept
+ any a;
+ static_assert(noexcept(swap(a, a)), "swap(any&, any&) must be noexcept");
+ }
+ {
+ any a1(1);
+ any a2(2);
+
+ swap(a1, a2);
+
+ assert(any_cast<int>(a1) == 2);
+ assert(any_cast<int>(a2) == 1);
+ }
+}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
index 490dc16b60e2..7419b70e0b8f 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::divides<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
static_assert((std::is_same<int, F::result_type>::value), "" );
assert(f(36, 4) == 9);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::divides<> F2;
const F2 f2 = F2();
assert(f2(36, 4) == 9);
@@ -33,7 +35,7 @@ int main()
constexpr int foo = std::divides<int> () (3, 2);
static_assert ( foo == 1, "" );
- constexpr int bar = std::divides<> () (3.0, 2);
- static_assert ( bar == 1, "" );
+ constexpr double bar = std::divides<> () (3.0, 2);
+ static_assert ( bar == 1.5, "" ); // exact in binary
#endif
}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
index 9bda541f896a..25df69d60e96 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::minus<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
static_assert((std::is_same<int, F::result_type>::value), "" );
assert(f(3, 2) == 1);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::minus<> F2;
const F2 f2 = F2();
assert(f2(3,2) == 1);
@@ -33,7 +35,7 @@ int main()
constexpr int foo = std::minus<int> () (3, 2);
static_assert ( foo == 1, "" );
- constexpr int bar = std::minus<> () (3.0, 2);
- static_assert ( bar == 1, "" );
+ constexpr double bar = std::minus<> () (3.0, 2);
+ static_assert ( bar == 1.0, "" );
#endif
}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
index ca5bba6d5b8e..6f39792e925f 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::modulus<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
static_assert((std::is_same<int, F::result_type>::value), "" );
assert(f(36, 8) == 4);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::modulus<> F2;
const F2 f2 = F2();
assert(f2(36, 8) == 4);
diff --git a/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
index f132c8d4bd9b..2b354826960e 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::multiplies<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
static_assert((std::is_same<int, F::result_type>::value), "" );
assert(f(3, 2) == 6);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::multiplies<> F2;
const F2 f2 = F2();
assert(f2(3,2) == 6);
@@ -33,7 +35,7 @@ int main()
constexpr int foo = std::multiplies<int> () (3, 2);
static_assert ( foo == 6, "" );
- constexpr int bar = std::multiplies<> () (3.0, 2);
- static_assert ( bar == 6, "" );
+ constexpr double bar = std::multiplies<> () (3.0, 2);
+ static_assert ( bar == 6.0, "" );
#endif
}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
index 0adac659123b..198894023cd7 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/negate.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::negate<int> F;
@@ -22,7 +24,7 @@ int main()
static_assert((std::is_same<F::argument_type, int>::value), "" );
static_assert((std::is_same<F::result_type, int>::value), "" );
assert(f(36) == -36);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::negate<> F2;
const F2 f2 = F2();
assert(f2(36) == -36);
@@ -32,7 +34,7 @@ int main()
constexpr int foo = std::negate<int> () (3);
static_assert ( foo == -3, "" );
- constexpr int bar = std::negate<> () (3.0);
- static_assert ( bar == -3, "" );
+ constexpr double bar = std::negate<> () (3.0);
+ static_assert ( bar == -3.0, "" );
#endif
}
diff --git a/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp b/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
index ce544c78b676..b56d3ef2b346 100644
--- a/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
+++ b/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::plus<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
static_assert((std::is_same<int, F::result_type>::value), "" );
assert(f(3, 2) == 5);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::plus<> F2;
const F2 f2 = F2();
assert(f2(3,2) == 5);
@@ -33,7 +35,7 @@ int main()
constexpr int foo = std::plus<int> () (3, 2);
static_assert ( foo == 5, "" );
- constexpr int bar = std::plus<> () (3.0, 2);
- static_assert ( bar == 5, "" );
+ constexpr double bar = std::plus<> () (3.0, 2);
+ static_assert ( bar == 5.0, "" );
#endif
}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
index 63d3c9b0de92..a543fffedbb5 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp
@@ -24,6 +24,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int dummy = 42;
int return_value(int) { return dummy; }
@@ -81,10 +83,10 @@ void do_test(Fn* func) {
// Check that the call operator SFINAE's away when too few arguments
// are provided but is well-formed otherwise.
{
- static_assert(!CheckCall<Bind>(), "");
+ LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), "");
static_assert(CheckCall<Bind, int>(), "");
static_assert(CheckCall<Bind, int, int>(), "");
- static_assert(!CheckCall<BindR>(), "");
+ LIBCPP_STATIC_ASSERT(!CheckCall<BindR>(), "");
static_assert(CheckCall<BindR, int>(), "");
static_assert(CheckCall<BindR, int, int>(), "");
}
@@ -108,7 +110,7 @@ void do_test_r(Fn* func) {
// Check that the call operator SFINAE's away when too few arguments
// are provided but is well-formed otherwise.
{
- static_assert(!CheckCall<Bind>(), "");
+ LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), "");
static_assert(CheckCall<Bind, int>(), "");
static_assert(CheckCall<Bind, int, int>(), "");
}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
index a0c686de77ba..180433109f26 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
@@ -29,7 +29,7 @@ struct DummyUnaryFunction
struct BadUnaryFunction
{
template <typename S>
- constexpr int operator()(S const & s) const
+ constexpr int operator()(S const &) const
{
// Trigger a compile error if this function is instantiated.
// The constexpr is needed so that it is instantiated while checking
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
index f61d93aefd89..0d4244b4d860 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
@@ -28,7 +28,7 @@ struct power
T
operator()(T a, T b)
{
- return std::pow(a, b);
+ return static_cast<T>(std::pow(a, b));
}
};
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
index 83fa452fecb3..5d833e28830b 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
@@ -14,12 +14,16 @@
// template<class T> struct is_bind_expression
#include <functional>
+#include "test_macros.h"
template <bool Expected, class T>
void
test(const T&)
{
static_assert(std::is_bind_expression<T>::value == Expected, "");
+#if TEST_STD_VER > 14
+ static_assert(std::is_bind_expression_v<T> == Expected, "");
+#endif
}
struct C {};
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
index 6a52bd1848e9..1d7c649dfc0e 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
@@ -12,12 +12,16 @@
// struct is_placeholder
#include <functional>
+#include "test_macros.h"
template <int Expected, class T>
void
test(const T&)
{
static_assert(std::is_placeholder<T>::value == Expected, "");
+#if TEST_STD_VER > 14
+ static_assert(std::is_placeholder_v<T> == Expected, "");
+#endif
}
struct C {};
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
index 68986ac1aeb3..59709d0ed5b2 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
@@ -56,8 +56,34 @@ constexpr decltype(std::placeholders::_9) cp9 = std::placeholders::_9;
constexpr decltype(std::placeholders::_10) cp10 = std::placeholders::_10;
#endif // TEST_STD_VER >= 11
+void use_placeholders_to_prevent_unused_warning() {
+#if TEST_STD_VER >= 11
+ ((void)cp1);
+ ((void)cp2);
+ ((void)cp3);
+ ((void)cp4);
+ ((void)cp5);
+ ((void)cp6);
+ ((void)cp7);
+ ((void)cp8);
+ ((void)cp9);
+ ((void)cp10);
+ ((void)default1);
+ ((void)default2);
+ ((void)default3);
+ ((void)default4);
+ ((void)default5);
+ ((void)default6);
+ ((void)default7);
+ ((void)default8);
+ ((void)default9);
+ ((void)default10);
+#endif
+}
+
int main()
{
+ use_placeholders_to_prevent_unused_warning();
test(std::placeholders::_1);
test(std::placeholders::_2);
test(std::placeholders::_3);
diff --git a/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
index c0135fad1982..12d968f42c0a 100644
--- a/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::bit_and<int> F;
@@ -27,7 +29,7 @@ int main()
assert(f(0x58D3, 0xEA95) == 0x4891);
assert(f(0x58D3, 0) == 0);
assert(f(0xFFFF, 0x58D3) == 0x58D3);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::bit_and<> F2;
const F2 f2 = F2();
assert(f2(0xEA95, 0xEA95) == 0xEA95);
diff --git a/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
index cb33df3d84b7..90dd9bc098bb 100644
--- a/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::bit_or<int> F;
@@ -27,7 +29,7 @@ int main()
assert(f(0x58D3, 0xEA95) == 0xFAD7);
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xFFFF);
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::bit_or<> F2;
const F2 f2 = F2();
assert(f2(0xEA95, 0xEA95) == 0xEA95);
diff --git a/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp b/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
index bbf2ce5baf1b..a5cbd17a0d0e 100644
--- a/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
+++ b/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -29,7 +31,7 @@ int main()
assert(f(0x58D3, 0) == 0x58D3);
assert(f(0xFFFF, 0x58D3) == 0xA72C);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::bit_xor<> F2;
const F2 f = F2();
diff --git a/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp b/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
index 66d783a6e357..b23d4e8bb478 100644
--- a/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
+++ b/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
@@ -19,13 +19,13 @@ void do_pointer_comparison_test() {
#endif
std::vector<std::shared_ptr<T> > pointers;
const std::size_t test_size = 100;
- for (int i=0; i < test_size; ++i)
+ for (size_t i=0; i < test_size; ++i)
pointers.push_back(std::shared_ptr<T>(new T()));
Compare comp;
UIntCompare ucomp;
VoidCompare vcomp;
- for (int i=0; i < test_size; ++i) {
- for (int j=0; j < test_size; ++j) {
+ for (size_t i=0; i < test_size; ++i) {
+ for (size_t j=0; j < test_size; ++j) {
T* lhs = pointers[i].get();
T* rhs = pointers[j].get();
std::uintptr_t lhs_uint = reinterpret_cast<std::uintptr_t>(lhs);
diff --git a/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
new file mode 100644
index 000000000000..aaac98474fcb
--- /dev/null
+++ b/test/std/utilities/function.objects/func.invoke/invoke_feature_test_macro.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class F, class ...Args>
+// result_of_t<F&&(Args&&...)> invoke(F&&, Args&&...);
+
+#include <functional>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
+# ifdef __cpp_lib_invoke
+# error Feature test macro should be defined
+# endif
+#else
+# ifndef __cpp_lib_invoke
+# error Feature test macro not defined
+# endif
+# if __cpp_lib_invoke != 201411
+# error __cpp_lib_invoke has the wrong value
+# endif
+#endif
+
+int foo(int) { return 42; }
+
+int main() {
+#if defined(__cpp_lib_invoke)
+ assert(std::invoke(foo, 101) == 42);
+#endif
+} \ No newline at end of file
diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
index c12fa7920974..47a3e1cc5969 100644
--- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
+++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -138,26 +138,26 @@ inline constexpr CallType operator|(CallType LHS, CallType RHS) {
struct ForwardingCallObject {
template <class ...Args>
- bool operator()(Args&&... args) & {
+ bool operator()(Args&&...) & {
set_call<Args&&...>(CT_NonConst | CT_LValue);
return true;
}
template <class ...Args>
- bool operator()(Args&&... args) const & {
+ bool operator()(Args&&...) const & {
set_call<Args&&...>(CT_Const | CT_LValue);
return true;
}
// Don't allow the call operator to be invoked as an rvalue.
template <class ...Args>
- bool operator()(Args&&... args) && {
+ bool operator()(Args&&...) && {
set_call<Args&&...>(CT_NonConst | CT_RValue);
return true;
}
template <class ...Args>
- bool operator()(Args&&... args) const && {
+ bool operator()(Args&&...) const && {
set_call<Args&&...>(CT_Const | CT_RValue);
return true;
}
@@ -526,7 +526,6 @@ void call_operator_forwarding_test()
assert(Fn::check_call<int&&>(CT_Const | CT_RValue));
}
{ // test multi arg
- int x = 42;
const double y = 3.14;
std::string s = "abc";
obj(42, std::move(y), s, std::string{"foo"});
@@ -554,7 +553,10 @@ void call_operator_noexcept_test()
using T = NoExceptCallable<bool>;
T value(true);
auto ret = std::not_fn(value);
- static_assert(noexcept(!_VSTD::__invoke(value)), "");
+ LIBCPP_STATIC_ASSERT(noexcept(!_VSTD::__invoke(value)), "");
+#if TEST_STD_VER > 14
+ static_assert(noexcept(!std::invoke(value)), "");
+#endif
static_assert(noexcept(ret()), "call should be noexcept");
auto const& cret = ret;
static_assert(noexcept(cret()), "call should be noexcept");
@@ -577,6 +579,19 @@ void call_operator_noexcept_test()
}
}
+void test_lwg2767() {
+ // See http://wg21.link/LWG2767
+ struct Abstract { virtual void f() const = 0; };
+ struct Derived : public Abstract { void f() const {} };
+ struct F { bool operator()(Abstract&&) { return false; } };
+ {
+ Derived d;
+ Abstract &a = d;
+ bool b = std::not_fn(F{})(std::move(a));
+ assert(b);
+ }
+}
+
int main()
{
constructor_tests();
@@ -586,4 +601,5 @@ int main()
call_operator_sfinae_test(); // somewhat of an extension
call_operator_forwarding_test();
call_operator_noexcept_test();
+ test_lwg2767();
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.fail.cpp
new file mode 100644
index 000000000000..e156fa966ac5
--- /dev/null
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// XFAIL: c++11, c++14
+
+// <functional>
+
+#include <functional>
+#include <type_traits>
+
+#include "test_macros.h"
+
+struct S : public std::function<void()> { using function::function; };
+
+int main() {
+ S f1( [](){} );
+ S f2(std::allocator_arg, std::allocator<int>{}, f1);
+}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
new file mode 100644
index 000000000000..5bdf9e98e897
--- /dev/null
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+// REQUIRES-ANY: c++11, c++14
+
+// <functional>
+
+// See https://llvm.org/bugs/show_bug.cgi?id=20002
+
+#include <functional>
+#include <type_traits>
+
+#include "test_macros.h"
+
+using Fn = std::function<void()>;
+struct S : public std::function<void()> { using function::function; };
+
+int main() {
+ S s( [](){} );
+ S f1( s );
+ S f2(std::allocator_arg, std::allocator<int>{}, s);
+}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
index 58192c928d58..1a9206e0e7f3 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
@@ -12,13 +12,14 @@
// class function<R(ArgTypes...)>
// template <MoveConstructible R, MoveConstructible ... ArgTypes>
-// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
+// void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&) noexcept;
#include <functional>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
class A
@@ -63,6 +64,9 @@ int main()
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(swap(f1, f2)), "" );
+#endif
assert(A::count == 2);
assert(globalMemCounter.checkOutstandingNewEq(2));
assert(f1.target<A>()->id() == 1);
@@ -78,6 +82,9 @@ int main()
{
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(swap(f1, f2)), "" );
+#endif
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f1.target<A>()->id() == 1);
@@ -93,6 +100,9 @@ int main()
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(swap(f1, f2)), "" );
+#endif
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(*f1.target<int(*)(int)>() == g);
@@ -108,6 +118,9 @@ int main()
{
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
+#if TEST_STD_VER >= 11
+ static_assert(noexcept(swap(f1, f2)), "" );
+#endif
assert(A::count == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(*f1.target<int(*)(int)>() == g);
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
index 82a6f6c5215e..fd296a7367b8 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
@@ -16,6 +16,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
class A
@@ -49,6 +50,17 @@ int A::count = 0;
int g(int) {return 0;}
+#if TEST_STD_VER >= 11
+struct RValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) && {}
+};
+struct LValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) & {}
+};
+#endif
+
int main()
{
assert(globalMemCounter.checkOutstandingNewEq(0));
@@ -91,4 +103,13 @@ int main()
std::function <void()> f(static_cast<void (*)()>(0));
assert(!f);
}
+#if TEST_STD_VER >= 11
+ {
+ using Fn = std::function<void(int, int, int)>;
+ static_assert(std::is_constructible<Fn, LValueCallable&>::value, "");
+ static_assert(std::is_constructible<Fn, LValueCallable>::value, "");
+ static_assert(!std::is_constructible<Fn, RValueCallable&>::value, "");
+ static_assert(!std::is_constructible<Fn, RValueCallable>::value, "");
+ }
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
index 11716e7946b0..e927ad42c06b 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
@@ -19,6 +19,7 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
class A
@@ -52,6 +53,17 @@ int A::count = 0;
int g(int) {return 0;}
+#if TEST_STD_VER >= 11
+struct RValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) && {}
+};
+struct LValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) & {}
+};
+#endif
+
int main()
{
assert(globalMemCounter.checkOutstandingNewEq(0));
@@ -95,4 +107,13 @@ int main()
assert(f.target<int(*)(int)>() != 0);
f(1);
}
+#if TEST_STD_VER >= 11
+ {
+ using Fn = std::function<void(int, int, int)>;
+ static_assert(std::is_assignable<Fn&, LValueCallable&>::value, "");
+ static_assert(std::is_assignable<Fn&, LValueCallable>::value, "");
+ static_assert(!std::is_assignable<Fn&, RValueCallable&>::value, "");
+ static_assert(!std::is_assignable<Fn&, RValueCallable>::value, "");
+ }
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp
new file mode 100644
index 000000000000..f455f0311847
--- /dev/null
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+// XFAIL: c++98, c++03, c++11, c++14
+
+// class function<R(ArgTypes...)>
+
+// template<class A> function(allocator_arg_t, const A&);
+
+#include <functional>
+#include <cassert>
+
+#include "min_allocator.h"
+
+int main()
+{
+ std::function<int(int)> f(std::allocator_arg, std::allocator<int>());
+}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
index f97e34d3f2cb..392dfc1993bc 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp
@@ -8,10 +8,13 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
// class function<R(ArgTypes...)>
// template<class A> function(allocator_arg_t, const A&);
+//
+// This signature was removed in C++17
#include <functional>
#include <cassert>
diff --git a/test/libcxx/containers/sequences/list/db_cfront.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
index 9501ce193138..24f7fceb877b 100644
--- a/test/libcxx/containers/sequences/list/db_cfront.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.fail.cpp
@@ -7,24 +7,23 @@
//
//===----------------------------------------------------------------------===//
-// <list>
+// <functional>
+// XFAIL: c++98, c++03, c++11, c++14
-// Call front() on empty const container.
+// class function<R(ArgTypes...)>
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+// template<class F, class A> function(allocator_arg_t, const A&, F);
+//
+// This signature was removed in C++17
-#include <list>
+#include <functional>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+
+#include "test_macros.h"
+
+void foo(int) {}
int main()
{
- typedef int T;
- typedef std::list<T> C;
- const C c;
- assert(c.front() == 0);
- assert(false);
+ std::function<void(int)> f(std::allocator_arg, std::allocator<int>(), foo);
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
index 352ecfc602be..8d454723320c 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
// class function<R(ArgTypes...)>
@@ -16,11 +17,24 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "test_allocator.h"
#include "count_new.hpp"
#include "../function_types.h"
+
+#if TEST_STD_VER >= 11
+struct RValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) && {}
+};
+struct LValueCallable {
+ template <class ...Args>
+ void operator()(Args&&...) & {}
+};
+#endif
+
class DummyClass {};
template <class FuncType, class AllocType>
@@ -103,4 +117,14 @@ int main()
non_default_test_allocator<DummyClass> non_default_alloc(42);
test_for_alloc(non_default_alloc);
}
+#if TEST_STD_VER >= 11
+ {
+ using Fn = std::function<void(int, int, int)>;
+ static_assert(std::is_constructible<Fn, std::allocator_arg_t, std::allocator<int>, LValueCallable&>::value, "");
+ static_assert(std::is_constructible<Fn, std::allocator_arg_t, std::allocator<int>, LValueCallable>::value, "");
+ static_assert(!std::is_constructible<Fn, std::allocator_arg_t, std::allocator<int>, RValueCallable&>::value, "");
+ static_assert(!std::is_constructible<Fn, std::allocator_arg_t, std::allocator<int>, RValueCallable>::value, "");
+ }
+#endif
+
}
diff --git a/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
index 08c10d34a01e..9967457ff821 100644
--- a/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.fail.cpp
@@ -7,25 +7,24 @@
//
//===----------------------------------------------------------------------===//
-// <list>
+// <functional>
+// XFAIL: c++98, c++03, c++11, c++14
-// Dereference non-dereferenceable iterator.
+// class function<R(ArgTypes...)>
+
+// template<class A> function(allocator_arg_t, const A&, const function&);
+//
+// This signature was removed in C++17
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#include <list>
+#include <functional>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+
+#include "test_macros.h"
int main()
{
- typedef int T;
- typedef std::list<T> C;
- C c(1);
- C::iterator i = c.end();
- T j = *i;
- assert(false);
+ typedef std::function<void(int)> F;
+ F f1;
+ F f2(std::allocator_arg, std::allocator<int>(), f1);
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
index 371eb98de1a9..718aa49341d2 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
// class function<R(ArgTypes...)>
diff --git a/test/libcxx/containers/sequences/list/db_cback.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp
index 1e25307c4602..cc4ecce75138 100644
--- a/test/libcxx/containers/sequences/list/db_cback.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.fail.cpp
@@ -7,24 +7,21 @@
//
//===----------------------------------------------------------------------===//
-// <list>
+// <functional>
+// XFAIL: c++98, c++03, c++11, c++14
-// Call back() on empty const container.
+// class function<R(ArgTypes...)>
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+// template<class A> function(allocator_arg_t, const A&, nullptr_t);
+//
+// This signature was removed in C++17
-#include <list>
+#include <functional>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+
+#include "min_allocator.h"
int main()
{
- typedef int T;
- typedef std::list<T> C;
- const C c;
- assert(c.back() == 0);
- assert(false);
+ std::function<int(int)> f(std::allocator_arg, std::allocator<int>(), nullptr);
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
index 2350f92f0f89..354ad955f207 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp
@@ -8,10 +8,13 @@
//===----------------------------------------------------------------------===//
// <functional>
+// REQUIRES-ANY: c++98, c++03, c++11, c++14
// class function<R(ArgTypes...)>
// template<class A> function(allocator_arg_t, const A&, nullptr_t);
+//
+// This signature was removed in C++17
#include <functional>
#include <cassert>
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp
new file mode 100644
index 000000000000..cb9fb9afad2b
--- /dev/null
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.fail.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+// XFAIL: c++98, c++03, c++11, c++14
+
+// class function<R(ArgTypes...)>
+
+// template<class A> function(allocator_arg_t, const A&, function&&);
+//
+// This signature was removed in C++17
+
+#include <functional>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+class A
+{
+ int data_[10];
+public:
+ static int count;
+
+ A()
+ {
+ ++count;
+ for (int i = 0; i < 10; ++i)
+ data_[i] = i;
+ }
+
+ A(const A&) {++count;}
+
+ ~A() {--count;}
+
+ int operator()(int i) const
+ {
+ for (int j = 0; j < 10; ++j)
+ i += data_[j];
+ return i;
+ }
+};
+
+int A::count = 0;
+
+int g(int) { return 0; }
+
+int main()
+{
+ {
+ std::function<int(int)> f = A();
+ std::function<int(int)> f2(std::allocator_arg, std::allocator<A>(), std::move(f));
+ }
+}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
index 403d646f4216..e328481b274d 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
@@ -8,12 +8,15 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
+// REQUIRES-ANY: c++11, c++14
// <functional>
// class function<R(ArgTypes...)>
// template<class A> function(allocator_arg_t, const A&, function&&);
+//
+// This signature was removed in C++17
#include <functional>
#include <memory>
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
index c91eaa2d5674..9b83ddecb974 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
@@ -16,94 +16,123 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
-class A
-{
- int data_[10];
+class A {
+ int data_[10];
+
public:
- static int count;
+ static int count;
- A()
- {
- ++count;
- for (int i = 0; i < 10; ++i)
- data_[i] = i;
- }
+ A() {
+ ++count;
+ for (int i = 0; i < 10; ++i)
+ data_[i] = i;
+ }
- A(const A&) {++count;}
+ A(const A &) { ++count; }
- ~A() {--count;}
+ ~A() { --count; }
- int operator()(int i) const
- {
- for (int j = 0; j < 10; ++j)
- i += data_[j];
- return i;
- }
+ int operator()(int i) const {
+ for (int j = 0; j < 10; ++j)
+ i += data_[j];
+ return i;
+ }
};
int A::count = 0;
-int g(int) {return 0;}
+int g0() { return 0; }
+int g(int) { return 0; }
+int g2(int, int) { return 2; }
+int g3(int, int, int) { return 3; }
-int main()
-{
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+int main() {
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f = A();
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f.target<A>());
- assert(f.target<int(*)(int)>() == 0);
+ assert(f.target<int (*)(int)>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(A::count == 2);
assert(globalMemCounter.checkOutstandingNewEq(2));
assert(f2.target<A>());
- assert(f2.target<int(*)(int)>() == 0);
- }
- assert(A::count == 0);
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ assert(f2.target<int (*)(int)>() == 0);
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f = g;
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(f.target<int(*)(int)>());
+ assert(f.target<int (*)(int)>());
assert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(f2.target<int(*)(int)>());
+ assert(f2.target<int (*)(int)>());
assert(f2.target<A>() == 0);
- }
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f;
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(f.target<int(*)(int)>() == 0);
+ assert(f.target<int (*)(int)>() == 0);
assert(f.target<A>() == 0);
std::function<int(int)> f2;
f2 = f;
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(f2.target<int(*)(int)>() == 0);
+ assert(f2.target<int (*)(int)>() == 0);
assert(f2.target<A>() == 0);
- }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ }
+ {
+ typedef std::function<int()> Func;
+ Func f = g0;
+ Func& fr = (f = f);
+ assert(&fr == &f);
+ assert(*f.target<int(*)()>() == g0);
+ }
+ {
+ typedef std::function<int(int)> Func;
+ Func f = g;
+ Func& fr = (f = f);
+ assert(&fr == &f);
+ assert(*f.target<int(*)(int)>() == g);
+ }
+ {
+ typedef std::function<int(int, int)> Func;
+ Func f = g2;
+ Func& fr = (f = f);
+ assert(&fr == &f);
+ assert(*f.target<int(*)(int, int)>() == g2);
+ }
+ {
+ typedef std::function<int(int, int, int)> Func;
+ Func f = g3;
+ Func& fr = (f = f);
+ assert(&fr == &f);
+ assert(*f.target<int(*)(int, int, int)>() == g3);
+ }
+#if TEST_STD_VER >= 11
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f = A();
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f.target<A>());
- assert(f.target<int(*)(int)>() == 0);
+ assert(f.target<int (*)(int)>() == 0);
std::function<int(int)> f2;
f2 = std::move(f);
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f2.target<A>());
- assert(f2.target<int(*)(int)>() == 0);
+ assert(f2.target<int (*)(int)>() == 0);
assert(f.target<A>() == 0);
- assert(f.target<int(*)(int)>() == 0);
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(f.target<int (*)(int)>() == 0);
+ }
+#endif
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
index 387b371a9331..9d5681a3db76 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
@@ -132,7 +132,7 @@ int main()
assert(A::count == 1);
assert(f2.target<A>() == nullptr);
assert(f2.target<Ref>());
- assert(f.target<Ref>()); // f is unchanged because the target is small
+ LIBCPP_ASSERT(f.target<Ref>()); // f is unchanged because the target is small
}
{
// Test that moving a function constructed from a function pointer
@@ -146,7 +146,7 @@ int main()
std::function<int(int)> f2(std::move(f));
assert(f2.target<A>() == nullptr);
assert(f2.target<Ptr>());
- assert(f.target<Ptr>()); // f is unchanged because the target is small
+ LIBCPP_ASSERT(f.target<Ptr>()); // f is unchanged because the target is small
}
#endif // TEST_STD_VER >= 11
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
index f94e689b2a6b..214c3f7c5d83 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
@@ -18,46 +18,49 @@
#include "count_new.hpp"
-class A
-{
- int data_[10];
+class A {
+ int data_[10];
+
public:
- static int count;
+ static int count;
- explicit A(int j)
- {
- ++count;
- data_[0] = j;
- }
+ explicit A(int j) {
+ ++count;
+ data_[0] = j;
+ }
- A(const A& a)
- {
- ++count;
- for (int i = 0; i < 10; ++i)
- data_[i] = a.data_[i];
- }
+ A(const A &a) {
+ ++count;
+ for (int i = 0; i < 10; ++i)
+ data_[i] = a.data_[i];
+ }
- ~A() {--count;}
+ ~A() { --count; }
- int operator()(int i) const
- {
- for (int j = 0; j < 10; ++j)
- i += data_[j];
- return i;
- }
+ int operator()(int i) const {
+ for (int j = 0; j < 10; ++j)
+ i += data_[j];
+ return i;
+ }
+
+ int operator()() const { return -1; }
+ int operator()(int, int) const { return -2; }
+ int operator()(int, int, int) const { return -3; }
- int id() const {return data_[0];}
+ int id() const { return data_[0]; }
};
int A::count = 0;
-int g(int) {return 0;}
-int h(int) {return 1;}
+int g0() { return 0; }
+int g(int) { return 0; }
+int h(int) { return 1; }
+int g2(int, int) { return 2; }
+int g3(int, int, int) { return 3; }
-int main()
-{
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+int main() {
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = A(2);
assert(A::count == 2);
@@ -69,52 +72,122 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(2));
assert(f1.target<A>()->id() == 2);
assert(f2.target<A>()->id() == 1);
- }
- assert(A::count == 0);
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f1 = A(1);
std::function<int(int)> f2 = g;
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f1.target<A>()->id() == 1);
- assert(*f2.target<int(*)(int)>() == g);
+ assert(*f2.target<int (*)(int)>() == g);
f1.swap(f2);
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(*f1.target<int(*)(int)>() == g);
+ assert(*f1.target<int (*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
- }
- assert(A::count == 0);
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = A(1);
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
- assert(*f1.target<int(*)(int)>() == g);
+ assert(*f1.target<int (*)(int)>() == g);
assert(f2.target<A>()->id() == 1);
f1.swap(f2);
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f1.target<A>()->id() == 1);
- assert(*f2.target<int(*)(int)>() == g);
- }
- assert(A::count == 0);
- assert(globalMemCounter.checkOutstandingNewEq(0));
- {
+ assert(*f2.target<int (*)(int)>() == g);
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
std::function<int(int)> f1 = g;
std::function<int(int)> f2 = h;
assert(A::count == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(*f1.target<int(*)(int)>() == g);
- assert(*f2.target<int(*)(int)>() == h);
+ assert(*f1.target<int (*)(int)>() == g);
+ assert(*f2.target<int (*)(int)>() == h);
f1.swap(f2);
assert(A::count == 0);
assert(globalMemCounter.checkOutstandingNewEq(0));
- assert(*f1.target<int(*)(int)>() == h);
- assert(*f2.target<int(*)(int)>() == g);
+ assert(*f1.target<int (*)(int)>() == h);
+ assert(*f2.target<int (*)(int)>() == g);
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ std::function<int(int)> f1 = A(1);
+ assert(A::count == 1);
+ {
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
}
- assert(A::count == 0);
- assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A::count == 1);
+ assert(f1.target<A>()->id() == 1);
+ }
+ assert(A::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ std::function<int()> f1 = g0;
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(*f1.target<int (*)()>() == g0);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ std::function<int(int, int)> f1 = g2;
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(*f1.target<int (*)(int, int)>() == g2);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ std::function<int(int, int, int)> f1 = g3;
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(*f1.target<int (*)(int, int, int)>() == g3);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ {
+ std::function<int()> f1 = A(1);
+ assert(A::count == 1);
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(A::count == 1);
+ assert(f1.target<A>()->id() == 1);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A::count == 0);
+ {
+ std::function<int(int, int)> f1 = A(2);
+ assert(A::count == 1);
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(A::count == 1);
+ assert(f1.target<A>()->id() == 2);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A::count == 0);
+ {
+ std::function<int(int, int, int)> f1 = A(3);
+ assert(A::count == 1);
+ DisableAllocationGuard guard;
+ ((void)guard);
+ f1.swap(f1);
+ assert(A::count == 1);
+ assert(f1.target<A>()->id() == 3);
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A::count == 0);
}
diff --git a/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp b/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
index 72f9dc20144d..ac94fa5362e8 100644
--- a/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::logical_and<int> F;
@@ -26,7 +28,7 @@ int main()
assert(!f(36, 0));
assert(!f(0, 36));
assert(!f(0, 0));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::logical_and<> F2;
const F2 f2 = F2();
assert( f2(36, 36));
diff --git a/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp b/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
index 8484625a727c..4f783dd0f23a 100644
--- a/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/logical_not.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::logical_not<int> F;
@@ -23,7 +25,7 @@ int main()
static_assert((std::is_same<F::result_type, bool>::value), "" );
assert(!f(36));
assert(f(0));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::logical_not<> F2;
const F2 f2 = F2();
assert(!f2(36));
diff --git a/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp b/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
index 7280504403f4..3c450a05de19 100644
--- a/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
+++ b/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::logical_or<int> F;
@@ -26,7 +28,7 @@ int main()
assert(f(36, 0));
assert(f(0, 36));
assert(!f(0, 0));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::logical_or<> F2;
const F2 f2 = F2();
assert( f2(36, 36));
diff --git a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
index 3c00bd20ac64..261a306ca156 100644
--- a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
@@ -21,7 +21,9 @@
#include <type_traits>
#include <string>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
class MoveOnly
{
MoveOnly(const MoveOnly&);
@@ -55,7 +57,7 @@ int main()
test<int>();
test<double>();
test<std::string>();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test<MoveOnly>();
#endif
}
diff --git a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
index 8aa2c1df8935..af367789a105 100644
--- a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// <functional>
// make sure that we can hash enumeration values
@@ -14,8 +16,6 @@
#include "test_macros.h"
-#if TEST_STD_VER >= 14
-
#include <functional>
#include <cassert>
#include <type_traits>
@@ -59,6 +59,3 @@ int main()
test<Fruits>();
}
-#else
-int main () {}
-#endif
diff --git a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
index 8954f4f3664b..2f3f9bee4bc3 100644
--- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
@@ -35,11 +35,11 @@ test()
for (int i = 0; i <= 5; ++i)
{
- T t(i);
+ T t(static_cast<T>(i));
if (sizeof(T) <= sizeof(std::size_t))
{
const std::size_t result = h(t);
- LIBCPP_ASSERT(result == t);
+ LIBCPP_ASSERT(result == static_cast<size_t>(t));
((void)result); // Prevent unused warning
}
}
diff --git a/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
new file mode 100644
index 000000000000..ed173f280d05
--- /dev/null
+++ b/test/std/utilities/function.objects/unord.hash/non_enum.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <functional>
+
+// Hashing a struct w/o a defined hash should *not* fail, but it should
+// create a type that is not constructible and not callable.
+// See also: http://cplusplus.github.io/LWG/lwg-active.html#2543
+
+#include <functional>
+#include <cassert>
+#include <type_traits>
+
+#include "test_macros.h"
+
+struct X {};
+
+int main()
+{
+ using H = std::hash<X>;
+ static_assert(!std::is_default_constructible<H>::value, "");
+ static_assert(!std::is_copy_constructible<H>::value, "");
+ static_assert(!std::is_move_constructible<H>::value, "");
+ static_assert(!std::is_copy_assignable<H>::value, "");
+ static_assert(!std::is_move_assignable<H>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_callable<H(X&)>::value, "");
+ static_assert(!std::is_callable<H(X const&)>::value, "");
+#endif
+}
diff --git a/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp b/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
index b689160babaa..ed899e7ca268 100644
--- a/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
+++ b/test/std/utilities/intseq/intseq.intseq/integer_seq.fail.cpp
@@ -22,9 +22,11 @@
#include <utility>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
// Should fail to compile, since float is not an integral type
using floatmix = std::integer_sequence<float>;
@@ -34,5 +36,5 @@ int main()
X
-#endif // _LIBCPP_STD_VER > 11
+#endif // TEST_STD_VER > 11
}
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
index af4a3c4dfe7f..192626935f00 100644
--- a/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
@@ -14,6 +14,9 @@
// UNSUPPORTED: c++98, c++03, c++11
+// This test hangs during recursive template instantiation with libstdc++
+// UNSUPPORTED: libstdc++
+
#include <utility>
#include <type_traits>
#include <cassert>
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp
index b6431b56d5f0..c3efe72fe7db 100644
--- a/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp
@@ -14,5 +14,8 @@
// UNSUPPORTED: c++98, c++03, c++11
+// This test hangs during recursive template instantiation with libstdc++
+// UNSUPPORTED: libstdc++
+
#define _LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE
#include "make_integer_seq.fail.cpp"
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
index 490fdf5d332b..ab8179c5ab4d 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
@@ -17,6 +17,7 @@
// };
#include <memory>
+#include <cstdint>
#include <cassert>
template <class T>
@@ -27,12 +28,12 @@ struct A
value_type* allocate(std::size_t n)
{
assert(n == 10);
- return (value_type*)0xDEADBEEF;
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xDEADBEEF));
}
};
int main()
{
A<int> a;
- assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF);
+ assert(std::allocator_traits<A<int> >::allocate(a, 10) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
index 079db3526ac7..808284261f7d 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
@@ -17,8 +17,11 @@
// };
#include <memory>
+#include <cstdint>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -27,7 +30,7 @@ struct A
value_type* allocate(std::size_t n)
{
assert(n == 10);
- return (value_type*)0xDEADBEEF;
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xDEADBEEF));
}
};
@@ -39,22 +42,22 @@ struct B
value_type* allocate(std::size_t n)
{
assert(n == 12);
- return (value_type*)0xEEADBEEF;
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xEEADBEEF));
}
value_type* allocate(std::size_t n, const void* p)
{
assert(n == 11);
assert(p == 0);
- return (value_type*)0xFEADBEEF;
+ return reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xFEADBEEF));
}
};
int main()
{
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
A<int> a;
- assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF);
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+ assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
+#endif
B<int> b;
- assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF);
+ assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF)));
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
index 634019758e70..46075f62c6c1 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
@@ -22,6 +22,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -36,14 +38,14 @@ struct B
{
typedef T value_type;
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
template <class U, class ...Args>
void construct(U* p, Args&& ...args)
{
++b_construct;
::new ((void*)p) U(std::forward<Args>(args)...);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif
};
struct A0
@@ -105,7 +107,7 @@ int main()
std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
assert(A2::count == 1);
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
{
A0::count = 0;
b_construct = 0;
@@ -139,5 +141,5 @@ int main()
assert(A2::count == 1);
assert(b_construct == 1);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
index b137dc6d36c3..8176d8b3767a 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
@@ -17,6 +17,7 @@
// };
#include <memory>
+#include <cstdint>
#include <cassert>
int called = 0;
@@ -28,7 +29,7 @@ struct A
void deallocate(value_type* p, std::size_t n)
{
- assert(p == (value_type*)0xDEADBEEF);
+ assert(p == reinterpret_cast<value_type*>(static_cast<std::uintptr_t>(0xDEADBEEF)));
assert(n == 10);
++called;
}
@@ -37,6 +38,6 @@ struct A
int main()
{
A<int> a;
- std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
+ std::allocator_traits<A<int> >::deallocate(a, reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF)), 10);
assert(called == 1);
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
index 54726c929efe..2ee64b8b4a07 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
@@ -22,6 +22,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -63,7 +65,7 @@ int main()
std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
assert(A0::count == 1);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
A0::count = 0;
b_destroy = 0;
@@ -76,5 +78,5 @@ int main()
assert(A0::count == 1);
assert(b_destroy == 1);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
index bbc6b470174d..d2c9a9826e14 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
@@ -43,7 +43,15 @@ struct B
int main()
{
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+ {
+ B<int> b;
+ assert(std::allocator_traits<B<int> >::max_size(b) == 100);
+ }
+ {
+ const B<int> b = {};
+ assert(std::allocator_traits<B<int> >::max_size(b) == 100);
+ }
+#if TEST_STD_VER >= 11
{
A<int> a;
assert(std::allocator_traits<A<int> >::max_size(a) ==
@@ -54,16 +62,6 @@ int main()
assert(std::allocator_traits<A<int> >::max_size(a) ==
std::numeric_limits<std::size_t>::max() / sizeof(int));
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
- {
- B<int> b;
- assert(std::allocator_traits<B<int> >::max_size(b) == 100);
- }
- {
- const B<int> b = {};
- assert(std::allocator_traits<B<int> >::max_size(b) == 100);
- }
-#if TEST_STD_VER >= 11
{
std::allocator<int> a;
static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, "");
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
index 29fe2be126f3..2e9703037894 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
@@ -22,6 +22,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -55,7 +57,7 @@ int main()
const A<int> a(0);
assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
}
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER >= 11
{
B<int> b;
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
@@ -64,5 +66,5 @@ int main()
const B<int> b(0);
assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
}
diff --git a/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp b/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp
index 87da9a0a85da..af4f5bc3fb46 100644
--- a/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
struct ReboundA {};
@@ -63,17 +65,17 @@ struct E
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
-#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#else
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
-#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#endif
}
diff --git a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
index bd32bc34e7a0..2831399c3047 100644
--- a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
+++ b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
@@ -38,16 +38,38 @@ private:
typedef int allocator_type;
};
+template <bool Expected, class T, class A>
+void
+test()
+{
+ static_assert((std::uses_allocator<T, A>::value == Expected), "");
+#if TEST_STD_VER > 14
+ static_assert((std::uses_allocator_v<T, A> == Expected), "");
+#endif
+}
+
int main()
{
- static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
- static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
- static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
- static_assert(( std::uses_allocator<B, double>::value), "");
- static_assert((!std::uses_allocator<C, decltype(C::allocator_type)>::value), "");
- static_assert((!std::uses_allocator<D, decltype(D::allocator_type)>::value), "");
+ test<false, int, std::allocator<int> >();
+ test<true, std::vector<int>, std::allocator<int> >();
+ test<false, A, std::allocator<int> >();
+ test<false, B, std::allocator<int> >();
+ test<true, B, double>();
+ test<false, C, decltype(C::allocator_type)>();
+ test<false, D, decltype(D::allocator_type)>();
#if TEST_STD_VER >= 11
- static_assert((!std::uses_allocator<E, int>::value), "");
+ test<false, E, int>();
#endif
+
+
+// static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
+// static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
+// static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
+// static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
+// static_assert(( std::uses_allocator<B, double>::value), "");
+// static_assert((!std::uses_allocator<C, decltype(C::allocator_type)>::value), "");
+// static_assert((!std::uses_allocator<D, decltype(D::allocator_type)>::value), "");
+// #if TEST_STD_VER >= 11
+// static_assert((!std::uses_allocator<E, int>::value), "");
+// #endif
}
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
index dc0bdd047c61..768d41878437 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <memory>
// allocator:
@@ -16,6 +16,8 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
template <typename T>
void test_max(size_t count)
{
@@ -27,23 +29,19 @@ void test_max(size_t count)
}
}
-int main()
+template <typename T>
+void test()
{
- { // Bug 26812 -- allocating too large
- typedef double T;
- std::allocator<T> a;
- test_max<T> (a.max_size() + 1); // just barely too large
- test_max<T> (a.max_size() * 2); // significantly too large
- test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
- test_max<T> ((size_t) -1); // way too large
- }
+ // Bug 26812 -- allocating too large
+ std::allocator<T> a;
+ test_max<T> (a.max_size() + 1); // just barely too large
+ test_max<T> (a.max_size() * 2); // significantly too large
+ test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
+ test_max<T> ((size_t) -1); // way too large
+}
- {
- typedef const double T;
- std::allocator<T> a;
- test_max<T> (a.max_size() + 1); // just barely too large
- test_max<T> (a.max_size() * 2); // significantly too large
- test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
- test_max<T> ((size_t) -1); // way too large
- }
+int main()
+{
+ test<double>();
+ LIBCPP_ONLY(test<const double>());
}
diff --git a/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
index cba32103dcd4..7f25e57765d4 100644
--- a/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
@@ -32,6 +32,8 @@
#include <type_traits>
#include <cstddef>
+#include "test_macros.h"
+
int main()
{
static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
@@ -45,7 +47,7 @@ int main()
std::allocator<int> >::value), "");
static_assert((std::is_same<std::allocator< char>::is_always_equal, std::true_type>::value), "");
- static_assert((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
std::allocator<char> a;
std::allocator<char> a2 = a;
diff --git a/test/std/utilities/memory/pointer.traits/rebind.pass.cpp b/test/std/utilities/memory/pointer.traits/rebind.pass.cpp
index 8716c05f3335..4caf4f650297 100644
--- a/test/std/utilities/memory/pointer.traits/rebind.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/rebind.pass.cpp
@@ -19,9 +19,11 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
#else
static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
new file mode 100644
index 000000000000..81f49eaac39b
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/addressof.temp.fail.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <ObjectType T> T* addressof(T&& r) = delete;
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if TEST_STD_VER > 14
+ const int *p = std::addressof<const int>(0);
+#else
+#error
+#endif
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
index a371f8eda1a8..41f06c519609 100644
--- a/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.addressof/constexpr_addressof.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: gcc
+// XFAIL: gcc-4, gcc-5, gcc-6
// <memory>
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.pass.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.pass.cpp
new file mode 100644
index 000000000000..2ad9d04e59b7
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt>
+// void destroy(ForwardIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static void reset() { count = 0; }
+ Counted() { ++count; }
+ Counted(Counted const&) { ++count; }
+ ~Counted() { --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+
+int main()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ std::uninitialized_fill(p, p+N, Counted());
+ assert(Counted::count == 5);
+ std::destroy(p, p+1);
+ p += 1;
+ assert(Counted::count == 4);
+ std::destroy(It(p), It(p + 4));
+ assert(Counted::count == 0);
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp
new file mode 100644
index 000000000000..4e67b1eceb57
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class _Tp>
+// void destroy_at(_Tp*);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+struct Counted {
+ static int count;
+ static void reset() { count = 0; }
+ Counted() { ++count; }
+ Counted(Counted const&) { ++count; }
+ ~Counted() { --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+
+struct VCounted {
+ static int count;
+ static void reset() { count = 0; }
+ VCounted() { ++count; }
+ VCounted(VCounted const&) { ++count; }
+ virtual ~VCounted() { --count; }
+ friend void operator&(VCounted) = delete;
+};
+int VCounted::count = 0;
+
+struct DCounted : VCounted {
+ friend void operator&(DCounted) = delete;
+};
+
+int main()
+{
+ {
+ void* mem1 = std::malloc(sizeof(Counted));
+ void* mem2 = std::malloc(sizeof(Counted));
+ assert(mem1 && mem2);
+ assert(Counted::count == 0);
+ Counted* ptr1 = ::new(mem1) Counted();
+ Counted* ptr2 = ::new(mem2) Counted();
+ assert(Counted::count == 2);
+ std::destroy_at(ptr1);
+ assert(Counted::count == 1);
+ std::destroy_at(ptr2);
+ assert(Counted::count == 0);
+ std::free(mem1);
+ std::free(mem2);
+ }
+ {
+ void* mem1 = std::malloc(sizeof(DCounted));
+ void* mem2 = std::malloc(sizeof(DCounted));
+ assert(mem1 && mem2);
+ assert(DCounted::count == 0);
+ DCounted* ptr1 = ::new(mem1) DCounted();
+ DCounted* ptr2 = ::new(mem2) DCounted();
+ assert(DCounted::count == 2);
+ assert(VCounted::count == 2);
+ std::destroy_at(ptr1);
+ assert(VCounted::count == 1);
+ std::destroy_at(ptr2);
+ assert(VCounted::count == 0);
+ std::free(mem1);
+ std::free(mem2);
+ }
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_n.pass.cpp
new file mode 100644
index 000000000000..d1eaca558a73
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_n.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt, class Size>
+// ForwardIt destroy_n(ForwardIt, Size s);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static void reset() { count = 0; }
+ Counted() { ++count; }
+ Counted(Counted const&) { ++count; }
+ ~Counted() { --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+
+int main()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ std::uninitialized_fill(p, p+N, Counted());
+ assert(Counted::count == 5);
+ Counted* np = std::destroy_n(p, 1);
+ assert(np == p+1);
+ assert(Counted::count == 4);
+ p += 1;
+ It it = std::destroy_n(It(p), 4);
+ assert(it == It(p+4));
+ assert(Counted::count == 0);
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp
new file mode 100644
index 000000000000..533d516707e1
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt>
+// void uninitialized_default_construct(ForwardIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted() { ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted() {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { assert(count > 0); --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_default_construct(It(p), It(p+N));
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 0);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+#endif
+}
+
+void test_counted()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ std::uninitialized_default_construct(It(p), It(p+1));
+ assert(Counted::count == 1);
+ assert(Counted::constructed = 1);
+ std::uninitialized_default_construct(It(p+1), It(p+N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+void test_value_initialized()
+{
+ using It = forward_iterator<int*>;
+ const int N = 5;
+ int pool[N] = {-1, -1, -1, -1, -1};
+ int* p = pool;
+ std::uninitialized_default_construct(It(p), It(p+1));
+ assert(pool[0] == -1);
+ assert(pool[1] == -1);
+ std::uninitialized_default_construct(It(p+1), It(p+N));
+ assert(pool[1] == -1);
+ assert(pool[2] == -1);
+ assert(pool[3] == -1);
+ assert(pool[4] == -1);
+}
+
+int main()
+{
+ test_counted();
+ test_value_initialized();
+ test_ctor_throws();
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp
new file mode 100644
index 000000000000..f22a74f1f832
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt>
+// void uninitialized_default_construct(ForwardIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted() { ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { assert(count > 0); --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted() {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { assert(count > 0); --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_default_construct_n(It(p), N);
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 0);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+#endif
+}
+
+void test_counted()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ It e = std::uninitialized_default_construct_n(It(p), 1);
+ assert(e == It(p+1));
+ assert(Counted::count == 1);
+ assert(Counted::constructed = 1);
+ e = std::uninitialized_default_construct_n(It(p+1), 4);
+ assert(e == It(p+N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+void test_value_initialized()
+{
+ using It = forward_iterator<int*>;
+ const int N = 5;
+ int pool[N] = {-1, -1, -1, -1, -1};
+ int* p = pool;
+ auto e = std::uninitialized_default_construct_n(It(p), 1);
+ assert(e == It(p+1));
+ assert(pool[0] == -1);
+ assert(pool[1] == -1);
+ e = std::uninitialized_default_construct_n(It(p+1), 4);
+ assert(e == It(p+N));
+ assert(pool[1] == -1);
+ assert(pool[2] == -1);
+ assert(pool[3] == -1);
+ assert(pool[4] == -1);
+}
+
+
+int main()
+{
+ test_counted();
+ test_value_initialized();
+ test_ctor_throws();
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp
new file mode 100644
index 000000000000..c2d860694a75
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt>
+// void uninitialized_value_construct(ForwardIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted() { ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { assert(count > 0); --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted() {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { assert(count > 0); --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_value_construct(It(p), It(p+N));
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 0);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+#endif
+}
+
+void test_counted()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ std::uninitialized_value_construct(It(p), It(p+1));
+ assert(Counted::count == 1);
+ assert(Counted::constructed = 1);
+ std::uninitialized_value_construct(It(p+1), It(p+N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+void test_value_initialized()
+{
+ using It = forward_iterator<int*>;
+ const int N = 5;
+ int pool[N] = {-1, -1, -1, -1, -1};
+ int* p = pool;
+ std::uninitialized_value_construct(It(p), It(p+1));
+ assert(pool[0] == 0);
+ assert(pool[1] == -1);
+ std::uninitialized_value_construct(It(p+1), It(p+N));
+ assert(pool[1] == 0);
+ assert(pool[2] == 0);
+ assert(pool[3] == 0);
+ assert(pool[4] == 0);
+}
+
+int main()
+{
+ test_counted();
+ test_value_initialized();
+ test_ctor_throws();
+}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
new file mode 100644
index 000000000000..323d00f7c9c4
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class ForwardIt>
+// void uninitialized_value_construct(ForwardIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted() { ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { --count; }
+ friend void operator&(Counted) = delete;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted() {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_value_construct_n(It(p), N);
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 3);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+ std::destroy(p, p+3);
+ assert(ThrowsCounted::count == 0);
+#endif
+}
+
+void test_counted()
+{
+ using It = forward_iterator<Counted*>;
+ const int N = 5;
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ It e = std::uninitialized_value_construct_n(It(p), 1);
+ assert(e == It(p+1));
+ assert(Counted::count == 1);
+ assert(Counted::constructed = 1);
+ e = std::uninitialized_value_construct_n(It(p+1), 4);
+ assert(e == It(p+N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+void test_value_initialized()
+{
+ using It = forward_iterator<int*>;
+ const int N = 5;
+ int pool[N] = {-1, -1, -1, -1, -1};
+ int* p = pool;
+ It e = std::uninitialized_value_construct_n(It(p), 1);
+ assert(e == It(p+1));
+ assert(pool[0] == 0);
+ assert(pool[1] == -1);
+ e = std::uninitialized_value_construct_n(It(p+1), 4);
+ assert(e == It(p+N));
+ assert(pool[1] == 0);
+ assert(pool[2] == 0);
+ assert(pool[3] == 0);
+ assert(pool[4] == 0);
+}
+
+int main()
+{
+ test_counted();
+ test_value_initialized();
+} \ No newline at end of file
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
index 1debd6d75ff0..1829dff354d3 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class ForwardIterator>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -49,6 +56,7 @@ int main()
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy(b, b+N, bp);
@@ -58,6 +66,7 @@ int main()
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
index 83aa19471ada..af20cd220291 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -49,6 +56,7 @@ int main()
B* bp = (B*)pool;
B b[N];
assert(B::population_ == N);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_copy_n(b, 5, bp);
@@ -58,6 +66,7 @@ int main()
{
assert(B::population_ == N);
}
+#endif
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
index 5f90a3792064..862e5be8e363 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class Size, class T>
@@ -17,13 +16,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -47,6 +54,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill_n(bp, 5, B());
@@ -56,6 +64,7 @@ int main()
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
B* r = std::uninitialized_fill_n(bp, 2, B());
assert(r == bp + 2);
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
index 3816a2528688..57438e9cb0d5 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class T>
@@ -18,13 +17,21 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count_;
static int population_;
int data_;
explicit B() : data_(1) { ++population_; }
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ B(const B &b) {
+ ++count_;
+ if (count_ == 3)
+ TEST_THROW(1);
+ data_ = b.data_;
+ ++population_;
+ }
~B() {data_ = 0; --population_; }
};
@@ -48,6 +55,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
assert(B::population_ == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
std::uninitialized_fill(bp, bp+N, B());
@@ -57,6 +65,7 @@ int main()
{
assert(B::population_ == 0);
}
+#endif
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
new file mode 100644
index 000000000000..d7a9542b4c27
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class InputIt, class ForwardIt>
+// ForwardIt uninitialized_move(InputIt, InputIt, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted(int&& x) : value(x) { x = 0; ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { assert(count > 0); --count; }
+ friend void operator&(Counted) = delete;
+ int value;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted(int&& x) {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ x = 0;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { assert(count > 0); --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ int values[N] = {1, 2, 3, 4, 5};
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_move(values, values + N, It(p));
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 0);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+ assert(values[0] == 0);
+ assert(values[1] == 0);
+ assert(values[2] == 0);
+ assert(values[3] == 4);
+ assert(values[4] == 5);
+#endif
+}
+
+void test_counted()
+{
+ using It = input_iterator<int*>;
+ using FIt = forward_iterator<Counted*>;
+ const int N = 5;
+ int values[N] = {1, 2, 3, 4, 5};
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ auto ret = std::uninitialized_move(It(values), It(values + 1), FIt(p));
+ assert(ret == FIt(p +1));
+ assert(Counted::constructed = 1);
+ assert(Counted::count == 1);
+ assert(p[0].value == 1);
+ assert(values[0] == 0);
+ ret = std::uninitialized_move(It(values+1), It(values+N), FIt(p+1));
+ assert(ret == FIt(p + N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ assert(p[1].value == 2);
+ assert(p[2].value == 3);
+ assert(p[3].value == 4);
+ assert(p[4].value == 5);
+ assert(values[1] == 0);
+ assert(values[2] == 0);
+ assert(values[3] == 0);
+ assert(values[4] == 0);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+int main() {
+ test_counted();
+ test_ctor_throws();
+} \ No newline at end of file
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
new file mode 100644
index 000000000000..f27e5726135f
--- /dev/null
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <memory>
+
+// template <class InputIt, class Size, class ForwardIt>
+// pair<InputIt, ForwardIt> uninitialized_move_n(InputIt, Size, ForwardIt);
+
+#include <memory>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+struct Counted {
+ static int count;
+ static int constructed;
+ static void reset() { count = constructed = 0; }
+ explicit Counted(int&& x) : value(x) { x = 0; ++count; ++constructed; }
+ Counted(Counted const&) { assert(false); }
+ ~Counted() { assert(count > 0); --count; }
+ friend void operator&(Counted) = delete;
+ int value;
+};
+int Counted::count = 0;
+int Counted::constructed = 0;
+
+struct ThrowsCounted {
+ static int count;
+ static int constructed;
+ static int throw_after;
+ static void reset() { throw_after = count = constructed = 0; }
+ explicit ThrowsCounted(int&& x) {
+ ++constructed;
+ if (throw_after > 0 && --throw_after == 0) {
+ TEST_THROW(1);
+ }
+ ++count;
+ x = 0;
+ }
+ ThrowsCounted(ThrowsCounted const&) { assert(false); }
+ ~ThrowsCounted() { assert(count > 0); --count; }
+ friend void operator&(ThrowsCounted) = delete;
+};
+int ThrowsCounted::count = 0;
+int ThrowsCounted::constructed = 0;
+int ThrowsCounted::throw_after = 0;
+
+void test_ctor_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using It = forward_iterator<ThrowsCounted*>;
+ const int N = 5;
+ int values[N] = {1, 2, 3, 4, 5};
+ alignas(ThrowsCounted) char pool[sizeof(ThrowsCounted)*N] = {};
+ ThrowsCounted* p = (ThrowsCounted*)pool;
+ try {
+ ThrowsCounted::throw_after = 4;
+ std::uninitialized_move_n(values, N, It(p));
+ assert(false);
+ } catch (...) {}
+ assert(ThrowsCounted::count == 0);
+ assert(ThrowsCounted::constructed == 4); // forth construction throws
+ assert(values[0] == 0);
+ assert(values[1] == 0);
+ assert(values[2] == 0);
+ assert(values[3] == 4);
+ assert(values[4] == 5);
+#endif
+}
+
+void test_counted()
+{
+ using It = input_iterator<int*>;
+ using FIt = forward_iterator<Counted*>;
+ const int N = 5;
+ int values[N] = {1, 2, 3, 4, 5};
+ alignas(Counted) char pool[sizeof(Counted)*N] = {};
+ Counted* p = (Counted*)pool;
+ auto ret = std::uninitialized_move_n(It(values), 1, FIt(p));
+ assert(ret.first == It(values +1));
+ assert(ret.second == FIt(p +1));
+ assert(Counted::constructed = 1);
+ assert(Counted::count == 1);
+ assert(p[0].value == 1);
+ assert(values[0] == 0);
+ ret = std::uninitialized_move_n(It(values+1), N-1, FIt(p+1));
+ assert(ret.first == It(values+N));
+ assert(ret.second == FIt(p + N));
+ assert(Counted::count == 5);
+ assert(Counted::constructed == 5);
+ assert(p[1].value == 2);
+ assert(p[2].value == 3);
+ assert(p[3].value == 4);
+ assert(p[4].value == 5);
+ assert(values[1] == 0);
+ assert(values[2] == 0);
+ assert(values[3] == 0);
+ assert(values[4] == 0);
+ std::destroy(p, p+N);
+ assert(Counted::count == 0);
+}
+
+int main()
+{
+ test_counted();
+ test_ctor_throws();
+} \ No newline at end of file
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 914802423ce7..3df8dd0eded0 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -13,6 +13,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
#include <MoveOnly.h>
int A_constructed = 0;
@@ -46,7 +47,7 @@ int main()
assert(A_constructed == i+1);
}
}
-#if _LIBCPP_STD_VER >= 14
+#if TEST_STD_VER >= 14
{
typedef MoveOnly S;
typedef std::aligned_storage<3*sizeof(S), std::alignment_of<S>::value>::type
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp
index a611b1a12f05..2949d6310c59 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp
@@ -24,4 +24,5 @@ int main()
{
std::default_delete<int[]> d1;
std::default_delete<const int[]> d2 = d1;
+ ((void)d2);
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
index 6d752b9951a5..50389978e8ab 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
@@ -16,6 +16,8 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
class Deleter
{
int state_;
@@ -36,9 +38,18 @@ int main()
Deleter d;
assert(d.state() == 0);
{
+ std::unique_ptr<int[], Deleter&> p(nullptr, d);
+ assert(p.get() == 0);
+ assert(&p.get_deleter() == &d);
+ }
+#if defined(_LIBCPP_VERSION)
+ {
+ // The standard only requires the constructor accept nullptr, but libc++
+ // also supports the literal 0.
std::unique_ptr<int[], Deleter&> p(0, d);
assert(p.get() == 0);
assert(&p.get_deleter() == &d);
}
+#endif
assert(d.state() == 0);
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
index 5720d3bd288f..89b6fa248845 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
@@ -38,7 +38,7 @@ source1()
return std::unique_ptr<A[]>(new A[3]);
}
-void sink1(std::unique_ptr<A[]> p)
+void sink1(std::unique_ptr<A[]>)
{
}
@@ -48,7 +48,7 @@ source2()
return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
}
-void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
+void sink2(std::unique_ptr<A[], Deleter<A[]> >)
{
}
@@ -59,7 +59,7 @@ source3()
return std::unique_ptr<A[], NCDeleter<A[]>&>(new A[3], d);
}
-void sink3(std::unique_ptr<A[], NCDeleter<A[]>&> p)
+void sink3(std::unique_ptr<A[], NCDeleter<A[]>&>)
{
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
index 2b0b5f0d945d..3de556563f97 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
@@ -42,7 +42,9 @@ int main()
assert(A::count == 0);
{ // LWG#2520 says that nullptr is a valid input as well as null
+#ifdef _LIBCPP_VERSION
std::unique_ptr<A[], Deleter<A[]> > s1(NULL, Deleter<A[]>());
+#endif
std::unique_ptr<A[], Deleter<A[]> > s2(nullptr, Deleter<A[]>());
}
assert(A::count == 0);
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
index e14bba0763c5..016eadcb2460 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// unique_ptr
@@ -46,17 +48,10 @@ template <class T>
class Deleter
{
int state_;
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@@ -64,20 +59,9 @@ public:
r.state_ = 0;
return *this;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter() : state_(5) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
@@ -87,12 +71,7 @@ private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
@@ -102,17 +81,6 @@ public:
int main()
{
- {
- const std::unique_ptr<B, Deleter<B> > s(new B);
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+ const std::unique_ptr<B, Deleter<B> > s;
+ std::unique_ptr<A, Deleter<A> > s2(s); // expected-error {{no matching constructor}}
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
index bcf94a978144..1b8bb736df20 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// unique_ptr
@@ -47,16 +49,9 @@ class Deleter
{
int state_;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@@ -64,20 +59,9 @@ public:
r.state_ = 0;
return *this;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter() : state_(5) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
@@ -87,12 +71,7 @@ private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
@@ -102,17 +81,6 @@ public:
int main()
{
- {
- const std::unique_ptr<B, Deleter<B> > s(new B);
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+ const std::unique_ptr<B, Deleter<B> > s;
+ std::unique_ptr<A, Deleter<A> > s2 = s; // expected-error {{no viable conversion}}
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
index 93956bcae663..20275de603e2 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// shared_ptr
@@ -42,7 +44,6 @@ int A::count = 0;
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@@ -119,5 +120,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
index 4194890dda2d..4a85633a89ad 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// shared_ptr
@@ -42,7 +44,6 @@ int A::count = 0;
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
std::shared_ptr<A> pA(new A);
A* ptrA = pA.get();
@@ -119,5 +120,4 @@ int main()
}
assert(B::count == 0);
assert(A::count == 0);
-#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
index 41aeb04a5feb..2e6441d66316 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <memory>
// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
index 85fc5e930544..009b4cfc00f9 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: sanitizer-new-delete
// <memory>
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
index c72847791778..388599bd7015 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// <memory>
// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
index 70af2964113d..7b40d6df2164 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: sanitizer-new-delete
// <memory>
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
index 2fa975eca833..182d5f4a4937 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: sanitizer-new-delete
// <memory>
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
index f041d9451a6d..ea0720404b48 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// shared_ptr
@@ -17,6 +19,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count;
@@ -66,24 +70,24 @@ int main()
std::shared_ptr<B> pB(std::move(pA));
assert(B::count == 1);
assert(A::count == 1);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
assert(pB.use_count() == 1);
assert(pA.use_count() == 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else
assert(pB.use_count() == 2);
assert(pA.use_count() == 2);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
assert(p == pB.get());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(B::count == 0);
assert(A::count == 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else
assert(pA.use_count() == 1);
assert(B::count == 1);
assert(A::count == 1);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
assert(B::count == 0);
assert(A::count == 0);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
index b89178e201cf..257d3ce19be3 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <memory>
// shared_ptr
@@ -16,6 +18,8 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct A
{
static int count;
@@ -37,22 +41,22 @@ int main()
A* p = pA.get();
std::shared_ptr<A> pA2(std::move(pA));
assert(A::count == 1);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(pA2.use_count() == 1);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else
assert(pA.use_count() == 2);
assert(pA2.use_count() == 2);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
assert(pA2.get() == p);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
assert(pA.use_count() == 0);
assert(A::count == 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else
assert(pA.use_count() == 1);
assert(A::count == 1);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
assert(A::count == 0);
{
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index 5c424f5c7428..877577c9ce58 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: sanitizer-new-delete
// <memory>
@@ -63,6 +62,7 @@ int main()
assert(p.get() == raw_ptr);
assert(ptr.get() == 0);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
assert(A::count == 0);
{
std::unique_ptr<A> ptr(new A);
@@ -86,6 +86,7 @@ int main()
#endif
}
}
+#endif
assert(A::count == 0);
{ // LWG 2399
fn(std::unique_ptr<int>(new int));
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
index 35a7d077b424..830aa5bbca4c 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// <memory>
// shared_ptr
@@ -17,6 +16,8 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count;
@@ -42,6 +43,7 @@ int A::count = 0;
int main()
{
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::weak_ptr<A> wp;
try
@@ -54,6 +56,7 @@ int main()
}
assert(A::count == 0);
}
+#endif
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
@@ -63,6 +66,7 @@ int main()
assert(A::count == 1);
}
assert(A::count == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
{
std::shared_ptr<A> sp0(new A);
std::weak_ptr<A> wp(sp0);
@@ -77,4 +81,5 @@ int main()
}
}
assert(A::count == 0);
+#endif
}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
index 8cb972b0c1a1..8d782716b94f 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -16,6 +16,7 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
struct A
@@ -65,7 +66,7 @@ int main()
assert(p2.get());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
nc = globalMemCounter.outstanding_new;
{
char c = 'e';
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
index 75bf3df90aa3..90f958e26852 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
@@ -18,6 +18,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
struct B
{
static int count;
@@ -55,7 +57,7 @@ int C::count = 0;
template <class T>
std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
template <class T>
void sink (std::weak_ptr<T> &&) {}
#endif
@@ -100,7 +102,7 @@ int main()
assert(B::count == 0);
assert(A::count == 0);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
std::shared_ptr<A> ps(new A);
std::weak_ptr<A> pA = source(ps);
diff --git a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp
index 335305a28236..51a837e4e032 100644
--- a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp
+++ b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp
@@ -14,6 +14,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::integral_constant<int, 5> _5;
@@ -26,7 +28,7 @@ int main()
assert(_5() == 5);
#endif
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert ( _5{}() == 5, "" );
static_assert ( std::true_type{}(), "" );
#endif
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp
index 28bbedee1749..f7902a2be775 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp
@@ -13,13 +13,15 @@
#include <type_traits>
+#include "test_macros.h"
+
enum Enum {zero, one_};
template <class T, class U>
void test_remove_all_extents()
{
static_assert((std::is_same<typename std::remove_all_extents<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_all_extents_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp
index c688c26b9a5b..aa175d9ebc8c 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp
@@ -13,13 +13,15 @@
#include <type_traits>
+#include "test_macros.h"
+
enum Enum {zero, one_};
template <class T, class U>
void test_remove_extent()
{
static_assert((std::is_same<typename std::remove_extent<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_extent_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp
index 19b1fb4d01b3..ef1aa8acbc68 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_add_const_imp()
{
static_assert((std::is_same<typename std::add_const<T>::type, const U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_const_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp
index 4905e518e12a..c0c2483e4c40 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_add_cv_imp()
{
static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_cv_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp
index 7a12c44a2c6e..f29fb06cd807 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_add_volatile_imp()
{
static_assert((std::is_same<typename std::add_volatile<T>::type, volatile U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::add_volatile_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp
index cd2faf786d80..426d22d29f67 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_remove_const_imp()
{
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_const_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp
index 3f6405c8280c..a6ce05756ef6 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_remove_cv_imp()
{
static_assert((std::is_same<typename std::remove_cv<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_cv_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp
index 6258a9039b40..90b8d4bcbea2 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_remove_volatile_imp()
{
static_assert((std::is_same<typename std::remove_volatile<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::remove_volatile_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp
index ae849ca54558..43f23f5ccc80 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp
@@ -13,12 +13,14 @@
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
{
typedef std::aligned_union<10, char >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, char>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 1, "");
@@ -26,7 +28,7 @@ int main()
}
{
typedef std::aligned_union<10, short >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, short>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -34,7 +36,7 @@ int main()
}
{
typedef std::aligned_union<10, int >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, int>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -42,7 +44,7 @@ int main()
}
{
typedef std::aligned_union<10, double >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, double>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@@ -50,7 +52,7 @@ int main()
}
{
typedef std::aligned_union<10, short, char >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, short, char>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -58,7 +60,7 @@ int main()
}
{
typedef std::aligned_union<10, char, short >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<10, char, short>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -66,7 +68,7 @@ int main()
}
{
typedef std::aligned_union<2, int, char, short >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<2, int, char, short>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -74,7 +76,7 @@ int main()
}
{
typedef std::aligned_union<2, char, int, short >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<2, char, int, short >, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -82,7 +84,7 @@ int main()
}
{
typedef std::aligned_union<2, char, short, int >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_union_t<2, char, short, int >, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
index e8611253c5d4..61523e4872d4 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
@@ -12,6 +12,7 @@
// common_type
#include <type_traits>
+#include <memory>
#include "test_macros.h"
@@ -30,15 +31,198 @@ namespace std
{
typedef S<T> type;
};
+
+ template <class T>
+ struct common_type< ::S<T>, T> {
+ typedef S<T> type;
+ };
+
+ template <> struct common_type< ::S<long>, long> {};
+ template <> struct common_type<long, ::S<long> > {};
}
#if TEST_STD_VER >= 11
-template <class T, class U, class = void>
-struct no_common_type : std::true_type {};
+template <class Tp>
+struct always_bool_imp { using type = bool; };
+template <class Tp> using always_bool = typename always_bool_imp<Tp>::type;
+
+template <class ...Args>
+constexpr auto no_common_type_imp(int)
+ -> always_bool<typename std::common_type<Args...>::type>
+ { return false; }
+
+template <class ...Args>
+constexpr bool no_common_type_imp(long) { return true; }
+
+template <class ...Args>
+using no_common_type = std::integral_constant<bool, no_common_type_imp<Args...>(0)>;
+
+template <class Tp>
+using Decay = typename std::decay<Tp>::type;
+
+template <class ...Args>
+using CommonType = typename std::common_type<Args...>::type;
+
+template <class T1, class T2>
+struct TernaryOpImp {
+ static_assert(std::is_same<Decay<T1>, T1>::value, "must be same");
+ static_assert(std::is_same<Decay<T2>, T2>::value, "must be same");
+ using type = typename std::decay<
+ decltype(false ? std::declval<T1>() : std::declval<T2>())
+ >::type;
+};
+
+template <class T1, class T2>
+using TernaryOp = typename TernaryOpImp<T1, T2>::type;
+
+// -- If sizeof...(T) is zero, there shall be no member type.
+void test_bullet_one() {
+ static_assert(no_common_type<>::value, "");
+}
+
+// If sizeof...(T) is one, let T0 denote the sole type constituting the pack T.
+// The member typedef-name type shall denote the same type as decay_t<T0>.
+void test_bullet_two() {
+ static_assert(std::is_same<CommonType<void>, void>::value, "");
+ static_assert(std::is_same<CommonType<int>, int>::value, "");
+ static_assert(std::is_same<CommonType<int const>, int>::value, "");
+ static_assert(std::is_same<CommonType<int volatile[]>, int volatile*>::value, "");
+ static_assert(std::is_same<CommonType<void(&)()>, void(*)()>::value, "");
+}
+
+template <class T, class U, class Expect>
+void test_bullet_three_one_imp() {
+ using DT = Decay<T>;
+ using DU = Decay<U>;
+ static_assert(!std::is_same<T, DT>::value || !std::is_same<U, DU>::value, "");
+ static_assert(std::is_same<CommonType<T, U>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<U, T>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<T, U>, CommonType<DT, DU>>::value, "");
+}
+
+// (3.3)
+// -- If sizeof...(T) is two, let the first and second types constituting T be
+// denoted by T1 and T2, respectively, and let D1 and D2 denote the same types
+// as decay_t<T1> and decay_t<T2>, respectively.
+// (3.3.1)
+// -- If is_same_v<T1, D1> is false or is_same_v<T2, D2> is false, let C
+// denote the same type, if any, as common_type_t<D1, D2>.
+void test_bullet_three_one() {
+ // Test that the user provided specialization of common_type is used after
+ // decaying T1.
+ {
+ using T1 = S<int> const;
+ using T2 = int;
+ test_bullet_three_one_imp<T1, T2, S<int> >();
+ }
+ // Test a user provided specialization that does not provide a typedef.
+ {
+ using T1 = ::S<long> const;
+ using T2 = long;
+ static_assert(no_common_type<T1, T2>::value, "");
+ static_assert(no_common_type<T2, T1>::value, "");
+ }
+ // Test that the ternary operator is not applied when the types are the
+ // same.
+ {
+ using T1 = const void;
+ using Expect = void;
+ static_assert(std::is_same<CommonType<T1, T1>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<T1, T1>, CommonType<T1>>::value, "");
+ }
+ {
+ using T1 = int const[];
+ using Expect = int const*;
+ static_assert(std::is_same<CommonType<T1, T1>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<T1, T1>, CommonType<T1>>::value, "");
+ }
+}
-template <class T, class U>
-struct no_common_type<T, U, typename std::conditional<false,
- typename std::common_type<T, U>::type, void>::type> : std::false_type {};
+// (3.3)
+// -- If sizeof...(T) is two, let the first and second types constituting T be
+// denoted by T1 and T2, respectively, and let D1 and D2 denote the same types
+// as decay_t<T1> and decay_t<T2>, respectively.
+// (3.3.1)
+// -- If [...]
+// (3.3.2)
+// -- Otherwise, let C denote the same type, if any, as
+// decay_t<decltype(false ? declval<D1>() : declval<D2>())>
+void test_bullet_three_two() {
+ {
+ using T1 = int const*;
+ using T2 = int*;
+ using Expect = TernaryOp<T1, T2>;
+ static_assert(std::is_same<CommonType<T1, T2>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<T2, T1>, Expect>::value, "");
+ }
+ // Test that there is no ::type member when the ternary op is ill-formed
+ {
+ using T1 = int;
+ using T2 = void;
+ static_assert(no_common_type<T1, T2>::value, "");
+ static_assert(no_common_type<T2, T1>::value, "");
+ }
+ {
+ using T1 = int;
+ using T2 = X<int>;
+ static_assert(no_common_type<T1, T2>::value, "");
+ static_assert(no_common_type<T2, T1>::value, "");
+ }
+ // Test that the ternary operator is not applied when the types are the
+ // same.
+ {
+ using T1 = void;
+ using Expect = void;
+ static_assert(std::is_same<CommonType<T1, T1>, Expect>::value, "");
+ static_assert(std::is_same<CommonType<T1, T1>, CommonType<T1>>::value, "");
+ }
+}
+
+// (3.4)
+// -- If sizeof...(T) is greater than two, let T1, T2, and R, respectively,
+// denote the first, second, and (pack of) remaining types constituting T.
+// Let C denote the same type, if any, as common_type_t<T1, T2>. If there is
+// such a type C, the member typedef-name type shall denote the
+// same type, if any, as common_type_t<C, R...>. Otherwise, there shall be
+// no member type.
+void test_bullet_four() {
+ { // test that there is no ::type member
+ static_assert(no_common_type<int, E>::value, "");
+ static_assert(no_common_type<int, int, E>::value, "");
+ static_assert(no_common_type<int, int, E, int>::value, "");
+ static_assert(no_common_type<int, int, int, E>::value, "");
+ }
+}
+
+
+// The example code specified in Note B for common_type
+namespace note_b_example {
+
+using PF1 = bool (&)();
+using PF2 = short (*)(long);
+
+struct S {
+ operator PF2() const;
+ double operator()(char, int&);
+ void fn(long) const;
+ char data;
+};
+
+using PMF = void (S::*)(long) const;
+using PMD = char S::*;
+
+using std::is_same;
+using std::result_of;
+using std::unique_ptr;
+
+static_assert(is_same<typename result_of<S(int)>::type, short>::value, "Error!");
+static_assert(is_same<typename result_of<S&(unsigned char, int&)>::type, double>::value, "Error!");
+static_assert(is_same<typename result_of<PF1()>::type, bool>::value, "Error!");
+static_assert(is_same<typename result_of<PMF(unique_ptr<S>, int)>::type, void>::value, "Error!");
+static_assert(is_same<typename result_of<PMD(S)>::type, char&&>::value, "Error!");
+static_assert(is_same<typename result_of<PMD(const S*)>::type, const char&>::value, "Error!");
+
+} // namespace note_b_example
#endif // TEST_STD_VER >= 11
int main()
@@ -89,14 +273,15 @@ int main()
static_assert((std::is_same<std::common_type<volatile void, void>::type, void>::value), "");
static_assert((std::is_same<std::common_type<const void, const void>::type, void>::value), "");
-#if TEST_STD_VER >= 11
- static_assert((no_common_type<void, int>::value), "");
- static_assert((no_common_type<int, void>::value), "");
- static_assert((no_common_type<int, E>::value), "");
- static_assert((no_common_type<int, X<int> >::value), "");
-#endif // TEST_STD_VER >= 11
-
static_assert((std::is_same<std::common_type<int, S<int> >::type, S<int> >::value), "");
static_assert((std::is_same<std::common_type<int, S<int>, S<int> >::type, S<int> >::value), "");
static_assert((std::is_same<std::common_type<int, int, S<int> >::type, S<int> >::value), "");
+
+#if TEST_STD_VER >= 11
+ test_bullet_one();
+ test_bullet_two();
+ test_bullet_three_one();
+ test_bullet_three_two();
+ test_bullet_four();
+#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp
index ac11e3a4ce86..7de0a0737905 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
static_assert((std::is_same<std::conditional<true, char, int>::type, char>::value), "");
static_assert((std::is_same<std::conditional<false, char, int>::type, int>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::conditional_t<true, char, int>, char>::value), "");
static_assert((std::is_same<std::conditional_t<false, char, int>, int>::value), "");
#endif
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
index bd8ae0e297bc..bcd839849453 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_decay()
{
static_assert((std::is_same<typename std::decay<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::decay_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp
index eb72b0f393b3..a9b1e1be1274 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
static_assert((std::is_same<std::enable_if<true>::type, void>::value), "");
static_assert((std::is_same<std::enable_if<true, int>::type, int>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::enable_if_t<true>, void>::value), "");
static_assert((std::is_same<std::enable_if_t<true, int>, int>::value), "");
#endif
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
index 1d7b23c19222..410e47e03bcc 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
@@ -21,14 +21,19 @@ enum F { W = UINT_MAX };
int main()
{
+#if !defined(_WIN32) || defined(__MINGW32__)
+ typedef unsigned ExpectUnsigned;
+#else
+ typedef int ExpectUnsigned; // MSVC's ABI doesn't follow the Standard
+#endif
static_assert((std::is_same<std::underlying_type<E>::type, int>::value),
"E has the wrong underlying type");
- static_assert((std::is_same<std::underlying_type<F>::type, unsigned>::value),
+ static_assert((std::is_same<std::underlying_type<F>::type, ExpectUnsigned>::value),
"F has the wrong underlying type");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::underlying_type_t<E>, int>::value), "");
- static_assert((std::is_same<std::underlying_type_t<F>, unsigned>::value), "");
+ static_assert((std::is_same<std::underlying_type_t<F>, ExpectUnsigned>::value), "");
#endif
#if TEST_STD_VER >= 11
@@ -36,7 +41,7 @@ int main()
static_assert((std::is_same<std::underlying_type<G>::type, char>::value),
"G has the wrong underlying type");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::underlying_type_t<G>, char>::value), "");
#endif
#endif // TEST_STD_VER >= 11
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
index fc147c37b1ac..373bad7d6e3c 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// type_traits
// add_rvalue_reference
@@ -16,8 +18,6 @@
#include <type_traits>
#include "test_macros.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class T, class U>
void test_add_rvalue_reference()
{
@@ -44,13 +44,11 @@ void test_function1()
static_assert((std::is_same<std::add_rvalue_reference_t<F>, F>::value), "");
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
struct Foo {};
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_add_rvalue_reference<void, void>();
test_add_rvalue_reference<int, int&&>();
test_add_rvalue_reference<int[3], int(&&)[3]>();
@@ -63,22 +61,17 @@ int main()
// LWG 2101 specifically talks about add_rvalue_reference and functions.
// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
test_function0<void()>();
-#if TEST_STD_VER >= 11
test_function1<void() const>();
test_function1<void() &>();
test_function1<void() &&>();
test_function1<void() const &>();
test_function1<void() const &&>();
-#endif
// But a cv- or ref-qualified member function *is* "a referenceable type"
test_function0<void (Foo::*)()>();
-#if TEST_STD_VER >= 11
test_function0<void (Foo::*)() const>();
test_function0<void (Foo::*)() &>();
test_function0<void (Foo::*)() &&>();
test_function0<void (Foo::*)() const &>();
test_function0<void (Foo::*)() const &&>();
-#endif
-#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
index e335bd19ef2d..1f9ec2476b50 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
@@ -37,11 +37,11 @@ int main()
test_remove_reference<int*&, int*>();
test_remove_reference<const int*&, const int*>();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_remove_reference<int&&, int>();
test_remove_reference<const int&&, const int>();
test_remove_reference<int(&&)[3], int[3]>();
test_remove_reference<int*&&, int*>();
test_remove_reference<const int*&&, const int*>();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
index eb8e31c76e10..06f6e6152aec 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
@@ -13,9 +13,15 @@
#include <type_traits>
+#include "test_macros.h"
+
enum Enum {zero, one_};
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
enum BigEnum
+#endif
{
bigzero,
big = 0xFFFFFFFFFFFFFFFFULL
@@ -32,7 +38,7 @@ template <class T, class U>
void test_make_signed()
{
static_assert((std::is_same<typename std::make_signed<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::make_signed_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
index 984440193fa6..3d152f6049e9 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
@@ -13,9 +13,15 @@
#include <type_traits>
+#include "test_macros.h"
+
enum Enum {zero, one_};
+#if TEST_STD_VER >= 11
+enum BigEnum : unsigned long long // MSVC's ABI doesn't follow the Standard
+#else
enum BigEnum
+#endif
{
bigzero,
big = 0xFFFFFFFFFFFFFFFFULL
@@ -32,7 +38,7 @@ template <class T, class U>
void test_make_unsigned()
{
static_assert((std::is_same<typename std::make_unsigned<T>::type, U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::make_unsigned_t<T>, U>::value), "");
#endif
}
diff --git a/test/std/utilities/meta/meta.unary.prop.query/void_t_feature_test_macro.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/void_t_feature_test_macro.pass.cpp
new file mode 100644
index 000000000000..f188c098c034
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary.prop.query/void_t_feature_test_macro.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// void_t
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
+# ifdef __cpp_lib_void_t
+# error Feature test macro should not be defined!
+# endif
+#else
+# ifndef __cpp_lib_void_t
+# error Feature test macro is not defined
+# endif
+# if __cpp_lib_void_t != 201411
+# error Feature test macro has the wrong value
+# endif
+#endif
+
+int main()
+{
+#if defined(__cpp_lib_void_t)
+ static_assert(std::is_same_v<std::void_t<int>, void>, "");
+#endif
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
index 13cad58c0ef3..5154a1d12936 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
@@ -13,11 +13,13 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void test_lvalue_ref()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
index b0edea37e8e8..cdaf713ac928 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
@@ -14,11 +14,13 @@
#define _LIBCPP_HAS_NO_VARIADICS
#include <type_traits>
+#include "test_macros.h"
+
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
index 99fd2887981f..23d391b490e5 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// type_traits
// rvalue_ref
@@ -39,11 +41,9 @@ struct incomplete_type;
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
// LWG#2582
static_assert(!std::is_rvalue_reference<incomplete_type>::value, "");
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
index 7563c2fd5850..b9b28fd8c3f1 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// type_traits
// rvalue_ref
@@ -27,8 +29,6 @@ void test_rvalue_ref()
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
test_rvalue_ref<int&&>();
test_rvalue_ref<const int&&>();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
index b734a1aa60d8..f4736e713422 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
@@ -43,7 +43,7 @@ void test_is_not_assignable()
struct D;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
struct C
{
template <class U>
@@ -59,6 +59,8 @@ struct E
template <typename T>
struct X { T t; };
+struct Incomplete;
+
int main()
{
test_is_assignable<int&, int&> ();
@@ -67,7 +69,7 @@ int main()
test_is_assignable<B, A> ();
test_is_assignable<void*&, void*> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_is_assignable<E, int> ();
test_is_not_assignable<int, int&> ();
@@ -80,4 +82,5 @@ int main()
// pointer to incomplete template type
test_is_assignable<X<D>*&, X<D>*> ();
+ test_is_not_assignable<Incomplete&, Incomplete const&>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index 9f8fdc7fc635..f6ae401533a9 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -14,9 +14,18 @@
// template <class T, class... Args>
// struct is_constructible;
+// MODULES_DEFINES: _LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE
+#define _LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE
#include <type_traits>
#include "test_macros.h"
+#if TEST_STD_VER >= 11 && defined(_LIBCPP_VERSION)
+#define LIBCPP11_STATIC_ASSERT(...) static_assert(__VA_ARGS__)
+#else
+#define LIBCPP11_STATIC_ASSERT(...) ((void)0)
+#endif
+
+
struct A
{
explicit A(int);
@@ -27,6 +36,9 @@ private:
A(char);
};
+struct Base {};
+struct Derived : public Base {};
+
class Abstract
{
virtual void foo() = 0;
@@ -37,10 +49,38 @@ class AbstractDestructor
virtual ~AbstractDestructor() = 0;
};
+struct PrivateDtor {
+ PrivateDtor(int) {}
+private:
+ ~PrivateDtor() {}
+};
+
+struct S {
+ template <class T>
+#if TEST_STD_VER >= 11
+ explicit
+#endif
+ operator T () const;
+};
+
+template <class To>
+struct ImplicitTo {
+ operator To();
+};
+
+#if TEST_STD_VER >= 11
+template <class To>
+struct ExplicitTo {
+ explicit operator To ();
+};
+#endif
+
+
template <class T>
void test_is_constructible()
{
static_assert( (std::is_constructible<T>::value), "");
+ LIBCPP11_STATIC_ASSERT((std::__libcpp_is_constructible<T>::type::value), "");
#if TEST_STD_VER > 14
static_assert( std::is_constructible_v<T>, "");
#endif
@@ -50,6 +90,7 @@ template <class T, class A0>
void test_is_constructible()
{
static_assert(( std::is_constructible<T, A0>::value), "");
+ LIBCPP11_STATIC_ASSERT((std::__libcpp_is_constructible<T, A0>::type::value), "");
#if TEST_STD_VER > 14
static_assert(( std::is_constructible_v<T, A0>), "");
#endif
@@ -59,6 +100,7 @@ template <class T, class A0, class A1>
void test_is_constructible()
{
static_assert(( std::is_constructible<T, A0, A1>::value), "");
+ LIBCPP11_STATIC_ASSERT((std::__libcpp_is_constructible<T, A0, A1>::type::value), "");
#if TEST_STD_VER > 14
static_assert(( std::is_constructible_v<T, A0, A1>), "");
#endif
@@ -68,6 +110,7 @@ template <class T>
void test_is_not_constructible()
{
static_assert((!std::is_constructible<T>::value), "");
+ LIBCPP11_STATIC_ASSERT((!std::__libcpp_is_constructible<T>::type::value), "");
#if TEST_STD_VER > 14
static_assert((!std::is_constructible_v<T>), "");
#endif
@@ -77,13 +120,28 @@ template <class T, class A0>
void test_is_not_constructible()
{
static_assert((!std::is_constructible<T, A0>::value), "");
+ LIBCPP11_STATIC_ASSERT((!std::__libcpp_is_constructible<T, A0>::type::value), "");
#if TEST_STD_VER > 14
static_assert((!std::is_constructible_v<T, A0>), "");
#endif
}
+#if TEST_STD_VER >= 11
+template <class T = int, class = decltype(static_cast<T&&>(std::declval<double&>()))>
+constexpr bool clang_disallows_valid_static_cast_test(int) { return false; };
+
+constexpr bool clang_disallows_valid_static_cast_test(long) { return true; }
+
+static constexpr bool clang_disallows_valid_static_cast_bug =
+ clang_disallows_valid_static_cast_test(0);
+#endif
+
+
int main()
{
+ typedef Base B;
+ typedef Derived D;
+
test_is_constructible<int> ();
test_is_constructible<int, const int> ();
test_is_constructible<A, int> ();
@@ -97,17 +155,138 @@ int main()
test_is_constructible<A, char> ();
#endif
test_is_not_constructible<A, void> ();
+ test_is_not_constructible<int, void()>();
+ test_is_not_constructible<int, void(&)()>();
+ test_is_not_constructible<int, void() const>();
+ test_is_not_constructible<int&, void>();
+ test_is_not_constructible<int&, void()>();
+ test_is_not_constructible<int&, void() const>();
+ test_is_not_constructible<int&, void(&)()>();
+
test_is_not_constructible<void> ();
+ test_is_not_constructible<const void> (); // LWG 2738
+ test_is_not_constructible<volatile void> ();
+ test_is_not_constructible<const volatile void> ();
test_is_not_constructible<int&> ();
test_is_not_constructible<Abstract> ();
test_is_not_constructible<AbstractDestructor> ();
+ test_is_constructible<int, S>();
+ test_is_not_constructible<int&, S>();
-// LWG 2560 -- postpone this test until bots updated
-// test_is_not_constructible<void()> ();
-#if TEST_STD_VER > 11
-// test_is_not_constructible<void() const> ();
-// test_is_not_constructible<void() volatile> ();
-// test_is_not_constructible<void() &> ();
-// test_is_not_constructible<void() &&> ();
+ test_is_constructible<void(&)(), void(&)()>();
+ test_is_constructible<void(&)(), void()>();
+#if TEST_STD_VER >= 11
+ test_is_constructible<void(&&)(), void(&&)()>();
+ test_is_constructible<void(&&)(), void()>();
+ test_is_constructible<void(&&)(), void(&)()>();
+#endif
+
+#if TEST_STD_VER >= 11
+ test_is_constructible<int const&, int>();
+ test_is_constructible<int const&, int&&>();
+
+ test_is_constructible<int&&, double&>();
+ test_is_constructible<void(&)(), void(&&)()>();
+
+ test_is_not_constructible<int&, int>();
+ test_is_not_constructible<int&, int const&>();
+ test_is_not_constructible<int&, int&&>();
+
+ test_is_constructible<int&&, int>();
+ test_is_constructible<int&&, int&&>();
+ test_is_not_constructible<int&&, int&>();
+ test_is_not_constructible<int&&, int const&&>();
+
+ test_is_constructible<Base, Derived>();
+ test_is_constructible<Base&, Derived&>();
+ test_is_not_constructible<Derived&, Base&>();
+ test_is_constructible<Base const&, Derived const&>();
+ test_is_not_constructible<Derived const&, Base const&>();
+ test_is_not_constructible<Derived const&, Base>();
+
+ test_is_constructible<Base&&, Derived>();
+ test_is_constructible<Base&&, Derived&&>();
+ test_is_not_constructible<Derived&&, Base&&>();
+ test_is_not_constructible<Derived&&, Base>();
+
+ // test that T must also be destructible
+ test_is_constructible<PrivateDtor&, PrivateDtor&>();
+ test_is_not_constructible<PrivateDtor, int>();
+
+ test_is_not_constructible<void() const, void() const>();
+ test_is_not_constructible<void() const, void*>();
+
+ test_is_constructible<int&, ImplicitTo<int&>>();
+ test_is_constructible<const int&, ImplicitTo<int&&>>();
+ test_is_constructible<int&&, ImplicitTo<int&&>>();
+ test_is_constructible<const int&, ImplicitTo<int>>();
+
+ test_is_not_constructible<B&&, B&>();
+ test_is_not_constructible<B&&, D&>();
+ test_is_constructible<B&&, ImplicitTo<D&&>>();
+ test_is_constructible<B&&, ImplicitTo<D&&>&>();
+ test_is_constructible<int&&, double&>();
+ test_is_constructible<const int&, ImplicitTo<int&>&>();
+ test_is_constructible<const int&, ImplicitTo<int&>>();
+ test_is_constructible<const int&, ExplicitTo<int&>&>();
+ test_is_constructible<const int&, ExplicitTo<int&>>();
+
+ test_is_constructible<const int&, ExplicitTo<int&>&>();
+ test_is_constructible<const int&, ExplicitTo<int&>>();
+ test_is_constructible<int&, ExplicitTo<int&>>();
+ test_is_constructible<const int&, ExplicitTo<int&&>>();
+
+ // Binding through reference-compatible type is required to perform
+ // direct-initialization as described in [over.match.ref] p. 1 b. 1:
+ test_is_constructible<int&, ExplicitTo<int&>>();
+ test_is_constructible<const int&, ExplicitTo<int&&>>();
+
+ static_assert(std::is_constructible<int&&, ExplicitTo<int&&>>::value, "");
+#ifdef __clang__
+#if defined(CLANG_TEST_VER) && CLANG_TEST_VER < 400
+ static_assert(clang_disallows_valid_static_cast_bug, "bug still exists");
+#endif
+ // FIXME Clang disallows this construction because it thinks that
+ // 'static_cast<int&&>(declval<ExplicitTo<int&&>>())' is ill-formed.
+ LIBCPP_STATIC_ASSERT(
+ clang_disallows_valid_static_cast_bug !=
+ std::__libcpp_is_constructible<int&&, ExplicitTo<int&&>>::value, "");
+#else
+ static_assert(clang_disallows_valid_static_cast_bug == false, "");
+ LIBCPP_STATIC_ASSERT(std::__libcpp_is_constructible<int&&, ExplicitTo<int&&>>::value, "");
+#endif
+
+#ifdef __clang__
+ // FIXME Clang and GCC disagree on the validity of this expression.
+ test_is_constructible<const int&, ExplicitTo<int>>();
+ static_assert(std::is_constructible<int&&, ExplicitTo<int>>::value, "");
+ LIBCPP_STATIC_ASSERT(
+ clang_disallows_valid_static_cast_bug !=
+ std::__libcpp_is_constructible<int&&, ExplicitTo<int>>::value, "");
+#else
+ test_is_not_constructible<const int&, ExplicitTo<int>>();
+ test_is_not_constructible<int&&, ExplicitTo<int>>();
+#endif
+
+ // Binding through temporary behaves like copy-initialization,
+ // see [dcl.init.ref] p. 5, very last sub-bullet:
+ test_is_not_constructible<const int&, ExplicitTo<double&&>>();
+ test_is_not_constructible<int&&, ExplicitTo<double&&>>();
+
+
+// TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly.
+// In those compiler versions the __is_constructible builtin gives the wrong
+// results for abominable function types.
+#if (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 703) \
+ || (defined(TEST_CLANG_VER) && TEST_CLANG_VER < 308)
+#define WORKAROUND_CLANG_BUG
+#endif
+#if !defined(WORKAROUND_CLANG_BUG)
+ test_is_not_constructible<void()>();
+ test_is_not_constructible<void() const> ();
+ test_is_not_constructible<void() volatile> ();
+ test_is_not_constructible<void() &> ();
+ test_is_not_constructible<void() &&> ();
#endif
+#endif // TEST_STD_VER >= 11
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
index ac8b80bbd3a4..06cf8007889d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
@@ -74,12 +74,10 @@ int main()
test_is_copy_assignable<NotEmpty> ();
test_is_copy_assignable<Empty> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_is_not_copy_assignable<const int> ();
test_is_not_copy_assignable<int[]> ();
test_is_not_copy_assignable<int[3]> ();
-#endif
-#if TEST_STD_VER >= 11
test_is_not_copy_assignable<B> ();
#endif
test_is_not_copy_assignable<void> ();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
index 318147e5d4a3..22755dc33dc3 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
@@ -92,15 +92,35 @@ int main()
test_is_default_constructible<int*>();
test_is_default_constructible<const int*>();
test_is_default_constructible<char[3]>();
+ test_is_default_constructible<char[5][3]>();
+
test_is_default_constructible<NotEmpty>();
test_is_default_constructible<bit_zero>();
test_is_not_default_constructible<void>();
test_is_not_default_constructible<int&>();
test_is_not_default_constructible<char[]>();
+ test_is_not_default_constructible<char[][3]>();
+
test_is_not_default_constructible<Abstract>();
test_is_not_default_constructible<NoDefaultConstructor>();
#if TEST_STD_VER >= 11
test_is_not_default_constructible<B>();
+ test_is_not_default_constructible<int&&>();
+
+// TODO: Remove this workaround once Clang <= 3.7 are no longer used regularly.
+// In those compiler versions the __is_constructible builtin gives the wrong
+// results for abominable function types.
+#if (defined(TEST_APPLE_CLANG_VER) && TEST_APPLE_CLANG_VER < 703) \
+ || (defined(TEST_CLANG_VER) && TEST_CLANG_VER < 308)
+#define WORKAROUND_CLANG_BUG
+#endif
+#if !defined(WORKAROUND_CLANG_BUG)
+ test_is_not_default_constructible<void()>();
+ test_is_not_default_constructible<void() const> ();
+ test_is_not_default_constructible<void() volatile> ();
+ test_is_not_default_constructible<void() &> ();
+ test_is_not_default_constructible<void() &&> ();
+#endif
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
index 410c1db7244d..7be76f4fa96a 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
@@ -11,6 +11,14 @@
// is_empty
+// T is a non-union class type with:
+// no non-static data members,
+// no unnamed bit-fields of non-zero length,
+// no virtual member functions,
+// no virtual base classes,
+// and no base class B for which is_empty_v<B> is false.
+
+
#include <type_traits>
#include "test_macros.h"
@@ -44,22 +52,33 @@ void test_is_not_empty()
#endif
}
-class Empty
-{
-};
+class Empty {};
+struct NotEmpty { int foo; };
-class NotEmpty
+class VirtualFn
{
- virtual ~NotEmpty();
+ virtual ~VirtualFn();
};
union Union {};
+struct EmptyBase : public Empty {};
+struct VirtualBase : virtual Empty {};
+struct NotEmptyBase : public NotEmpty {};
+
+struct StaticMember { static int foo; };
+struct NonStaticMember { int foo; };
+
struct bit_zero
{
int : 0;
};
+struct bit_one
+{
+ int : 1;
+};
+
int main()
{
test_is_not_empty<void>();
@@ -72,7 +91,14 @@ int main()
test_is_not_empty<char[]>();
test_is_not_empty<Union>();
test_is_not_empty<NotEmpty>();
+ test_is_not_empty<VirtualFn>();
+ test_is_not_empty<VirtualBase>();
+ test_is_not_empty<NotEmptyBase>();
+ test_is_not_empty<NonStaticMember>();
+// test_is_not_empty<bit_one>();
test_is_empty<Empty>();
+ test_is_empty<EmptyBase>();
+ test_is_empty<StaticMember>();
test_is_empty<bit_zero>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
index 613c1123e3fa..6209bc7b1483 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
@@ -63,7 +63,7 @@ int main()
test_is_move_assignable<NotEmpty> ();
test_is_move_assignable<Empty> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_is_not_move_assignable<const int> ();
test_is_not_move_assignable<int[]> ();
test_is_not_move_assignable<int[3]> ();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
index 07c283bf8890..e81f8d4f43c4 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
@@ -62,7 +62,7 @@ struct A
struct B
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
B(B&&);
#endif
};
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
index 9d629dc7ef46..3349a9d3a968 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
@@ -50,7 +50,7 @@ int main()
{
test_is_nothrow_assignable<int&, int&> ();
test_is_nothrow_assignable<int&, int> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_is_nothrow_assignable<int&, double> ();
#endif
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
index 8200b468fe3a..f36b80cac17c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
@@ -92,7 +92,7 @@ struct C
void operator=(C&); // not const
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
struct Tuple {
Tuple(Empty&&) noexcept {}
};
@@ -104,15 +104,14 @@ int main()
test_is_nothrow_constructible<int, const int&> ();
test_is_nothrow_constructible<Empty> ();
test_is_nothrow_constructible<Empty, const Empty&> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
-#endif
test_is_not_nothrow_constructible<A, int> ();
test_is_not_nothrow_constructible<A, int, double> ();
test_is_not_nothrow_constructible<A> ();
test_is_not_nothrow_constructible<C> ();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
+ test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
+
static_assert(!std::is_constructible<Tuple&, Empty>::value, "");
test_is_not_nothrow_constructible<Tuple &, Empty> (); // See bug #19616.
#endif
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp
index 408231f6057f..b23a5e45f287 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp
@@ -59,7 +59,7 @@ int main()
!std::is_nothrow_swappable_with<A&, A&>::value, "");
}
{
- // test that hetrogenius swap is allowed only if both 'swap(A, B)' and
+ // test that heterogeneous swap is allowed only if both 'swap(A, B)' and
// 'swap(B, A)' are valid.
static_assert(std::is_nothrow_swappable_with<A&, B&>::value, "");
static_assert(!std::is_nothrow_swappable_with<A&, C&>::value &&
diff --git a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp
new file mode 100644
index 000000000000..e3c7bb5ad27b
--- /dev/null
+++ b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// class bad_optional_access is default constructible
+
+#include <optional>
+#include <type_traits>
+
+int main()
+{
+ using std::bad_optional_access;
+ bad_optional_access ex;
+}
diff --git a/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
new file mode 100644
index 000000000000..85e36d2c107d
--- /dev/null
+++ b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// class bad_optional_access : public logic_error
+
+#include <optional>
+#include <type_traits>
+
+int main()
+{
+ using std::bad_optional_access;
+
+ static_assert(std::is_base_of<std::logic_error, bad_optional_access>::value, "");
+ static_assert(std::is_convertible<bad_optional_access*, std::logic_error*>::value, "");
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp
new file mode 100644
index 000000000000..b54a08f5575b
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator==(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator==(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator == ( const X &lhs, const X &rhs )
+ { return lhs.i_ == rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( !(o1 == T(1)), "" );
+ static_assert ( (o2 == T(1)), "" );
+ static_assert ( !(o3 == T(1)), "" );
+ static_assert ( (o3 == T(2)), "" );
+ static_assert ( (o3 == val), "" );
+
+ static_assert ( !(T(1) == o1), "" );
+ static_assert ( (T(1) == o2), "" );
+ static_assert ( !(T(1) == o3), "" );
+ static_assert ( (T(2) == o3), "" );
+ static_assert ( (val == o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp
new file mode 100644
index 000000000000..064114fb9db2
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator>(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator>(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator > ( const X &lhs, const X &rhs )
+ { return lhs.i_ > rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( !(o1 > T(1)), "" );
+ static_assert ( !(o2 > T(1)), "" ); // equal
+ static_assert ( (o3 > T(1)), "" );
+ static_assert ( !(o2 > val), "" );
+ static_assert ( !(o3 > val), "" ); // equal
+ static_assert ( !(o3 > T(3)), "" );
+
+ static_assert ( (T(1) > o1), "" );
+ static_assert ( !(T(1) > o2), "" ); // equal
+ static_assert ( !(T(1) > o3), "" );
+ static_assert ( (val > o2), "" );
+ static_assert ( !(val > o3), "" ); // equal
+ static_assert ( (T(3) > o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp
new file mode 100644
index 000000000000..663686cdf347
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator>=(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator>=(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator >= ( const X &lhs, const X &rhs )
+ { return lhs.i_ >= rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( !(o1 >= T(1)), "" );
+ static_assert ( (o2 >= T(1)), "" ); // equal
+ static_assert ( (o3 >= T(1)), "" );
+ static_assert ( !(o2 >= val), "" );
+ static_assert ( (o3 >= val), "" ); // equal
+ static_assert ( !(o3 >= T(3)), "" );
+
+ static_assert ( (T(1) >= o1), "" );
+ static_assert ( (T(1) >= o2), "" ); // equal
+ static_assert ( !(T(1) >= o3), "" );
+ static_assert ( (val >= o2), "" );
+ static_assert ( (val >= o3), "" ); // equal
+ static_assert ( (T(3) >= o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp
new file mode 100644
index 000000000000..05ac5eb12b48
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator<=(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator<=(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator <= ( const X &lhs, const X &rhs )
+ { return lhs.i_ <= rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( (o1 <= T(1)), "" );
+ static_assert ( (o2 <= T(1)), "" ); // equal
+ static_assert ( !(o3 <= T(1)), "" );
+ static_assert ( (o2 <= val), "" );
+ static_assert ( (o3 <= val), "" ); // equal
+ static_assert ( (o3 <= T(3)), "" );
+
+ static_assert ( !(T(1) <= o1), "" );
+ static_assert ( (T(1) <= o2), "" ); // equal
+ static_assert ( (T(1) <= o3), "" );
+ static_assert ( !(val <= o2), "" );
+ static_assert ( (val <= o3), "" ); // equal
+ static_assert ( !(T(3) <= o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp
new file mode 100644
index 000000000000..d1891a286d7b
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator<(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator<(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator < ( const X &lhs, const X &rhs )
+ { return lhs.i_ < rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( (o1 < T(1)), "" );
+ static_assert ( !(o2 < T(1)), "" ); // equal
+ static_assert ( !(o3 < T(1)), "" );
+ static_assert ( (o2 < val), "" );
+ static_assert ( !(o3 < val), "" ); // equal
+ static_assert ( (o3 < T(3)), "" );
+
+ static_assert ( !(T(1) < o1), "" );
+ static_assert ( !(T(1) < o2), "" ); // equal
+ static_assert ( (T(1) < o3), "" );
+ static_assert ( !(val < o2), "" );
+ static_assert ( !(val < o3), "" ); // equal
+ static_assert ( !(T(3) < o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp
new file mode 100644
index 000000000000..ae2ff808fb25
--- /dev/null
+++ b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator!=(const optional<T>& x, const T& v);
+// template <class T> constexpr bool operator!=(const T& v, const optional<T>& x);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator != ( const X &lhs, const X &rhs )
+ { return lhs.i_ != rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr T val(2);
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+ constexpr O o3{val}; // engaged
+
+ static_assert ( (o1 != T(1)), "" );
+ static_assert ( !(o2 != T(1)), "" );
+ static_assert ( (o3 != T(1)), "" );
+ static_assert ( !(o3 != T(2)), "" );
+ static_assert ( !(o3 != val), "" );
+
+ static_assert ( (T(1) != o1), "" );
+ static_assert ( !(T(1) != o2), "" );
+ static_assert ( (T(1) != o3), "" );
+ static_assert ( !(T(2) != o3), "" );
+ static_assert ( !(val != o3), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.hash/hash.pass.cpp b/test/std/utilities/optional/optional.hash/hash.pass.cpp
new file mode 100644
index 000000000000..dfdd07ddf452
--- /dev/null
+++ b/test/std/utilities/optional/optional.hash/hash.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> struct hash<optional<T>>;
+
+#include <optional>
+#include <string>
+#include <memory>
+#include <cassert>
+
+
+int main()
+{
+ using std::optional;
+ const std::size_t nullopt_hash =
+ std::hash<optional<double>>{}(optional<double>{});
+
+ {
+ typedef int T;
+ optional<T> opt;
+ assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
+ opt = 2;
+ assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
+ }
+ {
+ typedef std::string T;
+ optional<T> opt;
+ assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
+ opt = std::string("123");
+ assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
+ }
+ {
+ typedef std::unique_ptr<int> T;
+ optional<T> opt;
+ assert(std::hash<optional<T>>{}(opt) == nullopt_hash);
+ opt = std::unique_ptr<int>(new int(3));
+ assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/equal.pass.cpp b/test/std/utilities/optional/optional.nullops/equal.pass.cpp
new file mode 100644
index 000000000000..a87a87f877fc
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/equal.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( (nullopt == o1), "" );
+ static_assert ( !(nullopt == o2), "" );
+ static_assert ( (o1 == nullopt), "" );
+ static_assert ( !(o2 == nullopt), "" );
+
+ static_assert (noexcept(nullopt == o1), "");
+ static_assert (noexcept(o1 == nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/greater.pass.cpp b/test/std/utilities/optional/optional.nullops/greater.pass.cpp
new file mode 100644
index 000000000000..3986a0a92658
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/greater.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator>(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( !(nullopt > o1), "" );
+ static_assert ( !(nullopt > o2), "" );
+ static_assert ( !(o1 > nullopt), "" );
+ static_assert ( (o2 > nullopt), "" );
+
+ static_assert (noexcept(nullopt > o1), "");
+ static_assert (noexcept(o1 > nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp b/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp
new file mode 100644
index 000000000000..9f2427273476
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator>=(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( (nullopt >= o1), "" );
+ static_assert ( !(nullopt >= o2), "" );
+ static_assert ( (o1 >= nullopt), "" );
+ static_assert ( (o2 >= nullopt), "" );
+
+ static_assert (noexcept(nullopt >= o1), "");
+ static_assert (noexcept(o1 >= nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp b/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp
new file mode 100644
index 000000000000..8e73247b9d6e
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/less_equal.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator<=(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( (nullopt <= o1), "" );
+ static_assert ( (nullopt <= o2), "" );
+ static_assert ( (o1 <= nullopt), "" );
+ static_assert ( !(o2 <= nullopt), "" );
+
+ static_assert (noexcept(nullopt <= o1), "");
+ static_assert (noexcept(o1 <= nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/less_than.pass.cpp b/test/std/utilities/optional/optional.nullops/less_than.pass.cpp
new file mode 100644
index 000000000000..39a8e4a39363
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/less_than.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( !(nullopt < o1), "" );
+ static_assert ( (nullopt < o2), "" );
+ static_assert ( !(o1 < nullopt), "" );
+ static_assert ( !(o2 < nullopt), "" );
+
+ static_assert (noexcept(nullopt < o1), "");
+ static_assert (noexcept(o1 < nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp b/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp
new file mode 100644
index 000000000000..1c96dd42e808
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullops/not_equal.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept;
+// template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept;
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ {
+ typedef int T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2{1}; // engaged
+
+ static_assert ( !(nullopt != o1), "" );
+ static_assert ( (nullopt != o2), "" );
+ static_assert ( !(o1 != nullopt), "" );
+ static_assert ( (o2 != nullopt), "" );
+
+ static_assert (noexcept(nullopt != o1), "");
+ static_assert (noexcept(o1 != nullopt), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp b/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
new file mode 100644
index 000000000000..86da5054a708
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullopt/not_brace_initializable.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// struct nullopt_t{see below};
+
+#include <optional>
+
+using std::optional;
+using std::nullopt_t;
+
+int main()
+{
+ // I roughly interpret LWG2736 as "it shall not be possible to copy-list-initialize nullopt_t with an
+ // empty braced-init-list."
+ nullopt_t foo = {};
+}
diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
new file mode 100644
index 000000000000..84bb29fabac8
--- /dev/null
+++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// struct nullopt_t{see below};
+// constexpr nullopt_t nullopt(unspecified);
+
+#include <optional>
+#include <type_traits>
+
+using std::optional;
+using std::nullopt_t;
+using std::nullopt;
+
+constexpr
+int
+test(const nullopt_t&)
+{
+ return 3;
+}
+
+int main()
+{
+ static_assert((std::is_class<nullopt_t>::value), "");
+ static_assert((std::is_empty<nullopt_t>::value), "");
+ static_assert((std::is_literal_type<nullopt_t>::value), "");
+ static_assert((!std::is_default_constructible<nullopt_t>::value), "");
+
+ static_assert(test(nullopt) == 3, "");
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
new file mode 100644
index 000000000000..1207e24150ff
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
@@ -0,0 +1,273 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U> optional<T>& operator=(U&& v);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+#include <memory>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+struct ThrowAssign {
+ static int dtor_called;
+ ThrowAssign() = default;
+ ThrowAssign(int) { TEST_THROW(42); }
+ ThrowAssign& operator=(int) {
+ TEST_THROW(42);
+ }
+ ~ThrowAssign() { ++dtor_called; }
+};
+int ThrowAssign::dtor_called = 0;
+
+template <class T, class Arg = T, bool Expect = true>
+void assert_assignable() {
+ static_assert(std::is_assignable<optional<T>&, Arg>::value == Expect, "");
+ static_assert(!std::is_assignable<const optional<T>&, Arg>::value, "");
+}
+
+struct MismatchType {
+ explicit MismatchType(int) {}
+ explicit MismatchType(char*) {}
+ explicit MismatchType(int*) = delete;
+ MismatchType& operator=(int) { return *this; }
+ MismatchType& operator=(int*) { return *this; }
+ MismatchType& operator=(char*) = delete;
+};
+
+struct FromOptionalType {
+ using Opt = std::optional<FromOptionalType>;
+ FromOptionalType() = default;
+ FromOptionalType(FromOptionalType const&) = delete;
+ template <class Dummy = void>
+ constexpr FromOptionalType(Opt&) { Dummy::BARK; }
+ template <class Dummy = void>
+ constexpr FromOptionalType& operator=(Opt&) { Dummy::BARK; return *this; }
+};
+
+void test_sfinae() {
+ using I = TestTypes::TestType;
+ using E = ExplicitTestTypes::TestType;
+ assert_assignable<int>();
+ assert_assignable<int, int&>();
+ assert_assignable<int, int const&>();
+ // Implicit test type
+ assert_assignable<I, I const&>();
+ assert_assignable<I, I&&>();
+ assert_assignable<I, int>();
+ assert_assignable<I, void*, false>();
+ // Explicit test type
+ assert_assignable<E, E const&>();
+ assert_assignable<E, E &&>();
+ assert_assignable<E, int>();
+ assert_assignable<E, void*, false>();
+ // Mismatch type
+ assert_assignable<MismatchType, int>();
+ assert_assignable<MismatchType, int*, false>();
+ assert_assignable<MismatchType, char*, false>();
+ // Type constructible from optional
+ assert_assignable<FromOptionalType, std::optional<FromOptionalType>&, false>();
+}
+
+void test_with_test_type()
+{
+ using T = TestTypes::TestType;
+ T::reset();
+ { // to empty
+ optional<T> opt;
+ opt = 3;
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(3));
+ }
+ { // to existing
+ optional<T> opt(42);
+ T::reset_constructors();
+ opt = 3;
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 1);
+ assert(T::value_assigned == 1);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(3));
+ }
+ { // test default argument
+ optional<T> opt;
+ T::reset_constructors();
+ opt = {1, 2};
+ assert(T::alive == 1);
+ assert(T::constructed == 2);
+ assert(T::value_constructed == 1);
+ assert(T::move_constructed == 1);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1, 2));
+ }
+ { // test default argument
+ optional<T> opt(42);
+ T::reset_constructors();
+ opt = {1, 2};
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::assigned == 1);
+ assert(T::move_assigned == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1, 2));
+ }
+ { // test default argument
+ optional<T> opt;
+ T::reset_constructors();
+ opt = {1};
+ assert(T::alive == 1);
+ assert(T::constructed == 2);
+ assert(T::value_constructed == 1);
+ assert(T::move_constructed == 1);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1));
+ }
+ { // test default argument
+ optional<T> opt(42);
+ T::reset_constructors();
+ opt = {};
+ assert(static_cast<bool>(opt) == false);
+ assert(T::alive == 0);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 1);
+ }
+}
+
+template <class T, class Value = int>
+void test_with_type() {
+ { // to empty
+ optional<T> opt;
+ opt = Value(3);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(3));
+ }
+ { // to existing
+ optional<T> opt(Value(42));
+ opt = Value(3);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(3));
+ }
+ { // test const
+ optional<T> opt(Value(42));
+ const T t(Value(3));
+ opt = t;
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(3));
+ }
+ { // test default argument
+ optional<T> opt;
+ opt = {Value(1)};
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1));
+ }
+ { // test default argument
+ optional<T> opt(Value(42));
+ opt = {};
+ assert(static_cast<bool>(opt) == false);
+ }
+}
+
+template <class T>
+void test_with_type_multi() {
+ test_with_type<T>();
+ { // test default argument
+ optional<T> opt;
+ opt = {1, 2};
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1, 2));
+ }
+ { // test default argument
+ optional<T> opt(42);
+ opt = {1, 2};
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1, 2));
+ }
+}
+
+void test_throws()
+{
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using T = ThrowAssign;
+ {
+ using T = ThrowAssign;
+ optional<T> opt;
+ try {
+ opt = 42;
+ assert(false);
+ } catch (int) {}
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(T::dtor_called == 0);
+ {
+ T::dtor_called = 0;
+ optional<T> opt(std::in_place);
+ try {
+ opt = 42;
+ assert(false);
+ } catch (int) {}
+ assert(static_cast<bool>(opt) == true);
+ assert(T::dtor_called == 0);
+ }
+ assert(T::dtor_called == 1);
+#endif
+}
+
+enum MyEnum { Zero, One, Two, Three, FortyTwo = 42 };
+
+using Fn = void(*)();
+
+int main()
+{
+ test_sfinae();
+ // Test with instrumented type
+ test_with_test_type();
+ // Test with various scalar types
+ test_with_type<int>();
+ test_with_type<MyEnum, MyEnum>();
+ test_with_type<int, MyEnum>();
+ test_with_type<Fn, Fn>();
+ // Test types with multi argument constructors
+ test_with_type_multi<ConstexprTestTypes::TestType>();
+ test_with_type_multi<TrivialTestTypes::TestType>();
+ // Test move only types
+ {
+ optional<std::unique_ptr<int>> opt;
+ opt = std::unique_ptr<int>(new int(3));
+ assert(static_cast<bool>(opt) == true);
+ assert(**opt == 3);
+ }
+ {
+ optional<std::unique_ptr<int>> opt(std::unique_ptr<int>(new int(2)));
+ opt = std::unique_ptr<int>(new int(3));
+ assert(static_cast<bool>(opt) == true);
+ assert(**opt == 3);
+ }
+ test_throws();
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp
new file mode 100644
index 000000000000..d471c053c907
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/const_optional_U.pass.cpp
@@ -0,0 +1,254 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// From LWG2451:
+// template<class U>
+// optional<T>& operator=(const optional<U>& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+struct X
+{
+ static bool throw_now;
+
+ X() = default;
+ X(int)
+ {
+ if (throw_now)
+ TEST_THROW(6);
+ }
+};
+
+bool X::throw_now = false;
+
+struct Y1
+{
+ Y1() = default;
+ Y1(const int&) {}
+ Y1& operator=(const Y1&) = delete;
+};
+
+struct Y2
+{
+ Y2() = default;
+ Y2(const int&) = delete;
+ Y2& operator=(const int&) { return *this; }
+};
+
+template <class T>
+struct AssignableFrom {
+ static int type_constructed;
+ static int type_assigned;
+static int int_constructed;
+ static int int_assigned;
+
+ static void reset() {
+ type_constructed = int_constructed = 0;
+ type_assigned = int_assigned = 0;
+ }
+
+ AssignableFrom() = default;
+
+ explicit AssignableFrom(T) { ++type_constructed; }
+ AssignableFrom& operator=(T) { ++type_assigned; return *this; }
+
+ AssignableFrom(int) { ++int_constructed; }
+ AssignableFrom& operator=(int) { ++int_assigned; return *this; }
+private:
+ AssignableFrom(AssignableFrom const&) = delete;
+ AssignableFrom& operator=(AssignableFrom const&) = delete;
+};
+
+template <class T> int AssignableFrom<T>::type_constructed = 0;
+template <class T> int AssignableFrom<T>::type_assigned = 0;
+template <class T> int AssignableFrom<T>::int_constructed = 0;
+template <class T> int AssignableFrom<T>::int_assigned = 0;
+
+
+void test_with_test_type() {
+ using T = TestTypes::TestType;
+ T::reset();
+ { // non-empty to empty
+ T::reset_constructors();
+ optional<T> opt;
+ const optional<int> other(42);
+ opt = other;
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == true);
+ assert(*other == 42);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(42));
+ }
+ assert(T::alive == 0);
+ { // non-empty to non-empty
+ optional<T> opt(101);
+ const optional<int> other(42);
+ T::reset_constructors();
+ opt = other;
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 1);
+ assert(T::value_assigned == 1);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == true);
+ assert(*other == 42);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(42));
+ }
+ assert(T::alive == 0);
+ { // empty to non-empty
+ optional<T> opt(101);
+ const optional<int> other;
+ T::reset_constructors();
+ opt = other;
+ assert(T::alive == 0);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(other) == false);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(T::alive == 0);
+ { // empty to empty
+ optional<T> opt;
+ const optional<int> other;
+ T::reset_constructors();
+ opt = other;
+ assert(T::alive == 0);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == false);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(T::alive == 0);
+}
+
+void test_ambigious_assign() {
+ using OptInt = std::optional<int>;
+ {
+ using T = AssignableFrom<OptInt const&>;
+ const OptInt a(42);
+ T::reset();
+ {
+ std::optional<T> t;
+ t = a;
+ assert(T::type_constructed == 1);
+ assert(T::type_assigned == 0);
+ assert(T::int_constructed == 0);
+ assert(T::int_assigned == 0);
+ }
+ T::reset();
+ {
+ std::optional<T> t(42);
+ t = a;
+ assert(T::type_constructed == 0);
+ assert(T::type_assigned == 1);
+ assert(T::int_constructed == 1);
+ assert(T::int_assigned == 0);
+ }
+ T::reset();
+ {
+ std::optional<T> t(42);
+ t = std::move(a);
+ assert(T::type_constructed == 0);
+ assert(T::type_assigned == 1);
+ assert(T::int_constructed == 1);
+ assert(T::int_assigned == 0);
+ }
+ }
+ {
+ using T = AssignableFrom<OptInt&>;
+ OptInt a(42);
+ T::reset();
+ {
+ std::optional<T> t;
+ t = a;
+ assert(T::type_constructed == 1);
+ assert(T::type_assigned == 0);
+ assert(T::int_constructed == 0);
+ assert(T::int_assigned == 0);
+ }
+ {
+ using Opt = std::optional<T>;
+ static_assert(!std::is_assignable_v<Opt&, OptInt const&>, "");
+ }
+ }
+}
+
+
+int main()
+{
+ test_with_test_type();
+ test_ambigious_assign();
+ {
+ optional<int> opt;
+ constexpr optional<short> opt2;
+ opt = opt2;
+ static_assert(static_cast<bool>(opt2) == false, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt;
+ constexpr optional<short> opt2(short{2});
+ opt = opt2;
+ static_assert(static_cast<bool>(opt2) == true, "");
+ static_assert(*opt2 == 2, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+ {
+ optional<int> opt(3);
+ constexpr optional<short> opt2;
+ opt = opt2;
+ static_assert(static_cast<bool>(opt2) == false, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt(3);
+ constexpr optional<short> opt2(short{2});
+ opt = opt2;
+ static_assert(static_cast<bool>(opt2) == true, "");
+ static_assert(*opt2 == 2, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<X> opt;
+ optional<int> opt2(42);
+ assert(static_cast<bool>(opt2) == true);
+ try
+ {
+ X::throw_now = true;
+ opt = opt2;
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
new file mode 100644
index 000000000000..98c90aa1d4fb
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional<T>& operator=(const optional<T>& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+struct X
+{
+ static bool throw_now;
+
+ X() = default;
+ X(const X&)
+ {
+ if (throw_now)
+ TEST_THROW(6);
+ }
+};
+
+bool X::throw_now = false;
+
+template <class Tp>
+constexpr bool assign_empty(optional<Tp>&& lhs) {
+ const optional<Tp> rhs;
+ lhs = rhs;
+ return !lhs.has_value() && !rhs.has_value();
+}
+
+template <class Tp>
+constexpr bool assign_value(optional<Tp>&& lhs) {
+ const optional<Tp> rhs(101);
+ lhs = rhs;
+ return lhs.has_value() && rhs.has_value() && *lhs == *rhs;
+}
+
+int main()
+{
+ {
+ using O = optional<int>;
+ LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
+ LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+ assert(assign_empty(O{42}));
+ assert(assign_value(O{42}));
+ }
+ {
+ using O = optional<TrivialTestTypes::TestType>;
+ LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
+ LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+ assert(assign_empty(O{42}));
+ assert(assign_value(O{42}));
+ }
+ {
+ using O = optional<TestTypes::TestType>;
+ assert(assign_empty(O{42}));
+ assert(assign_value(O{42}));
+ }
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ optional<T> opt(3);
+ const optional<T> opt2;
+ assert(T::alive == 1);
+ opt = opt2;
+ assert(T::alive == 0);
+ assert(!opt2.has_value());
+ assert(!opt.has_value());
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<X> opt;
+ optional<X> opt2(X{});
+ assert(static_cast<bool>(opt2) == true);
+ try
+ {
+ X::throw_now = true;
+ opt = opt2;
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
new file mode 100644
index 000000000000..b5362589963c
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -0,0 +1,237 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class... Args> void optional<T>::emplace(Args&&... args);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+#include <memory>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+class X
+{
+ int i_;
+ int j_ = 0;
+public:
+ X() : i_(0) {}
+ X(int i) : i_(i) {}
+ X(int i, int j) : i_(i), j_(j) {}
+
+ friend bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Y
+{
+public:
+ static bool dtor_called;
+ Y() = default;
+ Y(int) { TEST_THROW(6);}
+ ~Y() {dtor_called = true;}
+};
+
+bool Y::dtor_called = false;
+
+template <class T>
+void test_one_arg() {
+ using Opt = std::optional<T>;
+ {
+ Opt opt;
+ opt.emplace();
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(0));
+ }
+ {
+ Opt opt;
+ opt.emplace(1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1));
+ }
+ {
+ Opt opt(2);
+ opt.emplace();
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(0));
+ }
+ {
+ Opt opt(2);
+ opt.emplace(1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(1));
+ }
+}
+
+
+template <class T>
+void test_multi_arg()
+{
+ test_one_arg<T>();
+ using Opt = std::optional<T>;
+ {
+ Opt opt;
+ opt.emplace(101, 41);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(101, 41));
+ }
+ {
+ Opt opt;
+ opt.emplace({1, 2, 3, 4});
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(4)); // T sets its value to the size of the init list
+ }
+ {
+ Opt opt;
+ opt.emplace({1, 2, 3, 4, 5}, 6);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(5)); // T sets its value to the size of the init list
+ }
+}
+
+template <class T>
+void test_on_test_type() {
+
+ T::reset();
+ optional<T> opt;
+ assert(T::alive == 0);
+ {
+ T::reset_constructors();
+ opt.emplace();
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::default_constructed == 1);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T());
+ }
+ {
+ T::reset_constructors();
+ opt.emplace();
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::default_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T());
+ }
+ {
+ T::reset_constructors();
+ opt.emplace(101);
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(101));
+ }
+ {
+ T::reset_constructors();
+ opt.emplace(-10, 99);
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(-10, 99));
+ }
+ {
+ T::reset_constructors();
+ opt.emplace(-10, 99);
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(-10, 99));
+ }
+ {
+ T::reset_constructors();
+ opt.emplace({-10, 99, 42, 1});
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(4)); // size of the initializer list
+ }
+ {
+ T::reset_constructors();
+ opt.emplace({-10, 99, 42, 1}, 42);
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(4)); // size of the initializer list
+ }
+}
+
+
+
+int main()
+{
+ {
+ test_on_test_type<TestTypes::TestType>();
+ test_on_test_type<ExplicitTestTypes::TestType>();
+ }
+ {
+ using T = int;
+ test_one_arg<T>();
+ test_one_arg<const T>();
+ }
+ {
+ using T = ConstexprTestTypes::TestType;
+ test_multi_arg<T>();
+ }
+ {
+ using T = ExplicitConstexprTestTypes::TestType;
+ test_multi_arg<T>();
+ }
+ {
+ using T = TrivialTestTypes::TestType;
+ test_multi_arg<T>();
+ }
+ {
+ using T = ExplicitTrivialTestTypes::TestType;
+ test_multi_arg<T>();
+ }
+ {
+ optional<const int> opt;
+ opt.emplace(42);
+ assert(*opt == 42);
+ opt.emplace();
+ assert(*opt == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ Y::dtor_called = false;
+ {
+ Y y;
+ optional<Y> opt(y);
+ try
+ {
+ assert(static_cast<bool>(opt) == true);
+ assert(Y::dtor_called == false);
+ opt.emplace(1);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ assert(Y::dtor_called == true);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
new file mode 100644
index 000000000000..1c3c69a70303
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
@@ -0,0 +1,113 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U, class... Args>
+// void optional<T>::emplace(initializer_list<U> il, Args&&... args);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+#include <vector>
+
+#include "test_macros.h"
+
+using std::optional;
+
+class X
+{
+ int i_;
+ int j_ = 0;
+public:
+ static bool dtor_called;
+ constexpr X() : i_(0) {}
+ constexpr X(int i) : i_(i) {}
+ constexpr X(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
+ ~X() {dtor_called = true;}
+
+ friend constexpr bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+bool X::dtor_called = false;
+
+class Y
+{
+ int i_;
+ int j_ = 0;
+public:
+ constexpr Y() : i_(0) {}
+ constexpr Y(int i) : i_(i) {}
+ constexpr Y(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
+
+ friend constexpr bool operator==(const Y& x, const Y& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Z
+{
+ int i_;
+ int j_ = 0;
+public:
+ static bool dtor_called;
+ Z() : i_(0) {}
+ Z(int i) : i_(i) {}
+ Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+ { TEST_THROW(6);}
+ ~Z() {dtor_called = true;}
+
+ friend bool operator==(const Z& x, const Z& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+bool Z::dtor_called = false;
+
+int main()
+{
+ {
+ X x;
+ optional<X> opt(x);
+ assert(X::dtor_called == false);
+ opt.emplace({1, 2});
+ assert(X::dtor_called == true);
+ assert(*opt == X({1, 2}));
+ }
+ {
+ optional<std::vector<int>> opt;
+ opt.emplace({1, 2, 3}, std::allocator<int>());
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == std::vector<int>({1, 2, 3}));
+ }
+ {
+ optional<Y> opt;
+ opt.emplace({1, 2});
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == Y({1, 2}));
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ Z z;
+ optional<Z> opt(z);
+ try
+ {
+ assert(static_cast<bool>(opt) == true);
+ assert(Z::dtor_called == false);
+ opt.emplace({1, 2});
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ assert(Z::dtor_called == true);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
new file mode 100644
index 000000000000..3ba261b52464
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -0,0 +1,174 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional<T>& operator=(optional<T>&& rhs)
+// noexcept(is_nothrow_move_assignable<T>::value &&
+// is_nothrow_move_constructible<T>::value);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+struct X
+{
+ static bool throw_now;
+ static int alive;
+
+ X() { ++alive; }
+ X(X&&)
+ {
+ if (throw_now)
+ TEST_THROW(6);
+ ++alive;
+ }
+
+ X& operator=(X&&)
+ {
+ if (throw_now)
+ TEST_THROW(42);
+ return *this;
+ }
+
+ ~X() { assert(alive > 0); --alive; }
+};
+
+struct Y {};
+
+bool X::throw_now = false;
+int X::alive = 0;
+
+int main()
+{
+ {
+ static_assert(std::is_nothrow_move_assignable<optional<int>>::value, "");
+ optional<int> opt;
+ constexpr optional<int> opt2;
+ opt = std::move(opt2);
+ static_assert(static_cast<bool>(opt2) == false, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt;
+ constexpr optional<int> opt2(2);
+ opt = std::move(opt2);
+ static_assert(static_cast<bool>(opt2) == true, "");
+ static_assert(*opt2 == 2, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+ {
+ optional<int> opt(3);
+ constexpr optional<int> opt2;
+ opt = std::move(opt2);
+ static_assert(static_cast<bool>(opt2) == false, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ optional<T> opt(3);
+ optional<T> opt2;
+ assert(T::alive == 1);
+ opt = std::move(opt2);
+ assert(T::alive == 0);
+ assert(static_cast<bool>(opt2) == false);
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt(3);
+ constexpr optional<int> opt2(2);
+ opt = std::move(opt2);
+ static_assert(static_cast<bool>(opt2) == true, "");
+ static_assert(*opt2 == 2, "");
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
+ X::alive = 0;
+ X::throw_now = false;
+ optional<X> opt;
+ optional<X> opt2(X{});
+ assert(X::alive == 1);
+ assert(static_cast<bool>(opt2) == true);
+ try
+ {
+ X::throw_now = true;
+ opt = std::move(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(X::alive == 1);
+ }
+ assert(X::alive == 0);
+ {
+ static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
+ X::throw_now = false;
+ optional<X> opt(X{});
+ optional<X> opt2(X{});
+ assert(X::alive == 2);
+ assert(static_cast<bool>(opt2) == true);
+ try
+ {
+ X::throw_now = true;
+ opt = std::move(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 42);
+ assert(static_cast<bool>(opt) == true);
+ }
+ assert(X::alive == 2);
+ }
+ assert(X::alive == 0);
+#endif // TEST_HAS_NO_EXCEPTIONS
+ {
+ static_assert(std::is_nothrow_move_assignable<optional<Y>>::value, "");
+ }
+ {
+ struct ThrowsMove {
+ ThrowsMove() noexcept {}
+ ThrowsMove(ThrowsMove const&) noexcept {}
+ ThrowsMove(ThrowsMove &&) noexcept(false) {}
+ ThrowsMove& operator=(ThrowsMove const&) noexcept { return *this; }
+ ThrowsMove& operator=(ThrowsMove &&) noexcept { return *this; }
+ };
+ static_assert(!std::is_nothrow_move_assignable<optional<ThrowsMove>>::value, "");
+ struct ThrowsMoveAssign {
+ ThrowsMoveAssign() noexcept {}
+ ThrowsMoveAssign(ThrowsMoveAssign const&) noexcept {}
+ ThrowsMoveAssign(ThrowsMoveAssign &&) noexcept {}
+ ThrowsMoveAssign& operator=(ThrowsMoveAssign const&) noexcept { return *this; }
+ ThrowsMoveAssign& operator=(ThrowsMoveAssign &&) noexcept(false) { return *this; }
+ };
+ static_assert(!std::is_nothrow_move_assignable<optional<ThrowsMoveAssign>>::value, "");
+ struct NoThrowMove {
+ NoThrowMove() noexcept(false) {}
+ NoThrowMove(NoThrowMove const&) noexcept(false) {}
+ NoThrowMove(NoThrowMove &&) noexcept {}
+ NoThrowMove& operator=(NoThrowMove const&) noexcept { return *this; }
+ NoThrowMove& operator=(NoThrowMove&&) noexcept { return *this; }
+ };
+ static_assert(std::is_nothrow_move_assignable<optional<NoThrowMove>>::value, "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
new file mode 100644
index 000000000000..991f4334304c
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional<T>& operator=(nullopt_t) noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+using std::nullopt_t;
+using std::nullopt;
+
+int main()
+{
+ {
+ optional<int> opt;
+ static_assert(noexcept(opt = nullopt) == true, "");
+ opt = nullopt;
+ assert(static_cast<bool>(opt) == false);
+ }
+ {
+ optional<int> opt(3);
+ opt = nullopt;
+ assert(static_cast<bool>(opt) == false);
+ }
+ using TT = TestTypes::TestType;
+ TT::reset();
+ {
+ optional<TT> opt;
+ static_assert(noexcept(opt = nullopt) == true, "");
+ assert(TT::destroyed == 0);
+ opt = nullopt;
+ assert(TT::constructed == 0);
+ assert(TT::alive == 0);
+ assert(TT::destroyed == 0);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(TT::alive == 0);
+ assert(TT::destroyed == 0);
+ TT::reset();
+ {
+ optional<TT> opt(42);
+ assert(TT::destroyed == 0);
+ TT::reset_constructors();
+ opt = nullopt;
+ assert(TT::constructed == 0);
+ assert(TT::alive == 0);
+ assert(TT::destroyed == 1);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(TT::alive == 0);
+ assert(TT::destroyed == 1);
+ TT::reset();
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
new file mode 100644
index 000000000000..db7fc19bfb10
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/optional_U.pass.cpp
@@ -0,0 +1,268 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// From LWG2451:
+// template <class U>
+// optional<T>& operator=(optional<U>&& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+struct X
+{
+ static bool throw_now;
+
+ X() = default;
+ X(int &&)
+ {
+ if (throw_now)
+ TEST_THROW(6);
+ }
+};
+
+bool X::throw_now = false;
+
+struct Y1
+{
+ Y1() = default;
+ Y1(const int&) {}
+ Y1& operator=(const Y1&) = delete;
+};
+
+struct Y2
+{
+ Y2() = default;
+ Y2(const int&) = delete;
+ Y2& operator=(const int&) { return *this; }
+};
+
+class B {};
+class D : public B {};
+
+
+template <class T>
+struct AssignableFrom {
+ static int type_constructed;
+ static int type_assigned;
+static int int_constructed;
+ static int int_assigned;
+
+ static void reset() {
+ type_constructed = int_constructed = 0;
+ type_assigned = int_assigned = 0;
+ }
+
+ AssignableFrom() = default;
+
+ explicit AssignableFrom(T) { ++type_constructed; }
+ AssignableFrom& operator=(T) { ++type_assigned; return *this; }
+
+ AssignableFrom(int) { ++int_constructed; }
+ AssignableFrom& operator=(int) { ++int_assigned; return *this; }
+private:
+ AssignableFrom(AssignableFrom const&) = delete;
+ AssignableFrom& operator=(AssignableFrom const&) = delete;
+};
+
+template <class T> int AssignableFrom<T>::type_constructed = 0;
+template <class T> int AssignableFrom<T>::type_assigned = 0;
+template <class T> int AssignableFrom<T>::int_constructed = 0;
+template <class T> int AssignableFrom<T>::int_assigned = 0;
+
+void test_with_test_type() {
+ using T = TestTypes::TestType;
+ T::reset();
+ { // non-empty to empty
+ T::reset_constructors();
+ optional<T> opt;
+ optional<int> other(42);
+ opt = std::move(other);
+ assert(T::alive == 1);
+ assert(T::constructed == 1);
+ assert(T::value_constructed == 1);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == true);
+ assert(*other == 42);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(42));
+ }
+ assert(T::alive == 0);
+ { // non-empty to non-empty
+ optional<T> opt(101);
+ optional<int> other(42);
+ T::reset_constructors();
+ opt = std::move(other);
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 1);
+ assert(T::value_assigned == 1);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == true);
+ assert(*other == 42);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == T(42));
+ }
+ assert(T::alive == 0);
+ { // empty to non-empty
+ optional<T> opt(101);
+ optional<int> other;
+ T::reset_constructors();
+ opt = std::move(other);
+ assert(T::alive == 0);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 1);
+ assert(static_cast<bool>(other) == false);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(T::alive == 0);
+ { // empty to empty
+ optional<T> opt;
+ optional<int> other;
+ T::reset_constructors();
+ opt = std::move(other);
+ assert(T::alive == 0);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ assert(static_cast<bool>(other) == false);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(T::alive == 0);
+}
+
+
+void test_ambigious_assign() {
+ using OptInt = std::optional<int>;
+ {
+ using T = AssignableFrom<OptInt&&>;
+ T::reset();
+ {
+ OptInt a(42);
+ std::optional<T> t;
+ t = std::move(a);
+ assert(T::type_constructed == 1);
+ assert(T::type_assigned == 0);
+ assert(T::int_constructed == 0);
+ assert(T::int_assigned == 0);
+ }
+ {
+ using Opt = std::optional<T>;
+ static_assert(!std::is_assignable<Opt&, const OptInt&&>::value, "");
+ static_assert(!std::is_assignable<Opt&, const OptInt&>::value, "");
+ static_assert(!std::is_assignable<Opt&, OptInt&>::value, "");
+ }
+ }
+ {
+ using T = AssignableFrom<OptInt const&&>;
+ T::reset();
+ {
+ const OptInt a(42);
+ std::optional<T> t;
+ t = std::move(a);
+ assert(T::type_constructed == 1);
+ assert(T::type_assigned == 0);
+ assert(T::int_constructed == 0);
+ assert(T::int_assigned == 0);
+ }
+ T::reset();
+ {
+ OptInt a(42);
+ std::optional<T> t;
+ t = std::move(a);
+ assert(T::type_constructed == 1);
+ assert(T::type_assigned == 0);
+ assert(T::int_constructed == 0);
+ assert(T::int_assigned == 0);
+ }
+ {
+ using Opt = std::optional<T>;
+ static_assert(std::is_assignable<Opt&, OptInt&&>::value, "");
+ static_assert(!std::is_assignable<Opt&, const OptInt&>::value, "");
+ static_assert(!std::is_assignable<Opt&, OptInt&>::value, "");
+ }
+ }
+}
+
+
+int main()
+{
+ test_with_test_type();
+ test_ambigious_assign();
+ {
+ optional<int> opt;
+ optional<short> opt2;
+ opt = std::move(opt2);
+ assert(static_cast<bool>(opt2) == false);
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt;
+ optional<short> opt2(short{2});
+ opt = std::move(opt2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+ {
+ optional<int> opt(3);
+ optional<short> opt2;
+ opt = std::move(opt2);
+ assert(static_cast<bool>(opt2) == false);
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ }
+ {
+ optional<int> opt(3);
+ optional<short> opt2(short{2});
+ opt = std::move(opt2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
+ assert(*opt == *opt2);
+ }
+ {
+ optional<std::unique_ptr<B>> opt;
+ optional<std::unique_ptr<D>> other(new D());
+ opt = std::move(other);
+ assert(static_cast<bool>(opt) == true);
+ assert(static_cast<bool>(other) == true);
+ assert(opt->get() != nullptr);
+ assert(other->get() == nullptr);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<X> opt;
+ optional<int> opt2(42);
+ assert(static_cast<bool>(opt2) == true);
+ try
+ {
+ X::throw_now = true;
+ opt = std::move(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ assert(static_cast<bool>(opt) == false);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
new file mode 100644
index 000000000000..c4d4763a6f0a
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// template <class U>
+// constexpr EXPLICIT optional(U&& u);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+
+
+using std::optional;
+
+struct ImplicitThrow
+{
+ constexpr ImplicitThrow(int x) { if (x != -1) TEST_THROW(6);}
+};
+
+struct ExplicitThrow
+{
+ constexpr explicit ExplicitThrow(int x) { if (x != -1) TEST_THROW(6);}
+};
+
+
+template <class To, class From>
+constexpr bool implicit_conversion(optional<To>&& opt, const From& v)
+{
+ using O = optional<To>;
+ static_assert(test_convertible<O, From>(), "");
+ static_assert(!test_convertible<O, void*>(), "");
+ static_assert(!test_convertible<O, From, int>(), "");
+ return opt && *opt == static_cast<To>(v);
+}
+
+template <class To, class Input, class Expect>
+constexpr bool explicit_conversion(Input&& in, const Expect& v)
+{
+ using O = optional<To>;
+ static_assert(std::is_constructible<O, Input>::value, "");
+ static_assert(!std::is_convertible<Input, O>::value, "");
+ static_assert(!std::is_constructible<O, void*>::value, "");
+ static_assert(!std::is_constructible<O, Input, int>::value, "");
+ optional<To> opt(std::forward<Input>(in));
+ return opt && *opt == static_cast<To>(v);
+}
+
+void test_implicit()
+{
+ {
+ using T = long long;
+ static_assert(implicit_conversion<long long>(42, 42), "");
+ }
+ {
+ using T = long double;
+ static_assert(implicit_conversion<long double>(3.14, 3.14), "");
+ }
+ {
+ int x = 42;
+ optional<void* const> o(&x);
+ assert(*o == &x);
+ }
+ {
+ using T = TrivialTestTypes::TestType;
+ static_assert(implicit_conversion<T>(42, 42), "");
+ }
+ {
+ using T = TestTypes::TestType;
+ assert(implicit_conversion<T>(3, T(3)));
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ try {
+ using T = ImplicitThrow;
+ optional<T> t = 42;
+ assert(false);
+ ((void)t);
+ } catch (int) {
+ }
+ }
+#endif
+}
+
+void test_explicit() {
+ {
+ using T = ExplicitTrivialTestTypes::TestType;
+ using O = optional<T>;
+ static_assert(explicit_conversion<T>(42, 42), "");
+ }
+ {
+ using T = ExplicitConstexprTestTypes::TestType;
+ using O = optional<T>;
+ static_assert(explicit_conversion<T>(42, 42), "");
+ static_assert(!std::is_convertible<int, T>::value, "");
+ }
+ {
+ using T = ExplicitTestTypes::TestType;
+ using O = optional<T>;
+ T::reset();
+ {
+ assert(explicit_conversion<T>(42, 42));
+ assert(T::alive == 0);
+ }
+ T::reset();
+ {
+ optional<T> t(42);
+ assert(T::alive == 1);
+ assert(T::value_constructed == 1);
+ assert(T::move_constructed == 0);
+ assert(T::copy_constructed == 0);
+ assert(t.value().value == 42);
+ }
+ assert(T::alive == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ try {
+ using T = ExplicitThrow;
+ optional<T> t(42);
+ assert(false);
+ } catch (int) {
+ }
+ }
+#endif
+}
+
+int main() {
+ test_implicit();
+ test_explicit();
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp
new file mode 100644
index 000000000000..34a12b8ad1c3
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -0,0 +1,128 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// constexpr optional(const T& v);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+int main()
+{
+ {
+ typedef int T;
+ constexpr T t(5);
+ constexpr optional<T> opt(t);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == 5, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+
+ }
+ {
+ typedef double T;
+ constexpr T t(3);
+ constexpr optional<T> opt(t);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+
+ }
+ {
+ const int x = 42;
+ optional<const int> o(x);
+ assert(*o == x);
+ }
+ {
+ typedef TestTypes::TestType T;
+ T::reset();
+ const T t(3);
+ optional<T> opt = t;
+ assert(T::alive == 2);
+ assert(T::copy_constructed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(opt.value().value == 3);
+ }
+ {
+ typedef ExplicitTestTypes::TestType T;
+ static_assert(!std::is_convertible<T const&, optional<T>>::value, "");
+ T::reset();
+ const T t(3);
+ optional<T> opt(t);
+ assert(T::alive == 2);
+ assert(T::copy_constructed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(opt.value().value == 3);
+ }
+ {
+ typedef ConstexprTestTypes::TestType T;
+ constexpr T t(3);
+ constexpr optional<T> opt = {t};
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(opt.value().value == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+ }
+ {
+ typedef ExplicitConstexprTestTypes::TestType T;
+ static_assert(!std::is_convertible<const T&, optional<T>>::value, "");
+ constexpr T t(3);
+ constexpr optional<T> opt(t);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(opt.value().value == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ struct Z {
+ Z(int) {}
+ Z(const Z&) {throw 6;}
+ };
+ typedef Z T;
+ try
+ {
+ const T t(3);
+ optional<T> opt(t);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/const_optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/const_optional_U.pass.cpp
new file mode 100644
index 000000000000..e12f6cb28f5a
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/const_optional_U.pass.cpp
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U>
+// optional(const optional<U>& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+template <class T, class U>
+void
+test(const optional<U>& rhs, bool is_going_to_throw = false)
+{
+ bool rhs_engaged = static_cast<bool>(rhs);
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ optional<T> lhs = rhs;
+ assert(is_going_to_throw == false);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == *rhs);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#else
+ if (is_going_to_throw) return;
+ optional<T> lhs = rhs;
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == *rhs);
+#endif
+}
+
+class X
+{
+ int i_;
+public:
+ X(int i) : i_(i) {}
+ X(const X& x) : i_(x.i_) {}
+ ~X() {i_ = 0;}
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+class Y
+{
+ int i_;
+public:
+ Y(int i) : i_(i) {}
+
+ friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
+};
+
+int count = 0;
+
+class Z
+{
+ int i_;
+public:
+ Z(int i) : i_(i) {TEST_THROW(6);}
+
+ friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
+};
+
+
+int main()
+{
+ {
+ typedef short U;
+ typedef int T;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef short U;
+ typedef int T;
+ optional<U> rhs(U{3});
+ test<T>(rhs);
+ }
+ {
+ typedef X T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef X T;
+ typedef int U;
+ optional<U> rhs(U{3});
+ test<T>(rhs);
+ }
+ {
+ typedef Y T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef Y T;
+ typedef int U;
+ optional<U> rhs(U{3});
+ test<T>(rhs);
+ }
+ {
+ typedef Z T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef Z T;
+ typedef int U;
+ optional<U> rhs(U{3});
+ test<T>(rhs, true);
+ }
+
+ static_assert(!(std::is_constructible<optional<X>, const optional<Y>&>::value), "");
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
new file mode 100644
index 000000000000..5906d4edd119
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -0,0 +1,155 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional(const optional<T>& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+template <class T, class ...InitArgs>
+void test(InitArgs&&... args)
+{
+ const optional<T> rhs(std::forward<InitArgs>(args)...);
+ bool rhs_engaged = static_cast<bool>(rhs);
+ optional<T> lhs = rhs;
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == *rhs);
+}
+
+void test_throwing_ctor() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ struct Z {
+ Z() : count(0) {}
+ Z(Z const& o) : count(o.count + 1)
+ { if (count == 2) throw 6; }
+ int count;
+ };
+ const Z z;
+ const optional<Z> rhs(z);
+ try
+ {
+ optional<Z> lhs(rhs);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#endif
+}
+
+template <class T, class ...InitArgs>
+void test_ref(InitArgs&&... args)
+{
+ const optional<T> rhs(std::forward<InitArgs>(args)...);
+ bool rhs_engaged = static_cast<bool>(rhs);
+ optional<T> lhs = rhs;
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(&(*lhs) == &(*rhs));
+}
+
+
+void test_reference_extension()
+{
+#if defined(_LIBCPP_VERSION) && 0 // FIXME these extensions are currently disabled.
+ using T = TestTypes::TestType;
+ T::reset();
+ {
+ T t;
+ T::reset_constructors();
+ test_ref<T&>();
+ test_ref<T&>(t);
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::destroyed == 1);
+ assert(T::alive == 0);
+ {
+ T t;
+ const T& ct = t;
+ T::reset_constructors();
+ test_ref<T const&>();
+ test_ref<T const&>(t);
+ test_ref<T const&>(ct);
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::alive == 0);
+ assert(T::destroyed == 1);
+ {
+ static_assert(!std::is_copy_constructible<std::optional<T&&>>::value, "");
+ static_assert(!std::is_copy_constructible<std::optional<T const&&>>::value, "");
+ }
+#endif
+}
+
+int main()
+{
+ test<int>();
+ test<int>(3);
+ {
+ const optional<const int> o(42);
+ optional<const int> o2(o);
+ assert(*o2 == 42);
+ }
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ const optional<T> rhs;
+ assert(T::alive == 0);
+ const optional<T> lhs(rhs);
+ assert(lhs.has_value() == false);
+ assert(T::alive == 0);
+ }
+ TestTypes::TestType::reset();
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ const optional<T> rhs(42);
+ assert(T::alive == 1);
+ assert(T::value_constructed == 1);
+ assert(T::copy_constructed == 0);
+ const optional<T> lhs(rhs);
+ assert(lhs.has_value());
+ assert(T::copy_constructed == 1);
+ assert(T::alive == 2);
+ }
+ TestTypes::TestType::reset();
+ {
+ using namespace ConstexprTestTypes;
+ test<TestType>();
+ test<TestType>(42);
+ }
+ {
+ using namespace TrivialTestTypes;
+ test<TestType>();
+ test<TestType>(42);
+ }
+ {
+ test_throwing_ctor();
+ }
+ {
+ test_reference_extension();
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp
new file mode 100644
index 000000000000..62795b91f9fd
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/default.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr optional() noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+template <class Opt>
+void
+test_constexpr()
+{
+ static_assert(std::is_nothrow_default_constructible<Opt>::value, "");
+ static_assert(std::is_trivially_destructible<Opt>::value, "");
+ static_assert(std::is_trivially_destructible<typename Opt::value_type>::value, "");
+
+ constexpr Opt opt;
+ static_assert(static_cast<bool>(opt) == false, "");
+
+ struct test_constexpr_ctor
+ : public Opt
+ {
+ constexpr test_constexpr_ctor() {}
+ };
+}
+
+template <class Opt>
+void
+test()
+{
+ static_assert(std::is_nothrow_default_constructible<Opt>::value, "");
+ static_assert(!std::is_trivially_destructible<Opt>::value, "");
+ static_assert(!std::is_trivially_destructible<typename Opt::value_type>::value, "");
+ {
+ Opt opt;
+ assert(static_cast<bool>(opt) == false);
+ }
+ {
+ const Opt opt;
+ assert(static_cast<bool>(opt) == false);
+ }
+
+ struct test_constexpr_ctor
+ : public Opt
+ {
+ constexpr test_constexpr_ctor() {}
+ };
+}
+
+int main()
+{
+ test_constexpr<optional<int>>();
+ test_constexpr<optional<int*>>();
+ test_constexpr<optional<ImplicitTypes::NoCtors>>();
+ test_constexpr<optional<NonTrivialTypes::NoCtors>>();
+ test_constexpr<optional<NonConstexprTypes::NoCtors>>();
+ test<optional<NonLiteralTypes::NoCtors>>();
+ // EXTENSIONS
+#if defined(_LIBCPP_VERSION) && 0 // FIXME these extensions are currently disabled.
+ test_constexpr<optional<int&>>();
+ test_constexpr<optional<const int&>>();
+ test_constexpr<optional<int&>>();
+ test_constexpr<optional<NonLiteralTypes::NoCtors&>>();
+ test_constexpr<optional<NonLiteralTypes::NoCtors&&>>();
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_const_optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_const_optional_U.pass.cpp
new file mode 100644
index 000000000000..64ac05316c2a
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_const_optional_U.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U>
+// explicit optional(const optional<U>& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+template <class T, class U>
+void
+test(const optional<U>& rhs, bool is_going_to_throw = false)
+{
+ static_assert(!(std::is_convertible<const optional<U>&, optional<T>>::value), "");
+ bool rhs_engaged = static_cast<bool>(rhs);
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ optional<T> lhs(rhs);
+ assert(is_going_to_throw == false);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == T(*rhs));
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#else
+ if (is_going_to_throw) return;
+ optional<T> lhs(rhs);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == T(*rhs));
+#endif
+}
+
+class X
+{
+ int i_;
+public:
+ explicit X(int i) : i_(i) {}
+ X(const X& x) : i_(x.i_) {}
+ ~X() {i_ = 0;}
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+class Y
+{
+ int i_;
+public:
+ explicit Y(int i) : i_(i) {}
+
+ friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
+};
+
+int count = 0;
+
+class Z
+{
+ int i_;
+public:
+ explicit Z(int i) : i_(i) { TEST_THROW(6);}
+
+ friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
+};
+
+
+int main()
+{
+ {
+ typedef X T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef X T;
+ typedef int U;
+ optional<U> rhs(3);
+ test<T>(rhs);
+ }
+ {
+ typedef Y T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef Y T;
+ typedef int U;
+ optional<U> rhs(3);
+ test<T>(rhs);
+ }
+ {
+ typedef Z T;
+ typedef int U;
+ optional<U> rhs;
+ test<T>(rhs);
+ }
+ {
+ typedef Z T;
+ typedef int U;
+ optional<U> rhs(3);
+ test<T>(rhs, true);
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_optional_U.pass.cpp
new file mode 100644
index 000000000000..2c6757a95825
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/explicit_optional_U.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U>
+// explicit optional(optional<U>&& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+template <class T, class U>
+void
+test(optional<U>&& rhs, bool is_going_to_throw = false)
+{
+ static_assert(!(std::is_convertible<optional<U>&&, optional<T>>::value), "");
+ bool rhs_engaged = static_cast<bool>(rhs);
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ optional<T> lhs(std::move(rhs));
+ assert(is_going_to_throw == false);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#else
+ if (is_going_to_throw) return;
+ optional<T> lhs(std::move(rhs));
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+#endif
+}
+
+class X
+{
+ int i_;
+public:
+ explicit X(int i) : i_(i) {}
+ X(X&& x) : i_(std::exchange(x.i_, 0)) {}
+ ~X() {i_ = 0;}
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+int count = 0;
+
+class Z
+{
+public:
+ explicit Z(int) { TEST_THROW(6); }
+};
+
+int main()
+{
+ {
+ optional<int> rhs;
+ test<X>(std::move(rhs));
+ }
+ {
+ optional<int> rhs(3);
+ test<X>(std::move(rhs));
+ }
+ {
+ optional<int> rhs;
+ test<Z>(std::move(rhs));
+ }
+ {
+ optional<int> rhs(3);
+ test<Z>(std::move(rhs), true);
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
new file mode 100644
index 000000000000..d0823d2c8c82
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// template <class... Args>
+// constexpr explicit optional(in_place_t, Args&&... args);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::in_place_t;
+using std::in_place;
+
+class X
+{
+ int i_;
+ int j_ = 0;
+public:
+ X() : i_(0) {}
+ X(int i) : i_(i) {}
+ X(int i, int j) : i_(i), j_(j) {}
+
+ ~X() {}
+
+ friend bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Y
+{
+ int i_;
+ int j_ = 0;
+public:
+ constexpr Y() : i_(0) {}
+ constexpr Y(int i) : i_(i) {}
+ constexpr Y(int i, int j) : i_(i), j_(j) {}
+
+ friend constexpr bool operator==(const Y& x, const Y& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Z
+{
+public:
+ Z(int) {TEST_THROW(6);}
+};
+
+
+int main()
+{
+ {
+ constexpr optional<int> opt(in_place, 5);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == 5, "");
+
+ struct test_constexpr_ctor
+ : public optional<int>
+ {
+ constexpr test_constexpr_ctor(in_place_t, int i)
+ : optional<int>(in_place, i) {}
+ };
+
+ }
+ {
+ optional<const int> opt(in_place, 5);
+ assert(*opt == 5);
+ }
+ {
+ const optional<X> opt(in_place);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == X());
+ }
+ {
+ const optional<X> opt(in_place, 5);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == X(5));
+ }
+ {
+ const optional<X> opt(in_place, 5, 4);
+ assert(static_cast<bool>(opt) == true);
+ assert(*opt == X(5, 4));
+ }
+ {
+ constexpr optional<Y> opt(in_place);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == Y(), "");
+
+ struct test_constexpr_ctor
+ : public optional<Y>
+ {
+ constexpr test_constexpr_ctor(in_place_t)
+ : optional<Y>(in_place) {}
+ };
+
+ }
+ {
+ constexpr optional<Y> opt(in_place, 5);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == Y(5), "");
+
+ struct test_constexpr_ctor
+ : public optional<Y>
+ {
+ constexpr test_constexpr_ctor(in_place_t, int i)
+ : optional<Y>(in_place, i) {}
+ };
+
+ }
+ {
+ constexpr optional<Y> opt(in_place, 5, 4);
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == Y(5, 4), "");
+
+ struct test_constexpr_ctor
+ : public optional<Y>
+ {
+ constexpr test_constexpr_ctor(in_place_t, int i, int j)
+ : optional<Y>(in_place, i, j) {}
+ };
+
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ try
+ {
+ const optional<Z> opt(in_place, 1);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
new file mode 100644
index 000000000000..6d9f45a97d45
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U, class... Args>
+// constexpr
+// explicit optional(in_place_t, initializer_list<U> il, Args&&... args);
+
+#include <optional>
+#include <type_traits>
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::in_place_t;
+using std::in_place;
+
+class X
+{
+ int i_;
+ int j_ = 0;
+public:
+ X() : i_(0) {}
+ X(int i) : i_(i) {}
+ X(int i, int j) : i_(i), j_(j) {}
+
+ ~X() {}
+
+ friend bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Y
+{
+ int i_;
+ int j_ = 0;
+public:
+ constexpr Y() : i_(0) {}
+ constexpr Y(int i) : i_(i) {}
+ constexpr Y(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1]) {}
+
+ friend constexpr bool operator==(const Y& x, const Y& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+class Z
+{
+ int i_;
+ int j_ = 0;
+public:
+ Z() : i_(0) {}
+ Z(int i) : i_(i) {}
+ Z(std::initializer_list<int> il) : i_(il.begin()[0]), j_(il.begin()[1])
+ {TEST_THROW(6);}
+
+ friend bool operator==(const Z& x, const Z& y)
+ {return x.i_ == y.i_ && x.j_ == y.j_;}
+};
+
+int main()
+{
+ {
+ static_assert(!std::is_constructible<X, std::initializer_list<int>&>::value, "");
+ static_assert(!std::is_constructible<optional<X>, std::initializer_list<int>&>::value, "");
+ }
+ {
+ optional<std::vector<int>> opt(in_place, {3, 1});
+ assert(static_cast<bool>(opt) == true);
+ assert((*opt == std::vector<int>{3, 1}));
+ assert(opt->size() == 2);
+ }
+ {
+ optional<std::vector<int>> opt(in_place, {3, 1}, std::allocator<int>());
+ assert(static_cast<bool>(opt) == true);
+ assert((*opt == std::vector<int>{3, 1}));
+ assert(opt->size() == 2);
+ }
+ {
+ static_assert(std::is_constructible<optional<Y>, std::initializer_list<int>&>::value, "");
+ constexpr optional<Y> opt(in_place, {3, 1});
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == Y{3, 1}, "");
+
+ struct test_constexpr_ctor
+ : public optional<Y>
+ {
+ constexpr test_constexpr_ctor(in_place_t, std::initializer_list<int> i)
+ : optional<Y>(in_place, i) {}
+ };
+
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ static_assert(std::is_constructible<optional<Z>, std::initializer_list<int>&>::value, "");
+ try
+ {
+ optional<Z> opt(in_place, {3, 1});
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
new file mode 100644
index 000000000000..bff6f5bf8f6f
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -0,0 +1,201 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// optional(optional<T>&& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+template <class T, class ...InitArgs>
+void test(InitArgs&&... args)
+{
+ const optional<T> orig(std::forward<InitArgs>(args)...);
+ optional<T> rhs(orig);
+ bool rhs_engaged = static_cast<bool>(rhs);
+ optional<T> lhs = std::move(rhs);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(*lhs == *orig);
+}
+
+void test_throwing_ctor() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ struct Z {
+ Z() : count(0) {}
+ Z(Z&& o) : count(o.count + 1)
+ { if (count == 2) throw 6; }
+ int count;
+ };
+ Z z;
+ optional<Z> rhs(std::move(z));
+ try
+ {
+ optional<Z> lhs(std::move(rhs));
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#endif
+}
+
+
+template <class T, class ...InitArgs>
+void test_ref(InitArgs&&... args)
+{
+ optional<T> rhs(std::forward<InitArgs>(args)...);
+ bool rhs_engaged = static_cast<bool>(rhs);
+ optional<T> lhs = std::move(rhs);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ if (rhs_engaged)
+ assert(&(*lhs) == &(*rhs));
+}
+
+void test_reference_extension()
+{
+#if defined(_LIBCPP_VERSION) && 0 // FIXME these extensions are currently disabled.
+ using T = TestTypes::TestType;
+ T::reset();
+ {
+ T t;
+ T::reset_constructors();
+ test_ref<T&>();
+ test_ref<T&>(t);
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::destroyed == 1);
+ assert(T::alive == 0);
+ {
+ T t;
+ const T& ct = t;
+ T::reset_constructors();
+ test_ref<T const&>();
+ test_ref<T const&>(t);
+ test_ref<T const&>(ct);
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::alive == 0);
+ assert(T::destroyed == 1);
+ {
+ T t;
+ T::reset_constructors();
+ test_ref<T&&>();
+ test_ref<T&&>(std::move(t));
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::alive == 0);
+ assert(T::destroyed == 1);
+ {
+ T t;
+ const T& ct = t;
+ T::reset_constructors();
+ test_ref<T const&&>();
+ test_ref<T const&&>(std::move(t));
+ test_ref<T const&&>(std::move(ct));
+ assert(T::alive == 1);
+ assert(T::constructed == 0);
+ assert(T::assigned == 0);
+ assert(T::destroyed == 0);
+ }
+ assert(T::alive == 0);
+ assert(T::destroyed == 1);
+ {
+ static_assert(!std::is_copy_constructible<std::optional<T&&>>::value, "");
+ static_assert(!std::is_copy_constructible<std::optional<T const&&>>::value, "");
+ }
+#endif
+}
+
+
+int main()
+{
+ test<int>();
+ test<int>(3);
+ {
+ optional<const int> o(42);
+ optional<const int> o2(std::move(o));
+ assert(*o2 == 42);
+ }
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ optional<T> rhs;
+ assert(T::alive == 0);
+ const optional<T> lhs(std::move(rhs));
+ assert(lhs.has_value() == false);
+ assert(rhs.has_value() == false);
+ assert(T::alive == 0);
+ }
+ TestTypes::TestType::reset();
+ {
+ using T = TestTypes::TestType;
+ T::reset();
+ optional<T> rhs(42);
+ assert(T::alive == 1);
+ assert(T::value_constructed == 1);
+ assert(T::move_constructed == 0);
+ const optional<T> lhs(std::move(rhs));
+ assert(lhs.has_value());
+ assert(rhs.has_value());
+ assert(lhs.value().value == 42);
+ assert(rhs.value().value == -1);
+ assert(T::move_constructed == 1);
+ assert(T::alive == 2);
+ }
+ TestTypes::TestType::reset();
+ {
+ using namespace ConstexprTestTypes;
+ test<TestType>();
+ test<TestType>(42);
+ }
+ {
+ using namespace TrivialTestTypes;
+ test<TestType>();
+ test<TestType>(42);
+ }
+ {
+ test_throwing_ctor();
+ }
+ {
+ struct ThrowsMove {
+ ThrowsMove() noexcept(false) {}
+ ThrowsMove(ThrowsMove const&) noexcept(false) {}
+ ThrowsMove(ThrowsMove &&) noexcept(false) {}
+ };
+ static_assert(!std::is_nothrow_move_constructible<optional<ThrowsMove>>::value, "");
+ struct NoThrowMove {
+ NoThrowMove() noexcept(false) {}
+ NoThrowMove(NoThrowMove const&) noexcept(false) {}
+ NoThrowMove(NoThrowMove &&) noexcept(true) {}
+ };
+ static_assert(std::is_nothrow_move_constructible<optional<NoThrowMove>>::value, "");
+ }
+ {
+ test_reference_extension();
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
new file mode 100644
index 000000000000..468a00346fc7
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/nullopt_t.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr optional(nullopt_t) noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "archetypes.hpp"
+
+using std::optional;
+using std::nullopt_t;
+using std::nullopt;
+
+template <class Opt>
+void
+test_constexpr()
+{
+ static_assert(std::is_nothrow_constructible<Opt, nullopt_t&>::value, "");
+ static_assert(std::is_trivially_destructible<Opt>::value, "");
+ static_assert(std::is_trivially_destructible<typename Opt::value_type>::value, "");
+
+ constexpr Opt opt(nullopt);
+ static_assert(static_cast<bool>(opt) == false, "");
+
+ struct test_constexpr_ctor
+ : public Opt
+ {
+ constexpr test_constexpr_ctor() {}
+ };
+}
+
+template <class Opt>
+void
+test()
+{
+ static_assert(std::is_nothrow_constructible<Opt, nullopt_t&>::value, "");
+ static_assert(!std::is_trivially_destructible<Opt>::value, "");
+ static_assert(!std::is_trivially_destructible<typename Opt::value_type>::value, "");
+ {
+ Opt opt(nullopt);
+ assert(static_cast<bool>(opt) == false);
+ }
+ {
+ const Opt opt(nullopt);
+ assert(static_cast<bool>(opt) == false);
+ }
+ struct test_constexpr_ctor
+ : public Opt
+ {
+ constexpr test_constexpr_ctor() {}
+ };
+}
+
+int main()
+{
+ test_constexpr<optional<int>>();
+ test_constexpr<optional<int*>>();
+ test_constexpr<optional<ImplicitTypes::NoCtors>>();
+ test_constexpr<optional<NonTrivialTypes::NoCtors>>();
+ test_constexpr<optional<NonConstexprTypes::NoCtors>>();
+ test<optional<NonLiteralTypes::NoCtors>>();
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp
new file mode 100644
index 000000000000..0e180c14ec67
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/optional_U.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U>
+// optional(optional<U>&& rhs);
+
+#include <optional>
+#include <type_traits>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+template <class T, class U>
+void
+test(optional<U>&& rhs, bool is_going_to_throw = false)
+{
+ bool rhs_engaged = static_cast<bool>(rhs);
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ try
+ {
+ optional<T> lhs = std::move(rhs);
+ assert(is_going_to_throw == false);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+#else
+ if (is_going_to_throw) return;
+ optional<T> lhs = std::move(rhs);
+ assert(static_cast<bool>(lhs) == rhs_engaged);
+#endif
+}
+
+class X
+{
+ int i_;
+public:
+ X(int i) : i_(i) {}
+ X(X&& x) : i_(std::exchange(x.i_, 0)) {}
+ ~X() {i_ = 0;}
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+int count = 0;
+
+struct Z
+{
+ Z(int) { TEST_THROW(6); }
+};
+
+int main()
+{
+ {
+ optional<short> rhs;
+ test<int>(std::move(rhs));
+ }
+ {
+ optional<short> rhs(short{3});
+ test<int>(std::move(rhs));
+ }
+ {
+ optional<int> rhs;
+ test<X>(std::move(rhs));
+ }
+ {
+ optional<int> rhs(3);
+ test<X>(std::move(rhs));
+ }
+ {
+ optional<int> rhs;
+ test<Z>(std::move(rhs));
+ }
+ {
+ optional<int> rhs(3);
+ test<Z>(std::move(rhs), true);
+ }
+
+ static_assert(!(std::is_constructible<optional<X>, optional<Z>>::value), "");
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
new file mode 100644
index 000000000000..eee749d01707
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -0,0 +1,153 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// constexpr optional(T&& v);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+
+using std::optional;
+
+
+class Z
+{
+public:
+ Z(int) {}
+ Z(Z&&) {TEST_THROW(6);}
+};
+
+
+int main()
+{
+ {
+ typedef int T;
+ constexpr optional<T> opt(T(5));
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == 5, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(T&&) {}
+ };
+ }
+ {
+ typedef double T;
+ constexpr optional<T> opt(T(3));
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(*opt == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(T&&) {}
+ };
+ }
+ {
+ const int x = 42;
+ optional<const int> o(std::move(x));
+ assert(*o == 42);
+ }
+ {
+ typedef TestTypes::TestType T;
+ T::reset();
+ optional<T> opt = T{3};
+ assert(T::alive == 1);
+ assert(T::move_constructed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(opt.value().value == 3);
+ }
+ {
+ typedef ExplicitTestTypes::TestType T;
+ static_assert(!std::is_convertible<T&&, optional<T>>::value, "");
+ T::reset();
+ optional<T> opt(T{3});
+ assert(T::alive == 1);
+ assert(T::move_constructed == 1);
+ assert(static_cast<bool>(opt) == true);
+ assert(opt.value().value == 3);
+ }
+ {
+ typedef TestTypes::TestType T;
+ T::reset();
+ optional<T> opt = {3};
+ assert(T::alive == 1);
+ assert(T::value_constructed == 1);
+ assert(T::copy_constructed == 0);
+ assert(T::move_constructed == 0);
+ assert(static_cast<bool>(opt) == true);
+ assert(opt.value().value == 3);
+ }
+ {
+ typedef ConstexprTestTypes::TestType T;
+ constexpr optional<T> opt = {T(3)};
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(opt.value().value == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+ }
+ {
+ typedef ConstexprTestTypes::TestType T;
+ constexpr optional<T> opt = {3};
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(opt.value().value == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(const T&) {}
+ };
+ }
+ {
+ typedef ExplicitConstexprTestTypes::TestType T;
+ static_assert(!std::is_convertible<T&&, optional<T>>::value, "");
+ constexpr optional<T> opt(T{3});
+ static_assert(static_cast<bool>(opt) == true, "");
+ static_assert(opt.value().value == 3, "");
+
+ struct test_constexpr_ctor
+ : public optional<T>
+ {
+ constexpr test_constexpr_ctor(T&&) {}
+ };
+
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ struct Z {
+ Z(int) {}
+ Z(Z&&) {throw 6;}
+ };
+ typedef Z T;
+ try
+ {
+ T t(3);
+ optional<T> opt(std::move(t));
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp
new file mode 100644
index 000000000000..5132c9a73d0f
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// ~optional();
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+using std::optional;
+
+struct PODType {
+ int value;
+ int value2;
+};
+
+class X
+{
+public:
+ static bool dtor_called;
+ X() = default;
+ ~X() {dtor_called = true;}
+};
+
+bool X::dtor_called = false;
+
+int main()
+{
+ {
+ typedef int T;
+ static_assert(std::is_trivially_destructible<T>::value, "");
+ static_assert(std::is_trivially_destructible<optional<T>>::value, "");
+ static_assert(std::is_literal_type<optional<T>>::value, "");
+ }
+ {
+ typedef double T;
+ static_assert(std::is_trivially_destructible<T>::value, "");
+ static_assert(std::is_trivially_destructible<optional<T>>::value, "");
+ static_assert(std::is_literal_type<optional<T>>::value, "");
+ }
+ {
+ typedef PODType T;
+ static_assert(std::is_trivially_destructible<T>::value, "");
+ static_assert(std::is_trivially_destructible<optional<T>>::value, "");
+ static_assert(std::is_literal_type<optional<T>>::value, "");
+ }
+ {
+ typedef X T;
+ static_assert(!std::is_trivially_destructible<T>::value, "");
+ static_assert(!std::is_trivially_destructible<optional<T>>::value, "");
+ static_assert(!std::is_literal_type<optional<T>>::value, "");
+ {
+ X x;
+ optional<X> opt{x};
+ assert(X::dtor_called == false);
+ }
+ assert(X::dtor_called == true);
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
new file mode 100644
index 000000000000..cee73da849b6
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// void reset() noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+using std::optional;
+
+struct X
+{
+ static bool dtor_called;
+ ~X() {dtor_called = true;}
+};
+
+bool X::dtor_called = false;
+
+int main()
+{
+ {
+ optional<int> opt;
+ static_assert(noexcept(opt.reset()) == true, "");
+ opt.reset();
+ assert(static_cast<bool>(opt) == false);
+ }
+ {
+ optional<int> opt(3);
+ opt.reset();
+ assert(static_cast<bool>(opt) == false);
+ }
+ {
+ optional<X> opt;
+ static_assert(noexcept(opt.reset()) == true, "");
+ assert(X::dtor_called == false);
+ opt.reset();
+ assert(X::dtor_called == false);
+ assert(static_cast<bool>(opt) == false);
+ }
+ assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997
+ {
+ optional<X> opt(X{});
+ X::dtor_called = false;
+ opt.reset();
+ assert(X::dtor_called == true);
+ assert(static_cast<bool>(opt) == false);
+ X::dtor_called = false;
+ }
+ assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp
new file mode 100644
index 000000000000..9820d50f632e
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/bool.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr explicit optional<T>::operator bool() const noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using std::optional;
+ {
+ const optional<int> opt; ((void)opt);
+ ASSERT_NOEXCEPT(bool(opt));
+ static_assert(!std::is_convertible<optional<int>, bool>::value, "");
+ }
+ {
+ constexpr optional<int> opt;
+ static_assert(!opt, "");
+ }
+ {
+ constexpr optional<int> opt(0);
+ static_assert(opt, "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
new file mode 100644
index 000000000000..4087cfdf104e
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/dereference.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T& optional<T>::operator*() &;
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const& {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const&& {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ constexpr int test() {return 7;}
+};
+
+constexpr int
+test()
+{
+ optional<Y> opt{Y{}};
+ return (*opt).test();
+}
+
+int main()
+{
+ {
+ optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(*opt), X&);
+ // ASSERT_NOT_NOEXCEPT(*opt);
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator*() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ optional<X> opt(X{});
+ assert((*opt).test() == 4);
+ }
+ static_assert(test() == 7, "");
+#ifdef _LIBCPP_DEBUG
+ {
+ optional<X> opt;
+ assert((*opt).test() == 3);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
new file mode 100644
index 000000000000..0779c9047c9e
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr const T& optional<T>::operator*() const &;
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const& {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const&& {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ int test() const {return 2;}
+};
+
+int main()
+{
+ {
+ const optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(*opt), X const&);
+ // ASSERT_NOT_NOEXCEPT(*opt);
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator*() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ constexpr optional<X> opt(X{});
+ static_assert((*opt).test() == 3, "");
+ }
+ {
+ constexpr optional<Y> opt(Y{});
+ assert((*opt).test() == 2);
+ }
+#ifdef _LIBCPP_DEBUG
+ {
+ const optional<X> opt;
+ assert((*opt).test() == 3);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
new file mode 100644
index 000000000000..78fd992952c9
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_const_rvalue.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T&& optional<T>::operator*() const &&;
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const& {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const&& {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ int test() const && {return 2;}
+};
+
+int main()
+{
+ {
+ const optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(*std::move(opt)), X const &&);
+ // ASSERT_NOT_NOEXCEPT(*std::move(opt));
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator*() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ constexpr optional<X> opt(X{});
+ static_assert((*std::move(opt)).test() == 5, "");
+ }
+ {
+ constexpr optional<Y> opt(Y{});
+ assert((*std::move(opt)).test() == 2);
+ }
+#ifdef _LIBCPP_DEBUG
+ {
+ optional<X> opt;
+ assert((*std::move(opt)).test() == 5);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
new file mode 100644
index 000000000000..2924123234a8
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/dereference_rvalue.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T&& optional<T>::operator*() &&;
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const& {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const&& {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ constexpr int test() && {return 7;}
+};
+
+constexpr int
+test()
+{
+ optional<Y> opt{Y{}};
+ return (*std::move(opt)).test();
+}
+
+int main()
+{
+ {
+ optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(*std::move(opt)), X&&);
+ // ASSERT_NOT_NOEXCEPT(*std::move(opt));
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator*() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ optional<X> opt(X{});
+ assert((*std::move(opt)).test() == 6);
+ }
+ static_assert(test() == 7, "");
+#ifdef _LIBCPP_DEBUG
+ {
+ optional<X> opt;
+ assert((*std::move(opt)).test() == 3);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp
new file mode 100644
index 000000000000..5df295d01e22
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/has_value.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr bool optional<T>::has_value() const noexcept;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using std::optional;
+ {
+ const optional<int> opt; ((void)opt);
+ ASSERT_NOEXCEPT(opt.has_value());
+ ASSERT_SAME_TYPE(decltype(opt.has_value()), bool);
+ }
+ {
+ constexpr optional<int> opt;
+ static_assert(!opt.has_value(), "");
+ }
+ {
+ constexpr optional<int> opt(0);
+ static_assert(opt.has_value(), "");
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
new file mode 100644
index 000000000000..2f1648c48c89
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T* optional<T>::operator->();
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ int test() noexcept {return 3;}
+};
+
+struct Y
+{
+ constexpr int test() {return 3;}
+};
+
+constexpr int
+test()
+{
+ optional<Y> opt{Y{}};
+ return opt->test();
+}
+
+int main()
+{
+ {
+ std::optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(opt.operator->()), X*);
+ // ASSERT_NOT_NOEXCEPT(opt.operator->());
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator->() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ optional<X> opt(X{});
+ assert(opt->test() == 3);
+ }
+ {
+ static_assert(test() == 3, "");
+ }
+#ifdef _LIBCPP_DEBUG
+ {
+ optional<X> opt;
+ assert(opt->test() == 3);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
new file mode 100644
index 000000000000..887edc7114eb
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/op_arrow_const.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr const T* optional<T>::operator->() const;
+
+#ifdef _LIBCPP_DEBUG
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+#endif
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const {return 3;}
+};
+
+struct Y
+{
+ int test() const noexcept {return 2;}
+};
+
+struct Z
+{
+ const Z* operator&() const;
+ constexpr int test() const {return 1;}
+};
+
+int main()
+{
+ {
+ const std::optional<X> opt; ((void)opt);
+ ASSERT_SAME_TYPE(decltype(opt.operator->()), X const*);
+ // ASSERT_NOT_NOEXCEPT(opt.operator->());
+ // FIXME: This assertion fails with GCC because it can see that
+ // (A) operator->() is constexpr, and
+ // (B) there is no path through the function that throws.
+ // It's arguable if this is the correct behavior for the noexcept
+ // operator.
+ // Regardless this function should still be noexcept(false) because
+ // it has a narrow contract.
+ }
+ {
+ constexpr optional<X> opt(X{});
+ static_assert(opt->test() == 3, "");
+ }
+ {
+ constexpr optional<Y> opt(Y{});
+ assert(opt->test() == 2);
+ }
+ {
+ constexpr optional<Z> opt(Z{});
+ static_assert(opt->test() == 1, "");
+ }
+#ifdef _LIBCPP_DEBUG
+ {
+ const optional<X> opt;
+ assert(opt->test() == 3);
+ assert(false);
+ }
+#endif // _LIBCPP_DEBUG
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
new file mode 100644
index 000000000000..516a79db5f64
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T& optional<T>::value() &;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::bad_optional_access;
+
+struct X
+{
+ X() = default;
+ X(const X&) = delete;
+ constexpr int test() const & {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const && {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ constexpr int test() & {return 7;}
+};
+
+constexpr int
+test()
+{
+ optional<Y> opt{Y{}};
+ return opt.value().test();
+}
+
+
+int main()
+{
+ {
+ optional<X> opt; ((void)opt);
+ ASSERT_NOT_NOEXCEPT(opt.value());
+ ASSERT_SAME_TYPE(decltype(opt.value()), X&);
+ }
+ {
+ optional<X> opt;
+ opt.emplace();
+ assert(opt.value().test() == 4);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<X> opt;
+ try
+ {
+ opt.value();
+ assert(false);
+ }
+ catch (const bad_optional_access&)
+ {
+ }
+ }
+#endif
+ static_assert(test() == 7, "");
+}
diff --git a/test/libcxx/containers/sequences/list/db_front.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.fail.cpp
index fc02895a8912..6076c509fa41 100644
--- a/test/libcxx/containers/sequences/list/db_front.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.fail.cpp
@@ -7,26 +7,27 @@
//
//===----------------------------------------------------------------------===//
-// <list>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
-// Call front() on empty container.
+// constexpr const T& optional<T>::value() const &;
-#define _LIBCPP_DEBUG 1
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-
-#include <list>
+#include <optional>
+#include <type_traits>
#include <cassert>
-#include <iterator>
-#include <exception>
-#include <cstdlib>
+
+using std::optional;
+
+struct X
+{
+ constexpr int test() const {return 3;}
+ int test() {return 4;}
+};
int main()
{
- typedef int T;
- typedef std::list<T> C;
- C c(1);
- assert(c.front() == 0);
- c.clear();
- assert(c.front() == 0);
- assert(false);
+ {
+ constexpr optional<X> opt;
+ static_assert(opt.value().test() == 3, "");
+ }
}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
new file mode 100644
index 000000000000..d4038e4efa6b
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr const T& optional<T>::value() const &;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::in_place_t;
+using std::in_place;
+using std::bad_optional_access;
+
+struct X
+{
+ X() = default;
+ X(const X&) = delete;
+ constexpr int test() const & {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const && {return 5;}
+ int test() && {return 6;}
+};
+
+int main()
+{
+ {
+ const optional<X> opt; ((void)opt);
+ ASSERT_NOT_NOEXCEPT(opt.value());
+ ASSERT_SAME_TYPE(decltype(opt.value()), X const&);
+ }
+ {
+ constexpr optional<X> opt(in_place);
+ static_assert(opt.value().test() == 3, "");
+ }
+ {
+ const optional<X> opt(in_place);
+ assert(opt.value().test() == 3);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ const optional<X> opt;
+ try
+ {
+ opt.value();
+ assert(false);
+ }
+ catch (const bad_optional_access&)
+ {
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
new file mode 100644
index 000000000000..e189d3af6886
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr const T& optional<T>::value() const &&;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::in_place_t;
+using std::in_place;
+using std::bad_optional_access;
+
+struct X
+{
+ X() = default;
+ X(const X&) = delete;
+ constexpr int test() const & {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const && {return 5;}
+ int test() && {return 6;}
+};
+
+int main()
+{
+ {
+ const optional<X> opt; ((void)opt);
+ ASSERT_NOT_NOEXCEPT(std::move(opt).value());
+ ASSERT_SAME_TYPE(decltype(std::move(opt).value()), X const&&);
+ }
+ {
+ constexpr optional<X> opt(in_place);
+ static_assert(std::move(opt).value().test() == 5, "");
+ }
+ {
+ const optional<X> opt(in_place);
+ assert(std::move(opt).value().test() == 5);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ const optional<X> opt;
+ try
+ {
+ std::move(opt).value();
+ assert(false);
+ }
+ catch (const bad_optional_access&)
+ {
+ }
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp
new file mode 100644
index 000000000000..c219e9704716
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U> T optional<T>::value_or(U&& v) &&;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::in_place_t;
+using std::in_place;
+
+struct Y
+{
+ int i_;
+
+ Y(int i) : i_(i) {}
+};
+
+struct X
+{
+ int i_;
+
+ X(int i) : i_(i) {}
+ X(X&& x) : i_(x.i_) {x.i_ = 0;}
+ X(const Y& y) : i_(y.i_) {}
+ X(Y&& y) : i_(y.i_+1) {}
+ friend constexpr bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_;}
+};
+
+int main()
+{
+ {
+ optional<X> opt(in_place, 2);
+ Y y(3);
+ assert(std::move(opt).value_or(y) == 2);
+ assert(*opt == 0);
+ }
+ {
+ optional<X> opt(in_place, 2);
+ assert(std::move(opt).value_or(Y(3)) == 2);
+ assert(*opt == 0);
+ }
+ {
+ optional<X> opt;
+ Y y(3);
+ assert(std::move(opt).value_or(y) == 3);
+ assert(!opt);
+ }
+ {
+ optional<X> opt;
+ assert(std::move(opt).value_or(Y(3)) == 4);
+ assert(!opt);
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
new file mode 100644
index 000000000000..36a85811ba49
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_or_const.pass.cpp
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class U> constexpr T optional<T>::value_or(U&& v) const&;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+using std::optional;
+
+struct Y
+{
+ int i_;
+
+ constexpr Y(int i) : i_(i) {}
+};
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+ constexpr X(const Y& y) : i_(y.i_) {}
+ constexpr X(Y&& y) : i_(y.i_+1) {}
+ friend constexpr bool operator==(const X& x, const X& y)
+ {return x.i_ == y.i_;}
+};
+
+int main()
+{
+ {
+ constexpr optional<X> opt(2);
+ constexpr Y y(3);
+ static_assert(opt.value_or(y) == 2, "");
+ }
+ {
+ constexpr optional<X> opt(2);
+ static_assert(opt.value_or(Y(3)) == 2, "");
+ }
+ {
+ constexpr optional<X> opt;
+ constexpr Y y(3);
+ static_assert(opt.value_or(y) == 3, "");
+ }
+ {
+ constexpr optional<X> opt;
+ static_assert(opt.value_or(Y(3)) == 4, "");
+ }
+ {
+ const optional<X> opt(2);
+ const Y y(3);
+ assert(opt.value_or(y) == 2);
+ }
+ {
+ const optional<X> opt(2);
+ assert(opt.value_or(Y(3)) == 2);
+ }
+ {
+ const optional<X> opt;
+ const Y y(3);
+ assert(opt.value_or(y) == 3);
+ }
+ {
+ const optional<X> opt;
+ assert(opt.value_or(Y(3)) == 4);
+ }
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
new file mode 100644
index 000000000000..2ef485b7fe50
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// constexpr T& optional<T>::value() &&;
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+using std::optional;
+using std::bad_optional_access;
+
+struct X
+{
+ X() = default;
+ X(const X&) = delete;
+ constexpr int test() const & {return 3;}
+ int test() & {return 4;}
+ constexpr int test() const && {return 5;}
+ int test() && {return 6;}
+};
+
+struct Y
+{
+ constexpr int test() && {return 7;}
+};
+
+constexpr int
+test()
+{
+ optional<Y> opt{Y{}};
+ return std::move(opt).value().test();
+}
+
+int main()
+{
+ {
+ optional<X> opt; ((void)opt);
+ ASSERT_NOT_NOEXCEPT(std::move(opt).value());
+ ASSERT_SAME_TYPE(decltype(std::move(opt).value()), X&&);
+ }
+ {
+ optional<X> opt;
+ opt.emplace();
+ assert(std::move(opt).value().test() == 6);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<X> opt;
+ try
+ {
+ std::move(opt).value();
+ assert(false);
+ }
+ catch (const bad_optional_access&)
+ {
+ }
+ }
+#endif
+ static_assert(test() == 7, "");
+}
diff --git a/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
new file mode 100644
index 000000000000..26041259fa93
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -0,0 +1,306 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// void swap(optional&)
+// noexcept(is_nothrow_move_constructible<T>::value &&
+// is_nothrow_swappable<T>::value)
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+class X
+{
+ int i_;
+public:
+ static unsigned dtor_called;
+ X(int i) : i_(i) {}
+ X(X&& x) = default;
+ X& operator=(X&&) = default;
+ ~X() {++dtor_called;}
+
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+unsigned X::dtor_called = 0;
+
+class Y
+{
+ int i_;
+public:
+ static unsigned dtor_called;
+ Y(int i) : i_(i) {}
+ Y(Y&&) = default;
+ ~Y() {++dtor_called;}
+
+ friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
+ friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);}
+};
+
+unsigned Y::dtor_called = 0;
+
+class Z
+{
+ int i_;
+public:
+ Z(int i) : i_(i) {}
+ Z(Z&&) {TEST_THROW(7);}
+
+ friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
+ friend void swap(Z&, Z&) {TEST_THROW(6);}
+};
+
+
+int main()
+{
+ {
+ optional<int> opt1;
+ optional<int> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<int> opt1(1);
+ optional<int> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<int> opt1;
+ optional<int> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<int> opt1(1);
+ optional<int> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<X> opt1;
+ optional<X> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ assert(X::dtor_called == 0);
+ }
+ {
+ optional<X> opt1(1);
+ optional<X> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ X::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(X::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<X> opt1;
+ optional<X> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ X::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(X::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<X> opt1(1);
+ optional<X> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ X::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(X::dtor_called == 1); // from inside std::swap
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Y> opt1;
+ optional<Y> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ assert(Y::dtor_called == 0);
+ }
+ {
+ optional<Y> opt1(1);
+ optional<Y> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ Y::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(Y::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Y> opt1;
+ optional<Y> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ Y::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(Y::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<Y> opt1(1);
+ optional<Y> opt2(2);
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ Y::dtor_called = 0;
+ opt1.swap(opt2);
+ assert(Y::dtor_called == 0);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Z> opt1;
+ optional<Z> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ opt1.swap(opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<Z> opt1;
+ opt1.emplace(1);
+ optional<Z> opt2;
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ try
+ {
+ opt1.swap(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 7);
+ }
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<Z> opt1;
+ optional<Z> opt2;
+ opt2.emplace(2);
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ try
+ {
+ opt1.swap(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 7);
+ }
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ }
+ {
+ optional<Z> opt1;
+ opt1.emplace(1);
+ optional<Z> opt2;
+ opt2.emplace(2);
+ static_assert(noexcept(opt1.swap(opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ try
+ {
+ opt1.swap(opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ }
+#endif
+}
diff --git a/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
new file mode 100644
index 000000000000..8a2c77af0ec1
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/optional_requires_destructible_object.fail.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// T shall be an object type and shall satisfy the requirements of Destructible
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+private:
+ ~X() {}
+};
+
+int main()
+{
+ using std::optional;
+ {
+ // expected-error@optional:* 2 {{static_assert failed "instantiation of optional with a reference type is ill-formed}}
+ optional<int&> opt1;
+ optional<int&&> opt2;
+ }
+ {
+ // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed"}}
+ optional<X> opt3;
+ }
+ {
+ // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ optional<void()> opt4;
+ }
+ {
+ // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-object type is undefined behavior"}}
+ // expected-error@optional:* {{static_assert failed "instantiation of optional with a non-destructible type is ill-formed}}
+ // expected-error@optional:* 1+ {{cannot form a reference to 'void'}}
+ optional<const void> opt4;
+ }
+ // FIXME these are garbage diagnostics that Clang should not produce
+ // expected-error@optional:* 0+ {{is not a base class}}
+}
diff --git a/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp b/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp
new file mode 100644
index 000000000000..fdd0f154f0e5
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "archetypes.hpp"
+
+template <class T>
+struct SpecialMemberTest {
+ using O = std::optional<T>;
+
+ static_assert(std::is_default_constructible_v<O>,
+ "optional is always default constructible.");
+ static_assert(std::is_copy_constructible_v<O> == std::is_copy_constructible_v<T>,
+ "optional<T> is copy constructible if and only if T is copy constructible.");
+ static_assert(std::is_move_constructible_v<O> ==
+ (std::is_copy_constructible_v<T> || std::is_move_constructible_v<T>),
+ "optional<T> is move constructible if and only if T is copy or move constructible.");
+ static_assert(std::is_copy_assignable_v<O> ==
+ (std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>),
+ "optional<T> is copy assignable if and only if T is both copy "
+ "constructible and copy assignable.");
+ static_assert(std::is_move_assignable_v<O> ==
+ ((std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>) ||
+ (std::is_move_constructible_v<T> && std::is_move_assignable_v<T>)),
+ "optional<T> is move assignable if and only if T is both move assignable and "
+ "move constructible, or both copy constructible and copy assignable.");
+};
+
+template <class ...Args> static void sink(Args&&...) {}
+
+template <class ...TestTypes>
+struct DoTestsMetafunction {
+ DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); }
+};
+
+struct TrivialMoveNonTrivialCopy {
+ TrivialMoveNonTrivialCopy() = default;
+ TrivialMoveNonTrivialCopy(const TrivialMoveNonTrivialCopy&) {}
+ TrivialMoveNonTrivialCopy(TrivialMoveNonTrivialCopy&&) = default;
+ TrivialMoveNonTrivialCopy& operator=(const TrivialMoveNonTrivialCopy&) { return *this; }
+ TrivialMoveNonTrivialCopy& operator=(TrivialMoveNonTrivialCopy&&) = default;
+};
+
+struct TrivialCopyNonTrivialMove {
+ TrivialCopyNonTrivialMove() = default;
+ TrivialCopyNonTrivialMove(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove(TrivialCopyNonTrivialMove&&) {}
+ TrivialCopyNonTrivialMove& operator=(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove& operator=(TrivialCopyNonTrivialMove&&) { return *this; }
+};
+
+int main()
+{
+ sink(
+ ImplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ ExplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{},
+ DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{}
+ );
+}
diff --git a/test/std/utilities/optional/optional.object/types.pass.cpp b/test/std/utilities/optional/optional.object/types.pass.cpp
new file mode 100644
index 000000000000..0230a13dded1
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/types.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T>
+// class optional
+// {
+// public:
+// typedef T value_type;
+// ...
+
+#include <optional>
+#include <type_traits>
+
+using std::optional;
+
+template <class Opt, class T>
+void
+test()
+{
+ static_assert(std::is_same<typename Opt::value_type, T>::value, "");
+}
+
+int main()
+{
+ test<optional<int>, int>();
+ test<optional<const int>, const int>();
+ test<optional<double>, double>();
+ test<optional<const double>, const double>();
+}
diff --git a/test/std/utilities/optional/optional.relops/equal.pass.cpp b/test/std/utilities/optional/optional.relops/equal.pass.cpp
new file mode 100644
index 000000000000..6650b6720a8e
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/equal.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator == ( const X &lhs, const X &rhs )
+ { return lhs.i_ == rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( o1 == o1 , "" );
+ static_assert ( o1 == o2 , "" );
+ static_assert ( !(o1 == o3), "" );
+ static_assert ( !(o1 == o4), "" );
+ static_assert ( !(o1 == o5), "" );
+
+ static_assert ( o2 == o1 , "" );
+ static_assert ( o2 == o2 , "" );
+ static_assert ( !(o2 == o3), "" );
+ static_assert ( !(o2 == o4), "" );
+ static_assert ( !(o2 == o5), "" );
+
+ static_assert ( !(o3 == o1), "" );
+ static_assert ( !(o3 == o2), "" );
+ static_assert ( o3 == o3 , "" );
+ static_assert ( !(o3 == o4), "" );
+ static_assert ( o3 == o5 , "" );
+
+ static_assert ( !(o4 == o1), "" );
+ static_assert ( !(o4 == o2), "" );
+ static_assert ( !(o4 == o3), "" );
+ static_assert ( o4 == o4 , "" );
+ static_assert ( !(o4 == o5), "" );
+
+ static_assert ( !(o5 == o1), "" );
+ static_assert ( !(o5 == o2), "" );
+ static_assert ( o5 == o3 , "" );
+ static_assert ( !(o5 == o4), "" );
+ static_assert ( o5 == o5 , "" );
+
+ }
+}
diff --git a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp
new file mode 100644
index 000000000000..f9b30449638a
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator>= (const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator >= ( const X &lhs, const X &rhs )
+ { return lhs.i_ >= rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef optional<X> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( (o1 >= o1), "" );
+ static_assert ( (o1 >= o2), "" );
+ static_assert ( !(o1 >= o3), "" );
+ static_assert ( !(o1 >= o4), "" );
+ static_assert ( !(o1 >= o5), "" );
+
+ static_assert ( (o2 >= o1), "" );
+ static_assert ( (o2 >= o2), "" );
+ static_assert ( !(o2 >= o3), "" );
+ static_assert ( !(o2 >= o4), "" );
+ static_assert ( !(o2 >= o5), "" );
+
+ static_assert ( (o3 >= o1), "" );
+ static_assert ( (o3 >= o2), "" );
+ static_assert ( (o3 >= o3), "" );
+ static_assert ( !(o3 >= o4), "" );
+ static_assert ( (o3 >= o5), "" );
+
+ static_assert ( (o4 >= o1), "" );
+ static_assert ( (o4 >= o2), "" );
+ static_assert ( (o4 >= o3), "" );
+ static_assert ( (o4 >= o4), "" );
+ static_assert ( (o4 >= o5), "" );
+
+ static_assert ( (o5 >= o1), "" );
+ static_assert ( (o5 >= o2), "" );
+ static_assert ( (o5 >= o3), "" );
+ static_assert ( !(o5 >= o4), "" );
+ static_assert ( (o5 >= o5), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp
new file mode 100644
index 000000000000..8a27eb471f28
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator> (const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator > ( const X &lhs, const X &rhs )
+ { return lhs.i_ > rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef optional<X> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( !(o1 > o1), "" );
+ static_assert ( !(o1 > o2), "" );
+ static_assert ( !(o1 > o3), "" );
+ static_assert ( !(o1 > o4), "" );
+ static_assert ( !(o1 > o5), "" );
+
+ static_assert ( !(o2 > o1), "" );
+ static_assert ( !(o2 > o2), "" );
+ static_assert ( !(o2 > o3), "" );
+ static_assert ( !(o2 > o4), "" );
+ static_assert ( !(o2 > o5), "" );
+
+ static_assert ( (o3 > o1), "" );
+ static_assert ( (o3 > o2), "" );
+ static_assert ( !(o3 > o3), "" );
+ static_assert ( !(o3 > o4), "" );
+ static_assert ( !(o3 > o5), "" );
+
+ static_assert ( (o4 > o1), "" );
+ static_assert ( (o4 > o2), "" );
+ static_assert ( (o4 > o3), "" );
+ static_assert ( !(o4 > o4), "" );
+ static_assert ( (o4 > o5), "" );
+
+ static_assert ( (o5 > o1), "" );
+ static_assert ( (o5 > o2), "" );
+ static_assert ( !(o5 > o3), "" );
+ static_assert ( !(o5 > o4), "" );
+ static_assert ( !(o5 > o5), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp
new file mode 100644
index 000000000000..a7d594dd34a2
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator<= (const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator <= ( const X &lhs, const X &rhs )
+ { return lhs.i_ <= rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef optional<X> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( (o1 <= o1), "" );
+ static_assert ( (o1 <= o2), "" );
+ static_assert ( (o1 <= o3), "" );
+ static_assert ( (o1 <= o4), "" );
+ static_assert ( (o1 <= o5), "" );
+
+ static_assert ( (o2 <= o1), "" );
+ static_assert ( (o2 <= o2), "" );
+ static_assert ( (o2 <= o3), "" );
+ static_assert ( (o2 <= o4), "" );
+ static_assert ( (o2 <= o5), "" );
+
+ static_assert ( !(o3 <= o1), "" );
+ static_assert ( !(o3 <= o2), "" );
+ static_assert ( (o3 <= o3), "" );
+ static_assert ( (o3 <= o4), "" );
+ static_assert ( (o3 <= o5), "" );
+
+ static_assert ( !(o4 <= o1), "" );
+ static_assert ( !(o4 <= o2), "" );
+ static_assert ( !(o4 <= o3), "" );
+ static_assert ( (o4 <= o4), "" );
+ static_assert ( !(o4 <= o5), "" );
+
+ static_assert ( !(o5 <= o1), "" );
+ static_assert ( !(o5 <= o2), "" );
+ static_assert ( (o5 <= o3), "" );
+ static_assert ( (o5 <= o4), "" );
+ static_assert ( (o5 <= o5), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.relops/less_than.pass.cpp b/test/std/utilities/optional/optional.relops/less_than.pass.cpp
new file mode 100644
index 000000000000..deffa5e849f9
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/less_than.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator< (const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator < ( const X &lhs, const X &rhs )
+ { return lhs.i_ < rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef optional<X> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( !(o1 < o1), "" );
+ static_assert ( !(o1 < o2), "" );
+ static_assert ( (o1 < o3), "" );
+ static_assert ( (o1 < o4), "" );
+ static_assert ( (o1 < o5), "" );
+
+ static_assert ( !(o2 < o1), "" );
+ static_assert ( !(o2 < o2), "" );
+ static_assert ( (o2 < o3), "" );
+ static_assert ( (o2 < o4), "" );
+ static_assert ( (o2 < o5), "" );
+
+ static_assert ( !(o3 < o1), "" );
+ static_assert ( !(o3 < o2), "" );
+ static_assert ( !(o3 < o3), "" );
+ static_assert ( (o3 < o4), "" );
+ static_assert ( !(o3 < o5), "" );
+
+ static_assert ( !(o4 < o1), "" );
+ static_assert ( !(o4 < o2), "" );
+ static_assert ( !(o4 < o3), "" );
+ static_assert ( !(o4 < o4), "" );
+ static_assert ( !(o4 < o5), "" );
+
+ static_assert ( !(o5 < o1), "" );
+ static_assert ( !(o5 < o2), "" );
+ static_assert ( !(o5 < o3), "" );
+ static_assert ( (o5 < o4), "" );
+ static_assert ( !(o5 < o5), "" );
+ }
+}
diff --git a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp
new file mode 100644
index 000000000000..fd11b2a207ca
--- /dev/null
+++ b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y);
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+using std::optional;
+
+struct X
+{
+ int i_;
+
+ constexpr X(int i) : i_(i) {}
+};
+
+constexpr bool operator != ( const X &lhs, const X &rhs )
+ { return lhs.i_ != rhs.i_ ; }
+
+int main()
+{
+ {
+ typedef X T;
+ typedef optional<T> O;
+
+ constexpr O o1; // disengaged
+ constexpr O o2; // disengaged
+ constexpr O o3{1}; // engaged
+ constexpr O o4{2}; // engaged
+ constexpr O o5{1}; // engaged
+
+ static_assert ( !(o1 != o1), "" );
+ static_assert ( !(o1 != o2), "" );
+ static_assert ( (o1 != o3), "" );
+ static_assert ( (o1 != o4), "" );
+ static_assert ( (o1 != o5), "" );
+
+ static_assert ( !(o2 != o1), "" );
+ static_assert ( !(o2 != o2), "" );
+ static_assert ( (o2 != o3), "" );
+ static_assert ( (o2 != o4), "" );
+ static_assert ( (o2 != o5), "" );
+
+ static_assert ( (o3 != o1), "" );
+ static_assert ( (o3 != o2), "" );
+ static_assert ( !(o3 != o3), "" );
+ static_assert ( (o3 != o4), "" );
+ static_assert ( !(o3 != o5), "" );
+
+ static_assert ( (o4 != o1), "" );
+ static_assert ( (o4 != o2), "" );
+ static_assert ( (o4 != o3), "" );
+ static_assert ( !(o4 != o4), "" );
+ static_assert ( (o4 != o5), "" );
+
+ static_assert ( (o5 != o1), "" );
+ static_assert ( (o5 != o2), "" );
+ static_assert ( !(o5 != o3), "" );
+ static_assert ( (o5 != o4), "" );
+ static_assert ( !(o5 != o5), "" );
+
+ }
+}
diff --git a/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp b/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp
new file mode 100644
index 000000000000..3fbf19f8ee1b
--- /dev/null
+++ b/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T>
+// constexpr optional<decay_t<T>> make_optional(T&& v);
+
+#include <optional>
+#include <string>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using std::optional;
+ using std::make_optional;
+ {
+ int arr[10]; ((void)arr);
+ ASSERT_SAME_TYPE(decltype(make_optional(arr)), optional<int*>);
+ }
+ {
+ constexpr auto opt = make_optional(2);
+ ASSERT_SAME_TYPE(decltype(opt), const optional<int>);
+ static_assert(opt.value() == 2);
+ }
+ {
+ optional<int> opt = make_optional(2);
+ assert(*opt == 2);
+ }
+ {
+ std::string s("123");
+ optional<std::string> opt = make_optional(s);
+ assert(*opt == s);
+ }
+ {
+ std::unique_ptr<int> s(new int(3));
+ optional<std::unique_ptr<int>> opt = make_optional(std::move(s));
+ assert(**opt == 3);
+ assert(s == nullptr);
+ }
+}
diff --git a/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp b/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp
new file mode 100644
index 000000000000..bdfeefbcc1d8
--- /dev/null
+++ b/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T, class... Args>
+// constexpr optional<T> make_optional(Args&&... args);
+
+#include <optional>
+#include <string>
+#include <memory>
+#include <cassert>
+
+int main()
+{
+ using std::optional;
+ using std::make_optional;
+
+ {
+ constexpr auto opt = make_optional<int>('a');
+ static_assert(*opt == int('a'), "");
+ }
+ {
+ std::string s("123");
+ auto opt = make_optional<std::string>(s);
+ assert(*opt == s);
+ }
+ {
+ std::unique_ptr<int> s(new int(3));
+ auto opt = make_optional<std::unique_ptr<int>>(std::move(s));
+ assert(**opt == 3);
+ assert(s == nullptr);
+ }
+ {
+ auto opt = make_optional<std::string>(4, 'X');
+ assert(*opt == "XXXX");
+ }
+}
diff --git a/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp b/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
new file mode 100644
index 000000000000..e6ed0129ddc7
--- /dev/null
+++ b/test/std/utilities/optional/optional.specalg/make_optional_explicit_initializer_list.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T, class U, class... Args>
+// constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
+
+#include <optional>
+#include <string>
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct TestT {
+ int x;
+ int size;
+ constexpr TestT(std::initializer_list<int> il) : x(*il.begin()), size(static_cast<int>(il.size())) {}
+ constexpr TestT(std::initializer_list<int> il, const int*)
+ : x(*il.begin()), size(static_cast<int>(il.size())) {}
+};
+
+int main()
+{
+ using std::make_optional;
+ {
+ constexpr auto opt = make_optional<TestT>({42, 2, 3});
+ ASSERT_SAME_TYPE(decltype(opt), const std::optional<TestT>);
+ static_assert(opt->x == 42, "");
+ static_assert(opt->size == 3, "");
+ }
+ {
+ constexpr auto opt = make_optional<TestT>({42, 2, 3}, nullptr);
+ static_assert(opt->x == 42, "");
+ static_assert(opt->size == 3, "");
+ }
+ {
+ auto opt = make_optional<std::string>({'1', '2', '3'});
+ assert(*opt == "123");
+ }
+ {
+ auto opt = make_optional<std::string>({'a', 'b', 'c'}, std::allocator<char>{});
+ assert(*opt == "abc");
+ }
+}
diff --git a/test/std/utilities/optional/optional.specalg/swap.pass.cpp b/test/std/utilities/optional/optional.specalg/swap.pass.cpp
new file mode 100644
index 000000000000..31779243e32a
--- /dev/null
+++ b/test/std/utilities/optional/optional.specalg/swap.pass.cpp
@@ -0,0 +1,352 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// template <class T> void swap(optional<T>& x, optional<T>& y)
+// noexcept(noexcept(x.swap(y)));
+
+#include <optional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "archetypes.hpp"
+
+using std::optional;
+
+class X
+{
+ int i_;
+public:
+ static unsigned dtor_called;
+ X(int i) : i_(i) {}
+ X(X&& x) = default;
+ X& operator=(X&&) = default;
+ ~X() {++dtor_called;}
+
+ friend bool operator==(const X& x, const X& y) {return x.i_ == y.i_;}
+};
+
+unsigned X::dtor_called = 0;
+
+class Y
+{
+ int i_;
+public:
+ static unsigned dtor_called;
+ Y(int i) : i_(i) {}
+ Y(Y&&) = default;
+ ~Y() {++dtor_called;}
+
+ friend constexpr bool operator==(const Y& x, const Y& y) {return x.i_ == y.i_;}
+ friend void swap(Y& x, Y& y) {std::swap(x.i_, y.i_);}
+};
+
+unsigned Y::dtor_called = 0;
+
+class Z
+{
+ int i_;
+public:
+ Z(int i) : i_(i) {}
+ Z(Z&&) { TEST_THROW(7);}
+
+ friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
+ friend void swap(Z&, Z&) { TEST_THROW(6);}
+};
+
+
+struct NonSwappable {
+ NonSwappable(NonSwappable const&) = delete;
+};
+void swap(NonSwappable&, NonSwappable&) = delete;
+
+void test_swap_sfinae() {
+ using std::optional;
+ {
+ using T = TestTypes::TestType;
+ static_assert(std::is_swappable_v<optional<T>>, "");
+ }
+ {
+ using T = TestTypes::MoveOnly;
+ static_assert(std::is_swappable_v<optional<T>>, "");
+ }
+ {
+ using T = TestTypes::Copyable;
+ static_assert(std::is_swappable_v<optional<T>>, "");
+ }
+ {
+ using T = TestTypes::NoCtors;
+ static_assert(!std::is_swappable_v<optional<T>>, "");
+ }
+ {
+ using T = NonSwappable;
+ static_assert(!std::is_swappable_v<optional<T>>, "");
+ }
+ {
+ // Even thought CopyOnly has deleted move operations, those operations
+ // cause optional<CopyOnly> to have implicitly deleted move operations
+ // that decay into copies.
+ using T = TestTypes::CopyOnly;
+ using Opt = optional<T>;
+ T::reset();
+ Opt L(101), R(42);
+ T::reset_constructors();
+ std::swap(L, R);
+ assert(L->value == 42);
+ assert(R->value == 101);
+ assert(T::copy_constructed == 1);
+ assert(T::constructed == T::copy_constructed);
+ assert(T::assigned == 2);
+ assert(T::assigned == T::copy_assigned);
+ }
+}
+
+int main()
+{
+ test_swap_sfinae();
+ {
+ optional<int> opt1;
+ optional<int> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<int> opt1(1);
+ optional<int> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<int> opt1;
+ optional<int> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<int> opt1(1);
+ optional<int> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<X> opt1;
+ optional<X> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ assert(X::dtor_called == 0);
+ }
+ {
+ optional<X> opt1(1);
+ optional<X> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ X::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(X::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<X> opt1;
+ optional<X> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ X::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(X::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<X> opt1(1);
+ optional<X> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == true, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ X::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(X::dtor_called == 1); // from inside std::swap
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Y> opt1;
+ optional<Y> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ assert(Y::dtor_called == 0);
+ }
+ {
+ optional<Y> opt1(1);
+ optional<Y> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ Y::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(Y::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Y> opt1;
+ optional<Y> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ Y::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(Y::dtor_called == 1);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<Y> opt1(1);
+ optional<Y> opt2(2);
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ Y::dtor_called = 0;
+ swap(opt1, opt2);
+ assert(Y::dtor_called == 0);
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 2);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 1);
+ }
+ {
+ optional<Z> opt1;
+ optional<Z> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ swap(opt1, opt2);
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == false);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ optional<Z> opt1;
+ opt1.emplace(1);
+ optional<Z> opt2;
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ try
+ {
+ swap(opt1, opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 7);
+ }
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == false);
+ }
+ {
+ optional<Z> opt1;
+ optional<Z> opt2;
+ opt2.emplace(2);
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ try
+ {
+ swap(opt1, opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 7);
+ }
+ assert(static_cast<bool>(opt1) == false);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ }
+ {
+ optional<Z> opt1;
+ opt1.emplace(1);
+ optional<Z> opt2;
+ opt2.emplace(2);
+ static_assert(noexcept(swap(opt1, opt2)) == false, "");
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ try
+ {
+ swap(opt1, opt2);
+ assert(false);
+ }
+ catch (int i)
+ {
+ assert(i == 6);
+ }
+ assert(static_cast<bool>(opt1) == true);
+ assert(*opt1 == 1);
+ assert(static_cast<bool>(opt2) == true);
+ assert(*opt2 == 2);
+ }
+#endif // TEST_HAS_NO_EXCEPTIONS
+}
diff --git a/test/std/utilities/optional/optional.syn/optional_in_place_t.fail.cpp b/test/std/utilities/optional/optional.syn/optional_in_place_t.fail.cpp
new file mode 100644
index 000000000000..20c90c7e34fd
--- /dev/null
+++ b/test/std/utilities/optional/optional.syn/optional_in_place_t.fail.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) in_place_t is ill-formed.
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::in_place_t;
+ using std::in_place;
+
+ optional<in_place_t> opt; // expected-note {{requested here}}
+ // expected-error@optional:* {{"instantiation of optional with in_place_t is ill-formed"}}
+}
diff --git a/test/std/utilities/utility/forward/forward4.fail.cpp b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
index 276506f811b5..687625e8b673 100644
--- a/test/std/utilities/utility/forward/forward4.fail.cpp
+++ b/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
@@ -7,19 +7,16 @@
//
//===----------------------------------------------------------------------===//
-// test forward
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
-#include <utility>
+// #include <initializer_list>
-struct A
-{
-};
-
-A source() {return A();}
-const A csource() {return A();}
+#include <optional>
int main()
{
- const A ca = A();
- std::forward<A>(ca); // error
+ using std::optional;
+
+ std::initializer_list<int> list;
}
diff --git a/test/std/utilities/optional/optional.syn/optional_nullopt_t.fail.cpp b/test/std/utilities/optional/optional.syn/optional_nullopt_t.fail.cpp
new file mode 100644
index 000000000000..56a30ccb0db9
--- /dev/null
+++ b/test/std/utilities/optional/optional.syn/optional_nullopt_t.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// <optional>
+
+// A program that necessitates the instantiation of template optional for
+// (possibly cv-qualified) nullopt_t is ill-formed.
+
+#include <optional>
+
+int main()
+{
+ using std::optional;
+ using std::nullopt_t;
+ using std::nullopt;
+
+ optional<nullopt_t> opt; // expected-note 1 {{requested here}}
+ optional<const nullopt_t> opt1; // expected-note 1 {{requested here}}
+ optional<nullopt_t &> opt2; // expected-note 1 {{requested here}}
+ optional<nullopt_t &&> opt3; // expected-note 1 {{requested here}}
+ // expected-error@optional:* 4 {{instantiation of optional with nullopt_t is ill-formed}}
+}
diff --git a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
index 1b121c5fb928..3ba88ee2db53 100644
--- a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
@@ -12,6 +12,7 @@
#include <bitset>
#include <cassert>
#include <algorithm> // for 'min' and 'max'
+#include <cstddef>
#include "test_macros.h"
@@ -21,9 +22,9 @@ void test_val_ctor()
{
TEST_CONSTEXPR std::bitset<N> v(0xAAAAAAAAAAAAAAAAULL);
assert(v.size() == N);
- unsigned M = std::min<std::size_t>(N, 64);
+ std::size_t M = std::min<std::size_t>(N, 64);
for (std::size_t i = 0; i < M; ++i)
- assert(v[i] == (i & 1));
+ assert(v[i] == ((i & 1) != 0));
for (std::size_t i = M; i < N; ++i)
assert(v[i] == false);
}
diff --git a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
index 88ce8e943caf..18a64a214a45 100644
--- a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test bitset<N>& flip(size_t pos);
#include <bitset>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
template <std::size_t N>
std::bitset<N>
make_bitset()
@@ -25,11 +26,15 @@ make_bitset()
}
template <std::size_t N>
-void test_flip_one()
+void test_flip_one(bool test_throws)
{
std::bitset<N> v = make_bitset<N>();
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (test_throws) return;
+#else
try
{
+#endif
v.flip(50);
bool b = v[50];
if (50 >= v.size())
@@ -39,21 +44,25 @@ void test_flip_one()
assert(v[50] != b);
v.flip(50);
assert(v[50] == b);
+ assert(!test_throws);
+#ifndef TEST_HAS_NO_EXCEPTIONS
}
catch (std::out_of_range&)
{
+ assert(test_throws);
}
+#endif
}
int main()
{
- test_flip_one<0>();
- test_flip_one<1>();
- test_flip_one<31>();
- test_flip_one<32>();
- test_flip_one<33>();
- test_flip_one<63>();
- test_flip_one<64>();
- test_flip_one<65>();
- test_flip_one<1000>();
+ test_flip_one<0>(true);
+ test_flip_one<1>(true);
+ test_flip_one<31>(true);
+ test_flip_one<32>(true);
+ test_flip_one<33>(true);
+ test_flip_one<63>(false);
+ test_flip_one<64>(false);
+ test_flip_one<65>(false);
+ test_flip_one<1000>(false);
}
diff --git a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
index f01d35b9a33c..6847694e4b73 100644
--- a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
@@ -7,18 +7,23 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test bitset<N>& reset(size_t pos);
#include <bitset>
#include <cassert>
+#include "test_macros.h"
+
template <std::size_t N>
-void test_reset_one()
+void test_reset_one(bool test_throws)
{
std::bitset<N> v;
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (test_throws) return;
+#else
try
{
+#endif
v.set();
v.reset(50);
if (50 >= v.size())
@@ -28,21 +33,25 @@ void test_reset_one()
assert(!v[i]);
else
assert(v[i]);
+ assert(!test_throws);
+#ifndef TEST_HAS_NO_EXCEPTIONS
}
catch (std::out_of_range&)
{
+ assert(test_throws);
}
+#endif
}
int main()
{
- test_reset_one<0>();
- test_reset_one<1>();
- test_reset_one<31>();
- test_reset_one<32>();
- test_reset_one<33>();
- test_reset_one<63>();
- test_reset_one<64>();
- test_reset_one<65>();
- test_reset_one<1000>();
+ test_reset_one<0>(true);
+ test_reset_one<1>(true);
+ test_reset_one<31>(true);
+ test_reset_one<32>(true);
+ test_reset_one<33>(true);
+ test_reset_one<63>(false);
+ test_reset_one<64>(false);
+ test_reset_one<65>(false);
+ test_reset_one<1000>(false);
}
diff --git a/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
index debe5431d8d0..1c8d6a1c32a4 100644
--- a/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
@@ -7,47 +7,60 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test bitset<N>& set(size_t pos, bool val = true);
#include <bitset>
#include <cassert>
+#include "test_macros.h"
+
template <std::size_t N>
-void test_set_one()
+void test_set_one(bool test_throws)
{
std::bitset<N> v;
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (test_throws) return;
+#else
try
+#endif
{
v.set(50);
if (50 >= v.size())
assert(false);
assert(v[50]);
+ assert(!test_throws);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (std::out_of_range&)
{
+ assert(test_throws);
}
try
+#endif
{
v.set(50, false);
if (50 >= v.size())
assert(false);
assert(!v[50]);
+ assert(!test_throws);
}
+#ifndef TEST_HAS_NO_EXCEPTIONS
catch (std::out_of_range&)
{
+ assert(test_throws);
}
+#endif
}
int main()
{
- test_set_one<0>();
- test_set_one<1>();
- test_set_one<31>();
- test_set_one<32>();
- test_set_one<33>();
- test_set_one<63>();
- test_set_one<64>();
- test_set_one<65>();
- test_set_one<1000>();
+ test_set_one<0>(true);
+ test_set_one<1>(true);
+ test_set_one<31>(true);
+ test_set_one<32>(true);
+ test_set_one<33>(true);
+ test_set_one<63>(false);
+ test_set_one<64>(false);
+ test_set_one<65>(false);
+ test_set_one<1000>(false);
}
diff --git a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
index 161afd11c291..1a2d70613e1f 100644
--- a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: libcpp-no-exceptions
// test constexpr bool test(size_t pos) const;
#include <bitset>
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
template <std::size_t N>
std::bitset<N>
make_bitset()
@@ -25,30 +26,38 @@ make_bitset()
}
template <std::size_t N>
-void test_test()
+void test_test(bool test_throws)
{
const std::bitset<N> v1 = make_bitset<N>();
+#ifdef TEST_HAS_NO_EXCEPTIONS
+ if (test_throws) return;
+#else
try
{
+#endif
bool b = v1.test(50);
if (50 >= v1.size())
assert(false);
assert(b == v1[50]);
+ assert(!test_throws);
+#ifndef TEST_HAS_NO_EXCEPTIONS
}
catch (std::out_of_range&)
{
+ assert(test_throws);
}
+#endif
}
int main()
{
- test_test<0>();
- test_test<1>();
- test_test<31>();
- test_test<32>();
- test_test<33>();
- test_test<63>();
- test_test<64>();
- test_test<65>();
- test_test<1000>();
+ test_test<0>(true);
+ test_test<1>(true);
+ test_test<31>(true);
+ test_test<32>(true);
+ test_test<33>(true);
+ test_test<63>(false);
+ test_test<64>(false);
+ test_test<65>(false);
+ test_test<1000>(false);
}
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
index 80792d919ccf..d86a10c6df13 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
@@ -33,7 +33,7 @@ void test_op_and()
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
- assert((v1 & v2) == (v3 &= v2));;
+ assert((v1 & v2) == (v3 &= v2));
}
int main()
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
index 65a7004acb86..0a8024d5eb9b 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
@@ -33,7 +33,7 @@ void test_op_not()
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
- assert((v1 ^ v2) == (v3 ^= v2));;
+ assert((v1 ^ v2) == (v3 ^= v2));
}
int main()
diff --git a/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp b/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
index dcabaa4a9a4d..449115edd757 100644
--- a/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
@@ -33,7 +33,7 @@ void test_op_or()
std::bitset<N> v1 = make_bitset<N>();
std::bitset<N> v2 = make_bitset<N>();
std::bitset<N> v3 = v1;
- assert((v1 | v2) == (v3 |= v2));;
+ assert((v1 | v2) == (v3 |= v2));
}
int main()
diff --git a/test/std/utilities/time/rep.h b/test/std/utilities/time/rep.h
index 2ec3514ab567..1c76582d3725 100644
--- a/test/std/utilities/time/rep.h
+++ b/test/std/utilities/time/rep.h
@@ -10,15 +10,17 @@
#ifndef REP_H
#define REP_H
+#include "test_macros.h"
+
class Rep
{
int data_;
public:
- _LIBCPP_CONSTEXPR Rep() : data_(-1) {}
- explicit _LIBCPP_CONSTEXPR Rep(int i) : data_(i) {}
+ TEST_CONSTEXPR Rep() : data_(-1) {}
+ explicit TEST_CONSTEXPR Rep(int i) : data_(i) {}
- bool _LIBCPP_CONSTEXPR operator==(int i) const {return data_ == i;}
- bool _LIBCPP_CONSTEXPR operator==(const Rep& r) const {return data_ == r.data_;}
+ bool TEST_CONSTEXPR operator==(int i) const {return data_ == i;}
+ bool TEST_CONSTEXPR operator==(const Rep& r) const {return data_ == r.data_;}
Rep& operator*=(Rep x) {data_ *= x.data_; return *this;}
Rep& operator/=(Rep x) {data_ /= x.data_; return *this;}
diff --git a/test/std/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp
index 7d7e82ac5e23..ae5423ef1161 100644
--- a/test/std/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp
@@ -19,6 +19,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class FromDuration, class ToDuration>
void
test(const FromDuration& df, const ToDuration& d)
@@ -35,7 +37,7 @@ test(const FromDuration& df, const ToDuration& d)
}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
template<class FromDuration, long long From, class ToDuration, long long To>
void test_constexpr ()
@@ -65,7 +67,7 @@ int main()
std::chrono::duration<double, std::ratio<3600> >(7265./3600));
test(std::chrono::duration<int, std::ratio<2, 3> >(9),
std::chrono::duration<int, std::ratio<3, 5> >(10));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
test_constexpr<std::chrono::milliseconds, 7265000, std::chrono::hours, 2> ();
test_constexpr<std::chrono::milliseconds, 7265000, std::chrono::minutes,121> ();
diff --git a/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp b/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
index a37bb266a0a9..a6f7cc0b89b2 100644
--- a/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
@@ -22,6 +22,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -55,7 +57,7 @@ int main()
assert( (t1 != t2));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T1 t1(Duration1(3));
constexpr T1 t2(Duration1(3));
diff --git a/test/std/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp b/test/std/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp
index 9d94400ed3d1..d7adf29f2ef8 100644
--- a/test/std/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp
@@ -30,6 +30,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -71,7 +73,7 @@ int main()
assert(!(t1 >= t2));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr T1 t1(Duration1(3));
constexpr T1 t2(Duration1(3));
diff --git a/test/std/utilities/time/time.point/time.point.cons/convert.pass.cpp b/test/std/utilities/time/time.point/time.point.cons/convert.pass.cpp
index 6cd7dcb7d2f4..33e349fe8941 100644
--- a/test/std/utilities/time/time.point/time.point.cons/convert.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cons/convert.pass.cpp
@@ -17,6 +17,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -27,7 +29,7 @@ int main()
std::chrono::time_point<Clock, Duration1> t1 = t2;
assert(t1.time_since_epoch() == Duration1(3000));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration2> t2(Duration2(3));
constexpr std::chrono::time_point<Clock, Duration1> t1 = t2;
diff --git a/test/std/utilities/time/time.point/time.point.cons/default.pass.cpp b/test/std/utilities/time/time.point/time.point.cons/default.pass.cpp
index 01f0bc169933..120fd3fb4e9f 100644
--- a/test/std/utilities/time/time.point/time.point.cons/default.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cons/default.pass.cpp
@@ -16,6 +16,7 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
#include "../../rep.h"
int main()
@@ -26,7 +27,7 @@ int main()
std::chrono::time_point<Clock, Duration> t;
assert(t.time_since_epoch() == Duration::zero());
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration> t;
static_assert(t.time_since_epoch() == Duration::zero(), "");
diff --git a/test/std/utilities/time/time.point/time.point.cons/duration.pass.cpp b/test/std/utilities/time/time.point/time.point.cons/duration.pass.cpp
index 9d53d86dea3b..1b96902aba3b 100644
--- a/test/std/utilities/time/time.point/time.point.cons/duration.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.cons/duration.pass.cpp
@@ -16,6 +16,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -28,7 +30,7 @@ int main()
std::chrono::time_point<Clock, Duration> t(std::chrono::seconds(3));
assert(t.time_since_epoch() == Duration(3000));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration> t(Duration(3));
static_assert(t.time_since_epoch() == Duration(3), "");
diff --git a/test/std/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp b/test/std/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp
index 7a8fa6dcf14f..19f5cbcd9f41 100644
--- a/test/std/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp
@@ -22,6 +22,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -34,7 +36,7 @@ int main()
t2 = Duration2(6) + t1;
assert(t2.time_since_epoch() == Duration2(3006));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
constexpr std::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
diff --git a/test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp b/test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp
index 342d27b5aebd..978f09d66bb2 100644
--- a/test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp
@@ -18,6 +18,19 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
+template <class D>
+void test2739() // LWG2739
+{
+ typedef std::chrono::time_point<std::chrono::system_clock> TimePoint;
+ typedef std::chrono::duration<D> Dur;
+ const Dur d(5);
+ TimePoint t0 = std::chrono::system_clock::from_time_t(200);
+ TimePoint t1 = t0 - d;
+ assert(t1 < t0);
+}
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -28,11 +41,13 @@ int main()
std::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
assert(t2.time_since_epoch() == Duration2(2995));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
constexpr std::chrono::time_point<Clock, Duration2> t2 = t1 - Duration2(5);
static_assert(t2.time_since_epoch() == Duration2(2995), "");
}
#endif
+ test2739<int32_t>();
+ test2739<uint32_t>();
}
diff --git a/test/std/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp b/test/std/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp
index 5267f07e1b86..fcef3f249733 100644
--- a/test/std/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp
@@ -18,6 +18,8 @@
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
@@ -28,7 +30,7 @@ int main()
std::chrono::time_point<Clock, Duration2> t2(Duration2(5));
assert((t1 - t2) == Duration2(2995));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
constexpr std::chrono::time_point<Clock, Duration2> t2(Duration2(5));
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
index 2e821945d09a..4c15499f5c1d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
@@ -166,7 +166,6 @@ void check_apply_quals_and_types(Tuple&& t) {
void test_call_quals_and_arg_types()
{
- TrackedCallable obj;
using Tup = std::tuple<int, int const&, unsigned&&>;
const int x = 42;
unsigned y = 101;
@@ -199,7 +198,7 @@ void test_noexcept()
// test that the functions noexcept-ness is propagated
using Tup = std::tuple<int, const char*, long>;
Tup t;
- ASSERT_NOEXCEPT(std::apply(nec, t));
+ LIBCPP_ASSERT_NOEXCEPT(std::apply(nec, t));
ASSERT_NOT_NOEXCEPT(std::apply(tc, t));
}
{
@@ -207,7 +206,7 @@ void test_noexcept()
using Tup = std::tuple<NothrowMoveable, int>;
Tup t;
ASSERT_NOT_NOEXCEPT(std::apply(nec, t));
- ASSERT_NOEXCEPT(std::apply(nec, std::move(t)));
+ LIBCPP_ASSERT_NOEXCEPT(std::apply(nec, std::move(t)));
}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
index 143ae195e6f4..eee1dd88253c 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
@@ -175,14 +175,14 @@ void test_noexcept() {
Tuple tup; ((void)tup);
Tuple const& ctup = tup; ((void)ctup);
ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(ctup));
- ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
+ LIBCPP_ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
}
{
using Tuple = std::pair<int, NothrowMoveable>;
Tuple tup; ((void)tup);
Tuple const& ctup = tup; ((void)ctup);
ASSERT_NOT_NOEXCEPT(std::make_from_tuple<TestType>(ctup));
- ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
+ LIBCPP_ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(std::move(tup)));
}
{
using Tuple = std::tuple<int, int, int>;
@@ -192,7 +192,7 @@ void test_noexcept() {
{
using Tuple = std::tuple<long, long, long>;
Tuple tup; ((void)tup);
- ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ LIBCPP_ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
}
{
using Tuple = std::array<int, 3>;
@@ -202,7 +202,7 @@ void test_noexcept() {
{
using Tuple = std::array<long, 3>;
Tuple tup; ((void)tup);
- ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
+ LIBCPP_ASSERT_NOEXCEPT(std::make_from_tuple<TestType>(tup));
}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
index a3d14487b47d..a66fba22d919 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/const_pair.pass.cpp
@@ -23,9 +23,9 @@
int main()
{
{
- typedef std::pair<double, char> T0;
- typedef std::tuple<int, short> T1;
- T0 t0(2.5, 'a');
+ typedef std::pair<long, char> T0;
+ typedef std::tuple<long long, short> T1;
+ T0 t0(2, 'a');
T1 t1;
t1 = t0;
assert(std::get<0>(t1) == 2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
index 91892efaf139..85dcee893a07 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_copy.pass.cpp
@@ -36,26 +36,26 @@ struct D
int main()
{
{
- typedef std::tuple<double> T0;
- typedef std::tuple<int> T1;
- T0 t0(2.5);
+ typedef std::tuple<long> T0;
+ typedef std::tuple<long long> T1;
+ T0 t0(2);
T1 t1;
t1 = t0;
assert(std::get<0>(t1) == 2);
}
{
- typedef std::tuple<double, char> T0;
- typedef std::tuple<int, int> T1;
- T0 t0(2.5, 'a');
+ typedef std::tuple<long, char> T0;
+ typedef std::tuple<long long, int> T1;
+ T0 t0(2, 'a');
T1 t1;
t1 = t0;
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
}
{
- typedef std::tuple<double, char, D> T0;
- typedef std::tuple<int, int, B> T1;
- T0 t0(2.5, 'a', D(3));
+ typedef std::tuple<long, char, D> T0;
+ typedef std::tuple<long long, int, B> T1;
+ T0 t0(2, 'a', D(3));
T1 t1;
t1 = t0;
assert(std::get<0>(t1) == 2);
@@ -65,10 +65,10 @@ int main()
{
D d(3);
D d2(2);
- typedef std::tuple<double, char, D&> T0;
- typedef std::tuple<int, int, B&> T1;
- T0 t0(2.5, 'a', d2);
- T1 t1(1.5, 'b', d);
+ typedef std::tuple<long, char, D&> T0;
+ typedef std::tuple<long long, int, B&> T1;
+ T0 t0(2, 'a', d2);
+ T1 t1(1, 'b', d);
t1 = t0;
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
index afd3e0fdb8e3..1a32acd55cff 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp
@@ -39,7 +39,7 @@ struct D
struct E {
E() = default;
- E& operator=(int val) {
+ E& operator=(int) {
return *this;
}
};
@@ -47,26 +47,26 @@ struct E {
int main()
{
{
- typedef std::tuple<double> T0;
- typedef std::tuple<int> T1;
- T0 t0(2.5);
+ typedef std::tuple<long> T0;
+ typedef std::tuple<long long> T1;
+ T0 t0(2);
T1 t1;
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
}
{
- typedef std::tuple<double, char> T0;
- typedef std::tuple<int, int> T1;
- T0 t0(2.5, 'a');
+ typedef std::tuple<long, char> T0;
+ typedef std::tuple<long long, int> T1;
+ T0 t0(2, 'a');
T1 t1;
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
}
{
- typedef std::tuple<double, char, D> T0;
- typedef std::tuple<int, int, B> T1;
- T0 t0(2.5, 'a', D(3));
+ typedef std::tuple<long, char, D> T0;
+ typedef std::tuple<long long, int, B> T1;
+ T0 t0(2, 'a', D(3));
T1 t1;
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
@@ -76,19 +76,19 @@ int main()
{
D d(3);
D d2(2);
- typedef std::tuple<double, char, D&> T0;
- typedef std::tuple<int, int, B&> T1;
- T0 t0(2.5, 'a', d2);
- T1 t1(1.5, 'b', d);
+ typedef std::tuple<long, char, D&> T0;
+ typedef std::tuple<long long, int, B&> T1;
+ T0 t0(2, 'a', d2);
+ T1 t1(1, 'b', d);
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
assert(std::get<2>(t1).id_ == 2);
}
{
- typedef std::tuple<double, char, std::unique_ptr<D>> T0;
- typedef std::tuple<int, int, std::unique_ptr<B>> T1;
- T0 t0(2.5, 'a', std::unique_ptr<D>(new D(3)));
+ typedef std::tuple<long, char, std::unique_ptr<D>> T0;
+ typedef std::tuple<long long, int, std::unique_ptr<B>> T1;
+ T0 t0(2, 'a', std::unique_ptr<D>(new D(3)));
T1 t1;
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
index d5d020779726..edb235a41919 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/copy.pass.cpp
@@ -16,9 +16,26 @@
// UNSUPPORTED: c++98, c++03
#include <tuple>
+#include <memory>
#include <string>
#include <cassert>
+#include "test_macros.h"
+
+struct NonAssignable {
+ NonAssignable& operator=(NonAssignable const&) = delete;
+ NonAssignable& operator=(NonAssignable&&) = delete;
+};
+struct CopyAssignable {
+ CopyAssignable& operator=(CopyAssignable const&) = default;
+ CopyAssignable& operator=(CopyAssignable &&) = delete;
+};
+static_assert(std::is_copy_assignable<CopyAssignable>::value, "");
+struct MoveAssignable {
+ MoveAssignable& operator=(MoveAssignable const&) = delete;
+ MoveAssignable& operator=(MoveAssignable&&) = default;
+};
+
int main()
{
{
@@ -51,4 +68,37 @@ int main()
assert(std::get<1>(t) == 'a');
assert(std::get<2>(t) == "some text");
}
+ {
+ // test reference assignment.
+ using T = std::tuple<int&, int&&>;
+ int x = 42;
+ int y = 100;
+ int x2 = -1;
+ int y2 = 500;
+ T t(x, std::move(y));
+ T t2(x2, std::move(y2));
+ t = t2;
+ assert(std::get<0>(t) == x2);
+ assert(&std::get<0>(t) == &x);
+ assert(std::get<1>(t) == y2);
+ assert(&std::get<1>(t) == &y);
+ }
+ {
+ // test that the implicitly generated copy assignment operator
+ // is properly deleted
+ using T = std::tuple<std::unique_ptr<int>>;
+ static_assert(!std::is_copy_assignable<T>::value, "");
+ }
+ {
+ using T = std::tuple<int, NonAssignable>;
+ static_assert(!std::is_copy_assignable<T>::value, "");
+ }
+ {
+ using T = std::tuple<int, CopyAssignable>;
+ static_assert(std::is_copy_assignable<T>::value, "");
+ }
+ {
+ using T = std::tuple<int, MoveAssignable>;
+ static_assert(!std::is_copy_assignable<T>::value, "");
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
index fc5e41ad569d..210f14be318a 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
@@ -21,6 +21,33 @@
#include "MoveOnly.h"
+struct NonAssignable {
+ NonAssignable& operator=(NonAssignable const&) = delete;
+ NonAssignable& operator=(NonAssignable&&) = delete;
+};
+struct CopyAssignable {
+ CopyAssignable& operator=(CopyAssignable const&) = default;
+ CopyAssignable& operator=(CopyAssignable&&) = delete;
+};
+static_assert(std::is_copy_assignable<CopyAssignable>::value, "");
+struct MoveAssignable {
+ MoveAssignable& operator=(MoveAssignable const&) = delete;
+ MoveAssignable& operator=(MoveAssignable&&) = default;
+};
+
+
+struct CountAssign {
+ static int copied;
+ static int moved;
+ static void reset() { copied = moved = 0; }
+ CountAssign() = default;
+ CountAssign& operator=(CountAssign const&) { ++copied; return *this; }
+ CountAssign& operator=(CountAssign&&) { ++moved; return *this; }
+};
+int CountAssign::copied = 0;
+int CountAssign::moved = 0;
+
+
int main()
{
{
@@ -53,4 +80,46 @@ int main()
assert(std::get<1>(t) == 1);
assert(std::get<2>(t) == 2);
}
+ {
+ // test reference assignment.
+ using T = std::tuple<int&, int&&>;
+ int x = 42;
+ int y = 100;
+ int x2 = -1;
+ int y2 = 500;
+ T t(x, std::move(y));
+ T t2(x2, std::move(y2));
+ t = std::move(t2);
+ assert(std::get<0>(t) == x2);
+ assert(&std::get<0>(t) == &x);
+ assert(std::get<1>(t) == y2);
+ assert(&std::get<1>(t) == &y);
+ }
+ {
+ // test that the implicitly generated move assignment operator
+ // is properly deleted
+ using T = std::tuple<std::unique_ptr<int>>;
+ static_assert(std::is_move_assignable<T>::value, "");
+ static_assert(!std::is_copy_assignable<T>::value, "");
+
+ }
+ {
+ using T = std::tuple<int, NonAssignable>;
+ static_assert(!std::is_move_assignable<T>::value, "");
+ }
+ {
+ using T = std::tuple<int, MoveAssignable>;
+ static_assert(std::is_move_assignable<T>::value, "");
+ }
+ {
+ // The move should decay to a copy.
+ CountAssign::reset();
+ using T = std::tuple<CountAssign, CopyAssignable>;
+ static_assert(std::is_move_assignable<T>::value, "");
+ T t1;
+ T t2;
+ t1 = std::move(t2);
+ assert(CountAssign::copied == 1);
+ assert(CountAssign::moved == 0);
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
index 812e6329bb3e..27656a675982 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
@@ -39,9 +39,9 @@ struct D
int main()
{
{
- typedef std::pair<double, std::unique_ptr<D>> T0;
- typedef std::tuple<int, std::unique_ptr<B>> T1;
- T0 t0(2.5, std::unique_ptr<D>(new D(3)));
+ typedef std::pair<long, std::unique_ptr<D>> T0;
+ typedef std::tuple<long long, std::unique_ptr<B>> T1;
+ T0 t0(2, std::unique_ptr<D>(new D(3)));
T1 t1;
t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
index ed3cafadbf08..a5b3d4415e38 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
@@ -91,6 +91,8 @@ int main() {
}
{
std::tuple<A&&> t(std::forward_as_tuple(A{}));
+ ((void)t);
std::tuple<ExplicitA&&> t2(std::forward_as_tuple(ExplicitA{}));
+ ((void)t2);
}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR31384.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR31384.pass.cpp
new file mode 100644
index 000000000000..dd9b832423a6
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR31384.pass.cpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class TupleLike> tuple(TupleLike&&); // libc++ extension
+
+// See llvm.org/PR31384
+#include <tuple>
+#include <cassert>
+
+int count = 0;
+
+struct Explicit {
+ Explicit() = default;
+ explicit Explicit(int) {}
+};
+
+struct Implicit {
+ Implicit() = default;
+ Implicit(int) {}
+};
+
+template<class T>
+struct Derived : std::tuple<T> {
+ using std::tuple<T>::tuple;
+ template<class U>
+ operator std::tuple<U>() && { ++count; return {}; }
+};
+
+
+template<class T>
+struct ExplicitDerived : std::tuple<T> {
+ using std::tuple<T>::tuple;
+ template<class U>
+ explicit operator std::tuple<U>() && { ++count; return {}; }
+};
+
+int main() {
+ {
+ std::tuple<Explicit> foo = Derived<int>{42}; ((void)foo);
+ assert(count == 1);
+ std::tuple<Explicit> bar(Derived<int>{42}); ((void)bar);
+ assert(count == 2);
+ }
+ count = 0;
+ {
+ std::tuple<Implicit> foo = Derived<int>{42}; ((void)foo);
+ assert(count == 1);
+ std::tuple<Implicit> bar(Derived<int>{42}); ((void)bar);
+ assert(count == 2);
+ }
+ count = 0;
+ {
+ static_assert(!std::is_convertible<
+ ExplicitDerived<int>, std::tuple<Explicit>>::value, "");
+ std::tuple<Explicit> bar(ExplicitDerived<int>{42}); ((void)bar);
+ assert(count == 1);
+ }
+ count = 0;
+ {
+ // FIXME: Libc++ incorrectly rejects this code.
+#ifndef _LIBCPP_VERSION
+ std::tuple<Implicit> foo = ExplicitDerived<int>{42}; ((void)foo);
+ static_assert(std::is_convertible<
+ ExplicitDerived<int>, std::tuple<Implicit>>::value,
+ "correct STLs accept this");
+#else
+ static_assert(!std::is_convertible<
+ ExplicitDerived<int>, std::tuple<Implicit>>::value,
+ "libc++ incorrectly rejects this");
+#endif
+ assert(count == 0);
+ std::tuple<Implicit> bar(ExplicitDerived<int>{42}); ((void)bar);
+ assert(count == 1);
+ }
+ count = 0;
+
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
index 6ab303c735be..06284df56642 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
@@ -20,9 +20,11 @@
#include <cassert>
#include <type_traits>
+#include "test_macros.h"
+#include "test_convertible.hpp"
#include "MoveOnly.h"
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
struct Empty {};
struct A
@@ -123,17 +125,23 @@ int main()
// extensions
#ifdef _LIBCPP_VERSION
{
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0),
- MoveOnly(1));
+ using E = MoveOnly;
+ using Tup = std::tuple<E, E, E>;
+ // Test that the reduced arity initialization extension is only
+ // allowed on the explicit constructor.
+ static_assert(test_convertible<Tup, E, E, E>(), "");
+
+ Tup t(E(0), E(1));
+ static_assert(!test_convertible<Tup, E, E>(), "");
assert(std::get<0>(t) == 0);
assert(std::get<1>(t) == 1);
assert(std::get<2>(t) == MoveOnly());
- }
- {
- std::tuple<MoveOnly, MoveOnly, MoveOnly> t(MoveOnly(0));
+
+ Tup t2(E(0));
+ static_assert(!test_convertible<Tup, E>(), "");
assert(std::get<0>(t) == 0);
- assert(std::get<1>(t) == MoveOnly());
- assert(std::get<2>(t) == MoveOnly());
+ assert(std::get<1>(t) == E());
+ assert(std::get<2>(t) == E());
}
#endif
#if TEST_STD_VER > 11
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_pair.pass.cpp
index c5941618180d..1d0c7b49aaaa 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_pair.pass.cpp
@@ -27,8 +27,8 @@
int main()
{
{
- typedef std::pair<double, int> T0;
- typedef std::tuple<int, double> T1;
+ typedef std::pair<long, int> T0;
+ typedef std::tuple<long long, double> T1;
T0 t0(2, 3);
T1 t1(std::allocator_arg, A1<int>(5), t0);
assert(std::get<0>(t1) == 2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
index 36d9f32879cb..153cd2b3d7ce 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
@@ -37,9 +37,9 @@ struct Implicit {
int main()
{
{
- typedef std::tuple<double> T0;
- typedef std::tuple<int> T1;
- T0 t0(2.5);
+ typedef std::tuple<long> T0;
+ typedef std::tuple<long long> T1;
+ T0 t0(2);
T1 t1(std::allocator_arg, A1<int>(), t0);
assert(std::get<0>(t1) == 2);
}
@@ -65,9 +65,9 @@ int main()
assert(std::get<1>(t1) == 3);
}
{
- typedef std::tuple<double, int, int> T0;
- typedef std::tuple<int, alloc_first, alloc_last> T1;
- T0 t0(1.5, 2, 3);
+ typedef std::tuple<long, int, int> T0;
+ typedef std::tuple<long long, alloc_first, alloc_last> T1;
+ T0 t0(1, 2, 3);
alloc_first::allocator_constructed = false;
alloc_last::allocator_constructed = false;
T1 t1(std::allocator_arg, A1<int>(5), t0);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
index 367f19e5d8dd..0da132fcfc26 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
template <class ...>
struct never {
@@ -81,12 +82,13 @@ int main()
{
// check that the literal '0' can implicitly initialize a stored pointer.
std::tuple<int*> t = 0;
+ assert(std::get<0>(t) == nullptr);
}
{
std::tuple<int> t(2);
assert(std::get<0>(t) == 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::tuple<int> t(2);
static_assert(std::get<0>(t) == 2, "");
@@ -101,7 +103,7 @@ int main()
assert(std::get<0>(t) == 2);
assert(std::get<1>(t) == nullptr);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::tuple<int, char*> t(2, nullptr);
static_assert(std::get<0>(t) == 2, "");
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
index d6d489fd0ea4..bed161a3dcef 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp
@@ -19,23 +19,25 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
- typedef std::pair<double, char> T0;
- typedef std::tuple<int, short> T1;
- T0 t0(2.5, 'a');
+ typedef std::pair<long, char> T0;
+ typedef std::tuple<long long, short> T1;
+ T0 t0(2, 'a');
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == short('a'));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
- typedef std::pair<double, char> P0;
- typedef std::tuple<int, short> T1;
- constexpr P0 p0(2.5, 'a');
+ typedef std::pair<long, char> P0;
+ typedef std::tuple<long long, short> T1;
+ constexpr P0 p0(2, 'a');
constexpr T1 t1 = p0;
- static_assert(std::get<0>(t1) != std::get<0>(p0), "");
+ static_assert(std::get<0>(t1) == std::get<0>(p0), "");
static_assert(std::get<1>(t1) == std::get<1>(p0), "");
static_assert(std::get<0>(t1) == 2, "");
static_assert(std::get<1>(t1) == short('a'), "");
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
index b7fa2e3a03cc..4609b042556b 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp
@@ -20,6 +20,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
struct Explicit {
int value;
explicit Explicit(int x) : value(x) {}
@@ -43,7 +45,7 @@ struct D
explicit D(int i) : B(i) {}
};
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
struct A
{
@@ -66,17 +68,17 @@ struct C
int main()
{
{
- typedef std::tuple<double> T0;
- typedef std::tuple<int> T1;
- T0 t0(2.5);
+ typedef std::tuple<long> T0;
+ typedef std::tuple<long long> T1;
+ T0 t0(2);
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
- typedef std::tuple<double> T0;
+ typedef std::tuple<int> T0;
typedef std::tuple<A> T1;
- constexpr T0 t0(2.5);
+ constexpr T0 t0(2);
constexpr T1 t1 = t0;
static_assert(std::get<0>(t1) == 2, "");
}
@@ -89,17 +91,17 @@ int main()
}
#endif
{
- typedef std::tuple<double, char> T0;
- typedef std::tuple<int, int> T1;
- T0 t0(2.5, 'a');
+ typedef std::tuple<long, char> T0;
+ typedef std::tuple<long long, int> T1;
+ T0 t0(2, 'a');
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
}
{
- typedef std::tuple<double, char, D> T0;
- typedef std::tuple<int, int, B> T1;
- T0 t0(2.5, 'a', D(3));
+ typedef std::tuple<long, char, D> T0;
+ typedef std::tuple<long long, int, B> T1;
+ T0 t0(2, 'a', D(3));
T1 t1 = t0;
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
@@ -107,9 +109,9 @@ int main()
}
{
D d(3);
- typedef std::tuple<double, char, D&> T0;
- typedef std::tuple<int, int, B&> T1;
- T0 t0(2.5, 'a', d);
+ typedef std::tuple<long, char, D&> T0;
+ typedef std::tuple<long long, int, B&> T1;
+ T0 t0(2, 'a', d);
T1 t1 = t0;
d.id_ = 2;
assert(std::get<0>(t1) == 2);
@@ -117,9 +119,9 @@ int main()
assert(std::get<2>(t1).id_ == 2);
}
{
- typedef std::tuple<double, char, int> T0;
- typedef std::tuple<int, int, B> T1;
- T0 t0(2.5, 'a', 3);
+ typedef std::tuple<long, char, int> T0;
+ typedef std::tuple<long long, int, B> T1;
+ T0 t0(2, 'a', 3);
T1 t1(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
index 8423f5d0145f..2af86fdd0868 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp
@@ -48,24 +48,24 @@ struct D
int main()
{
{
- typedef std::tuple<double> T0;
- typedef std::tuple<int> T1;
- T0 t0(2.5);
+ typedef std::tuple<long> T0;
+ typedef std::tuple<long long> T1;
+ T0 t0(2);
T1 t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
}
{
- typedef std::tuple<double, char> T0;
- typedef std::tuple<int, int> T1;
- T0 t0(2.5, 'a');
+ typedef std::tuple<long, char> T0;
+ typedef std::tuple<long long, int> T1;
+ T0 t0(2, 'a');
T1 t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
}
{
- typedef std::tuple<double, char, D> T0;
- typedef std::tuple<int, int, B> T1;
- T0 t0(2.5, 'a', D(3));
+ typedef std::tuple<long, char, D> T0;
+ typedef std::tuple<long long, int, B> T1;
+ T0 t0(2, 'a', D(3));
T1 t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
@@ -73,9 +73,9 @@ int main()
}
{
D d(3);
- typedef std::tuple<double, char, D&> T0;
- typedef std::tuple<int, int, B&> T1;
- T0 t0(2.5, 'a', d);
+ typedef std::tuple<long, char, D&> T0;
+ typedef std::tuple<long long, int, B&> T1;
+ T0 t0(2, 'a', d);
T1 t1 = std::move(t0);
d.id_ = 2;
assert(std::get<0>(t1) == 2);
@@ -83,9 +83,9 @@ int main()
assert(std::get<2>(t1).id_ == 2);
}
{
- typedef std::tuple<double, char, std::unique_ptr<D>> T0;
- typedef std::tuple<int, int, std::unique_ptr<B>> T1;
- T0 t0(2.5, 'a', std::unique_ptr<D>(new D(3)));
+ typedef std::tuple<long, char, std::unique_ptr<D>> T0;
+ typedef std::tuple<long long, int, std::unique_ptr<B>> T1;
+ T0 t0(2, 'a', std::unique_ptr<D>(new D(3)));
T1 t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1) == int('a'));
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp
index 783c9d1f06a8..1137df2918dd 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/copy.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
struct Empty {};
int main()
@@ -50,7 +52,7 @@ int main()
assert(std::get<1>(t) == 'a');
assert(std::get<2>(t) == "some text");
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::tuple<int> T;
constexpr T t0(2);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp
new file mode 100644
index 000000000000..fbcda44e4065
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/dtor.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// ~tuple();
+
+#include <tuple>
+#include <string>
+#include <cassert>
+#include <type_traits>
+
+int main()
+{
+ static_assert(std::is_trivially_destructible<
+ std::tuple<> >::value, "");
+ static_assert(std::is_trivially_destructible<
+ std::tuple<void*> >::value, "");
+ static_assert(std::is_trivially_destructible<
+ std::tuple<int, float> >::value, "");
+ static_assert(!std::is_trivially_destructible<
+ std::tuple<std::string> >::value, "");
+ static_assert(!std::is_trivially_destructible<
+ std::tuple<int, std::string> >::value, "");
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
index 0c93673532bb..1cc13cf58ba8 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
@@ -29,7 +29,7 @@ struct ConstructsWithTupleLeaf
ConstructsWithTupleLeaf(ConstructsWithTupleLeaf &&) {}
template <class T>
- ConstructsWithTupleLeaf(T t) {
+ ConstructsWithTupleLeaf(T) {
static_assert(!std::is_same<T, T>::value,
"Constructor instantiated for type other than int");
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp
index 2dfbaff6cc1a..13558f3fbe17 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp
@@ -38,9 +38,9 @@ struct D
int main()
{
{
- typedef std::pair<double, std::unique_ptr<D>> T0;
- typedef std::tuple<int, std::unique_ptr<B>> T1;
- T0 t0(2.5, std::unique_ptr<D>(new D(3)));
+ typedef std::pair<long, std::unique_ptr<D>> T0;
+ typedef std::tuple<long long, std::unique_ptr<B>> T1;
+ T0 t0(2, std::unique_ptr<D>(new D(3)));
T1 t1 = std::move(t0);
assert(std::get<0>(t1) == 2);
assert(std::get<1>(t1)->id_ == 3);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
index 2dbe81513a1a..1099e3579687 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
@@ -18,6 +18,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class Tuple>
void
test0(const Tuple&)
@@ -54,7 +56,7 @@ test2a(const Tuple& t)
assert(std::get<1>(t) == 'a');
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
template <class Tuple>
constexpr int
test3(const Tuple&)
@@ -79,7 +81,7 @@ int main()
double i = 2.5;
char c = 'a';
test2a(std::forward_as_tuple(i, c));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert ( test3 (std::forward_as_tuple(i, c)) == 2, "" );
#endif
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
index f27e8a09fb97..2c38bf7d230c 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/make_tuple.pass.cpp
@@ -20,6 +20,8 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -40,7 +42,7 @@ int main()
assert(i == 0);
assert(j == 0);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr auto t1 = std::make_tuple(0, 1, 3.14);
constexpr int i1 = std::get<1>(t1);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp
index 52ecd249402f..c4c3c242d8f8 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/tie.pass.cpp
@@ -20,6 +20,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -29,7 +31,7 @@ int main()
assert(i == 42);
assert(s == "C++");
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
static constexpr int i = 42;
static constexpr double f = 1.1;
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
index 770edcaca5e1..18095f7e3033 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
int main()
@@ -48,7 +49,7 @@ int main()
assert(std::get<0>(t) == 1);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
constexpr std::tuple<> t = std::tuple_cat();
((void)t); // Prevent unused warning
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
index 002ad148ad6d..f014916742ad 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const.pass.cpp
@@ -21,6 +21,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
struct Empty {};
int main()
@@ -36,7 +38,7 @@ int main()
assert(std::get<0>(t) == "high");
assert(std::get<1>(t) == 5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::tuple<double, int> T;
constexpr T t(2.718, 5);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp
index 58df2df7679a..9c2d992b8e49 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp
@@ -19,7 +19,7 @@
#include <tuple>
-template <class T> void cref(T const&) {};
+template <class T> void cref(T const&) {}
template <class T> void cref(T const&&) = delete;
std::tuple<int> const tup4() { return std::make_tuple(4); }
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
index 86d1191db556..fc53412899fb 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_non_const.pass.cpp
@@ -71,7 +71,7 @@ int main()
assert(std::get<2>(t) == 4);
assert(d == 2.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{ // get on an rvalue tuple
static_assert ( std::get<0> ( std::make_tuple ( 0.0f, 1, 2.0, 3L )) == 0, "" );
static_assert ( std::get<1> ( std::make_tuple ( 0.0f, 1, 2.0, 3L )) == 1, "" );
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.pass.cpp
index 42e4fab88ffa..5beedbe9d157 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_element.pass.cpp
@@ -23,6 +23,8 @@
#include <tuple>
#include <type_traits>
+#include "test_macros.h"
+
template <class T, std::size_t N, class U>
void test()
{
@@ -30,7 +32,7 @@ void test()
static_assert((std::is_same<typename std::tuple_element<N, const T>::type, const U>::value), "");
static_assert((std::is_same<typename std::tuple_element<N, volatile T>::type, volatile U>::value), "");
static_assert((std::is_same<typename std::tuple_element<N, const volatile T>::type, const volatile U>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<typename std::tuple_element_t<N, T>, U>::value), "");
static_assert((std::is_same<typename std::tuple_element_t<N, const T>, const U>::value), "");
static_assert((std::is_same<typename std::tuple_element_t<N, volatile T>, volatile U>::value), "");
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp
index 3f132e47b626..50c6f17efbef 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.fail.cpp
@@ -21,7 +21,7 @@
int main()
{
- (void)std::tuple_size<std::tuple<> &>::value; // expected-error {{implicit instantiation of undefined template}}
- (void)std::tuple_size<int>::value; // expected-error {{implicit instantiation of undefined template}}
- (void)std::tuple_size<std::tuple<>*>::value; // expected-error {{implicit instantiation of undefined template}}
+ (void)std::tuple_size<std::tuple<> &>::value; // expected-error {{no member named 'value'}}
+ (void)std::tuple_size<int>::value; // expected-error {{no member named 'value'}}
+ (void)std::tuple_size<std::tuple<>*>::value; // expected-error {{no member named 'value'}}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp
index 49b4215a1956..40214f632e75 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp
@@ -18,19 +18,36 @@
// UNSUPPORTED: c++98, c++03
#include <tuple>
+#include <utility>
+#include <array>
#include <type_traits>
+template <class T, class = decltype(std::tuple_size<T>::value)>
+constexpr bool has_value(int) { return true; }
+template <class> constexpr bool has_value(long) { return false; }
+template <class T> constexpr bool has_value() { return has_value<T>(0); }
+
+
template <class T, std::size_t N>
void test()
{
+ static_assert(has_value<T>(), "");
static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
std::tuple_size<T> >::value), "");
+ static_assert(has_value<const T>(), "");
static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
std::tuple_size<const T> >::value), "");
+ static_assert(has_value<volatile T>(), "");
static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
std::tuple_size<volatile T> >::value), "");
+
+ static_assert(has_value<const volatile T>(), "");
static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
std::tuple_size<const volatile T> >::value), "");
+ {
+ static_assert(!has_value<T &>(), "");
+ static_assert(!has_value<T *>(), "");
+ }
}
int main()
@@ -39,4 +56,13 @@ int main()
test<std::tuple<int>, 1>();
test<std::tuple<char, int>, 2>();
test<std::tuple<char, char*, int>, 3>();
+ test<std::pair<int, void*>, 2>();
+ test<std::array<int, 42>, 42>();
+ {
+ static_assert(!has_value<void>(), "");
+ static_assert(!has_value<void*>(), "");
+ static_assert(!has_value<int>(), "");
+ static_assert(!has_value<std::pair<int, int>*>(), "");
+ static_assert(!has_value<std::array<int, 42>&>(), "");
+ }
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp
index 957a683b47f8..700dd95c959c 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_v.fail.cpp
@@ -22,5 +22,5 @@ int main()
(void)std::tuple_size_v<std::tuple<> &>; // expected-note {{requested here}}
(void)std::tuple_size_v<int>; // expected-note {{requested here}}
(void)std::tuple_size_v<std::tuple<>*>; // expected-note {{requested here}}
- // expected-error@tuple:* 3 {{implicit instantiation of undefined template}}
+ // expected-error@tuple:* 3 {{no member named 'value'}}
}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
index e5991df636f8..a802a05da2bc 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp
@@ -21,6 +21,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -49,104 +51,104 @@ int main()
}
{
typedef std::tuple<int, double> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
- const T2 t2(1, char(2));
+ const T2 t2(1, 2);
assert(t1 == t2);
assert(!(t1 != t2));
}
{
typedef std::tuple<int, double> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
- const T2 t2(1, char(3));
+ const T2 t2(1, 3);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
typedef std::tuple<int, double> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
- const T2 t2(1.1, char(2));
+ const T2 t2(1.1, 2);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
typedef std::tuple<int, double> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
- const T2 t2(1.1, char(3));
+ const T2 t2(1.1, 3);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 2, 3);
assert(t1 == t2);
assert(!(t1 != t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1.1, 2, 3);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 3, 3);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 2, 4);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 3, 2);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1.1, 2, 2);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1.1, 3, 3);
assert(!(t1 == t2));
assert(t1 != t2);
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1.1, 3, 2);
assert(!(t1 == t2));
assert(t1 != t2);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
constexpr T1 t1(1, 2, 3);
constexpr T2 t2(1.1, 3, 2);
static_assert(!(t1 == t2), "");
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
index 34aafb1e1347..f4d764b87ee9 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.rel/lt.pass.cpp
@@ -33,6 +33,8 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -46,7 +48,7 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char> T1;
+ typedef std::tuple<long> T1;
typedef std::tuple<double> T2;
const T1 t1(1);
const T2 t2(1);
@@ -56,7 +58,7 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char> T1;
+ typedef std::tuple<long> T1;
typedef std::tuple<double> T2;
const T1 t1(1);
const T2 t2(0.9);
@@ -66,7 +68,7 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char> T1;
+ typedef std::tuple<long> T1;
typedef std::tuple<double> T2;
const T1 t1(1);
const T2 t2(1.1);
@@ -76,8 +78,8 @@ int main()
assert(!(t1 >= t2));
}
{
- typedef std::tuple<char, int> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<long, int> T1;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
const T2 t2(1, 2);
assert(!(t1 < t2));
@@ -86,8 +88,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<long, int> T1;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
const T2 t2(0.9, 2);
assert(!(t1 < t2));
@@ -96,8 +98,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<long, int> T1;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
const T2 t2(1.1, 2);
assert( (t1 < t2));
@@ -106,8 +108,8 @@ int main()
assert(!(t1 >= t2));
}
{
- typedef std::tuple<char, int> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<long, int> T1;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
const T2 t2(1, 1);
assert(!(t1 < t2));
@@ -116,8 +118,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int> T1;
- typedef std::tuple<double, char> T2;
+ typedef std::tuple<long, int> T1;
+ typedef std::tuple<double, long> T2;
const T1 t1(1, 2);
const T2 t2(1, 3);
assert( (t1 < t2));
@@ -126,8 +128,8 @@ int main()
assert(!(t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 2, 3);
assert(!(t1 < t2));
@@ -136,8 +138,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(0.9, 2, 3);
assert(!(t1 < t2));
@@ -146,8 +148,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1.1, 2, 3);
assert( (t1 < t2));
@@ -156,8 +158,8 @@ int main()
assert(!(t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 1, 3);
assert(!(t1 < t2));
@@ -166,8 +168,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 3, 3);
assert( (t1 < t2));
@@ -176,8 +178,8 @@ int main()
assert(!(t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 2, 2);
assert(!(t1 < t2));
@@ -186,8 +188,8 @@ int main()
assert( (t1 >= t2));
}
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
const T1 t1(1, 2, 3);
const T2 t2(1, 2, 4);
assert( (t1 < t2));
@@ -195,10 +197,10 @@ int main()
assert(!(t1 > t2));
assert(!(t1 >= t2));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
- typedef std::tuple<char, int, double> T1;
- typedef std::tuple<double, char, int> T2;
+ typedef std::tuple<long, int, double> T1;
+ typedef std::tuple<double, long, int> T2;
constexpr T1 t1(1, 2, 3);
constexpr T2 t2(1, 2, 4);
static_assert( (t1 < t2), "");
diff --git a/test/std/utilities/utility/exchange/exchange.pass.cpp b/test/std/utilities/utility/exchange/exchange.pass.cpp
index 5ef0ac3b09f5..2d01d6c8c8af 100644
--- a/test/std/utilities/utility/exchange/exchange.pass.cpp
+++ b/test/std/utilities/utility/exchange/exchange.pass.cpp
@@ -22,10 +22,10 @@ int main()
int v = 12;
assert ( std::exchange ( v, 23 ) == 12 );
assert ( v == 23 );
- assert ( std::exchange ( v, 67.2 ) == 23 );
+ assert ( std::exchange ( v, static_cast<short>(67) ) == 23 );
assert ( v == 67 );
- assert ((std::exchange<int, float> ( v, {} )) == 67 );
+ assert ((std::exchange<int, short> ( v, {} )) == 67 );
assert ( v == 0 );
}
diff --git a/test/std/utilities/utility/forward/forward.fail.cpp b/test/std/utilities/utility/forward/forward.fail.cpp
new file mode 100644
index 000000000000..a3bb890482ef
--- /dev/null
+++ b/test/std/utilities/utility/forward/forward.fail.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test forward
+
+#include <utility>
+
+#include "test_macros.h"
+
+struct A
+{
+};
+
+A source() {return A();}
+const A csource() {return A();}
+
+int main()
+{
+#if TEST_STD_VER >= 11
+ {
+ std::forward<A&>(source()); // expected-note {{requested here}}
+ // expected-error@type_traits:* 1 {{static_assert failed "can not forward an rvalue as an lvalue"}}
+ }
+#else
+ {
+ std::forward<A&>(source()); // expected-error {{no matching function for call to 'forward'}}
+ }
+#endif
+ {
+ const A ca = A();
+ std::forward<A&>(ca); // expected-error {{no matching function for call to 'forward'}}
+ }
+ {
+ std::forward<A&>(csource()); // expected-error {{no matching function for call to 'forward'}}
+ }
+ {
+ const A ca = A();
+ std::forward<A>(ca); // expected-error {{no matching function for call to 'forward'}}
+ }
+ {
+ std::forward<A>(csource()); // expected-error {{no matching function for call to 'forward'}}
+ }
+ {
+ A a;
+ std::forward(a); // expected-error {{no matching function for call to 'forward'}}
+ }
+}
diff --git a/test/std/utilities/utility/forward/forward.pass.cpp b/test/std/utilities/utility/forward/forward.pass.cpp
index 94575485df04..afff8d627fad 100644
--- a/test/std/utilities/utility/forward/forward.pass.cpp
+++ b/test/std/utilities/utility/forward/forward.pass.cpp
@@ -7,32 +7,40 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// test forward
#include <utility>
+#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
struct A
{
};
-A source() {return A();}
-const A csource() {return A();}
-
-typedef char one;
-struct two {one _[2];};
-struct four {one _[4];};
-struct eight {one _[8];};
-
-one test(A&);
-two test(const A&);
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-four test(A&&);
-eight test(const A&&);
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+A source() noexcept {return A();}
+const A csource() noexcept {return A();}
+
+
+constexpr bool test_constexpr_forward() {
+#if TEST_STD_VER > 11
+ int x = 42;
+ const int cx = 101;
+ return std::forward<int&>(x) == 42
+ && std::forward<int>(x) == 42
+ && std::forward<const int&>(x) == 42
+ && std::forward<const int>(x) == 42
+ && std::forward<int&&>(x) == 42
+ && std::forward<const int&&>(x) == 42
+ && std::forward<const int&>(cx) == 101
+ && std::forward<const int>(cx) == 101;
+#else
+ return true;
+#endif
+}
int main()
{
@@ -42,42 +50,42 @@ int main()
((void)a); // Prevent unused warning
((void)ca); // Prevent unused warning
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- static_assert(sizeof(test(std::forward<A&>(a))) == 1, "");
- static_assert(sizeof(test(std::forward<A>(a))) == 4, "");
- static_assert(sizeof(test(std::forward<A>(source()))) == 4, "");
-
- static_assert(sizeof(test(std::forward<const A&>(a))) == 2, "");
-// static_assert(sizeof(test(std::forward<const A&>(source()))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(a))) == 8, "");
- static_assert(sizeof(test(std::forward<const A>(source()))) == 8, "");
-
- static_assert(sizeof(test(std::forward<const A&>(ca))) == 2, "");
-// static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(ca))) == 8, "");
- static_assert(sizeof(test(std::forward<const A>(csource()))) == 8, "");
-
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- static_assert(sizeof(test(std::forward<A&>(a))) == 1, "");
- static_assert(sizeof(test(std::forward<A>(a))) == 1, "");
-// static_assert(sizeof(test(std::forward<A>(source()))) == 2, "");
-
- static_assert(sizeof(test(std::forward<const A&>(a))) == 2, "");
- static_assert(sizeof(test(std::forward<const A&>(source()))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(a))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(source()))) == 2, "");
-
- static_assert(sizeof(test(std::forward<const A&>(ca))) == 2, "");
- static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(ca))) == 2, "");
- static_assert(sizeof(test(std::forward<const A>(csource()))) == 2, "");
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#if _LIBCPP_STD_VER > 11
- constexpr int i1 = std::move(23);
- static_assert(i1 == 23, "" );
+ static_assert(std::is_same<decltype(std::forward<A&>(a)), A&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<A>(a)), A&&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<A>(source())), A&&>::value, "");
+ static_assert(noexcept(std::forward<A&>(a)), "");
+ static_assert(noexcept(std::forward<A>(a)), "");
+ static_assert(noexcept(std::forward<A>(source())), "");
+
+ static_assert(std::is_same<decltype(std::forward<const A&>(a)), const A&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<const A>(a)), const A&&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<const A>(source())), const A&&>::value, "");
+ static_assert(noexcept(std::forward<const A&>(a)), "");
+ static_assert(noexcept(std::forward<const A>(a)), "");
+ static_assert(noexcept(std::forward<const A>(source())), "");
+
+ static_assert(std::is_same<decltype(std::forward<const A&>(ca)), const A&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<const A>(ca)), const A&&>::value, "");
+ static_assert(std::is_same<decltype(std::forward<const A>(csource())), const A&&>::value, "");
+ static_assert(noexcept(std::forward<const A&>(ca)), "");
+ static_assert(noexcept(std::forward<const A>(ca)), "");
+ static_assert(noexcept(std::forward<const A>(csource())), "");
+
+#if TEST_STD_VER > 11
+ {
+ constexpr int i2 = std::forward<int>(42);
+ static_assert(std::forward<int>(42) == 42, "");
+ static_assert(std::forward<const int&>(i2) == 42, "");
+ static_assert(test_constexpr_forward(), "");
+ }
+#endif
+#if TEST_STD_VER == 11 && defined(_LIBCPP_VERSION)
+ // Test that std::forward is constexpr in C++11. This is an extension
+ // provided by both libc++ and libstdc++.
+ {
constexpr int i2 = std::forward<int>(42);
- static_assert(i2 == 42, "" );
+ static_assert(std::forward<int>(42) == 42, "" );
+ static_assert(std::forward<const int&>(i2) == 42, "");
+ }
#endif
}
diff --git a/test/std/utilities/utility/forward/forward5.fail.cpp b/test/std/utilities/utility/forward/forward5.fail.cpp
deleted file mode 100644
index 86c2b5651b90..000000000000
--- a/test/std/utilities/utility/forward/forward5.fail.cpp
+++ /dev/null
@@ -1,25 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// test forward
-
-#include <utility>
-
-struct A
-{
-};
-
-A source() {return A();}
-const A csource() {return A();}
-
-int main()
-{
- const A ca = A();
- std::forward<A>(csource()); // error
-}
diff --git a/test/std/utilities/utility/forward/forward_03.pass.cpp b/test/std/utilities/utility/forward/forward_03.pass.cpp
new file mode 100644
index 000000000000..7e141bad94e8
--- /dev/null
+++ b/test/std/utilities/utility/forward/forward_03.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test forward
+
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct A
+{
+};
+
+A source() {return A();}
+const A csource() {return A();}
+
+typedef char one;
+struct two {one _[2];};
+struct four {one _[4];};
+struct eight {one _[8];};
+
+one test(A&);
+two test(const A&);
+
+int main()
+{
+ A a;
+ const A ca = A();
+
+ ((void)a); // Prevent unused warning
+ ((void)ca); // Prevent unused warning
+
+#if TEST_STD_VER < 11
+ static_assert(sizeof(test(std::forward<A&>(a))) == 1, "");
+ static_assert(sizeof(test(std::forward<A>(a))) == 1, "");
+
+ // Libc++'s C++03 implementation of 'forward' cannot accept true non-const
+ // rvalues.
+ // static_assert(sizeof(test(std::forward<A>(source()))) == 2, "");
+
+ static_assert(sizeof(test(std::forward<const A&>(a))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A&>(source()))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A>(a))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A>(source()))) == 2, "");
+
+ static_assert(sizeof(test(std::forward<const A&>(ca))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A&>(csource()))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A>(ca))) == 2, "");
+ static_assert(sizeof(test(std::forward<const A>(csource()))) == 2, "");
+#endif
+}
diff --git a/test/std/utilities/utility/forward/move_only.pass.cpp b/test/std/utilities/utility/forward/move.fail.cpp
index 520bf5e5b6a1..bd2126cbaee4 100644
--- a/test/std/utilities/utility/forward/move_only.pass.cpp
+++ b/test/std/utilities/utility/forward/move.fail.cpp
@@ -7,22 +7,17 @@
//
//===----------------------------------------------------------------------===//
-// test move
-
// UNSUPPORTED: c++98, c++03
+// test move
+
#include <utility>
#include <cassert>
-class move_only
-{
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-public:
- move_only(move_only&&) {}
- move_only& operator=(move_only&&) {return *this;}
-
+struct move_only {
move_only() {}
+ move_only(move_only&&) = default;
+ move_only& operator=(move_only&&) = default;
};
move_only source() {return move_only();}
@@ -32,8 +27,8 @@ void test(move_only) {}
int main()
{
- move_only mo;
+ move_only a;
+ const move_only ca = move_only();
- test(std::move(mo));
- test(source());
+ test(std::move(ca)); // c
}
diff --git a/test/std/utilities/utility/forward/move.pass.cpp b/test/std/utilities/utility/forward/move.pass.cpp
new file mode 100644
index 000000000000..e2edc2a2afad
--- /dev/null
+++ b/test/std/utilities/utility/forward/move.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// test move
+
+// UNSUPPORTED: c++98, c++03
+
+#include <utility>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+class move_only
+{
+ move_only(const move_only&);
+ move_only& operator=(const move_only&);
+public:
+ move_only(move_only&&) {}
+ move_only& operator=(move_only&&) {return *this;}
+
+ move_only() {}
+};
+
+move_only source() {return move_only();}
+const move_only csource() {return move_only();}
+
+void test(move_only) {}
+
+int x = 42;
+const int& cx = x;
+
+template <class QualInt>
+QualInt get() noexcept { return static_cast<QualInt>(x); }
+
+
+int copy_ctor = 0;
+int move_ctor = 0;
+
+struct A {
+ A() {}
+ A(const A&) {++copy_ctor;}
+ A(A&&) {++move_ctor;}
+ A& operator=(const A&) = delete;
+};
+
+constexpr bool test_constexpr_move() {
+#if TEST_STD_VER > 11
+ int y = 42;
+ const int cy = y;
+ return std::move(y) == 42
+ && std::move(cy) == 42
+ && std::move(static_cast<int&&>(y)) == 42
+ && std::move(static_cast<int const&&>(y)) == 42;
+#else
+ return true;
+#endif
+}
+
+int main()
+{
+ { // Test return type and noexcept.
+ static_assert(std::is_same<decltype(std::move(x)), int&&>::value, "");
+ static_assert(noexcept(std::move(x)), "");
+ static_assert(std::is_same<decltype(std::move(cx)), const int&&>::value, "");
+ static_assert(noexcept(std::move(cx)), "");
+ static_assert(std::is_same<decltype(std::move(42)), int&&>::value, "");
+ static_assert(noexcept(std::move(42)), "");
+ static_assert(std::is_same<decltype(std::move(get<const int&&>())), const int&&>::value, "");
+ static_assert(noexcept(std::move(get<int const&&>())), "");
+ }
+ { // test copy and move semantics
+ A a;
+ const A ca = A();
+
+ assert(copy_ctor == 0);
+ assert(move_ctor == 0);
+
+ A a2 = a;
+ assert(copy_ctor == 1);
+ assert(move_ctor == 0);
+
+ A a3 = std::move(a);
+ assert(copy_ctor == 1);
+ assert(move_ctor == 1);
+
+ A a4 = ca;
+ assert(copy_ctor == 2);
+ assert(move_ctor == 1);
+
+ A a5 = std::move(ca);
+ assert(copy_ctor == 3);
+ assert(move_ctor == 1);
+ }
+ { // test on a move only type
+ move_only mo;
+ test(std::move(mo));
+ test(source());
+ }
+#if TEST_STD_VER > 11
+ {
+ constexpr int y = 42;
+ static_assert(std::move(y) == 42, "");
+ static_assert(test_constexpr_move(), "");
+ }
+#endif
+#if TEST_STD_VER == 11 && defined(_LIBCPP_VERSION)
+ // Test that std::forward is constexpr in C++11. This is an extension
+ // provided by both libc++ and libstdc++.
+ {
+ constexpr int y = 42;
+ static_assert(std::move(y) == 42, "");
+ }
+#endif
+}
diff --git a/test/std/utilities/utility/forward/move_copy.pass.cpp b/test/std/utilities/utility/forward/move_copy.pass.cpp
deleted file mode 100644
index fa15553f669f..000000000000
--- a/test/std/utilities/utility/forward/move_copy.pass.cpp
+++ /dev/null
@@ -1,61 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// test move
-
-// UNSUPPORTED: c++98, c++03
-
-#include <utility>
-#include <cassert>
-
-int copy_ctor = 0;
-int move_ctor = 0;
-
-class A
-{
-public:
-
- A(const A&) {++copy_ctor;}
- A& operator=(const A&);
-
- A(A&&) {++move_ctor;}
- A& operator=(A&&);
-
- A() {}
-};
-
-A source() {return A();}
-const A csource() {return A();}
-
-void test(A) {}
-
-int main()
-{
- A a;
- const A ca = A();
-
- assert(copy_ctor == 0);
- assert(move_ctor == 0);
-
- A a2 = a;
- assert(copy_ctor == 1);
- assert(move_ctor == 0);
-
- A a3 = std::move(a);
- assert(copy_ctor == 1);
- assert(move_ctor == 1);
-
- A a4 = ca;
- assert(copy_ctor == 2);
- assert(move_ctor == 1);
-
- A a5 = std::move(ca);
- assert(copy_ctor == 3);
- assert(move_ctor == 1);
-}
diff --git a/test/std/utilities/utility/forward/move_only1.fail.cpp b/test/std/utilities/utility/forward/move_only1.fail.cpp
deleted file mode 100644
index 5e7623a1bd19..000000000000
--- a/test/std/utilities/utility/forward/move_only1.fail.cpp
+++ /dev/null
@@ -1,52 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// test move
-
-#include <utility>
-#include <cassert>
-
-#include <typeinfo>
-#include <stdio.h>
-
-class move_only
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&);
- move_only& operator=(move_only&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&&) {}
- move_only& operator=(move_only&&) {}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
- move_only(std::__rv<move_only>) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- move_only() {}
-};
-
-move_only source() {return move_only();}
-const move_only csource() {return move_only();}
-
-void test(move_only) {}
-
-int main()
-{
- move_only a;
- const move_only ca = move_only();
-
- test(a);
-}
diff --git a/test/std/utilities/utility/forward/move_only2.fail.cpp b/test/std/utilities/utility/forward/move_only2.fail.cpp
deleted file mode 100644
index 2043f3d4bde7..000000000000
--- a/test/std/utilities/utility/forward/move_only2.fail.cpp
+++ /dev/null
@@ -1,52 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// test move
-
-#include <utility>
-#include <cassert>
-
-#include <typeinfo>
-#include <stdio.h>
-
-class move_only
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&);
- move_only& operator=(move_only&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&&) {}
- move_only& operator=(move_only&&) {}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
- move_only(std::__rv<move_only>) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- move_only() {}
-};
-
-move_only source() {return move_only();}
-const move_only csource() {return move_only();}
-
-void test(move_only) {}
-
-int main()
-{
- move_only a;
- const move_only ca = move_only();
-
- test(ca);
-}
diff --git a/test/std/utilities/utility/forward/move_only3.fail.cpp b/test/std/utilities/utility/forward/move_only3.fail.cpp
deleted file mode 100644
index 84c83ae48f8a..000000000000
--- a/test/std/utilities/utility/forward/move_only3.fail.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.
-//
-//===----------------------------------------------------------------------===//
-
-// test move
-
-#include <utility>
-#include <cassert>
-
-class move_only
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&);
- move_only& operator=(move_only&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&&) {}
- move_only& operator=(move_only&&) {}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
- move_only(std::__rv<move_only>) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- move_only() {}
-};
-
-move_only source() {return move_only();}
-const move_only csource() {return move_only();}
-
-void test(move_only) {}
-
-int main()
-{
- move_only a;
- const move_only ca = move_only();
-
- test(std::move(ca));
-}
diff --git a/test/std/utilities/utility/forward/move_only4.fail.cpp b/test/std/utilities/utility/forward/move_only4.fail.cpp
deleted file mode 100644
index 5eeca89abe36..000000000000
--- a/test/std/utilities/utility/forward/move_only4.fail.cpp
+++ /dev/null
@@ -1,52 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// test move
-
-#include <utility>
-#include <cassert>
-
-#include <typeinfo>
-#include <stdio.h>
-
-class move_only
-{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&);
- move_only& operator=(move_only&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&&) {}
- move_only& operator=(move_only&&) {}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
- move_only(std::__rv<move_only>) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- move_only() {}
-};
-
-move_only source() {return move_only();}
-const move_only csource() {return move_only();}
-
-void test(move_only) {}
-
-int main()
-{
- move_only a;
- const move_only ca = move_only();
-
- test(csource());
-}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
index 9ef7bcff2ba8..c09c8815e16f 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_const.pass.cpp
@@ -24,7 +24,7 @@ int main()
{
{
typedef std::pair<int, short> P;
- const P p(3, 4);
+ const P p(3, static_cast<short>(4));
assert(std::get<0>(p) == 3);
assert(std::get<1>(p) == 4);
}
@@ -32,7 +32,7 @@ int main()
#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P;
- constexpr P p1(3, 4);
+ constexpr P p1(3, static_cast<short>(4));
static_assert(std::get<0>(p1) == 3, "");
static_assert(std::get<1>(p1) == 4, "");
}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp
index edd2f3d0752f..5c38318d26da 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp
@@ -28,7 +28,7 @@ int main()
{
{
typedef std::pair<std::unique_ptr<int>, short> P;
- const P p(std::unique_ptr<int>(new int(3)), 4);
+ const P p(std::unique_ptr<int>(new int(3)), static_cast<short>(4));
static_assert(std::is_same<const std::unique_ptr<int>&&, decltype(std::get<0>(std::move(p)))>::value, "");
static_assert(noexcept(std::get<0>(std::move(p))), "");
const std::unique_ptr<int>&& ptr = std::get<0>(std::move(p));
@@ -58,7 +58,7 @@ int main()
#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P;
- constexpr const P p1(3, 4);
+ constexpr const P p1(3, static_cast<short>(4));
static_assert(std::get<0>(std::move(p1)) == 3, "");
static_assert(std::get<1>(std::move(p1)) == 4, "");
}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
index 47b4c06134d9..2f8b6c1e8497 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp
@@ -34,7 +34,7 @@ int main()
{
{
typedef std::pair<int, short> P;
- P p(3, 4);
+ P p(3, static_cast<short>(4));
assert(std::get<0>(p) == 3);
assert(std::get<1>(p) == 4);
std::get<0>(p) = 5;
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
index aa5ca530913c..0601e4e73a74 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
@@ -21,12 +23,10 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P;
- P p(std::unique_ptr<int>(new int(3)), 4);
+ P p(std::unique_ptr<int>(new int(3)), static_cast<short>(4));
std::unique_ptr<int> ptr = std::get<0>(std::move(p));
assert(*ptr == 3);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
index 8c7dee2499dd..1ef2d9402fc3 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
@@ -7,24 +7,94 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
// template<class U, class V> pair(U&& x, V&& y);
+
#include <utility>
#include <memory>
#include <cassert>
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+using namespace ImplicitTypes; // Get implicitly archetypes
+
+template <class T1, class T1Arg,
+ bool CanCopy = true, bool CanConvert = CanCopy>
+void test_sfinae() {
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ using T2 = int const&;
+ static_assert(std::is_constructible<P1, T1Arg, T2>::value == CanCopy, "");
+ static_assert(test_convertible<P1, T1Arg, T2>() == CanConvert, "");
+ static_assert(std::is_constructible<P2, T2, T1Arg>::value == CanCopy, "");
+ static_assert(test_convertible<P2, T2, T1Arg>() == CanConvert, "");
+}
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short*> P;
P p(std::unique_ptr<int>(new int(3)), nullptr);
assert(*p.first == 3);
assert(p.second == nullptr);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ // Test non-const lvalue and rvalue types
+ test_sfinae<AllCtors, AllCtors&>();
+ test_sfinae<AllCtors, AllCtors&&>();
+ test_sfinae<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&, true, false>();
+ test_sfinae<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&&, true, false>();
+ test_sfinae<CopyOnly, CopyOnly&>();
+ test_sfinae<CopyOnly, CopyOnly&&>();
+ test_sfinae<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&, true, false>();
+ test_sfinae<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&&, true, false>();
+ test_sfinae<MoveOnly, MoveOnly&, false>();
+ test_sfinae<MoveOnly, MoveOnly&&>();
+ test_sfinae<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&, false>();
+ test_sfinae<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&&, true, false>();
+ test_sfinae<NonCopyable, NonCopyable&, false>();
+ test_sfinae<NonCopyable, NonCopyable&&, false>();
+ test_sfinae<ExplicitTypes::NonCopyable, ExplicitTypes::NonCopyable&, false>();
+ test_sfinae<ExplicitTypes::NonCopyable, ExplicitTypes::NonCopyable&&, false>();
+ }
+ {
+ // Test converting types
+ test_sfinae<ConvertingType, int&>();
+ test_sfinae<ConvertingType, const int&>();
+ test_sfinae<ConvertingType, int&&>();
+ test_sfinae<ConvertingType, const int&&>();
+ test_sfinae<ExplicitTypes::ConvertingType, int&, true, false>();
+ test_sfinae<ExplicitTypes::ConvertingType, const int&, true, false>();
+ test_sfinae<ExplicitTypes::ConvertingType, int&&, true, false>();
+ test_sfinae<ExplicitTypes::ConvertingType, const int&&, true, false>();
+ }
+#if TEST_STD_VER > 11
+ { // explicit constexpr test
+ constexpr std::pair<ExplicitT, ExplicitT> p(42, 43);
+ static_assert(p.first.value == 42, "");
+ static_assert(p.second.value == 43, "");
+ }
+ { // implicit constexpr test
+ constexpr std::pair<ImplicitT, ImplicitT> p = {42, 43};
+ static_assert(p.first.value == 42, "");
+ static_assert(p.second.value == 43, "");
+ }
+#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp
index fdef5961437a..132443f66a7c 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_const_pair_U_V.pass.cpp
@@ -21,7 +21,7 @@ int main()
{
typedef std::pair<int, short> P1;
typedef std::pair<double, long> P2;
- P1 p1(3, 4);
+ P1 p1(3, static_cast<short>(4));
P2 p2;
p2 = p1;
assert(p2.first == 3);
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp
new file mode 100644
index 000000000000..3f7066310002
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair& operator=(pair const& p);
+
+#include <utility>
+#include <memory>
+#include <cassert>
+
+
+struct NonAssignable {
+ NonAssignable& operator=(NonAssignable const&) = delete;
+ NonAssignable& operator=(NonAssignable&&) = delete;
+};
+struct CopyAssignable {
+ CopyAssignable() = default;
+ CopyAssignable(CopyAssignable const&) = default;
+ CopyAssignable& operator=(CopyAssignable const&) = default;
+ CopyAssignable& operator=(CopyAssignable&&) = delete;
+};
+struct MoveAssignable {
+ MoveAssignable() = default;
+ MoveAssignable& operator=(MoveAssignable const&) = delete;
+ MoveAssignable& operator=(MoveAssignable&&) = default;
+};
+
+struct CountAssign {
+ static int copied;
+ static int moved;
+ static void reset() { copied = moved = 0; }
+ CountAssign() = default;
+ CountAssign& operator=(CountAssign const&) { ++copied; return *this; }
+ CountAssign& operator=(CountAssign&&) { ++moved; return *this; }
+};
+int CountAssign::copied = 0;
+int CountAssign::moved = 0;
+
+struct Incomplete;
+extern Incomplete inc_obj;
+
+int main()
+{
+ {
+ typedef std::pair<CopyAssignable, short> P;
+ const P p1(CopyAssignable(), 4);
+ P p2;
+ p2 = p1;
+ assert(p2.second == 4);
+ }
+ {
+ using P = std::pair<int&, int&&>;
+ int x = 42;
+ int y = 101;
+ int x2 = -1;
+ int y2 = 300;
+ P p1(x, std::move(y));
+ P p2(x2, std::move(y2));
+ p1 = p2;
+ assert(p1.first == x2);
+ assert(p1.second == y2);
+ }
+ {
+ using P = std::pair<int, NonAssignable>;
+ static_assert(!std::is_copy_assignable<P>::value, "");
+ }
+ {
+ CountAssign::reset();
+ using P = std::pair<CountAssign, CopyAssignable>;
+ static_assert(std::is_copy_assignable<P>::value, "");
+ P p;
+ P p2;
+ p = p2;
+ assert(CountAssign::copied == 1);
+ assert(CountAssign::moved == 0);
+ }
+ {
+ using P = std::pair<int, MoveAssignable>;
+ static_assert(!std::is_copy_assignable<P>::value, "");
+ }
+ {
+ using P = std::pair<int, Incomplete&>;
+ static_assert(!std::is_copy_assignable<P>::value, "");
+ P p(42, inc_obj);
+ assert(&p.second == &inc_obj);
+ }
+}
+
+struct Incomplete {};
+Incomplete inc_obj;
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp
new file mode 100644
index 000000000000..2623b800fff7
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES-ANY: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair& operator=(pair const& p);
+
+#include <utility>
+#include <memory>
+#include <cassert>
+
+struct NonAssignable {
+ NonAssignable() {}
+private:
+ NonAssignable& operator=(NonAssignable const&);
+};
+
+struct Incomplete;
+extern Incomplete inc_obj;
+
+int main()
+{
+ {
+ // Test that we don't constrain the assignment operator in C++03 mode.
+ // Since we don't have access control SFINAE having pair evaluate SFINAE
+ // may cause a hard error.
+ typedef std::pair<int, NonAssignable> P;
+ static_assert(std::is_copy_assignable<P>::value, "");
+ }
+ {
+ typedef std::pair<int, Incomplete&> P;
+ static_assert(std::is_copy_assignable<P>::value, "");
+ P p(42, inc_obj);
+ assert(&p.second == &inc_obj);
+ }
+}
+
+struct Incomplete {};
+Incomplete inc_obj;
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
index a753ee520dfa..38089200e4da 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
@@ -17,9 +19,35 @@
#include <memory>
#include <cassert>
+
+struct NonAssignable {
+ NonAssignable& operator=(NonAssignable const&) = delete;
+ NonAssignable& operator=(NonAssignable&&) = delete;
+};
+struct CopyAssignable {
+ CopyAssignable() = default;
+ CopyAssignable& operator=(CopyAssignable const&) = default;
+ CopyAssignable& operator=(CopyAssignable&&) = delete;
+};
+struct MoveAssignable {
+ MoveAssignable() = default;
+ MoveAssignable& operator=(MoveAssignable const&) = delete;
+ MoveAssignable& operator=(MoveAssignable&&) = default;
+};
+
+struct CountAssign {
+ static int copied;
+ static int moved;
+ static void reset() { copied = moved = 0; }
+ CountAssign() = default;
+ CountAssign& operator=(CountAssign const&) { ++copied; return *this; }
+ CountAssign& operator=(CountAssign&&) { ++moved; return *this; }
+};
+int CountAssign::copied = 0;
+int CountAssign::moved = 0;
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P;
P p1(std::unique_ptr<int>(new int(3)), 4);
@@ -28,5 +56,41 @@ int main()
assert(*p2.first == 3);
assert(p2.second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ using P = std::pair<int&, int&&>;
+ int x = 42;
+ int y = 101;
+ int x2 = -1;
+ int y2 = 300;
+ P p1(x, std::move(y));
+ P p2(x2, std::move(y2));
+ p1 = std::move(p2);
+ assert(p1.first == x2);
+ assert(p1.second == y2);
+ }
+ {
+ using P = std::pair<int, NonAssignable>;
+ static_assert(!std::is_move_assignable<P>::value, "");
+ }
+ {
+ // The move decays to the copy constructor
+ CountAssign::reset();
+ using P = std::pair<CountAssign, CopyAssignable>;
+ static_assert(std::is_move_assignable<P>::value, "");
+ P p;
+ P p2;
+ p = std::move(p2);
+ assert(CountAssign::moved == 0);
+ assert(CountAssign::copied == 1);
+ }
+ {
+ CountAssign::reset();
+ using P = std::pair<CountAssign, MoveAssignable>;
+ static_assert(std::is_move_assignable<P>::value, "");
+ P p;
+ P p2;
+ p = std::move(p2);
+ assert(CountAssign::moved == 1);
+ assert(CountAssign::copied == 0);
+ }
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
index a200390f4882..76dfc3f65a23 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
@@ -29,15 +31,13 @@ struct Derived
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<Derived>, short> P1;
typedef std::pair<std::unique_ptr<Base>, long> P2;
- P1 p1(std::unique_ptr<Derived>(), 4);
+ P1 p1(std::unique_ptr<Derived>(), static_cast<short>(4));
P2 p2;
p2 = std::move(p1);
assert(p2.first == nullptr);
assert(p2.second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp
new file mode 100644
index 000000000000..ef7bebcf5c29
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/assign_tuple.pass.cpp
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template<class U, class V> pair& operator=(tuple<U, V>&& p);
+
+#include <utility>
+#include <tuple>
+#include <array>
+#include <memory>
+#include <cassert>
+
+// Clang warns about missing braces when initializing std::array.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#endif
+
+struct CountingType {
+ static int constructed;
+ static int copy_constructed;
+ static int move_constructed;
+ static int assigned;
+ static int copy_assigned;
+ static int move_assigned;
+ static void reset() {
+ constructed = copy_constructed = move_constructed = 0;
+ assigned = copy_assigned = move_assigned = 0;
+ }
+ CountingType() : value(0) { ++constructed; }
+ CountingType(int v) : value(v) { ++constructed; }
+ CountingType(CountingType const& o) : value(o.value) { ++constructed; ++copy_constructed; }
+ CountingType(CountingType&& o) : value(o.value) { ++constructed; ++move_constructed; o.value = -1;}
+
+ CountingType& operator=(CountingType const& o) {
+ ++assigned;
+ ++copy_assigned;
+ value = o.value;
+ return *this;
+ }
+ CountingType& operator=(CountingType&& o) {
+ ++assigned;
+ ++move_assigned;
+ value = o.value;
+ o.value = -1;
+ return *this;
+ }
+ int value;
+};
+int CountingType::constructed;
+int CountingType::copy_constructed;
+int CountingType::move_constructed;
+int CountingType::assigned;
+int CountingType::copy_assigned;
+int CountingType::move_assigned;
+
+int main()
+{
+ using C = CountingType;
+ {
+ using P = std::pair<int, C>;
+ using T = std::tuple<int, C>;
+ T t(42, C{42});
+ P p(101, C{101});
+ C::reset();
+ p = t;
+ assert(C::constructed == 0);
+ assert(C::assigned == 1);
+ assert(C::copy_assigned == 1);
+ assert(C::move_assigned == 0);
+ assert(p.first == 42);
+ assert(p.second.value == 42);
+ }
+ {
+ using P = std::pair<int, C>;
+ using T = std::tuple<int, C>;
+ T t(42, -42);
+ P p(101, 101);
+ C::reset();
+ p = std::move(t);
+ assert(C::constructed == 0);
+ assert(C::assigned == 1);
+ assert(C::copy_assigned == 0);
+ assert(C::move_assigned == 1);
+ assert(p.first == 42);
+ assert(p.second.value == -42);
+ }
+ {
+ using P = std::pair<C, C>;
+ using T = std::array<C, 2>;
+ T t = {42, -42};
+ P p{101, 101};
+ C::reset();
+ p = t;
+ assert(C::constructed == 0);
+ assert(C::assigned == 2);
+ assert(C::copy_assigned == 2);
+ assert(C::move_assigned == 0);
+ assert(p.first.value == 42);
+ assert(p.second.value == -42);
+ }
+ {
+ using P = std::pair<C, C>;
+ using T = std::array<C, 2>;
+ T t = {42, -42};
+ P p{101, 101};
+ C::reset();
+ p = t;
+ assert(C::constructed == 0);
+ assert(C::assigned == 2);
+ assert(C::copy_assigned == 2);
+ assert(C::move_assigned == 0);
+ assert(p.first.value == 42);
+ assert(p.second.value == -42);
+ }
+ {
+ using P = std::pair<C, C>;
+ using T = std::array<C, 2>;
+ T t = {42, -42};
+ P p{101, 101};
+ C::reset();
+ p = std::move(t);
+ assert(C::constructed == 0);
+ assert(C::assigned == 2);
+ assert(C::copy_assigned == 0);
+ assert(C::move_assigned == 2);
+ assert(p.first.value == 42);
+ assert(p.second.value == -42);
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
index 2041b39c2dc9..bf19d1abe4c5 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
@@ -16,25 +18,34 @@
#include <utility>
#include <cassert>
-class A
-{
- int data_;
-public:
- A(int data) : data_(data) {}
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+using namespace ImplicitTypes; // Get implicitly archetypes
- bool operator==(const A& a) const {return data_ == a.data_;}
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
};
-#if _LIBCPP_STD_VER > 11
-class AC
-{
- int data_;
-public:
- constexpr AC(int data) : data_(data) {}
-
- constexpr bool operator==(const AC& a) const {return data_ == a.data_;}
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
};
-#endif
+
+template <class T1,
+ bool CanCopy = true, bool CanConvert = CanCopy>
+void test_sfinae() {
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ using T1Arg = T1 const&;
+ using T2 = int const&;
+ static_assert(std::is_constructible<P1, T1Arg, T2>::value == CanCopy, "");
+ static_assert(test_convertible<P1, T1Arg, T2>() == CanConvert, "");
+ static_assert(std::is_constructible<P2, T2, T1Arg>::value == CanCopy, "");
+ static_assert(test_convertible<P2, T2, T1Arg>() == CanConvert, "");
+}
int main()
{
@@ -45,13 +56,22 @@ int main()
assert(p.second == nullptr);
}
{
- typedef std::pair<A, int> P;
+ typedef std::pair<ImplicitT, int> P;
P p(1, 2);
- assert(p.first == A(1));
+ assert(p.first.value == 1);
assert(p.second == 2);
}
-
-#if _LIBCPP_STD_VER > 11
+ {
+ test_sfinae<AllCtors>();
+ test_sfinae<ExplicitTypes::AllCtors, true, false>();
+ test_sfinae<CopyOnly>();
+ test_sfinae<ExplicitTypes::CopyOnly, true, false>();
+ test_sfinae<MoveOnly, false>();
+ test_sfinae<ExplicitTypes::MoveOnly, false>();
+ test_sfinae<NonCopyable, false>();
+ test_sfinae<ExplicitTypes::NonCopyable, false>();
+ }
+#if TEST_STD_VER > 11
{
typedef std::pair<float, short*> P;
constexpr P p(3.5f, 0);
@@ -59,10 +79,20 @@ int main()
static_assert(p.second == nullptr, "");
}
{
- typedef std::pair<AC, int> P;
- constexpr P p(1, 2);
- static_assert(p.first == AC(1), "");
- static_assert(p.second == 2, "");
+ using P = std::pair<ExplicitT, int>;
+ constexpr ExplicitT e(42);
+ constexpr int x = 10;
+ constexpr P p(e, x);
+ static_assert(p.first.value == 42, "");
+ static_assert(p.second == 10, "");
+ }
+ {
+ using P = std::pair<ImplicitT, int>;
+ constexpr ImplicitT e(42);
+ constexpr int x = 10;
+ constexpr P p = {e, x};
+ static_assert(p.first.value == 42, "");
+ static_assert(p.second == 10, "");
}
#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second_cxx03.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second_cxx03.pass.cpp
new file mode 100644
index 000000000000..8c56c2003460
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_first_const_second_cxx03.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(const T1& x, const T2& y);
+
+#include <utility>
+#include <cassert>
+
+class A
+{
+ int data_;
+public:
+ A(int data) : data_(data) {}
+
+ bool operator==(const A& a) const {return data_ == a.data_;}
+};
+
+int main()
+{
+ {
+ typedef std::pair<float, short*> P;
+ P p(3.5f, 0);
+ assert(p.first == 3.5f);
+ assert(p.second == nullptr);
+ }
+ {
+ typedef std::pair<A, int> P;
+ P p(1, 2);
+ assert(p.first == A(1));
+ assert(p.second == 2);
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
index 286cce47f050..ade8130d7822 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
@@ -7,27 +7,152 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
-// template <class U, class V> pair(const pair<U, V>& p);
+// template <class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
#include <utility>
#include <cassert>
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+using namespace ImplicitTypes; // Get implicitly archetypes
+
+template <class T1, class U1,
+ bool CanCopy = true, bool CanConvert = CanCopy>
+void test_pair_const()
+{
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ using UP1 = std::pair<U1, int> const&;
+ using UP2 = std::pair<int, U1> const&;
+ static_assert(std::is_constructible<P1, UP1>::value == CanCopy, "");
+ static_assert(test_convertible<P1, UP1>() == CanConvert, "");
+ static_assert(std::is_constructible<P2, UP2>::value == CanCopy, "");
+ static_assert(test_convertible<P2, UP2>() == CanConvert, "");
+}
+
+template <class T, class U>
+struct DPair : public std::pair<T, U> {
+ using Base = std::pair<T, U>;
+ using Base::Base;
+};
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
int main()
{
{
typedef std::pair<int, short> P1;
typedef std::pair<double, long> P2;
- P1 p1(3, 4);
- P2 p2 = p1;
+ const P1 p1(3, 4);
+ const P2 p2 = p1;
assert(p2.first == 3);
assert(p2.second == 4);
}
+ {
+ // We allow derived types to use this constructor
+ using P1 = DPair<long, long>;
+ using P2 = std::pair<int, int>;
+ P1 p1(42, 101);
+ P2 p2(p1);
+ assert(p2.first == 42);
+ assert(p2.second = 101);
+ }
+ {
+ test_pair_const<AllCtors, AllCtors>(); // copy construction
+ test_pair_const<AllCtors, AllCtors&>();
+ test_pair_const<AllCtors, AllCtors&&>();
+ test_pair_const<AllCtors, const AllCtors&>();
+ test_pair_const<AllCtors, const AllCtors&&>();
+
+ test_pair_const<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors>(); // copy construction
+ test_pair_const<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&, true, false>();
+ test_pair_const<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&&, true, false>();
+ test_pair_const<ExplicitTypes::AllCtors, const ExplicitTypes::AllCtors&, true, false>();
+ test_pair_const<ExplicitTypes::AllCtors, const ExplicitTypes::AllCtors&&, true, false>();
+
+ test_pair_const<MoveOnly, MoveOnly, false>(); // copy construction
+ test_pair_const<MoveOnly, MoveOnly&, false>();
+ test_pair_const<MoveOnly, MoveOnly&&, false>();
+
+ test_pair_const<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly, false>(); // copy construction
+ test_pair_const<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&, false>();
+ test_pair_const<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&&, false>();
+
+ test_pair_const<CopyOnly, CopyOnly>();
+ test_pair_const<CopyOnly, CopyOnly&>();
+ test_pair_const<CopyOnly, CopyOnly&&>();
+
+ test_pair_const<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly>();
+ test_pair_const<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&, true, false>();
+ test_pair_const<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&&, true, false>();
-#if _LIBCPP_STD_VER > 11
+ test_pair_const<NonCopyable, NonCopyable, false>();
+ test_pair_const<NonCopyable, NonCopyable&, false>();
+ test_pair_const<NonCopyable, NonCopyable&&, false>();
+ test_pair_const<NonCopyable, const NonCopyable&, false>();
+ test_pair_const<NonCopyable, const NonCopyable&&, false>();
+ }
+
+ { // Test construction of references
+ test_pair_const<NonCopyable&, NonCopyable&>();
+ test_pair_const<NonCopyable&, NonCopyable&&>();
+ test_pair_const<NonCopyable&, NonCopyable const&, false>();
+ test_pair_const<NonCopyable const&, NonCopyable&&>();
+ test_pair_const<NonCopyable&&, NonCopyable&&, false>();
+
+ test_pair_const<ConvertingType&, int, false>();
+ test_pair_const<ExplicitTypes::ConvertingType&, int, false>();
+ // Unfortunately the below conversions are allowed and create dangling
+ // references.
+ //test_pair_const<ConvertingType&&, int>();
+ //test_pair_const<ConvertingType const&, int>();
+ //test_pair_const<ConvertingType const&&, int>();
+ // But these are not because the converting constructor is explicit.
+ test_pair_const<ExplicitTypes::ConvertingType&&, int, false>();
+ test_pair_const<ExplicitTypes::ConvertingType const&, int, false>();
+ test_pair_const<ExplicitTypes::ConvertingType const&&, int, false>();
+
+ }
+ {
+ test_pair_const<AllCtors, int, false>();
+ test_pair_const<ExplicitTypes::AllCtors, int, false>();
+ test_pair_const<ConvertingType, int>();
+ test_pair_const<ExplicitTypes::ConvertingType, int, true, false>();
+
+ test_pair_const<ConvertingType, int>();
+ test_pair_const<ConvertingType, ConvertingType>();
+ test_pair_const<ConvertingType, ConvertingType const&>();
+ test_pair_const<ConvertingType, ConvertingType&>();
+ test_pair_const<ConvertingType, ConvertingType&&>();
+
+ test_pair_const<ExplicitTypes::ConvertingType, int, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, int&, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, const int&, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, int&&, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, const int&&, true, false>();
+
+ test_pair_const<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType>();
+ test_pair_const<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType const&, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType&, true, false>();
+ test_pair_const<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType&&, true, false>();
+ }
+#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P1;
typedef std::pair<double, long> P2;
@@ -36,5 +161,21 @@ int main()
static_assert(p2.first == 3, "");
static_assert(p2.second == 4, "");
}
+ {
+ using P1 = std::pair<int, int>;
+ using P2 = std::pair<ExplicitT, ExplicitT>;
+ constexpr P1 p1(42, 101);
+ constexpr P2 p2(p1);
+ static_assert(p2.first.value == 42, "");
+ static_assert(p2.second.value == 101, "");
+ }
+ {
+ using P1 = std::pair<int, int>;
+ using P2 = std::pair<ImplicitT, ImplicitT>;
+ constexpr P1 p1(42, 101);
+ constexpr P2 p2 = p1;
+ static_assert(p2.first.value == 42, "");
+ static_assert(p2.second.value == 101, "");
+ }
#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V_cxx03.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V_cxx03.pass.cpp
new file mode 100644
index 000000000000..fbf461f9b7e0
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V_cxx03.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class U, class V> pair(const pair<U, V>& p);
+
+#include <utility>
+#include <cassert>
+
+int main()
+{
+ {
+ typedef std::pair<int, short> P1;
+ typedef std::pair<double, long> P2;
+ const P1 p1(3, static_cast<short>(4));
+ const P2 p2 = p1;
+ assert(p2.first == 3);
+ assert(p2.second == 4);
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
index 1117db3297b8..1003f3c8b68f 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/copy_ctor.pass.cpp
@@ -22,7 +22,7 @@ int main()
{
{
typedef std::pair<int, short> P1;
- P1 p1(3, 4);
+ P1 p1(3, static_cast<short>(4));
P1 p2 = p1;
assert(p2.first == 3);
assert(p2.second == 4);
@@ -30,7 +30,7 @@ int main()
#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P1;
- constexpr P1 p1(3, 4);
+ constexpr P1 p1(3, static_cast<short>(4));
constexpr P1 p2 = p1;
static_assert(p2.first == 3, "");
static_assert(p2.second == 4, "");
diff --git a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
index 97182d24d021..ace00a16f21e 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -27,14 +27,15 @@
#include <cassert>
#include "test_macros.h"
+#include "archetypes.hpp"
int main()
{
{
- typedef std::pair<float, short*> P;
- P p;
- assert(p.first == 0.0f);
- assert(p.second == nullptr);
+ typedef std::pair<float, short*> P;
+ P p;
+ assert(p.first == 0.0f);
+ assert(p.second == nullptr);
}
#if TEST_STD_VER >= 11
{
@@ -43,5 +44,12 @@ int main()
static_assert(p.first == 0.0f, "");
static_assert(p.second == nullptr, "");
}
+ {
+ using NoDefault = ImplicitTypes::NoDefault;
+ using P = std::pair<int, NoDefault>;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ using P2 = std::pair<NoDefault, int>;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ }
#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp
new file mode 100644
index 000000000000..2d87e7ababab
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/dtor.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// ~pair()
+
+
+#include <utility>
+#include <type_traits>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ static_assert((std::is_trivially_destructible<
+ std::pair<int, float> >::value), "");
+ static_assert((!std::is_trivially_destructible<
+ std::pair<int, std::string> >::value), "");
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
index 06cb5e5658c9..99e00b025da2 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/move_ctor.pass.cpp
@@ -31,7 +31,7 @@ int main()
{
typedef std::pair<int, short> P1;
static_assert(std::is_move_constructible<P1>::value, "");
- P1 p1(3, 4);
+ P1 p1(3, static_cast<short>(4));
P1 p2 = std::move(p1);
assert(p2.first == 3);
assert(p2.second == 4);
diff --git a/test/std/utilities/utility/pairs/pairs.pair/not_constexpr_cxx11.fail.cpp b/test/std/utilities/utility/pairs/pairs.pair/not_constexpr_cxx11.fail.cpp
new file mode 100644
index 000000000000..3704dcc32edc
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/not_constexpr_cxx11.fail.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++11
+
+// <utility>
+
+// Test that only the default constructor is constexpr in C++11
+
+#include <utility>
+#include <cassert>
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+int main()
+{
+ {
+ using P = std::pair<int, int>;
+ constexpr int x = 42;
+ constexpr P default_p{};
+ constexpr P copy_p(default_p);
+ constexpr P const_U_V(x, x); // expected-error {{must be initialized by a constant expression}}
+ constexpr P U_V(42, 101); // expected-error {{must be initialized by a constant expression}}
+ }
+ {
+ using P = std::pair<ExplicitT, ExplicitT>;
+ constexpr std::pair<int, int> other;
+ constexpr ExplicitT e(99);
+ constexpr P const_U_V(e, e); // expected-error {{must be initialized by a constant expression}}
+ constexpr P U_V(42, 101); // expected-error {{must be initialized by a constant expression}}
+ constexpr P pair_U_V(other); // expected-error {{must be initialized by a constant expression}}
+ }
+ {
+ using P = std::pair<ImplicitT, ImplicitT>;
+ constexpr std::pair<int, int> other;
+ constexpr ImplicitT i = 99;
+ constexpr P const_U_V = {i, i}; // expected-error {{must be initialized by a constant expression}}
+ constexpr P U_V = {42, 101}; // expected-error {{must be initialized by a constant expression}}
+ constexpr P pair_U_V = other; // expected-error {{must be initialized by a constant expression}}
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
index 5fb6c98979b5..2856190841c0 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <utility>
// template <class T1, class T2> struct pair
@@ -17,6 +19,24 @@
#include <memory>
#include <cassert>
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+using namespace ImplicitTypes; // Get implicitly archetypes
+
+template <class T1, class U1,
+ bool CanCopy = true, bool CanConvert = CanCopy>
+void test_pair_rv()
+{
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ using UP1 = std::pair<U1, int>&&;
+ using UP2 = std::pair<int, U1>&&;
+ static_assert(std::is_constructible<P1, UP1>::value == CanCopy, "");
+ static_assert(test_convertible<P1, UP1>() == CanConvert, "");
+ static_assert(std::is_constructible<P2, UP2>::value == CanCopy, "");
+ static_assert(test_convertible<P2, UP2>() == CanConvert, "");
+}
+
struct Base
{
virtual ~Base() {}
@@ -27,9 +47,25 @@ struct Derived
{
};
+
+template <class T, class U>
+struct DPair : public std::pair<T, U> {
+ using Base = std::pair<T, U>;
+ using Base::Base;
+};
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<Derived>, short> P1;
typedef std::pair<std::unique_ptr<Base>, long> P2;
@@ -38,5 +74,104 @@ int main()
assert(p2.first == nullptr);
assert(p2.second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ // We allow derived types to use this constructor
+ using P1 = DPair<long, long>;
+ using P2 = std::pair<int, int>;
+ P1 p1(42, 101);
+ P2 p2(std::move(p1));
+ assert(p2.first == 42);
+ assert(p2.second = 101);
+ }
+ {
+ test_pair_rv<AllCtors, AllCtors>();
+ test_pair_rv<AllCtors, AllCtors&>();
+ test_pair_rv<AllCtors, AllCtors&&>();
+ test_pair_rv<AllCtors, const AllCtors&>();
+ test_pair_rv<AllCtors, const AllCtors&&>();
+
+ test_pair_rv<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors>();
+ test_pair_rv<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&, true, false>();
+ test_pair_rv<ExplicitTypes::AllCtors, ExplicitTypes::AllCtors&&, true, false>();
+ test_pair_rv<ExplicitTypes::AllCtors, const ExplicitTypes::AllCtors&, true, false>();
+ test_pair_rv<ExplicitTypes::AllCtors, const ExplicitTypes::AllCtors&&, true, false>();
+
+ test_pair_rv<MoveOnly, MoveOnly>();
+ test_pair_rv<MoveOnly, MoveOnly&, false>();
+ test_pair_rv<MoveOnly, MoveOnly&&>();
+
+ test_pair_rv<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly>(); // copy construction
+ test_pair_rv<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&, false>();
+ test_pair_rv<ExplicitTypes::MoveOnly, ExplicitTypes::MoveOnly&&, true, false>();
+
+ test_pair_rv<CopyOnly, CopyOnly>();
+ test_pair_rv<CopyOnly, CopyOnly&>();
+ test_pair_rv<CopyOnly, CopyOnly&&>();
+
+ test_pair_rv<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly>();
+ test_pair_rv<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&, true, false>();
+ test_pair_rv<ExplicitTypes::CopyOnly, ExplicitTypes::CopyOnly&&, true, false>();
+
+ test_pair_rv<NonCopyable, NonCopyable, false>();
+ test_pair_rv<NonCopyable, NonCopyable&, false>();
+ test_pair_rv<NonCopyable, NonCopyable&&, false>();
+ test_pair_rv<NonCopyable, const NonCopyable&, false>();
+ test_pair_rv<NonCopyable, const NonCopyable&&, false>();
+ }
+ { // Test construction of references
+ test_pair_rv<NonCopyable&, NonCopyable&>();
+ test_pair_rv<NonCopyable&, NonCopyable&&>();
+ test_pair_rv<NonCopyable&, NonCopyable const&, false>();
+ test_pair_rv<NonCopyable const&, NonCopyable&&>();
+ test_pair_rv<NonCopyable&&, NonCopyable&&>();
+
+ test_pair_rv<ConvertingType&, int, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType&, int, false>();
+ // Unfortunately the below conversions are allowed and create dangling
+ // references.
+ //test_pair_rv<ConvertingType&&, int>();
+ //test_pair_rv<ConvertingType const&, int>();
+ //test_pair_rv<ConvertingType const&&, int>();
+ // But these are not because the converting constructor is explicit.
+ test_pair_rv<ExplicitTypes::ConvertingType&&, int, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType const&, int, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType const&&, int, false>();
+ }
+ {
+ test_pair_rv<AllCtors, int, false>();
+ test_pair_rv<ExplicitTypes::AllCtors, int, false>();
+ test_pair_rv<ConvertingType, int>();
+ test_pair_rv<ExplicitTypes::ConvertingType, int, true, false>();
+
+ test_pair_rv<ConvertingType, int>();
+ test_pair_rv<ConvertingType, ConvertingType>();
+ test_pair_rv<ConvertingType, ConvertingType const&>();
+ test_pair_rv<ConvertingType, ConvertingType&>();
+ test_pair_rv<ConvertingType, ConvertingType&&>();
+
+ test_pair_rv<ExplicitTypes::ConvertingType, int, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, int&, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, const int&, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, int&&, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, const int&&, true, false>();
+
+ test_pair_rv<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType>();
+ test_pair_rv<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType const&, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType&, true, false>();
+ test_pair_rv<ExplicitTypes::ConvertingType, ExplicitTypes::ConvertingType&&, true, false>();
+ }
+#if TEST_STD_VER > 11
+ { // explicit constexpr test
+ constexpr std::pair<int, int> p1(42, 43);
+ constexpr std::pair<ExplicitT, ExplicitT> p2(std::move(p1));
+ static_assert(p2.first.value == 42, "");
+ static_assert(p2.second.value == 43, "");
+ }
+ { // implicit constexpr test
+ constexpr std::pair<int, int> p1(42, 43);
+ constexpr std::pair<ImplicitT, ImplicitT> p2 = std::move(p1);
+ static_assert(p2.first.value == 42, "");
+ static_assert(p2.second.value == 43, "");
+ }
+#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/special_member_generation_test.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/special_member_generation_test.pass.cpp
new file mode 100644
index 000000000000..1331a3153641
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/special_member_generation_test.pass.cpp
@@ -0,0 +1,127 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T, class U> struct pair;
+
+// pair(pair const&) = default;
+// pair(pair &&) = default;
+// pair& operator=(pair const&);
+// pair& operator=(pair&&);
+
+// Test that the copy/move constructors and assignment operators are
+// correctly defined or deleted based on the properties of `T` and `U`.
+
+#include <cassert>
+#include <string>
+#include <tuple>
+
+#include "archetypes.hpp"
+using namespace ImplicitTypes; // Get implicitly archetypes
+
+namespace ConstructorTest {
+
+template <class T1, bool CanCopy = true, bool CanMove = CanCopy> void test() {
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ static_assert(std::is_copy_constructible<P1>::value == CanCopy, "");
+ static_assert(std::is_move_constructible<P1>::value == CanMove, "");
+ static_assert(std::is_copy_constructible<P2>::value == CanCopy, "");
+ static_assert(std::is_move_constructible<P2>::value == CanMove, "");
+};
+
+} // namespace ConstructorTest
+
+void test_constructors_exist() {
+ using namespace ConstructorTest;
+ {
+ test<int>();
+ test<int &>();
+ test<int &&, false, true>();
+ test<const int>();
+ test<const int &>();
+ test<const int &&, false, true>();
+ }
+ {
+ test<Copyable>();
+ test<Copyable &>();
+ test<Copyable &&, false, true>();
+ }
+ {
+ test<NonCopyable, false>();
+ test<NonCopyable &, true>();
+ test<NonCopyable &&, false, true>();
+ }
+ {
+ // Even though CopyOnly has an explicitly deleted move constructor
+ // pair's move constructor is only implicitly deleted and therefore
+ // it doesn't participate in overload resolution.
+ test<CopyOnly, true, true>();
+ test<CopyOnly &, true>();
+ test<CopyOnly &&, false, true>();
+ }
+ {
+ test<MoveOnly, false, true>();
+ test<MoveOnly &, true>();
+ test<MoveOnly &&, false, true>();
+ }
+}
+
+namespace AssignmentOperatorTest {
+
+template <class T1, bool CanCopy = true, bool CanMove = CanCopy> void test() {
+ using P1 = std::pair<T1, int>;
+ using P2 = std::pair<int, T1>;
+ static_assert(std::is_copy_assignable<P1>::value == CanCopy, "");
+ static_assert(std::is_move_assignable<P1>::value == CanMove, "");
+ static_assert(std::is_copy_assignable<P2>::value == CanCopy, "");
+ static_assert(std::is_move_assignable<P2>::value == CanMove, "");
+};
+
+} // namespace AssignmentOperatorTest
+
+void test_assignment_operator_exists() {
+ using namespace AssignmentOperatorTest;
+ {
+ test<int>();
+ test<int &>();
+ test<int &&>();
+ test<const int, false>();
+ test<const int &, false>();
+ test<const int &&, false>();
+ }
+ {
+ test<Copyable>();
+ test<Copyable &>();
+ test<Copyable &&>();
+ }
+ {
+ test<NonCopyable, false>();
+ test<NonCopyable &, false>();
+ test<NonCopyable &&, false>();
+ }
+ {
+ test<CopyOnly, true>();
+ test<CopyOnly &, true>();
+ test<CopyOnly &&, true>();
+ }
+ {
+ test<MoveOnly, false, true>();
+ test<MoveOnly &, false, false>();
+ test<MoveOnly &&, false, true>();
+ }
+}
+
+int main() {
+ test_constructors_exist();
+ test_assignment_operator_exists();
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
index dfea61eeacdb..95b1f66d64aa 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
@@ -29,8 +29,8 @@ int main()
{
{
typedef std::pair<int, short> P1;
- P1 p1(3, 4);
- P1 p2(5, 6);
+ P1 p1(3, static_cast<short>(4));
+ P1 p2(5, static_cast<short>(6));
p1.swap(p2);
assert(p1.first == 5);
assert(p1.second == 6);
diff --git a/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
index 53cf56700df8..200f044c6359 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
@@ -32,19 +32,25 @@ int main()
typedef std::pair<int, short> P;
{
static_assert(std::is_copy_constructible<P>::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
static_assert(std::is_trivially_copy_constructible<P>::value, "");
+#endif
}
#if TEST_STD_VER >= 11
{
static_assert(std::is_move_constructible<P>::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
static_assert(std::is_trivially_move_constructible<P>::value, "");
+#endif
}
{
using P1 = std::pair<Dummy, int>;
static_assert(!std::is_copy_constructible<P1>::value, "");
static_assert(!std::is_trivially_copy_constructible<P1>::value, "");
static_assert(std::is_move_constructible<P1>::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
static_assert(std::is_trivially_move_constructible<P1>::value, "");
+#endif
}
#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.spec/comparison.pass.cpp b/test/std/utilities/utility/pairs/pairs.spec/comparison.pass.cpp
index 9ba8532ab29e..3b994dfd4dfe 100644
--- a/test/std/utilities/utility/pairs/pairs.spec/comparison.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.spec/comparison.pass.cpp
@@ -21,12 +21,14 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
typedef std::pair<int, short> P;
- P p1(3, 4);
- P p2(3, 4);
+ P p1(3, static_cast<short>(4));
+ P p2(3, static_cast<short>(4));
assert( (p1 == p2));
assert(!(p1 != p2));
assert(!(p1 < p2));
@@ -36,8 +38,8 @@ int main()
}
{
typedef std::pair<int, short> P;
- P p1(2, 4);
- P p2(3, 4);
+ P p1(2, static_cast<short>(4));
+ P p2(3, static_cast<short>(4));
assert(!(p1 == p2));
assert( (p1 != p2));
assert( (p1 < p2));
@@ -47,8 +49,8 @@ int main()
}
{
typedef std::pair<int, short> P;
- P p1(3, 2);
- P p2(3, 4);
+ P p1(3, static_cast<short>(2));
+ P p2(3, static_cast<short>(4));
assert(!(p1 == p2));
assert( (p1 != p2));
assert( (p1 < p2));
@@ -58,8 +60,8 @@ int main()
}
{
typedef std::pair<int, short> P;
- P p1(3, 4);
- P p2(2, 4);
+ P p1(3, static_cast<short>(4));
+ P p2(2, static_cast<short>(4));
assert(!(p1 == p2));
assert( (p1 != p2));
assert(!(p1 < p2));
@@ -69,8 +71,8 @@ int main()
}
{
typedef std::pair<int, short> P;
- P p1(3, 4);
- P p2(3, 2);
+ P p1(3, static_cast<short>(4));
+ P p2(3, static_cast<short>(2));
assert(!(p1 == p2));
assert( (p1 != p2));
assert(!(p1 < p2));
@@ -79,11 +81,11 @@ int main()
assert( (p1 >= p2));
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef std::pair<int, short> P;
- constexpr P p1(3, 4);
- constexpr P p2(3, 2);
+ constexpr P p1(3, static_cast<short>(4));
+ constexpr P p2(3, static_cast<short>(2));
static_assert(!(p1 == p2), "");
static_assert( (p1 != p2), "");
static_assert(!(p1 < p2), "");
diff --git a/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp b/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
index 4a6d71e7b9c8..3586243f8bac 100644
--- a/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
@@ -15,34 +15,35 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
typedef std::pair<int, short> P1;
- P1 p1 = std::make_pair(3, 4);
+ P1 p1 = std::make_pair(3, static_cast<short>(4));
assert(p1.first == 3);
assert(p1.second == 4);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
typedef std::pair<std::unique_ptr<int>, short> P1;
- P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), 4);
+ P1 p1 = std::make_pair(std::unique_ptr<int>(new int(3)), static_cast<short>(4));
assert(*p1.first == 3);
assert(p1.second == 4);
}
{
typedef std::pair<std::unique_ptr<int>, short> P1;
- P1 p1 = std::make_pair(nullptr, 4);
+ P1 p1 = std::make_pair(nullptr, static_cast<short>(4));
assert(p1.first == nullptr);
assert(p1.second == 4);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#if _LIBCPP_STD_VER > 11
+#endif
+#if TEST_STD_VER >= 14
{
typedef std::pair<int, short> P1;
- constexpr P1 p1 = std::make_pair(3, 4);
+ constexpr P1 p1 = std::make_pair(3, static_cast<short>(4));
static_assert(p1.first == 3, "");
static_assert(p1.second == 4, "");
}
diff --git a/test/std/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp b/test/std/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp
index d9d8f27b5225..62fa94247946 100644
--- a/test/std/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.spec/non_member_swap.pass.cpp
@@ -20,8 +20,8 @@ int main()
{
{
typedef std::pair<int, short> P1;
- P1 p1(3, 4);
- P1 p2(5, 6);
+ P1 p1(3, static_cast<short>(4));
+ P1 p2(5, static_cast<short>(6));
swap(p1, p2);
assert(p1.first == 5);
assert(p1.second == 6);
diff --git a/test/std/utilities/utility/utility.inplace/inplace.pass.cpp b/test/std/utilities/utility/utility.inplace/inplace.pass.cpp
new file mode 100644
index 000000000000..e87c6f399e93
--- /dev/null
+++ b/test/std/utilities/utility/utility.inplace/inplace.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <utility>
+
+// struct in_place_t {
+// explicit in_place_t() = default;
+// };
+// inline constexpr in_place_t in_place{};
+
+// template <class T>
+// struct in_place_type_t {
+// explicit in_place_type_t() = default;
+// };
+// template <class T>
+// inline constexpr in_place_type_t<T> in_place_type{};
+
+// template <size_t I>
+// struct in_place_index_t {
+// explicit in_place_index_t() = default;
+// };
+// template <size_t I>
+// inline constexpr in_place_index_t<I> in_place_index{};
+
+#include <utility>
+#include <cassert>
+#include <memory>
+
+#include "test_macros.h"
+#include "type_id.h"
+
+template <class Tp, class Up>
+constexpr bool check_tag(Up) {
+ return std::is_same<Tp, std::decay_t<Tp>>::value
+ && std::is_same<Tp, Up>::value;
+}
+
+int main() {
+ // test in_place_t
+ {
+ using T = std::in_place_t;
+ static_assert(check_tag<T>(std::in_place));
+ }
+ // test in_place_type_t
+ {
+ using T1 = std::in_place_type_t<void>;
+ using T2 = std::in_place_type_t<int>;
+ using T3 = std::in_place_type_t<const int>;
+ static_assert(!std::is_same<T1, T2>::value && !std::is_same<T1, T3>::value);
+ static_assert(!std::is_same<T2, T3>::value);
+ static_assert(check_tag<T1>(std::in_place_type<void>));
+ static_assert(check_tag<T2>(std::in_place_type<int>));
+ static_assert(check_tag<T3>(std::in_place_type<const int>));
+ }
+ // test in_place_index_t
+ {
+ using T1 = std::in_place_index_t<0>;
+ using T2 = std::in_place_index_t<1>;
+ using T3 = std::in_place_index_t<static_cast<size_t>(-1)>;
+ static_assert(!std::is_same<T1, T2>::value && !std::is_same<T1, T3>::value);
+ static_assert(!std::is_same<T2, T3>::value);
+ static_assert(check_tag<T1>(std::in_place_index<0>));
+ static_assert(check_tag<T2>(std::in_place_index<1>));
+ static_assert(check_tag<T3>(std::in_place_index<static_cast<size_t>(-1)>));
+ }
+}
diff --git a/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp b/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp
new file mode 100644
index 000000000000..77fd1719ff33
--- /dev/null
+++ b/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+/*
+
+ class bad_variant_access : public exception {
+public:
+ bad_variant_access() noexcept;
+ virtual const char* what() const noexcept;
+};
+
+*/
+
+#include <cassert>
+#include <exception>
+#include <type_traits>
+#include <variant>
+
+int main() {
+ static_assert(std::is_base_of<std::exception, std::bad_variant_access>::value,
+ "");
+ static_assert(noexcept(std::bad_variant_access{}), "must be noexcept");
+ static_assert(noexcept(std::bad_variant_access{}.what()), "must be noexcept");
+ std::bad_variant_access ex;
+ assert(ex.what());
+}
diff --git a/test/std/utilities/variant/variant.general/nothing_to_do.pass.cpp b/test/std/utilities/variant/variant.general/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..8fb3817dba9b
--- /dev/null
+++ b/test/std/utilities/variant/variant.general/nothing_to_do.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main() {}
diff --git a/test/std/utilities/variant/variant.get/get_if_index.pass.cpp b/test/std/utilities/variant/variant.get/get_if_index.pass.cpp
new file mode 100644
index 000000000000..94cc08031fda
--- /dev/null
+++ b/test/std/utilities/variant/variant.get/get_if_index.pass.cpp
@@ -0,0 +1,132 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <size_t I, class... Types>
+// constexpr add_pointer_t<variant_alternative_t<I, variant<Types...>>>
+// get_if(variant<Types...>* v) noexcept;
+// template <size_t I, class... Types>
+// constexpr add_pointer_t<const variant_alternative_t<I, variant<Types...>>>
+// get_if(const variant<Types...>* v) noexcept;
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include <cassert>
+#include <memory>
+#include <variant>
+
+void test_const_get_if() {
+ {
+ using V = std::variant<int>;
+ constexpr const V *v = nullptr;
+ static_assert(std::get_if<0>(v) == nullptr, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42);
+ ASSERT_NOEXCEPT(std::get_if<0>(&v));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), const int *);
+ static_assert(*std::get_if<0>(&v) == 42, "");
+ static_assert(std::get_if<1>(&v) == nullptr, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get_if<1>(&v)), const long *);
+ static_assert(*std::get_if<1>(&v) == 42, "");
+ static_assert(std::get_if<0>(&v) == nullptr, "");
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), const int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+#endif
+}
+
+void test_get_if() {
+ {
+ using V = std::variant<int>;
+ V *v = nullptr;
+ assert(std::get_if<0>(v) == nullptr);
+ }
+ {
+ using V = std::variant<int, long>;
+ V v(42);
+ ASSERT_NOEXCEPT(std::get_if<0>(&v));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), int *);
+ assert(*std::get_if<0>(&v) == 42);
+ assert(std::get_if<1>(&v) == nullptr);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get_if<1>(&v)), const long *);
+ assert(*std::get_if<1>(&v) == 42);
+ assert(std::get_if<0>(&v) == nullptr);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), const int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<0>(&v)), const int *);
+ assert(std::get_if<0>(&v) == &x);
+ }
+#endif
+}
+
+int main() {
+ test_const_get_if();
+ test_get_if();
+}
diff --git a/test/std/utilities/variant/variant.get/get_if_type.pass.cpp b/test/std/utilities/variant/variant.get/get_if_type.pass.cpp
new file mode 100644
index 000000000000..a8cc664ef113
--- /dev/null
+++ b/test/std/utilities/variant/variant.get/get_if_type.pass.cpp
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class T, class... Types>
+// constexpr add_pointer_t<T> get_if(variant<Types...>* v) noexcept;
+// template <class T, class... Types>
+// constexpr add_pointer_t<const T> get_if(const variant<Types...>* v)
+// noexcept;
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include <cassert>
+#include <variant>
+
+void test_const_get_if() {
+ {
+ using V = std::variant<int>;
+ constexpr const V *v = nullptr;
+ static_assert(std::get_if<int>(v) == nullptr, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42);
+ ASSERT_NOEXCEPT(std::get_if<int>(&v));
+ ASSERT_SAME_TYPE(decltype(std::get_if<int>(&v)), const int *);
+ static_assert(*std::get_if<int>(&v) == 42, "");
+ static_assert(std::get_if<const long>(&v) == nullptr, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get_if<const long>(&v)), const long *);
+ static_assert(*std::get_if<const long>(&v) == 42, "");
+ static_assert(std::get_if<int>(&v) == nullptr, "");
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<int &>(&v)), int *);
+ assert(std::get_if<int &>(&v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<int &&>(&v)), int *);
+ assert(std::get_if<int &&>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<const int &&>(&v)), const int *);
+ assert(std::get_if<const int &&>(&v) == &x);
+ }
+#endif
+}
+
+void test_get_if() {
+ {
+ using V = std::variant<int>;
+ V *v = nullptr;
+ assert(std::get_if<int>(v) == nullptr);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42);
+ ASSERT_NOEXCEPT(std::get_if<int>(&v));
+ ASSERT_SAME_TYPE(decltype(std::get_if<int>(&v)), int *);
+ assert(*std::get_if<int>(&v) == 42);
+ assert(std::get_if<const long>(&v) == nullptr);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get_if<const long>(&v)), const long *);
+ assert(*std::get_if<const long>(&v) == 42);
+ assert(std::get_if<int>(&v) == nullptr);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<int &>(&v)), int *);
+ assert(std::get_if<int &>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get_if<const int &>(&v)), const int *);
+ assert(std::get_if<const int &>(&v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<int &&>(&v)), int *);
+ assert(std::get_if<int &&>(&v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get_if<const int &&>(&v)), const int *);
+ assert(std::get_if<const int &&>(&v) == &x);
+ }
+#endif
+}
+
+int main() {
+ test_const_get_if();
+ test_get_if();
+}
diff --git a/test/std/utilities/variant/variant.get/get_index.pass.cpp b/test/std/utilities/variant/variant.get/get_index.pass.cpp
new file mode 100644
index 000000000000..72d17b0ed971
--- /dev/null
+++ b/test/std/utilities/variant/variant.get/get_index.pass.cpp
@@ -0,0 +1,287 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <size_t I, class... Types>
+// constexpr variant_alternative_t<I, variant<Types...>>&
+// get(variant<Types...>& v);
+// template <size_t I, class... Types>
+// constexpr variant_alternative_t<I, variant<Types...>>&&
+// get(variant<Types...>&& v);
+// template <size_t I, class... Types>
+// constexpr variant_alternative_t<I, variant<Types...>> const& get(const
+// variant<Types...>& v);
+// template <size_t I, class... Types>
+// constexpr variant_alternative_t<I, variant<Types...>> const&& get(const
+// variant<Types...>&& v);
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include <cassert>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+void test_const_lvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ ASSERT_NOEXCEPT(std::get<0>(v));
+#endif
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ static_assert(std::get<0>(v) == 42, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<0>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ assert(std::get<0>(v) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42l);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ ASSERT_NOEXCEPT(std::get<1>(v));
+#endif
+ ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
+ static_assert(std::get<1>(v) == 42, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42l);
+ ASSERT_NOT_NOEXCEPT(std::get<1>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
+ assert(std::get<1>(v) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), int &);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), int &);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ assert(&std::get<0>(v) == &x);
+ }
+#endif
+}
+
+void test_lvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<0>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), int &);
+ assert(std::get<0>(v) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
+ assert(std::get<1>(v) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), int &);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), int &);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ assert(&std::get<0>(v) == &x);
+ }
+#endif
+}
+
+void test_rvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<0>(std::move(v)));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), int &&);
+ assert(std::get<0>(std::move(v)) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<1>(std::move(v))), const long &&);
+ assert(std::get<1>(std::move(v)) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), int &);
+ assert(&std::get<0>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), const int &);
+ assert(&std::get<0>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), int &&);
+ int &&xref = std::get<0>(std::move(v));
+ assert(&xref == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), const int &&);
+ const int &&xref = std::get<0>(std::move(v));
+ assert(&xref == &x);
+ }
+#endif
+}
+
+void test_const_rvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ const V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<0>(std::move(v)));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), const int &&);
+ assert(std::get<0>(std::move(v)) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<1>(std::move(v))), const long &&);
+ assert(std::get<1>(std::move(v)) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), int &);
+ assert(&std::get<0>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), const int &);
+ assert(&std::get<0>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), int &&);
+ int &&xref = std::get<0>(std::move(v));
+ assert(&xref == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(std::move(v))), const int &&);
+ const int &&xref = std::get<0>(std::move(v));
+ assert(&xref == &x);
+ }
+#endif
+}
+
+template <std::size_t I> using Idx = std::integral_constant<size_t, I>;
+
+void test_throws_for_all_value_categories() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<int, long>;
+ V v0(42);
+ const V &cv0 = v0;
+ assert(v0.index() == 0);
+ V v1(42l);
+ const V &cv1 = v1;
+ assert(v1.index() == 1);
+ std::integral_constant<size_t, 0> zero;
+ std::integral_constant<size_t, 1> one;
+ auto test = [](auto idx, auto &&v) {
+ using Idx = decltype(idx);
+ try {
+ std::get<Idx::value>(std::forward<decltype(v)>(v));
+ } catch (const std::bad_variant_access &) {
+ return true;
+ } catch (...) { /* ... */
+ }
+ return false;
+ };
+ { // lvalue test cases
+ assert(test(one, v0));
+ assert(test(zero, v1));
+ }
+ { // const lvalue test cases
+ assert(test(one, cv0));
+ assert(test(zero, cv1));
+ }
+ { // rvalue test cases
+ assert(test(one, std::move(v0)));
+ assert(test(zero, std::move(v1)));
+ }
+ { // const rvalue test cases
+ assert(test(one, std::move(cv0)));
+ assert(test(zero, std::move(cv1)));
+ }
+#endif
+}
+
+int main() {
+ test_const_lvalue_get();
+ test_lvalue_get();
+ test_rvalue_get();
+ test_const_rvalue_get();
+ test_throws_for_all_value_categories();
+}
diff --git a/test/std/utilities/variant/variant.get/get_type.pass.cpp b/test/std/utilities/variant/variant.get/get_type.pass.cpp
new file mode 100644
index 000000000000..fc355378a21a
--- /dev/null
+++ b/test/std/utilities/variant/variant.get/get_type.pass.cpp
@@ -0,0 +1,287 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class T, class... Types> constexpr T& get(variant<Types...>& v);
+// template <class T, class... Types> constexpr T&& get(variant<Types...>&& v);
+// template <class T, class... Types> constexpr const T& get(const
+// variant<Types...>& v);
+// template <class T, class... Types> constexpr const T&& get(const
+// variant<Types...>&& v);
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include <cassert>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+void test_const_lvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ ASSERT_NOEXCEPT(std::get<int>(v));
+#endif
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ static_assert(std::get<int>(v) == 42, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<int>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
+ assert(std::get<int>(v) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ constexpr V v(42l);
+#ifndef __clang__ // Avoid https://llvm.org/bugs/show_bug.cgi?id=15481
+ ASSERT_NOEXCEPT(std::get<const long>(v));
+#endif
+ ASSERT_SAME_TYPE(decltype(std::get<const long>(v)), const long &);
+ static_assert(std::get<const long>(v) == 42, "");
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42l);
+ ASSERT_NOT_NOEXCEPT(std::get<const long>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<const long>(v)), const long &);
+ assert(std::get<const long>(v) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<int &>(v)), int &);
+ assert(&std::get<int &>(v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<int &&>(v)), int &);
+ assert(&std::get<int &&>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<const int &&>(v)), const int &);
+ assert(&std::get<const int &&>(v) == &x);
+ }
+#endif
+}
+
+void test_lvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<int>(v));
+ ASSERT_SAME_TYPE(decltype(std::get<int>(v)), int &);
+ assert(std::get<int>(v) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<const long>(v)), const long &);
+ assert(std::get<const long>(v) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<int &>(v)), int &);
+ assert(&std::get<int &>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<const int &>(v)), const int &);
+ assert(&std::get<const int &>(v) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<int &&>(v)), int &);
+ assert(&std::get<int &&>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<const int &&>(v)), const int &);
+ assert(&std::get<const int &&>(v) == &x);
+ }
+#endif
+}
+
+void test_rvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<int>(std::move(v)));
+ ASSERT_SAME_TYPE(decltype(std::get<int>(std::move(v))), int &&);
+ assert(std::get<int>(std::move(v)) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<const long>(std::move(v))),
+ const long &&);
+ assert(std::get<const long>(std::move(v)) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<int &>(std::move(v))), int &);
+ assert(&std::get<int &>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<const int &>(std::move(v))),
+ const int &);
+ assert(&std::get<const int &>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<int &&>(std::move(v))), int &&);
+ int &&xref = std::get<int &&>(std::move(v));
+ assert(&xref == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<const int &&>(std::move(v))),
+ const int &&);
+ const int &&xref = std::get<const int &&>(std::move(v));
+ assert(&xref == &x);
+ }
+#endif
+}
+
+void test_const_rvalue_get() {
+ {
+ using V = std::variant<int, const long>;
+ const V v(42);
+ ASSERT_NOT_NOEXCEPT(std::get<int>(std::move(v)));
+ ASSERT_SAME_TYPE(decltype(std::get<int>(std::move(v))), const int &&);
+ assert(std::get<int>(std::move(v)) == 42);
+ }
+ {
+ using V = std::variant<int, const long>;
+ const V v(42l);
+ ASSERT_SAME_TYPE(decltype(std::get<const long>(std::move(v))),
+ const long &&);
+ assert(std::get<const long>(std::move(v)) == 42);
+ }
+// FIXME: Remove these once reference support is reinstated
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<int &>(std::move(v))), int &);
+ assert(&std::get<int &>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<const int &>;
+ int x = 42;
+ const V v(x);
+ ASSERT_SAME_TYPE(decltype(std::get<const int &>(std::move(v))),
+ const int &);
+ assert(&std::get<const int &>(std::move(v)) == &x);
+ }
+ {
+ using V = std::variant<int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<int &&>(std::move(v))), int &&);
+ int &&xref = std::get<int &&>(std::move(v));
+ assert(&xref == &x);
+ }
+ {
+ using V = std::variant<const int &&>;
+ int x = 42;
+ const V v(std::move(x));
+ ASSERT_SAME_TYPE(decltype(std::get<const int &&>(std::move(v))),
+ const int &&);
+ const int &&xref = std::get<const int &&>(std::move(v));
+ assert(&xref == &x);
+ }
+#endif
+}
+
+template <class Tp> struct identity { using type = Tp; };
+
+void test_throws_for_all_value_categories() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<int, long>;
+ V v0(42);
+ const V &cv0 = v0;
+ assert(v0.index() == 0);
+ V v1(42l);
+ const V &cv1 = v1;
+ assert(v1.index() == 1);
+ identity<int> zero;
+ identity<long> one;
+ auto test = [](auto idx, auto &&v) {
+ using Idx = decltype(idx);
+ try {
+ std::get<typename Idx::type>(std::forward<decltype(v)>(v));
+ } catch (const std::bad_variant_access &) {
+ return true;
+ } catch (...) { /* ... */
+ }
+ return false;
+ };
+ { // lvalue test cases
+ assert(test(one, v0));
+ assert(test(zero, v1));
+ }
+ { // const lvalue test cases
+ assert(test(one, cv0));
+ assert(test(zero, cv1));
+ }
+ { // rvalue test cases
+ assert(test(one, std::move(v0)));
+ assert(test(zero, std::move(v1)));
+ }
+ { // const rvalue test cases
+ assert(test(one, std::move(cv0)));
+ assert(test(zero, std::move(cv1)));
+ }
+#endif
+}
+
+int main() {
+ test_const_lvalue_get();
+ test_lvalue_get();
+ test_rvalue_get();
+ test_const_rvalue_get();
+ test_throws_for_all_value_categories();
+}
diff --git a/test/std/utilities/variant/variant.get/holds_alternative.pass.cpp b/test/std/utilities/variant/variant.get/holds_alternative.pass.cpp
new file mode 100644
index 000000000000..103b0498197d
--- /dev/null
+++ b/test/std/utilities/variant/variant.get/holds_alternative.pass.cpp
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class T, class... Types>
+// constexpr bool holds_alternative(const variant<Types...>& v) noexcept;
+
+#include "test_macros.h"
+#include <variant>
+
+int main() {
+ {
+ using V = std::variant<int>;
+ constexpr V v;
+ static_assert(std::holds_alternative<int>(v), "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v;
+ static_assert(std::holds_alternative<int>(v), "");
+ static_assert(!std::holds_alternative<long>(v), "");
+ }
+ { // noexcept test
+ using V = std::variant<int>;
+ const V v;
+ ASSERT_NOEXCEPT(std::holds_alternative<int>(v));
+ }
+}
diff --git a/test/std/utilities/variant/variant.hash/hash.pass.cpp b/test/std/utilities/variant/variant.hash/hash.pass.cpp
new file mode 100644
index 000000000000..d807a7c7e2ea
--- /dev/null
+++ b/test/std/utilities/variant/variant.hash/hash.pass.cpp
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class... Types> struct hash<variant<Types...>>;
+// template <> struct hash<monostate>;
+
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+namespace std {
+template <> struct hash<::MakeEmptyT> {
+ size_t operator()(const ::MakeEmptyT &) const {
+ assert(false);
+ return 0;
+ }
+};
+}
+#endif
+
+void test_hash_variant() {
+ {
+ using V = std::variant<int, long, int>;
+ using H = std::hash<V>;
+ const V v(std::in_place_index<0>, 42);
+ const V v_copy = v;
+ V v2(std::in_place_index<0>, 100);
+ const H h{};
+ assert(h(v) == h(v));
+ assert(h(v) != h(v2));
+ assert(h(v) == h(v_copy));
+ {
+ ASSERT_SAME_TYPE(decltype(h(v)), std::size_t);
+ static_assert(std::is_copy_constructible<H>::value, "");
+ }
+ }
+ {
+ using V = std::variant<std::monostate, int, long, const char *>;
+ using H = std::hash<V>;
+ const char *str = "hello";
+ const V v0;
+ const V v0_other;
+ const V v1(42);
+ const V v1_other(100);
+ V v2(100l);
+ V v2_other(999l);
+ V v3(str);
+ V v3_other("not hello");
+ const H h{};
+ assert(h(v0) == h(v0));
+ assert(h(v0) == h(v0_other));
+ assert(h(v1) == h(v1));
+ assert(h(v1) != h(v1_other));
+ assert(h(v2) == h(v2));
+ assert(h(v2) != h(v2_other));
+ assert(h(v3) == h(v3));
+ assert(h(v3) != h(v3_other));
+ assert(h(v0) != h(v1));
+ assert(h(v0) != h(v2));
+ assert(h(v0) != h(v3));
+ assert(h(v1) != h(v2));
+ assert(h(v1) != h(v3));
+ assert(h(v2) != h(v3));
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ using H = std::hash<V>;
+ V v;
+ makeEmpty(v);
+ V v2;
+ makeEmpty(v2);
+ const H h{};
+ assert(h(v) == h(v2));
+ }
+#endif
+}
+
+void test_hash_monostate() {
+ using H = std::hash<std::monostate>;
+ const H h{};
+ std::monostate m1{};
+ const std::monostate m2{};
+ assert(h(m1) == h(m1));
+ assert(h(m2) == h(m2));
+ assert(h(m1) == h(m2));
+ {
+ ASSERT_SAME_TYPE(decltype(h(m1)), std::size_t);
+ static_assert(std::is_copy_constructible<H>::value, "");
+ }
+}
+
+void test_hash_variant_duplicate_elements() {
+ // Test that the index of the alternative participates in the hash value.
+ using V = std::variant<std::monostate, std::monostate>;
+ using H = std::hash<V>;
+ H h{};
+ const V v1(std::in_place_index<0>);
+ const V v2(std::in_place_index<1>);
+ assert(h(v1) == h(v1));
+ assert(h(v2) == h(v2));
+ LIBCPP_ASSERT(h(v1) != h(v2));
+}
+
+int main() {
+ test_hash_variant();
+ test_hash_variant_duplicate_elements();
+ test_hash_monostate();
+}
diff --git a/test/std/utilities/variant/variant.helpers/variant_alternative.pass.cpp b/test/std/utilities/variant/variant.helpers/variant_alternative.pass.cpp
new file mode 100644
index 000000000000..84689a050391
--- /dev/null
+++ b/test/std/utilities/variant/variant.helpers/variant_alternative.pass.cpp
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <size_t I, class T> struct variant_alternative; // undefined
+// template <size_t I, class T> struct variant_alternative<I, const T>;
+// template <size_t I, class T> struct variant_alternative<I, volatile T>;
+// template <size_t I, class T> struct variant_alternative<I, const volatile T>;
+// template <size_t I, class T>
+// using variant_alternative_t = typename variant_alternative<I, T>::type;
+//
+// template <size_t I, class... Types>
+// struct variant_alternative<I, variant<Types...>>;
+
+#include <memory>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+template <class V, size_t I, class E> void test() {
+ static_assert(
+ std::is_same_v<typename std::variant_alternative<I, V>::type, E>, "");
+ static_assert(
+ std::is_same_v<typename std::variant_alternative<I, const V>::type,
+ const E>,
+ "");
+ static_assert(
+ std::is_same_v<typename std::variant_alternative<I, volatile V>::type,
+ volatile E>,
+ "");
+ static_assert(
+ std::is_same_v<
+ typename std::variant_alternative<I, const volatile V>::type,
+ const volatile E>,
+ "");
+ static_assert(std::is_same_v<std::variant_alternative_t<I, V>, E>, "");
+ static_assert(std::is_same_v<std::variant_alternative_t<I, const V>, const E>,
+ "");
+ static_assert(
+ std::is_same_v<std::variant_alternative_t<I, volatile V>, volatile E>,
+ "");
+ static_assert(std::is_same_v<std::variant_alternative_t<I, const volatile V>,
+ const volatile E>,
+ "");
+}
+
+int main() {
+ {
+ using V = std::variant<int, void *, const void *, long double>;
+ test<V, 0, int>();
+ test<V, 1, void *>();
+ test<V, 2, const void *>();
+ test<V, 3, long double>();
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, int &, const int &, int &&, long double>;
+ test<V, 0, int>();
+ test<V, 1, int &>();
+ test<V, 2, const int &>();
+ test<V, 3, int &&>();
+ test<V, 4, long double>();
+ }
+#endif
+}
diff --git a/test/std/utilities/variant/variant.helpers/variant_size.pass.cpp b/test/std/utilities/variant/variant.helpers/variant_size.pass.cpp
new file mode 100644
index 000000000000..2085fa56effe
--- /dev/null
+++ b/test/std/utilities/variant/variant.helpers/variant_size.pass.cpp
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class T> struct variant_size; // undefined
+// template <class T> struct variant_size<const T>;
+// template <class T> struct variant_size<volatile T>;
+// template <class T> struct variant_size<const volatile T>;
+// template <class T> constexpr size_t variant_size_v
+// = variant_size<T>::value;
+
+#include <memory>
+#include <type_traits>
+#include <variant>
+
+template <class V, size_t E> void test() {
+ static_assert(std::variant_size<V>::value == E, "");
+ static_assert(std::variant_size<const V>::value == E, "");
+ static_assert(std::variant_size<volatile V>::value == E, "");
+ static_assert(std::variant_size<const volatile V>::value == E, "");
+ static_assert(std::variant_size_v<V> == E, "");
+ static_assert(std::variant_size_v<const V> == E, "");
+ static_assert(std::variant_size_v<volatile V> == E, "");
+ static_assert(std::variant_size_v<const volatile V> == E, "");
+ static_assert(std::is_base_of<std::integral_constant<std::size_t, E>,
+ std::variant_size<V>>::value,
+ "");
+};
+
+int main() {
+ test<std::variant<>, 0>();
+ test<std::variant<void *>, 1>();
+ test<std::variant<long, long, void *, double>, 4>();
+}
diff --git a/test/std/utilities/variant/variant.monostate.relops/relops.pass.cpp b/test/std/utilities/variant/variant.monostate.relops/relops.pass.cpp
new file mode 100644
index 000000000000..49abba2954e5
--- /dev/null
+++ b/test/std/utilities/variant/variant.monostate.relops/relops.pass.cpp
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// constexpr bool operator<(monostate, monostate) noexcept { return false; }
+// constexpr bool operator>(monostate, monostate) noexcept { return false; }
+// constexpr bool operator<=(monostate, monostate) noexcept { return true; }
+// constexpr bool operator>=(monostate, monostate) noexcept { return true; }
+// constexpr bool operator==(monostate, monostate) noexcept { return true; }
+// constexpr bool operator!=(monostate, monostate) noexcept { return false; }
+
+#include "test_macros.h"
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+int main() {
+ using M = std::monostate;
+ constexpr M m1{};
+ constexpr M m2{};
+ {
+ static_assert((m1 < m2) == false, "");
+ ASSERT_NOEXCEPT(m1 < m2);
+ }
+ {
+ static_assert((m1 > m2) == false, "");
+ ASSERT_NOEXCEPT(m1 > m2);
+ }
+ {
+ static_assert((m1 <= m2) == true, "");
+ ASSERT_NOEXCEPT(m1 <= m2);
+ }
+ {
+ static_assert((m1 >= m2) == true, "");
+ ASSERT_NOEXCEPT(m1 >= m2);
+ }
+ {
+ static_assert((m1 == m2) == true, "");
+ ASSERT_NOEXCEPT(m1 == m2);
+ }
+ {
+ static_assert((m1 != m2) == false, "");
+ ASSERT_NOEXCEPT(m1 != m2);
+ }
+}
diff --git a/test/std/utilities/variant/variant.monostate/monostate.pass.cpp b/test/std/utilities/variant/variant.monostate/monostate.pass.cpp
new file mode 100644
index 000000000000..76cddf90043d
--- /dev/null
+++ b/test/std/utilities/variant/variant.monostate/monostate.pass.cpp
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// struct monostate {};
+
+#include <type_traits>
+#include <variant>
+
+int main() {
+ using M = std::monostate;
+ static_assert(std::is_trivially_default_constructible<M>::value, "");
+ static_assert(std::is_trivially_copy_constructible<M>::value, "");
+ static_assert(std::is_trivially_copy_assignable<M>::value, "");
+ static_assert(std::is_trivially_destructible<M>::value, "");
+ constexpr M m{};
+ ((void)m);
+}
diff --git a/test/std/utilities/variant/variant.relops/relops.pass.cpp b/test/std/utilities/variant/variant.relops/relops.pass.cpp
new file mode 100644
index 000000000000..4337b4bdbbd7
--- /dev/null
+++ b/test/std/utilities/variant/variant.relops/relops.pass.cpp
@@ -0,0 +1,227 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types>
+// constexpr bool
+// operator==(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator!=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>=(variant<Types...> const&, variant<Types...> const&) noexcept;
+
+#include <cassert>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct MakeEmptyT {
+ MakeEmptyT() = default;
+ MakeEmptyT(MakeEmptyT &&) { throw 42; }
+ MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; }
+};
+inline bool operator==(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+inline bool operator!=(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+inline bool operator<(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+inline bool operator<=(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+inline bool operator>(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+inline bool operator>=(const MakeEmptyT &, const MakeEmptyT &) {
+ assert(false);
+ return false;
+}
+
+template <class Variant> void makeEmpty(Variant &v) {
+ Variant v2(std::in_place_type<MakeEmptyT>);
+ try {
+ v = std::move(v2);
+ assert(false);
+ } catch (...) {
+ assert(v.valueless_by_exception());
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+void test_equality() {
+ {
+ using V = std::variant<int, long>;
+ constexpr V v1(42);
+ constexpr V v2(42);
+ static_assert(v1 == v2, "");
+ static_assert(v2 == v1, "");
+ static_assert(!(v1 != v2), "");
+ static_assert(!(v2 != v1), "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v1(42);
+ constexpr V v2(43);
+ static_assert(!(v1 == v2), "");
+ static_assert(!(v2 == v1), "");
+ static_assert(v1 != v2, "");
+ static_assert(v2 != v1, "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v1(42);
+ constexpr V v2(42l);
+ static_assert(!(v1 == v2), "");
+ static_assert(!(v2 == v1), "");
+ static_assert(v1 != v2, "");
+ static_assert(v2 != v1, "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v1(42l);
+ constexpr V v2(42l);
+ static_assert(v1 == v2, "");
+ static_assert(v2 == v1, "");
+ static_assert(!(v1 != v2), "");
+ static_assert(!(v2 != v1), "");
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ V v2;
+ makeEmpty(v2);
+ assert(!(v1 == v2));
+ assert(!(v2 == v1));
+ assert(v1 != v2);
+ assert(v2 != v1);
+ }
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ V v2;
+ assert(!(v1 == v2));
+ assert(!(v2 == v1));
+ assert(v1 != v2);
+ assert(v2 != v1);
+ }
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ V v2;
+ makeEmpty(v2);
+ assert(v1 == v2);
+ assert(v2 == v1);
+ assert(!(v1 != v2));
+ assert(!(v2 != v1));
+ }
+#endif
+}
+
+template <class Var>
+constexpr bool test_less(const Var &l, const Var &r, bool expect_less,
+ bool expect_greater) {
+ return ((l < r) == expect_less) && (!(l >= r) == expect_less) &&
+ ((l > r) == expect_greater) && (!(l <= r) == expect_greater);
+}
+
+void test_relational() {
+ { // same index, same value
+ using V = std::variant<int, long>;
+ constexpr V v1(1);
+ constexpr V v2(1);
+ static_assert(test_less(v1, v2, false, false), "");
+ }
+ { // same index, value < other_value
+ using V = std::variant<int, long>;
+ constexpr V v1(0);
+ constexpr V v2(1);
+ static_assert(test_less(v1, v2, true, false), "");
+ }
+ { // same index, value > other_value
+ using V = std::variant<int, long>;
+ constexpr V v1(1);
+ constexpr V v2(0);
+ static_assert(test_less(v1, v2, false, true), "");
+ }
+ { // LHS.index() < RHS.index()
+ using V = std::variant<int, long>;
+ constexpr V v1(0);
+ constexpr V v2(0l);
+ static_assert(test_less(v1, v2, true, false), "");
+ }
+ { // LHS.index() > RHS.index()
+ using V = std::variant<int, long>;
+ constexpr V v1(0l);
+ constexpr V v2(0);
+ static_assert(test_less(v1, v2, false, true), "");
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ { // LHS.index() < RHS.index(), RHS is empty
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ V v2;
+ makeEmpty(v2);
+ assert(test_less(v1, v2, false, true));
+ }
+ { // LHS.index() > RHS.index(), LHS is empty
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ V v2;
+ assert(test_less(v1, v2, true, false));
+ }
+ { // LHS.index() == RHS.index(), LHS and RHS are empty
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ V v2;
+ makeEmpty(v2);
+ assert(test_less(v1, v2, false, false));
+ }
+#endif
+}
+
+int main() {
+ test_equality();
+ test_relational();
+}
diff --git a/test/std/utilities/variant/variant.synopsis/variant_npos.pass.cpp b/test/std/utilities/variant/variant.synopsis/variant_npos.pass.cpp
new file mode 100644
index 000000000000..4d7c8563caad
--- /dev/null
+++ b/test/std/utilities/variant/variant.synopsis/variant_npos.pass.cpp
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// constexpr size_t variant_npos = -1;
+
+#include <variant>
+
+int main() {
+ static_assert(std::variant_npos == static_cast<std::size_t>(-1), "");
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
new file mode 100644
index 000000000000..10022b14aa06
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
@@ -0,0 +1,232 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class T>
+// variant& operator=(T&&) noexcept(see below);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+namespace MetaHelpers {
+
+struct Dummy {
+ Dummy() = default;
+};
+
+struct ThrowsCtorT {
+ ThrowsCtorT(int) noexcept(false) {}
+ ThrowsCtorT &operator=(int) noexcept { return *this; }
+};
+
+struct ThrowsAssignT {
+ ThrowsAssignT(int) noexcept {}
+ ThrowsAssignT &operator=(int) noexcept(false) { return *this; }
+};
+
+struct NoThrowT {
+ NoThrowT(int) noexcept {}
+ NoThrowT &operator=(int) noexcept { return *this; }
+};
+
+} // namespace MetaHelpers
+
+namespace RuntimeHelpers {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+
+struct ThrowsCtorT {
+ int value;
+ ThrowsCtorT() : value(0) {}
+ ThrowsCtorT(int) noexcept(false) { throw 42; }
+ ThrowsCtorT &operator=(int v) noexcept {
+ value = v;
+ return *this;
+ }
+};
+
+struct ThrowsAssignT {
+ int value;
+ ThrowsAssignT() : value(0) {}
+ ThrowsAssignT(int v) noexcept : value(v) {}
+ ThrowsAssignT &operator=(int) noexcept(false) { throw 42; }
+};
+
+struct NoThrowT {
+ int value;
+ NoThrowT() : value(0) {}
+ NoThrowT(int v) noexcept : value(v) {}
+ NoThrowT &operator=(int v) noexcept {
+ value = v;
+ return *this;
+ }
+};
+
+#endif // !defined(TEST_HAS_NO_EXCEPTIONS)
+} // namespace RuntimeHelpers
+
+void test_T_assignment_noexcept() {
+ using namespace MetaHelpers;
+ {
+ using V = std::variant<Dummy, NoThrowT>;
+ static_assert(std::is_nothrow_assignable<V, int>::value, "");
+ }
+ {
+ using V = std::variant<Dummy, ThrowsCtorT>;
+ static_assert(!std::is_nothrow_assignable<V, int>::value, "");
+ }
+ {
+ using V = std::variant<Dummy, ThrowsAssignT>;
+ static_assert(!std::is_nothrow_assignable<V, int>::value, "");
+ }
+}
+
+void test_T_assignment_sfinae() {
+ {
+ using V = std::variant<long, unsigned>;
+ static_assert(!std::is_assignable<V, int>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<std::string, std::string>;
+ static_assert(!std::is_assignable<V, const char *>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<std::string, void *>;
+ static_assert(!std::is_assignable<V, int>::value, "no matching operator=");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, int &&>;
+ static_assert(!std::is_assignable<V, int>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<int, const int &>;
+ static_assert(!std::is_assignable<V, int>::value, "ambiguous");
+ }
+#endif
+}
+
+void test_T_assignment_basic() {
+ {
+ std::variant<int> v(43);
+ v = 42;
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == 42);
+ }
+ {
+ std::variant<int, long> v(43l);
+ v = 42;
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == 42);
+ v = 43l;
+ assert(v.index() == 1);
+ assert(std::get<1>(v) == 43);
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &, int &&, long>;
+ int x = 42;
+ V v(43l);
+ v = x;
+ assert(v.index() == 0);
+ assert(&std::get<0>(v) == &x);
+ v = std::move(x);
+ assert(v.index() == 1);
+ assert(&std::get<1>(v) == &x);
+ // 'long' is selected by FUN(const int &) since 'const int &' cannot bind
+ // to 'int&'.
+ const int &cx = x;
+ v = cx;
+ assert(v.index() == 2);
+ assert(std::get<2>(v) == 42);
+ }
+#endif
+}
+
+void test_T_assignment_performs_construction() {
+ using namespace RuntimeHelpers;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<std::string, ThrowsCtorT>;
+ V v(std::in_place_type<std::string>, "hello");
+ try {
+ v = 42;
+ } catch (...) { /* ... */
+ }
+ assert(v.valueless_by_exception());
+ }
+ {
+ using V = std::variant<ThrowsAssignT, std::string>;
+ V v(std::in_place_type<std::string>, "hello");
+ v = 42;
+ assert(v.index() == 0);
+ assert(std::get<0>(v).value == 42);
+ }
+#endif
+}
+
+void test_T_assignment_performs_assignment() {
+ using namespace RuntimeHelpers;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<ThrowsCtorT>;
+ V v;
+ v = 42;
+ assert(v.index() == 0);
+ assert(std::get<0>(v).value == 42);
+ }
+ {
+ using V = std::variant<ThrowsCtorT, std::string>;
+ V v;
+ v = 42;
+ assert(v.index() == 0);
+ assert(std::get<0>(v).value == 42);
+ }
+ {
+ using V = std::variant<ThrowsAssignT>;
+ V v(100);
+ try {
+ v = 42;
+ assert(false);
+ } catch (...) { /* ... */
+ }
+ assert(v.index() == 0);
+ assert(std::get<0>(v).value == 100);
+ }
+ {
+ using V = std::variant<std::string, ThrowsAssignT>;
+ V v(100);
+ try {
+ v = 42;
+ assert(false);
+ } catch (...) { /* ... */
+ }
+ assert(v.index() == 1);
+ assert(std::get<1>(v).value == 100);
+ }
+#endif
+}
+
+int main() {
+ test_T_assignment_basic();
+ test_T_assignment_performs_construction();
+ test_T_assignment_performs_assignment();
+ test_T_assignment_noexcept();
+ test_T_assignment_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
new file mode 100644
index 000000000000..d92f16fd6418
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
@@ -0,0 +1,397 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant& operator=(variant const&);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NoCopy {
+ NoCopy(const NoCopy &) = delete;
+ NoCopy &operator=(const NoCopy &) = default;
+};
+
+struct NothrowCopy {
+ NothrowCopy(const NothrowCopy &) noexcept = default;
+ NothrowCopy &operator=(const NothrowCopy &) noexcept = default;
+};
+
+struct CopyOnly {
+ CopyOnly(const CopyOnly &) = default;
+ CopyOnly(CopyOnly &&) = delete;
+ CopyOnly &operator=(const CopyOnly &) = default;
+ CopyOnly &operator=(CopyOnly &&) = delete;
+};
+
+struct MoveOnly {
+ MoveOnly(const MoveOnly &) = delete;
+ MoveOnly(MoveOnly &&) = default;
+ MoveOnly &operator=(const MoveOnly &) = default;
+};
+
+struct MoveOnlyNT {
+ MoveOnlyNT(const MoveOnlyNT &) = delete;
+ MoveOnlyNT(MoveOnlyNT &&) {}
+ MoveOnlyNT &operator=(const MoveOnlyNT &) = default;
+};
+
+struct CopyAssign {
+ static int alive;
+ static int copy_construct;
+ static int copy_assign;
+ static int move_construct;
+ static int move_assign;
+ static void reset() {
+ copy_construct = copy_assign = move_construct = move_assign = alive = 0;
+ }
+ CopyAssign(int v) : value(v) { ++alive; }
+ CopyAssign(const CopyAssign &o) : value(o.value) {
+ ++alive;
+ ++copy_construct;
+ }
+ CopyAssign(CopyAssign &&o) : value(o.value) {
+ o.value = -1;
+ ++alive;
+ ++move_construct;
+ }
+ CopyAssign &operator=(const CopyAssign &o) {
+ value = o.value;
+ ++copy_assign;
+ return *this;
+ }
+ CopyAssign &operator=(CopyAssign &&o) {
+ value = o.value;
+ o.value = -1;
+ ++move_assign;
+ return *this;
+ }
+ ~CopyAssign() { --alive; }
+ int value;
+};
+
+int CopyAssign::alive = 0;
+int CopyAssign::copy_construct = 0;
+int CopyAssign::copy_assign = 0;
+int CopyAssign::move_construct = 0;
+int CopyAssign::move_assign = 0;
+
+struct CopyMaybeThrows {
+ CopyMaybeThrows(const CopyMaybeThrows &);
+ CopyMaybeThrows &operator=(const CopyMaybeThrows &);
+};
+struct CopyDoesThrow {
+ CopyDoesThrow(const CopyDoesThrow &) noexcept(false);
+ CopyDoesThrow &operator=(const CopyDoesThrow &) noexcept(false);
+};
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct CopyThrows {
+ CopyThrows() = default;
+ CopyThrows(const CopyThrows &) { throw 42; }
+ CopyThrows &operator=(const CopyThrows &) { throw 42; }
+};
+
+struct MoveThrows {
+ static int alive;
+ MoveThrows() { ++alive; }
+ MoveThrows(const MoveThrows &) { ++alive; }
+ MoveThrows(MoveThrows &&) { throw 42; }
+ MoveThrows &operator=(const MoveThrows &) { return *this; }
+ MoveThrows &operator=(MoveThrows &&) { throw 42; }
+ ~MoveThrows() { --alive; }
+};
+
+int MoveThrows::alive = 0;
+
+struct MakeEmptyT {
+ static int alive;
+ MakeEmptyT() { ++alive; }
+ MakeEmptyT(const MakeEmptyT &) {
+ ++alive;
+ // Don't throw from the copy constructor since variant's assignment
+ // operator performs a copy before committing to the assignment.
+ }
+ MakeEmptyT(MakeEmptyT &&) { throw 42; }
+ MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; }
+ MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; }
+ ~MakeEmptyT() { --alive; }
+};
+
+int MakeEmptyT::alive = 0;
+
+template <class Variant> void makeEmpty(Variant &v) {
+ Variant v2(std::in_place_type<MakeEmptyT>);
+ try {
+ v = v2;
+ assert(false);
+ } catch (...) {
+ assert(v.valueless_by_exception());
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+void test_copy_assignment_not_noexcept() {
+ {
+ using V = std::variant<CopyMaybeThrows>;
+ static_assert(!std::is_nothrow_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, CopyDoesThrow>;
+ static_assert(!std::is_nothrow_copy_assignable<V>::value, "");
+ }
+}
+
+void test_copy_assignment_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_copy_assignable<V>::value, "");
+ }
+ {
+ // variant only provides copy assignment when both the copy and move
+ // constructors are well formed
+ using V = std::variant<int, CopyOnly>;
+ static_assert(!std::is_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NoCopy>;
+ static_assert(!std::is_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(!std::is_copy_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnlyNT>;
+ static_assert(!std::is_copy_assignable<V>::value, "");
+ }
+}
+
+void test_copy_assignment_empty_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, long, MET>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+#endif
+}
+
+void test_copy_assignment_non_empty_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET>;
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_index<2>, "hello");
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+#endif
+}
+
+void test_copy_assignment_empty_non_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_index<0>, 42);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 0);
+ assert(std::get<0>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_type<std::string>, "hello");
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ }
+#endif
+}
+
+void test_copy_assignment_same_index() {
+ {
+ using V = std::variant<int>;
+ V v1(43);
+ V v2(42);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 0);
+ assert(std::get<0>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, long, unsigned>;
+ V v1(43l);
+ V v2(42l);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, CopyAssign, unsigned>;
+ V v1(std::in_place_type<CopyAssign>, 43);
+ V v2(std::in_place_type<CopyAssign>, 42);
+ CopyAssign::reset();
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1).value == 42);
+ assert(CopyAssign::copy_construct == 0);
+ assert(CopyAssign::move_construct == 0);
+ assert(CopyAssign::copy_assign == 1);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_type<MET>);
+ MET &mref = std::get<1>(v1);
+ V v2(std::in_place_type<MET>);
+ try {
+ v1 = v2;
+ assert(false);
+ } catch (...) {
+ }
+ assert(v1.index() == 1);
+ assert(&std::get<1>(v1) == &mref);
+ }
+#endif
+}
+
+void test_copy_assignment_different_index() {
+ {
+ using V = std::variant<int, long, unsigned>;
+ V v1(43);
+ V v2(42l);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, CopyAssign, unsigned>;
+ CopyAssign::reset();
+ V v1(std::in_place_type<unsigned>, 43);
+ V v2(std::in_place_type<CopyAssign>, 42);
+ assert(CopyAssign::copy_construct == 0);
+ assert(CopyAssign::move_construct == 0);
+ assert(CopyAssign::alive == 1);
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1).value == 42);
+ assert(CopyAssign::alive == 2);
+ assert(CopyAssign::copy_construct == 1);
+ assert(CopyAssign::move_construct == 1);
+ assert(CopyAssign::copy_assign == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ // Test that if copy construction throws then original value is
+ // unchanged.
+ using V = std::variant<int, CopyThrows, std::string>;
+ V v1(std::in_place_type<std::string>, "hello");
+ V v2(std::in_place_type<CopyThrows>);
+ try {
+ v1 = v2;
+ assert(false);
+ } catch (...) { /* ... */
+ }
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ }
+ {
+ // Test that if move construction throws then the variant is left
+ // valueless by exception.
+ using V = std::variant<int, MoveThrows, std::string>;
+ V v1(std::in_place_type<std::string>, "hello");
+ V v2(std::in_place_type<MoveThrows>);
+ assert(MoveThrows::alive == 1);
+ try {
+ v1 = v2;
+ assert(false);
+ } catch (...) { /* ... */
+ }
+ assert(v1.valueless_by_exception());
+ assert(v2.index() == 1);
+ assert(MoveThrows::alive == 1);
+ }
+ {
+ using V = std::variant<int, CopyThrows, std::string>;
+ V v1(std::in_place_type<CopyThrows>);
+ V v2(std::in_place_type<std::string>, "hello");
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ assert(v2.index() == 2);
+ assert(std::get<2>(v2) == "hello");
+ }
+ {
+ using V = std::variant<int, MoveThrows, std::string>;
+ V v1(std::in_place_type<MoveThrows>);
+ V v2(std::in_place_type<std::string>, "hello");
+ V &vref = (v1 = v2);
+ assert(&vref == &v1);
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ assert(v2.index() == 2);
+ assert(std::get<2>(v2) == "hello");
+ }
+#endif
+}
+
+
+int main() {
+ test_copy_assignment_empty_empty();
+ test_copy_assignment_non_empty_empty();
+ test_copy_assignment_empty_non_empty();
+ test_copy_assignment_same_index();
+ test_copy_assignment_different_index();
+ test_copy_assignment_sfinae();
+ test_copy_assignment_not_noexcept();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
new file mode 100644
index 000000000000..232d77c882eb
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
@@ -0,0 +1,319 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant& operator=(variant&&) noexcept(see below);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+struct NoCopy {
+ NoCopy(const NoCopy &) = delete;
+ NoCopy &operator=(const NoCopy &) = default;
+};
+
+struct CopyOnly {
+ CopyOnly(const CopyOnly &) = default;
+ CopyOnly(CopyOnly &&) = delete;
+ CopyOnly &operator=(const CopyOnly &) = default;
+ CopyOnly &operator=(CopyOnly &&) = delete;
+};
+
+struct MoveOnly {
+ MoveOnly(const MoveOnly &) = delete;
+ MoveOnly(MoveOnly &&) = default;
+ MoveOnly &operator=(const MoveOnly &) = delete;
+ MoveOnly &operator=(MoveOnly &&) = default;
+};
+
+struct MoveOnlyNT {
+ MoveOnlyNT(const MoveOnlyNT &) = delete;
+ MoveOnlyNT(MoveOnlyNT &&) {}
+ MoveOnlyNT &operator=(const MoveOnlyNT &) = delete;
+ MoveOnlyNT &operator=(MoveOnlyNT &&) = default;
+};
+
+struct MoveOnlyOddNothrow {
+ MoveOnlyOddNothrow(MoveOnlyOddNothrow &&) noexcept(false) {}
+ MoveOnlyOddNothrow(const MoveOnlyOddNothrow &) = delete;
+ MoveOnlyOddNothrow &operator=(MoveOnlyOddNothrow &&) noexcept = default;
+ MoveOnlyOddNothrow &operator=(const MoveOnlyOddNothrow &) = delete;
+};
+
+struct MoveAssignOnly {
+ MoveAssignOnly(MoveAssignOnly &&) = delete;
+ MoveAssignOnly &operator=(MoveAssignOnly &&) = default;
+};
+
+struct MoveAssign {
+ static int move_construct;
+ static int move_assign;
+ static void reset() { move_construct = move_assign = 0; }
+ MoveAssign(int v) : value(v) {}
+ MoveAssign(MoveAssign &&o) : value(o.value) {
+ ++move_construct;
+ o.value = -1;
+ }
+ MoveAssign &operator=(MoveAssign &&o) {
+ value = o.value;
+ ++move_assign;
+ o.value = -1;
+ return *this;
+ }
+ int value;
+};
+
+int MoveAssign::move_construct = 0;
+int MoveAssign::move_assign = 0;
+
+void test_move_assignment_noexcept() {
+ {
+ using V = std::variant<int>;
+ static_assert(std::is_nothrow_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<MoveOnly>;
+ static_assert(std::is_nothrow_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_nothrow_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(std::is_nothrow_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<MoveOnlyNT>;
+ static_assert(!std::is_nothrow_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<MoveOnlyOddNothrow>;
+ static_assert(!std::is_nothrow_move_assignable<V>::value, "");
+ }
+}
+
+void test_move_assignment_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_move_assignable<V>::value, "");
+ }
+ {
+ // variant only provides move assignment when both the move constructor
+ // and move assignment operator are well formed.
+ using V = std::variant<int, CopyOnly>;
+ static_assert(!std::is_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NoCopy>;
+ static_assert(!std::is_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(std::is_move_assignable<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnlyNT>;
+ static_assert(std::is_move_assignable<V>::value, "");
+ }
+ {
+ // variant only provides move assignment when the types also provide
+ // a move constructor.
+ using V = std::variant<int, MoveAssignOnly>;
+ static_assert(!std::is_move_assignable<V>::value, "");
+ }
+}
+
+void test_move_assignment_empty_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, long, MET>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+#endif
+}
+
+void test_move_assignment_non_empty_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET>;
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_index<2>, "hello");
+ V v2(std::in_place_index<0>);
+ makeEmpty(v2);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+#endif
+}
+
+void test_move_assignment_empty_non_empty() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_index<0>, 42);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 0);
+ assert(std::get<0>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_index<0>);
+ makeEmpty(v1);
+ V v2(std::in_place_type<std::string>, "hello");
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ }
+#endif
+}
+
+void test_move_assignment_same_index() {
+ {
+ using V = std::variant<int>;
+ V v1(43);
+ V v2(42);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 0);
+ assert(std::get<0>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, long, unsigned>;
+ V v1(43l);
+ V v2(42l);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, MoveAssign, unsigned>;
+ V v1(std::in_place_type<MoveAssign>, 43);
+ V v2(std::in_place_type<MoveAssign>, 42);
+ MoveAssign::reset();
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1).value == 42);
+ assert(MoveAssign::move_construct == 0);
+ assert(MoveAssign::move_assign == 1);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_type<MET>);
+ MET &mref = std::get<1>(v1);
+ V v2(std::in_place_type<MET>);
+ try {
+ v1 = std::move(v2);
+ assert(false);
+ } catch (...) {
+ }
+ assert(v1.index() == 1);
+ assert(&std::get<1>(v1) == &mref);
+ }
+#endif
+}
+
+void test_move_assignment_different_index() {
+ {
+ using V = std::variant<int, long, unsigned>;
+ V v1(43);
+ V v2(42l);
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1) == 42);
+ }
+ {
+ using V = std::variant<int, MoveAssign, unsigned>;
+ V v1(std::in_place_type<unsigned>, 43);
+ V v2(std::in_place_type<MoveAssign>, 42);
+ MoveAssign::reset();
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 1);
+ assert(std::get<1>(v1).value == 42);
+ assert(MoveAssign::move_construct == 1);
+ assert(MoveAssign::move_assign == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using MET = MakeEmptyT;
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_type<int>);
+ V v2(std::in_place_type<MET>);
+ try {
+ v1 = std::move(v2);
+ assert(false);
+ } catch (...) {
+ }
+ assert(v1.valueless_by_exception());
+ assert(v1.index() == std::variant_npos);
+ }
+ {
+ using V = std::variant<int, MET, std::string>;
+ V v1(std::in_place_type<MET>);
+ V v2(std::in_place_type<std::string>, "hello");
+ V &vref = (v1 = std::move(v2));
+ assert(&vref == &v1);
+ assert(v1.index() == 2);
+ assert(std::get<2>(v1) == "hello");
+ }
+#endif
+}
+
+int main() {
+ test_move_assignment_empty_empty();
+ test_move_assignment_non_empty_empty();
+ test_move_assignment_empty_non_empty();
+ test_move_assignment_same_index();
+ test_move_assignment_different_index();
+ test_move_assignment_sfinae();
+ test_move_assignment_noexcept();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp
new file mode 100644
index 000000000000..d33ea0bd3f4e
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class T> constexpr variant(T&&) noexcept(see below);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+struct Dummy {
+ Dummy() = default;
+};
+
+struct ThrowsT {
+ ThrowsT(int) noexcept(false) {}
+};
+
+struct NoThrowT {
+ NoThrowT(int) noexcept(true) {}
+};
+
+void test_T_ctor_noexcept() {
+ {
+ using V = std::variant<Dummy, NoThrowT>;
+ static_assert(std::is_nothrow_constructible<V, int>::value, "");
+ }
+ {
+ using V = std::variant<Dummy, ThrowsT>;
+ static_assert(!std::is_nothrow_constructible<V, int>::value, "");
+ }
+}
+
+void test_T_ctor_sfinae() {
+ {
+ using V = std::variant<long, unsigned>;
+ static_assert(!std::is_constructible<V, int>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<std::string, std::string>;
+ static_assert(!std::is_constructible<V, const char *>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<std::string, void *>;
+ static_assert(!std::is_constructible<V, int>::value,
+ "no matching constructor");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, int &&>;
+ static_assert(!std::is_constructible<V, int>::value, "ambiguous");
+ }
+ {
+ using V = std::variant<int, const int &>;
+ static_assert(!std::is_constructible<V, int>::value, "ambiguous");
+ }
+#endif
+}
+
+void test_T_ctor_basic() {
+ {
+ constexpr std::variant<int> v(42);
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 42, "");
+ }
+ {
+ constexpr std::variant<int, long> v(42l);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v) == 42, "");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<const int &, int &&, long>;
+ static_assert(std::is_convertible<int &, V>::value, "must be implicit");
+ int x = 42;
+ V v(x);
+ assert(v.index() == 0);
+ assert(&std::get<0>(v) == &x);
+ }
+ {
+ using V = std::variant<const int &, int &&, long>;
+ static_assert(std::is_convertible<int, V>::value, "must be implicit");
+ int x = 42;
+ V v(std::move(x));
+ assert(v.index() == 1);
+ assert(&std::get<1>(v) == &x);
+ }
+#endif
+}
+
+int main() {
+ test_T_ctor_basic();
+ test_T_ctor_noexcept();
+ test_T_ctor_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
new file mode 100644
index 000000000000..18216c6da923
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
@@ -0,0 +1,159 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant(variant const&);
+
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NonT {
+ NonT(int v) : value(v) {}
+ NonT(const NonT &o) : value(o.value) {}
+ int value;
+};
+static_assert(!std::is_trivially_copy_constructible<NonT>::value, "");
+
+struct NoCopy {
+ NoCopy(const NoCopy &) = delete;
+};
+
+struct MoveOnly {
+ MoveOnly(const MoveOnly &) = delete;
+ MoveOnly(MoveOnly &&) = default;
+};
+
+struct MoveOnlyNT {
+ MoveOnlyNT(const MoveOnlyNT &) = delete;
+ MoveOnlyNT(MoveOnlyNT &&) {}
+};
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct MakeEmptyT {
+ static int alive;
+ MakeEmptyT() { ++alive; }
+ MakeEmptyT(const MakeEmptyT &) {
+ ++alive;
+ // Don't throw from the copy constructor since variant's assignment
+ // operator performs a copy before committing to the assignment.
+ }
+ MakeEmptyT(MakeEmptyT &&) { throw 42; }
+ MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; }
+ MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; }
+ ~MakeEmptyT() { --alive; }
+};
+
+int MakeEmptyT::alive = 0;
+
+template <class Variant> void makeEmpty(Variant &v) {
+ Variant v2(std::in_place_type<MakeEmptyT>);
+ try {
+ v = v2;
+ assert(false);
+ } catch (...) {
+ assert(v.valueless_by_exception());
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+void test_copy_ctor_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NoCopy>;
+ static_assert(!std::is_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(!std::is_copy_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnlyNT>;
+ static_assert(!std::is_copy_constructible<V>::value, "");
+ }
+}
+
+void test_copy_ctor_basic() {
+ {
+ std::variant<int> v(std::in_place_index<0>, 42);
+ std::variant<int> v2 = v;
+ assert(v2.index() == 0);
+ assert(std::get<0>(v2) == 42);
+ }
+ {
+ std::variant<int, long> v(std::in_place_index<1>, 42);
+ std::variant<int, long> v2 = v;
+ assert(v2.index() == 1);
+ assert(std::get<1>(v2) == 42);
+ }
+ {
+ std::variant<NonT> v(std::in_place_index<0>, 42);
+ assert(v.index() == 0);
+ std::variant<NonT> v2(v);
+ assert(v2.index() == 0);
+ assert(std::get<0>(v2).value == 42);
+ }
+ {
+ std::variant<int, NonT> v(std::in_place_index<1>, 42);
+ assert(v.index() == 1);
+ std::variant<int, NonT> v2(v);
+ assert(v2.index() == 1);
+ assert(std::get<1>(v2).value == 42);
+ }
+}
+
+void test_copy_ctor_valueless_by_exception() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ const V &cv1 = v1;
+ V v(cv1);
+ assert(v.valueless_by_exception());
+#endif
+}
+
+template <size_t Idx>
+constexpr bool test_constexpr_copy_ctor_extension_imp(
+ std::variant<long, void*, const int> const& v)
+{
+ auto v2 = v;
+ return v2.index() == v.index() &&
+ v2.index() == Idx &&
+ std::get<Idx>(v2) == std::get<Idx>(v);
+}
+
+void test_constexpr_copy_ctor_extension() {
+#ifdef _LIBCPP_VERSION
+ using V = std::variant<long, void*, const int>;
+ static_assert(std::is_trivially_copyable<V>::value, "");
+ static_assert(std::is_trivially_copy_constructible<V>::value, "");
+ static_assert(test_constexpr_copy_ctor_extension_imp<0>(V(42l)), "");
+ static_assert(test_constexpr_copy_ctor_extension_imp<1>(V(nullptr)), "");
+ static_assert(test_constexpr_copy_ctor_extension_imp<2>(V(101)), "");
+#endif
+}
+
+int main() {
+ test_copy_ctor_basic();
+ test_copy_ctor_valueless_by_exception();
+ test_copy_ctor_sfinae();
+ test_constexpr_copy_ctor_extension();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp
new file mode 100644
index 000000000000..a4a86ff6c1ca
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp
@@ -0,0 +1,112 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// constexpr variant() noexcept(see below);
+
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+struct NonDefaultConstructible {
+ NonDefaultConstructible(int) {}
+};
+
+struct NotNoexcept {
+ NotNoexcept() noexcept(false) {}
+};
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct DefaultCtorThrows {
+ DefaultCtorThrows() { throw 42; }
+};
+#endif
+
+void test_default_ctor_sfinae() {
+ {
+ using V = std::variant<std::monostate, int>;
+ static_assert(std::is_default_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<NonDefaultConstructible, int>;
+ static_assert(!std::is_default_constructible<V>::value, "");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int &, int>;
+ static_assert(!std::is_default_constructible<V>::value, "");
+ }
+#endif
+}
+
+void test_default_ctor_noexcept() {
+ {
+ using V = std::variant<int>;
+ static_assert(std::is_nothrow_default_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<NotNoexcept>;
+ static_assert(!std::is_nothrow_default_constructible<V>::value, "");
+ }
+}
+
+void test_default_ctor_throws() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<DefaultCtorThrows, int>;
+ try {
+ V v;
+ assert(false);
+ } catch (const int &ex) {
+ assert(ex == 42);
+ } catch (...) {
+ assert(false);
+ }
+#endif
+}
+
+void test_default_ctor_basic() {
+ {
+ std::variant<int> v;
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == 0);
+ }
+ {
+ std::variant<int, long> v;
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == 0);
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v;
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 0, "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v;
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 0, "");
+ }
+}
+
+int main() {
+ test_default_ctor_basic();
+ test_default_ctor_sfinae();
+ test_default_ctor_noexcept();
+ test_default_ctor_throws();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp
new file mode 100644
index 000000000000..18115722f8d1
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <size_t I, class ...Args>
+// constexpr explicit variant(in_place_index_t<I>, Args&&...);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+void test_ctor_sfinae() {
+ {
+ using V = std::variant<int>;
+ static_assert(
+ std::is_constructible<V, std::in_place_index_t<0>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<0>, int>(), "");
+ }
+ {
+ using V = std::variant<int, long, long long>;
+ static_assert(
+ std::is_constructible<V, std::in_place_index_t<1>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<1>, int>(), "");
+ }
+ {
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ std::is_constructible<V, std::in_place_index_t<2>, int *>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<2>, int *>(), "");
+ }
+ { // args not convertible to type
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_index_t<0>, int *>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<0>, int *>(), "");
+ }
+ { // index not in variant
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_index_t<3>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<3>, int>(), "");
+ }
+}
+
+void test_ctor_basic() {
+ {
+ constexpr std::variant<int> v(std::in_place_index<0>, 42);
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 42, "");
+ }
+ {
+ constexpr std::variant<int, long, long> v(std::in_place_index<1>, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v) == 42, "");
+ }
+ {
+ constexpr std::variant<int, const int, long> v(std::in_place_index<1>, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v) == 42, "");
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_index<0>, x);
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == x);
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_index<1>, x);
+ assert(v.index() == 1);
+ assert(std::get<1>(v) == x);
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_index<2>, x);
+ assert(v.index() == 2);
+ assert(std::get<2>(v) == x);
+ }
+}
+
+int main() {
+ test_ctor_basic();
+ test_ctor_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp
new file mode 100644
index 000000000000..608cdf9d6efb
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <size_t I, class Up, class ...Args>
+// constexpr explicit
+// variant(in_place_index_t<I>, initializer_list<Up>, Args&&...);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+struct InitList {
+ std::size_t size;
+ constexpr InitList(std::initializer_list<int> il) : size(il.size()) {}
+};
+
+struct InitListArg {
+ std::size_t size;
+ int value;
+ constexpr InitListArg(std::initializer_list<int> il, int v)
+ : size(il.size()), value(v) {}
+};
+
+void test_ctor_sfinae() {
+ using IL = std::initializer_list<int>;
+ { // just init list
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(std::is_constructible<V, std::in_place_index_t<0>, IL>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_index_t<0>, IL>(), "");
+ }
+ { // too many arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_index_t<0>, IL, int>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_index_t<0>, IL, int>(),
+ "");
+ }
+ { // too few arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_index_t<1>, IL>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<1>, IL>(), "");
+ }
+ { // init list and arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ std::is_constructible<V, std::in_place_index_t<1>, IL, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<1>, IL, int>(),
+ "");
+ }
+ { // not constructible from arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_index_t<2>, IL>::value, "");
+ static_assert(!test_convertible<V, std::in_place_index_t<2>, IL>(), "");
+ }
+}
+
+void test_ctor_basic() {
+ {
+ constexpr std::variant<InitList, InitListArg, InitList> v(
+ std::in_place_index<0>, {1, 2, 3});
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v).size == 3, "");
+ }
+ {
+ constexpr std::variant<InitList, InitListArg, InitList> v(
+ std::in_place_index<2>, {1, 2, 3});
+ static_assert(v.index() == 2, "");
+ static_assert(std::get<2>(v).size == 3, "");
+ }
+ {
+ constexpr std::variant<InitList, InitListArg, InitListArg> v(
+ std::in_place_index<1>, {1, 2, 3, 4}, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v).size == 4, "");
+ static_assert(std::get<1>(v).value == 42, "");
+ }
+}
+
+int main() {
+ test_ctor_basic();
+ test_ctor_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp
new file mode 100644
index 000000000000..a023f02bad6e
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class Tp, class ...Args>
+// constexpr explicit variant(in_place_type_t<Tp>, Args&&...);
+
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+void test_ctor_sfinae() {
+ {
+ using V = std::variant<int>;
+ static_assert(
+ std::is_constructible<V, std::in_place_type_t<int>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_type_t<int>, int>(), "");
+ }
+ {
+ using V = std::variant<int, long, long long>;
+ static_assert(
+ std::is_constructible<V, std::in_place_type_t<long>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_type_t<long>, int>(), "");
+ }
+ {
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ std::is_constructible<V, std::in_place_type_t<int *>, int *>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_type_t<int *>, int *>(),
+ "");
+ }
+ { // duplicate type
+ using V = std::variant<int, long, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_type_t<int>, int>::value, "");
+ static_assert(!test_convertible<V, std::in_place_type_t<int>, int>(), "");
+ }
+ { // args not convertible to type
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_type_t<int>, int *>::value, "");
+ static_assert(!test_convertible<V, std::in_place_type_t<int>, int *>(), "");
+ }
+ { // type not in variant
+ using V = std::variant<int, long, int *>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_type_t<long long>, int>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_type_t<long long>, int>(),
+ "");
+ }
+}
+
+void test_ctor_basic() {
+ {
+ constexpr std::variant<int> v(std::in_place_type<int>, 42);
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 42, "");
+ }
+ {
+ constexpr std::variant<int, long> v(std::in_place_type<long>, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v) == 42, "");
+ }
+ {
+ constexpr std::variant<int, const int, long> v(
+ std::in_place_type<const int>, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v) == 42, "");
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_type<const int>, x);
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == x);
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_type<volatile int>, x);
+ assert(v.index() == 1);
+ assert(std::get<1>(v) == x);
+ }
+ {
+ using V = std::variant<const int, volatile int, int>;
+ int x = 42;
+ V v(std::in_place_type<int>, x);
+ assert(v.index() == 2);
+ assert(std::get<2>(v) == x);
+ }
+}
+
+int main() {
+ test_ctor_basic();
+ test_ctor_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp
new file mode 100644
index 000000000000..e151572c4666
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class Tp, class Up, class ...Args>
+// constexpr explicit
+// variant(in_place_type_t<Tp>, initializer_list<Up>, Args&&...);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+struct InitList {
+ std::size_t size;
+ constexpr InitList(std::initializer_list<int> il) : size(il.size()) {}
+};
+
+struct InitListArg {
+ std::size_t size;
+ int value;
+ constexpr InitListArg(std::initializer_list<int> il, int v)
+ : size(il.size()), value(v) {}
+};
+
+void test_ctor_sfinae() {
+ using IL = std::initializer_list<int>;
+ { // just init list
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ std::is_constructible<V, std::in_place_type_t<InitList>, IL>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_type_t<InitList>, IL>(),
+ "");
+ }
+ { // too many arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(!std::is_constructible<V, std::in_place_type_t<InitList>, IL,
+ int>::value,
+ "");
+ static_assert(
+ !test_convertible<V, std::in_place_type_t<InitList>, IL, int>(), "");
+ }
+ { // too few arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_type_t<InitListArg>, IL>::value,
+ "");
+ static_assert(!test_convertible<V, std::in_place_type_t<InitListArg>, IL>(),
+ "");
+ }
+ { // init list and arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(std::is_constructible<V, std::in_place_type_t<InitListArg>,
+ IL, int>::value,
+ "");
+ static_assert(
+ !test_convertible<V, std::in_place_type_t<InitListArg>, IL, int>(), "");
+ }
+ { // not constructible from arguments
+ using V = std::variant<InitList, InitListArg, int>;
+ static_assert(
+ !std::is_constructible<V, std::in_place_type_t<int>, IL>::value, "");
+ static_assert(!test_convertible<V, std::in_place_type_t<int>, IL>(), "");
+ }
+ { // duplicate types in variant
+ using V = std::variant<InitListArg, InitListArg, int>;
+ static_assert(!std::is_constructible<V, std::in_place_type_t<InitListArg>,
+ IL, int>::value,
+ "");
+ static_assert(
+ !test_convertible<V, std::in_place_type_t<InitListArg>, IL, int>(), "");
+ }
+}
+
+void test_ctor_basic() {
+ {
+ constexpr std::variant<InitList, InitListArg> v(
+ std::in_place_type<InitList>, {1, 2, 3});
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v).size == 3, "");
+ }
+ {
+ constexpr std::variant<InitList, InitListArg> v(
+ std::in_place_type<InitListArg>, {1, 2, 3, 4}, 42);
+ static_assert(v.index() == 1, "");
+ static_assert(std::get<1>(v).size == 4, "");
+ static_assert(std::get<1>(v).value == 42, "");
+ }
+}
+
+int main() {
+ test_ctor_basic();
+ test_ctor_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
new file mode 100644
index 000000000000..66f67fe8d3f2
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// variant(variant&&) noexcept(see below);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct ThrowsMove {
+ ThrowsMove(ThrowsMove &&) noexcept(false) {}
+};
+
+struct NoCopy {
+ NoCopy(const NoCopy &) = delete;
+};
+
+struct MoveOnly {
+ int value;
+ MoveOnly(int v) : value(v) {}
+ MoveOnly(const MoveOnly &) = delete;
+ MoveOnly(MoveOnly &&) = default;
+};
+
+struct MoveOnlyNT {
+ int value;
+ MoveOnlyNT(int v) : value(v) {}
+ MoveOnlyNT(const MoveOnlyNT &) = delete;
+ MoveOnlyNT(MoveOnlyNT &&other) : value(other.value) { other.value = -1; }
+};
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct MakeEmptyT {
+ static int alive;
+ MakeEmptyT() { ++alive; }
+ MakeEmptyT(const MakeEmptyT &) {
+ ++alive;
+ // Don't throw from the copy constructor since variant's assignment
+ // operator performs a copy before committing to the assignment.
+ }
+ MakeEmptyT(MakeEmptyT &&) { throw 42; }
+ MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; }
+ MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; }
+ ~MakeEmptyT() { --alive; }
+};
+
+int MakeEmptyT::alive = 0;
+
+template <class Variant> void makeEmpty(Variant &v) {
+ Variant v2(std::in_place_type<MakeEmptyT>);
+ try {
+ v = v2;
+ assert(false);
+ } catch (...) {
+ assert(v.valueless_by_exception());
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+void test_move_noexcept() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_nothrow_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(std::is_nothrow_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnlyNT>;
+ static_assert(!std::is_nothrow_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, ThrowsMove>;
+ static_assert(!std::is_nothrow_move_constructible<V>::value, "");
+ }
+}
+
+void test_move_ctor_sfinae() {
+ {
+ using V = std::variant<int, long>;
+ static_assert(std::is_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnly>;
+ static_assert(std::is_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, MoveOnlyNT>;
+ static_assert(std::is_move_constructible<V>::value, "");
+ }
+ {
+ using V = std::variant<int, NoCopy>;
+ static_assert(!std::is_move_constructible<V>::value, "");
+ }
+}
+
+void test_move_ctor_basic() {
+ {
+ std::variant<int> v(std::in_place_index<0>, 42);
+ std::variant<int> v2 = std::move(v);
+ assert(v2.index() == 0);
+ assert(std::get<0>(v2) == 42);
+ }
+ {
+ std::variant<int, long> v(std::in_place_index<1>, 42);
+ std::variant<int, long> v2 = std::move(v);
+ assert(v2.index() == 1);
+ assert(std::get<1>(v2) == 42);
+ }
+ {
+ std::variant<MoveOnly> v(std::in_place_index<0>, 42);
+ assert(v.index() == 0);
+ std::variant<MoveOnly> v2(std::move(v));
+ assert(v2.index() == 0);
+ assert(std::get<0>(v2).value == 42);
+ }
+ {
+ std::variant<int, MoveOnly> v(std::in_place_index<1>, 42);
+ assert(v.index() == 1);
+ std::variant<int, MoveOnly> v2(std::move(v));
+ assert(v2.index() == 1);
+ assert(std::get<1>(v2).value == 42);
+ }
+ {
+ std::variant<MoveOnlyNT> v(std::in_place_index<0>, 42);
+ assert(v.index() == 0);
+ std::variant<MoveOnlyNT> v2(std::move(v));
+ assert(v2.index() == 0);
+ assert(std::get<0>(v).value == -1);
+ assert(std::get<0>(v2).value == 42);
+ }
+ {
+ std::variant<int, MoveOnlyNT> v(std::in_place_index<1>, 42);
+ assert(v.index() == 1);
+ std::variant<int, MoveOnlyNT> v2(std::move(v));
+ assert(v2.index() == 1);
+ assert(std::get<1>(v).value == -1);
+ assert(std::get<1>(v2).value == 42);
+ }
+}
+
+void test_move_ctor_valueless_by_exception() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<int, MakeEmptyT>;
+ V v1;
+ makeEmpty(v1);
+ V v(std::move(v1));
+ assert(v.valueless_by_exception());
+#endif
+}
+
+template <size_t Idx>
+constexpr bool test_constexpr_ctor_extension_imp(
+ std::variant<long, void*, const int> const& v)
+{
+ auto copy = v;
+ auto v2 = std::move(copy);
+ return v2.index() == v.index() &&
+ v2.index() == Idx &&
+ std::get<Idx>(v2) == std::get<Idx>(v);
+}
+
+void test_constexpr_move_ctor_extension() {
+#ifdef _LIBCPP_VERSION
+ using V = std::variant<long, void*, const int>;
+ static_assert(std::is_trivially_copyable<V>::value, "");
+ static_assert(std::is_trivially_move_constructible<V>::value, "");
+ static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
+ static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
+ static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
+#endif
+}
+
+int main() {
+ test_move_ctor_basic();
+ test_move_ctor_valueless_by_exception();
+ test_move_noexcept();
+ test_move_ctor_sfinae();
+ test_constexpr_move_ctor_extension();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.dtor/dtor.pass.cpp b/test/std/utilities/variant/variant.variant/variant.dtor/dtor.pass.cpp
new file mode 100644
index 000000000000..7299394ee7bb
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.dtor/dtor.pass.cpp
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// ~variant();
+
+#include <cassert>
+#include <type_traits>
+#include <variant>
+
+#include "test_macros.h"
+
+struct NonTDtor {
+ static int count;
+ NonTDtor() = default;
+ ~NonTDtor() { ++count; }
+};
+int NonTDtor::count = 0;
+static_assert(!std::is_trivially_destructible<NonTDtor>::value, "");
+
+struct NonTDtor1 {
+ static int count;
+ NonTDtor1() = default;
+ ~NonTDtor1() { ++count; }
+};
+int NonTDtor1::count = 0;
+static_assert(!std::is_trivially_destructible<NonTDtor1>::value, "");
+
+struct TDtor {
+ TDtor(const TDtor &) {} // non-trivial copy
+ ~TDtor() = default;
+};
+static_assert(!std::is_trivially_copy_constructible<TDtor>::value, "");
+static_assert(std::is_trivially_destructible<TDtor>::value, "");
+
+int main() {
+ {
+ using V = std::variant<int, long, TDtor>;
+ static_assert(std::is_trivially_destructible<V>::value, "");
+ }
+ {
+ using V = std::variant<NonTDtor, int, NonTDtor1>;
+ static_assert(!std::is_trivially_destructible<V>::value, "");
+ {
+ V v(std::in_place_index<0>);
+ assert(NonTDtor::count == 0);
+ assert(NonTDtor1::count == 0);
+ }
+ assert(NonTDtor::count == 1);
+ assert(NonTDtor1::count == 0);
+ NonTDtor::count = 0;
+ { V v(std::in_place_index<1>); }
+ assert(NonTDtor::count == 0);
+ assert(NonTDtor1::count == 0);
+ {
+ V v(std::in_place_index<2>);
+ assert(NonTDtor::count == 0);
+ assert(NonTDtor1::count == 0);
+ }
+ assert(NonTDtor::count == 0);
+ assert(NonTDtor1::count == 1);
+ }
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
new file mode 100644
index 000000000000..8f694cfd5eda
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <size_t I, class ...Args> void emplace(Args&&... args);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+template <class Var, size_t I, class... Args>
+constexpr auto test_emplace_exists_imp(int) -> decltype(
+ std::declval<Var>().template emplace<I>(std::declval<Args>()...), true) {
+ return true;
+}
+
+template <class, size_t, class...>
+constexpr auto test_emplace_exists_imp(long) -> bool {
+ return false;
+}
+
+template <class Var, size_t I, class... Args> constexpr bool emplace_exists() {
+ return test_emplace_exists_imp<Var, I, Args...>(0);
+}
+
+void test_emplace_sfinae() {
+ {
+ using V = std::variant<int, void *, const void *, TestTypes::NoCtors>;
+ static_assert(emplace_exists<V, 0>(), "");
+ static_assert(emplace_exists<V, 0, int>(), "");
+ static_assert(!emplace_exists<V, 0, decltype(nullptr)>(),
+ "cannot construct");
+ static_assert(emplace_exists<V, 1, decltype(nullptr)>(), "");
+ static_assert(emplace_exists<V, 1, int *>(), "");
+ static_assert(!emplace_exists<V, 1, const int *>(), "");
+ static_assert(!emplace_exists<V, 1, int>(), "cannot construct");
+ static_assert(emplace_exists<V, 2, const int *>(), "");
+ static_assert(emplace_exists<V, 2, int *>(), "");
+ static_assert(!emplace_exists<V, 3>(), "cannot construct");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, int &, const int &, int &&, TestTypes::NoCtors>;
+ static_assert(emplace_exists<V, 0>(), "");
+ static_assert(emplace_exists<V, 0, int>(), "");
+ static_assert(emplace_exists<V, 0, long long>(), "");
+ static_assert(!emplace_exists<V, 0, int, int>(), "too many args");
+ static_assert(emplace_exists<V, 1, int &>(), "");
+ static_assert(!emplace_exists<V, 1>(), "cannot default construct ref");
+ static_assert(!emplace_exists<V, 1, const int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, 1, int &&>(), "cannot bind ref");
+ static_assert(emplace_exists<V, 2, int &>(), "");
+ static_assert(emplace_exists<V, 2, const int &>(), "");
+ static_assert(emplace_exists<V, 2, int &&>(), "");
+ static_assert(!emplace_exists<V, 2, void *>(),
+ "not constructible from void*");
+ static_assert(emplace_exists<V, 3, int>(), "");
+ static_assert(!emplace_exists<V, 3, int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, 3, const int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, 3, const int &&>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, 4>(), "no ctors");
+ }
+#endif
+}
+
+void test_basic() {
+ {
+ using V = std::variant<int>;
+ V v(42);
+ v.emplace<0>();
+ assert(std::get<0>(v) == 0);
+ v.emplace<0>(42);
+ assert(std::get<0>(v) == 42);
+ }
+ {
+ using V =
+ std::variant<int, long, const void *, TestTypes::NoCtors, std::string>;
+ const int x = 100;
+ V v(std::in_place_index<0>, -1);
+ // default emplace a value
+ v.emplace<1>();
+ assert(std::get<1>(v) == 0);
+ v.emplace<2>(&x);
+ assert(std::get<2>(v) == &x);
+ // emplace with multiple args
+ v.emplace<4>(3, 'a');
+ assert(std::get<4>(v) == "aaa");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, long, const int &, int &&, TestTypes::NoCtors,
+ std::string>;
+ const int x = 100;
+ int y = 42;
+ int z = 43;
+ V v(std::in_place_index<0>, -1);
+ // default emplace a value
+ v.emplace<1>();
+ assert(std::get<1>(v) == 0);
+ // emplace a reference
+ v.emplace<2>(x);
+ assert(&std::get<2>(v) == &x);
+ // emplace an rvalue reference
+ v.emplace<3>(std::move(y));
+ assert(&std::get<3>(v) == &y);
+ // re-emplace a new reference over the active member
+ v.emplace<3>(std::move(z));
+ assert(&std::get<3>(v) == &z);
+ // emplace with multiple args
+ v.emplace<5>(3, 'a');
+ assert(std::get<5>(v) == "aaa");
+ }
+#endif
+}
+
+int main() {
+ test_basic();
+ test_emplace_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp
new file mode 100644
index 000000000000..f466b160cb4f
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <size_t I, class U, class ...Args>
+// void emplace(initializer_list<U> il,Args&&... args);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+struct InitList {
+ std::size_t size;
+ constexpr InitList(std::initializer_list<int> il) : size(il.size()) {}
+};
+
+struct InitListArg {
+ std::size_t size;
+ int value;
+ constexpr InitListArg(std::initializer_list<int> il, int v)
+ : size(il.size()), value(v) {}
+};
+
+template <class Var, size_t I, class... Args>
+constexpr auto test_emplace_exists_imp(int) -> decltype(
+ std::declval<Var>().template emplace<I>(std::declval<Args>()...), true) {
+ return true;
+}
+
+template <class, size_t, class...>
+constexpr auto test_emplace_exists_imp(long) -> bool {
+ return false;
+}
+
+template <class Var, size_t I, class... Args> constexpr bool emplace_exists() {
+ return test_emplace_exists_imp<Var, I, Args...>(0);
+}
+
+void test_emplace_sfinae() {
+ using V =
+ std::variant<int, TestTypes::NoCtors, InitList, InitListArg, long, long>;
+ using IL = std::initializer_list<int>;
+ static_assert(!emplace_exists<V, 1, IL>(), "no such constructor");
+ static_assert(emplace_exists<V, 2, IL>(), "");
+ static_assert(!emplace_exists<V, 2, int>(), "args don't match");
+ static_assert(!emplace_exists<V, 2, IL, int>(), "too many args");
+ static_assert(emplace_exists<V, 3, IL, int>(), "");
+ static_assert(!emplace_exists<V, 3, int>(), "args don't match");
+ static_assert(!emplace_exists<V, 3, IL>(), "too few args");
+ static_assert(!emplace_exists<V, 3, IL, int, int>(), "too many args");
+}
+
+void test_basic() {
+ using V = std::variant<int, InitList, InitListArg, TestTypes::NoCtors>;
+ V v;
+ v.emplace<1>({1, 2, 3});
+ assert(std::get<1>(v).size == 3);
+ v.emplace<2>({1, 2, 3, 4}, 42);
+ assert(std::get<2>(v).size == 4);
+ assert(std::get<2>(v).value == 42);
+ v.emplace<1>({1});
+ assert(std::get<1>(v).size == 1);
+}
+
+int main() {
+ test_basic();
+ test_emplace_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp
new file mode 100644
index 000000000000..4ca2cc4803e3
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class T, class ...Args> void emplace(Args&&... args);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+template <class Var, class T, class... Args>
+constexpr auto test_emplace_exists_imp(int) -> decltype(
+ std::declval<Var>().template emplace<T>(std::declval<Args>()...), true) {
+ return true;
+}
+
+template <class, class, class...>
+constexpr auto test_emplace_exists_imp(long) -> bool {
+ return false;
+}
+
+template <class... Args> constexpr bool emplace_exists() {
+ return test_emplace_exists_imp<Args...>(0);
+}
+
+void test_emplace_sfinae() {
+ {
+ using V = std::variant<int, void *, const void *, TestTypes::NoCtors>;
+ static_assert(emplace_exists<V, int>(), "");
+ static_assert(emplace_exists<V, int, int>(), "");
+ static_assert(!emplace_exists<V, int, decltype(nullptr)>(),
+ "cannot construct");
+ static_assert(emplace_exists<V, void *, decltype(nullptr)>(), "");
+ static_assert(!emplace_exists<V, void *, int>(), "cannot construct");
+ static_assert(emplace_exists<V, void *, int *>(), "");
+ static_assert(!emplace_exists<V, void *, const int *>(), "");
+ static_assert(emplace_exists<V, const void *, const int *>(), "");
+ static_assert(emplace_exists<V, const void *, int *>(), "");
+ static_assert(!emplace_exists<V, TestTypes::NoCtors>(), "cannot construct");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ using V = std::variant<int, int &, const int &, int &&, long, long,
+ TestTypes::NoCtors>;
+ static_assert(emplace_exists<V, int>(), "");
+ static_assert(emplace_exists<V, int, int>(), "");
+ static_assert(emplace_exists<V, int, long long>(), "");
+ static_assert(!emplace_exists<V, int, int, int>(), "too many args");
+ static_assert(emplace_exists<V, int &, int &>(), "");
+ static_assert(!emplace_exists<V, int &>(), "cannot default construct ref");
+ static_assert(!emplace_exists<V, int &, const int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, int &, int &&>(), "cannot bind ref");
+ static_assert(emplace_exists<V, const int &, int &>(), "");
+ static_assert(emplace_exists<V, const int &, const int &>(), "");
+ static_assert(emplace_exists<V, const int &, int &&>(), "");
+ static_assert(!emplace_exists<V, const int &, void *>(),
+ "not constructible from void*");
+ static_assert(emplace_exists<V, int &&, int>(), "");
+ static_assert(!emplace_exists<V, int &&, int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, int &&, const int &>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, int &&, const int &&>(), "cannot bind ref");
+ static_assert(!emplace_exists<V, long, long>(), "ambiguous");
+ static_assert(!emplace_exists<V, TestTypes::NoCtors>(),
+ "cannot construct void");
+#endif
+}
+
+void test_basic() {
+ {
+ using V = std::variant<int>;
+ V v(42);
+ v.emplace<int>();
+ assert(std::get<0>(v) == 0);
+ v.emplace<int>(42);
+ assert(std::get<0>(v) == 42);
+ }
+ {
+ using V =
+ std::variant<int, long, const void *, TestTypes::NoCtors, std::string>;
+ const int x = 100;
+ V v(std::in_place_type<int>, -1);
+ // default emplace a value
+ v.emplace<long>();
+ assert(std::get<1>(v) == 0);
+ v.emplace<const void *>(&x);
+ assert(std::get<2>(v) == &x);
+ // emplace with multiple args
+ v.emplace<std::string>(3, 'a');
+ assert(std::get<4>(v) == "aaa");
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ {
+ using V = std::variant<int, long, const int &, int &&, TestTypes::NoCtors,
+ std::string>;
+ const int x = 100;
+ int y = 42;
+ int z = 43;
+ V v(std::in_place_index<0>, -1);
+ // default emplace a value
+ v.emplace<long>();
+ assert(std::get<long>(v) == 0);
+ // emplace a reference
+ v.emplace<const int &>(x);
+ assert(&std::get<const int &>(v) == &x);
+ // emplace an rvalue reference
+ v.emplace<int &&>(std::move(y));
+ assert(&std::get<int &&>(v) == &y);
+ // re-emplace a new reference over the active member
+ v.emplace<int &&>(std::move(z));
+ assert(&std::get<int &&>(v) == &z);
+ // emplace with multiple args
+ v.emplace<std::string>(3, 'a');
+ assert(std::get<std::string>(v) == "aaa");
+ }
+#endif
+}
+
+int main() {
+ test_basic();
+ test_emplace_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
new file mode 100644
index 000000000000..b2be8ac5b3fd
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// template <class T, class U, class ...Args>
+// void emplace(initializer_list<U> il,Args&&... args);
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_convertible.hpp"
+#include "test_macros.h"
+
+struct InitList {
+ std::size_t size;
+ constexpr InitList(std::initializer_list<int> il) : size(il.size()) {}
+};
+
+struct InitListArg {
+ std::size_t size;
+ int value;
+ constexpr InitListArg(std::initializer_list<int> il, int v)
+ : size(il.size()), value(v) {}
+};
+
+template <class Var, class T, class... Args>
+constexpr auto test_emplace_exists_imp(int) -> decltype(
+ std::declval<Var>().template emplace<T>(std::declval<Args>()...), true) {
+ return true;
+}
+
+template <class, class, class...>
+constexpr auto test_emplace_exists_imp(long) -> bool {
+ return false;
+}
+
+template <class... Args> constexpr bool emplace_exists() {
+ return test_emplace_exists_imp<Args...>(0);
+}
+
+void test_emplace_sfinae() {
+ using V =
+ std::variant<int, TestTypes::NoCtors, InitList, InitListArg, long, long>;
+ using IL = std::initializer_list<int>;
+ static_assert(emplace_exists<V, InitList, IL>(), "");
+ static_assert(!emplace_exists<V, InitList, int>(), "args don't match");
+ static_assert(!emplace_exists<V, InitList, IL, int>(), "too many args");
+ static_assert(emplace_exists<V, InitListArg, IL, int>(), "");
+ static_assert(!emplace_exists<V, InitListArg, int>(), "args don't match");
+ static_assert(!emplace_exists<V, InitListArg, IL>(), "too few args");
+ static_assert(!emplace_exists<V, InitListArg, IL, int, int>(),
+ "too many args");
+}
+
+void test_basic() {
+ using V = std::variant<int, InitList, InitListArg, TestTypes::NoCtors>;
+ V v;
+ v.emplace<InitList>({1, 2, 3});
+ assert(std::get<InitList>(v).size == 3);
+ v.emplace<InitListArg>({1, 2, 3, 4}, 42);
+ assert(std::get<InitListArg>(v).size == 4);
+ assert(std::get<InitListArg>(v).value == 42);
+ v.emplace<InitList>({1});
+ assert(std::get<InitList>(v).size == 1);
+}
+
+int main() {
+ test_basic();
+ test_emplace_sfinae();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp b/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
new file mode 100644
index 000000000000..4b30188ce6ff
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// Clang 3.8 doesn't allow constexpr variables of non-literal type
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// constexpr size_t index() const noexcept;
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+int main() {
+ {
+ using V = std::variant<int, ConstexprTestTypes::NoCtors>;
+ constexpr V v;
+ static_assert(v.index() == 0, "");
+ }
+ {
+ using V = std::variant<int, long>;
+ constexpr V v(std::in_place_index<1>);
+ static_assert(v.index() == 1, "");
+ }
+ {
+ using V = std::variant<int, std::string>;
+ V v("abc");
+ assert(v.index() == 1);
+ v = 42;
+ assert(v.index() == 0);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v;
+ assert(v.index() == 0);
+ makeEmpty(v);
+ assert(v.index() == std::variant_npos);
+ }
+#endif
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp b/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
new file mode 100644
index 000000000000..8546beb1319c
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
@@ -0,0 +1,51 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// Clang 3.8 doesn't allow constexpr variables of non-literal type
+// XFAIL: clang-3.8, apple-clang-7, apple-clang-8
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// constexpr bool valueless_by_exception() const noexcept;
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "archetypes.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+int main() {
+ {
+ using V = std::variant<int, ConstexprTestTypes::NoCtors>;
+ constexpr V v;
+ static_assert(!v.valueless_by_exception(), "");
+ }
+ {
+ using V = std::variant<int, long, std::string>;
+ const V v("abc");
+ assert(!v.valueless_by_exception());
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v;
+ assert(!v.valueless_by_exception());
+ makeEmpty(v);
+ assert(v.valueless_by_exception());
+ }
+#endif
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp b/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
new file mode 100644
index 000000000000..416c6b4e334d
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
@@ -0,0 +1,591 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+// void swap(variant& rhs) noexcept(see below)
+
+#include <cassert>
+#include <string>
+#include <type_traits>
+#include <variant>
+
+#include "test_convertible.hpp"
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+struct NotSwappable {};
+void swap(NotSwappable &, NotSwappable &) = delete;
+
+struct NotCopyable {
+ NotCopyable() = default;
+ NotCopyable(const NotCopyable &) = delete;
+ NotCopyable &operator=(const NotCopyable &) = delete;
+};
+
+struct NotCopyableWithSwap {
+ NotCopyableWithSwap() = default;
+ NotCopyableWithSwap(const NotCopyableWithSwap &) = delete;
+ NotCopyableWithSwap &operator=(const NotCopyableWithSwap &) = delete;
+};
+void swap(NotCopyableWithSwap &, NotCopyableWithSwap) {}
+
+struct NotMoveAssignable {
+ NotMoveAssignable() = default;
+ NotMoveAssignable(NotMoveAssignable &&) = default;
+ NotMoveAssignable &operator=(NotMoveAssignable &&) = delete;
+};
+
+struct NotMoveAssignableWithSwap {
+ NotMoveAssignableWithSwap() = default;
+ NotMoveAssignableWithSwap(NotMoveAssignableWithSwap &&) = default;
+ NotMoveAssignableWithSwap &operator=(NotMoveAssignableWithSwap &&) = delete;
+};
+void swap(NotMoveAssignableWithSwap &, NotMoveAssignableWithSwap &) noexcept {}
+
+template <bool Throws> void do_throw() {}
+
+template <> void do_throw<true>() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ throw 42;
+#else
+ std::abort();
+#endif
+}
+
+template <bool NT_Copy, bool NT_Move, bool NT_CopyAssign, bool NT_MoveAssign,
+ bool NT_Swap, bool EnableSwap = true>
+struct NothrowTypeImp {
+ static int move_called;
+ static int move_assign_called;
+ static int swap_called;
+ static void reset() { move_called = move_assign_called = swap_called = 0; }
+ NothrowTypeImp() = default;
+ explicit NothrowTypeImp(int v) : value(v) {}
+ NothrowTypeImp(const NothrowTypeImp &o) noexcept(NT_Copy) : value(o.value) {
+ assert(false);
+ } // never called by test
+ NothrowTypeImp(NothrowTypeImp &&o) noexcept(NT_Move) : value(o.value) {
+ ++move_called;
+ do_throw<!NT_Move>();
+ o.value = -1;
+ }
+ NothrowTypeImp &operator=(const NothrowTypeImp &) noexcept(NT_CopyAssign) {
+ assert(false);
+ return *this;
+ } // never called by the tests
+ NothrowTypeImp &operator=(NothrowTypeImp &&o) noexcept(NT_MoveAssign) {
+ ++move_assign_called;
+ do_throw<!NT_MoveAssign>();
+ value = o.value;
+ o.value = -1;
+ return *this;
+ }
+ int value;
+};
+template <bool NT_Copy, bool NT_Move, bool NT_CopyAssign, bool NT_MoveAssign,
+ bool NT_Swap, bool EnableSwap>
+int NothrowTypeImp<NT_Copy, NT_Move, NT_CopyAssign, NT_MoveAssign, NT_Swap,
+ EnableSwap>::move_called = 0;
+template <bool NT_Copy, bool NT_Move, bool NT_CopyAssign, bool NT_MoveAssign,
+ bool NT_Swap, bool EnableSwap>
+int NothrowTypeImp<NT_Copy, NT_Move, NT_CopyAssign, NT_MoveAssign, NT_Swap,
+ EnableSwap>::move_assign_called = 0;
+template <bool NT_Copy, bool NT_Move, bool NT_CopyAssign, bool NT_MoveAssign,
+ bool NT_Swap, bool EnableSwap>
+int NothrowTypeImp<NT_Copy, NT_Move, NT_CopyAssign, NT_MoveAssign, NT_Swap,
+ EnableSwap>::swap_called = 0;
+
+template <bool NT_Copy, bool NT_Move, bool NT_CopyAssign, bool NT_MoveAssign,
+ bool NT_Swap>
+void swap(NothrowTypeImp<NT_Copy, NT_Move, NT_CopyAssign, NT_MoveAssign,
+ NT_Swap, true> &lhs,
+ NothrowTypeImp<NT_Copy, NT_Move, NT_CopyAssign, NT_MoveAssign,
+ NT_Swap, true> &rhs) noexcept(NT_Swap) {
+ lhs.swap_called++;
+ do_throw<!NT_Swap>();
+ int tmp = lhs.value;
+ lhs.value = rhs.value;
+ rhs.value = tmp;
+}
+
+// throwing copy, nothrow move ctor/assign, no swap provided
+using NothrowMoveable = NothrowTypeImp<false, true, false, true, false, false>;
+// throwing copy and move assign, nothrow move ctor, no swap provided
+using NothrowMoveCtor = NothrowTypeImp<false, true, false, false, false, false>;
+// nothrow move ctor, throwing move assignment, swap provided
+using NothrowMoveCtorWithThrowingSwap =
+ NothrowTypeImp<false, true, false, false, false, true>;
+// throwing move ctor, nothrow move assignment, no swap provided
+using ThrowingMoveCtor =
+ NothrowTypeImp<false, false, false, true, false, false>;
+// throwing special members, nothrowing swap
+using ThrowingTypeWithNothrowSwap =
+ NothrowTypeImp<false, false, false, false, true, true>;
+using NothrowTypeWithThrowingSwap =
+ NothrowTypeImp<true, true, true, true, false, true>;
+// throwing move assign with nothrow move and nothrow swap
+using ThrowingMoveAssignNothrowMoveCtorWithSwap =
+ NothrowTypeImp<false, true, false, false, true, true>;
+// throwing move assign with nothrow move but no swap.
+using ThrowingMoveAssignNothrowMoveCtor =
+ NothrowTypeImp<false, true, false, false, false, false>;
+
+struct NonThrowingNonNoexceptType {
+ static int move_called;
+ static void reset() { move_called = 0; }
+ NonThrowingNonNoexceptType() = default;
+ NonThrowingNonNoexceptType(int v) : value(v) {}
+ NonThrowingNonNoexceptType(NonThrowingNonNoexceptType &&o) noexcept(false)
+ : value(o.value) {
+ ++move_called;
+ o.value = -1;
+ }
+ NonThrowingNonNoexceptType &
+ operator=(NonThrowingNonNoexceptType &&) noexcept(false) {
+ assert(false); // never called by the tests.
+ return *this;
+ }
+ int value;
+};
+int NonThrowingNonNoexceptType::move_called = 0;
+
+struct ThrowsOnSecondMove {
+ int value;
+ int move_count;
+ ThrowsOnSecondMove(int v) : value(v), move_count(0) {}
+ ThrowsOnSecondMove(ThrowsOnSecondMove &&o) noexcept(false)
+ : value(o.value), move_count(o.move_count + 1) {
+ if (move_count == 2)
+ do_throw<true>();
+ o.value = -1;
+ }
+ ThrowsOnSecondMove &operator=(ThrowsOnSecondMove &&) {
+ assert(false); // not called by test
+ return *this;
+ }
+};
+
+void test_swap_valueless_by_exception() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using V = std::variant<int, MakeEmptyT>;
+ { // both empty
+ V v1;
+ makeEmpty(v1);
+ V v2;
+ makeEmpty(v2);
+ assert(MakeEmptyT::alive == 0);
+ { // member swap
+ v1.swap(v2);
+ assert(v1.valueless_by_exception());
+ assert(v2.valueless_by_exception());
+ assert(MakeEmptyT::alive == 0);
+ }
+ { // non-member swap
+ swap(v1, v2);
+ assert(v1.valueless_by_exception());
+ assert(v2.valueless_by_exception());
+ assert(MakeEmptyT::alive == 0);
+ }
+ }
+ { // only one empty
+ V v1(42);
+ V v2;
+ makeEmpty(v2);
+ { // member swap
+ v1.swap(v2);
+ assert(v1.valueless_by_exception());
+ assert(std::get<0>(v2) == 42);
+ // swap again
+ v2.swap(v1);
+ assert(v2.valueless_by_exception());
+ assert(std::get<0>(v1) == 42);
+ }
+ { // non-member swap
+ swap(v1, v2);
+ assert(v1.valueless_by_exception());
+ assert(std::get<0>(v2) == 42);
+ // swap again
+ swap(v1, v2);
+ assert(v2.valueless_by_exception());
+ assert(std::get<0>(v1) == 42);
+ }
+ }
+#endif
+}
+
+void test_swap_same_alternative() {
+ {
+ using T = ThrowingTypeWithNothrowSwap;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>, 100);
+ v1.swap(v2);
+ assert(T::swap_called == 1);
+ assert(std::get<0>(v1).value == 100);
+ assert(std::get<0>(v2).value == 42);
+ swap(v1, v2);
+ assert(T::swap_called == 2);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<0>(v2).value == 100);
+ }
+ {
+ using T = NothrowMoveable;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>, 100);
+ v1.swap(v2);
+ assert(T::swap_called == 0);
+ assert(T::move_called == 1);
+ assert(T::move_assign_called == 2);
+ assert(std::get<0>(v1).value == 100);
+ assert(std::get<0>(v2).value == 42);
+ T::reset();
+ swap(v1, v2);
+ assert(T::swap_called == 0);
+ assert(T::move_called == 1);
+ assert(T::move_assign_called == 2);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<0>(v2).value == 100);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using T = NothrowTypeWithThrowingSwap;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T::swap_called == 1);
+ assert(T::move_called == 0);
+ assert(T::move_assign_called == 0);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<0>(v2).value == 100);
+ }
+ {
+ using T = ThrowingMoveCtor;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T::move_called == 1); // call threw
+ assert(T::move_assign_called == 0);
+ assert(std::get<0>(v1).value ==
+ 42); // throw happened before v1 was moved from
+ assert(std::get<0>(v2).value == 100);
+ }
+ {
+ using T = ThrowingMoveAssignNothrowMoveCtor;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<0>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T::move_called == 1);
+ assert(T::move_assign_called == 1); // call threw and didn't complete
+ assert(std::get<0>(v1).value == -1); // v1 was moved from
+ assert(std::get<0>(v2).value == 100);
+ }
+#endif
+}
+
+void test_swap_different_alternatives() {
+ {
+ using T = NothrowMoveCtorWithThrowingSwap;
+ using V = std::variant<T, int>;
+ T::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ v1.swap(v2);
+ assert(T::swap_called == 0);
+ // The libc++ implementation double copies the argument, and not
+ // the variant swap is called on.
+ LIBCPP_ASSERT(T::move_called == 1);
+ assert(T::move_called <= 2);
+ assert(T::move_assign_called == 0);
+ assert(std::get<1>(v1) == 100);
+ assert(std::get<0>(v2).value == 42);
+ T::reset();
+ swap(v1, v2);
+ assert(T::swap_called == 0);
+ LIBCPP_ASSERT(T::move_called == 2);
+ assert(T::move_called <= 2);
+ assert(T::move_assign_called == 0);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<1>(v2) == 100);
+ }
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ using T1 = ThrowingTypeWithNothrowSwap;
+ using T2 = NonThrowingNonNoexceptType;
+ using V = std::variant<T1, T2>;
+ T1::reset();
+ T2::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T1::swap_called == 0);
+ assert(T1::move_called == 1); // throws
+ assert(T1::move_assign_called == 0);
+ // FIXME: libc++ shouldn't move from T2 here.
+ LIBCPP_ASSERT(T2::move_called == 1);
+ assert(T2::move_called <= 1);
+ assert(std::get<0>(v1).value == 42);
+ if (T2::move_called != 0)
+ assert(v2.valueless_by_exception());
+ else
+ assert(std::get<1>(v2).value == 100);
+ }
+ {
+ using T1 = NonThrowingNonNoexceptType;
+ using T2 = ThrowingTypeWithNothrowSwap;
+ using V = std::variant<T1, T2>;
+ T1::reset();
+ T2::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ LIBCPP_ASSERT(T1::move_called == 0);
+ assert(T1::move_called <= 1);
+ assert(T2::swap_called == 0);
+ assert(T2::move_called == 1); // throws
+ assert(T2::move_assign_called == 0);
+ if (T1::move_called != 0)
+ assert(v1.valueless_by_exception());
+ else
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<1>(v2).value == 100);
+ }
+// FIXME: The tests below are just very libc++ specific
+#ifdef _LIBCPP_VERSION
+ {
+ using T1 = ThrowsOnSecondMove;
+ using T2 = NonThrowingNonNoexceptType;
+ using V = std::variant<T1, T2>;
+ T2::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ v1.swap(v2);
+ assert(T2::move_called == 2);
+ assert(std::get<1>(v1).value == 100);
+ assert(std::get<0>(v2).value == 42);
+ assert(std::get<0>(v2).move_count == 1);
+ }
+ {
+ using T1 = NonThrowingNonNoexceptType;
+ using T2 = ThrowsOnSecondMove;
+ using V = std::variant<T1, T2>;
+ T1::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T1::move_called == 1);
+ assert(v1.valueless_by_exception());
+ assert(std::get<0>(v2).value == 42);
+ }
+#endif
+// testing libc++ extension. If either variant stores a nothrow move
+// constructible type v1.swap(v2) provides the strong exception safety
+// guarantee.
+#ifdef _LIBCPP_VERSION
+ {
+
+ using T1 = ThrowingTypeWithNothrowSwap;
+ using T2 = NothrowMoveable;
+ using V = std::variant<T1, T2>;
+ T1::reset();
+ T2::reset();
+ V v1(std::in_place_index<0>, 42);
+ V v2(std::in_place_index<1>, 100);
+ try {
+ v1.swap(v2);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T1::swap_called == 0);
+ assert(T1::move_called == 1);
+ assert(T1::move_assign_called == 0);
+ assert(T2::swap_called == 0);
+ assert(T2::move_called == 2);
+ assert(T2::move_assign_called == 0);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<1>(v2).value == 100);
+ // swap again, but call v2's swap.
+ T1::reset();
+ T2::reset();
+ try {
+ v2.swap(v1);
+ assert(false);
+ } catch (int) {
+ }
+ assert(T1::swap_called == 0);
+ assert(T1::move_called == 1);
+ assert(T1::move_assign_called == 0);
+ assert(T2::swap_called == 0);
+ assert(T2::move_called == 2);
+ assert(T2::move_assign_called == 0);
+ assert(std::get<0>(v1).value == 42);
+ assert(std::get<1>(v2).value == 100);
+ }
+#endif // _LIBCPP_VERSION
+#endif
+}
+
+template <class Var>
+constexpr auto has_swap_member_imp(int)
+ -> decltype(std::declval<Var &>().swap(std::declval<Var &>()), true) {
+ return true;
+}
+
+template <class Var> constexpr auto has_swap_member_imp(long) -> bool {
+ return false;
+}
+
+template <class Var> constexpr bool has_swap_member() {
+ return has_swap_member_imp<Var>(0);
+}
+
+void test_swap_sfinae() {
+ {
+ // This variant type does not provide either a member or non-member swap
+ // but is still swappable via the generic swap algorithm, since the
+ // variant is move constructible and move assignable.
+ using V = std::variant<int, NotSwappable>;
+ LIBCPP_STATIC_ASSERT(!has_swap_member<V>());
+ static_assert(std::is_swappable_v<V>, "");
+ }
+ {
+ using V = std::variant<int, NotCopyable>;
+ LIBCPP_STATIC_ASSERT(!has_swap_member<V>(), "");
+ static_assert(!std::is_swappable_v<V>, "");
+ }
+ {
+ using V = std::variant<int, NotCopyableWithSwap>;
+ LIBCPP_STATIC_ASSERT(!has_swap_member<V>(), "");
+ static_assert(!std::is_swappable_v<V>, "");
+ }
+ {
+ using V = std::variant<int, NotMoveAssignable>;
+ LIBCPP_STATIC_ASSERT(!has_swap_member<V>(), "");
+ static_assert(!std::is_swappable_v<V>, "");
+ }
+}
+
+void test_swap_noexcept() {
+ {
+ using V = std::variant<int, NothrowMoveable>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ using V = std::variant<int, NothrowMoveCtor>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(!std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ using V = std::variant<int, ThrowingTypeWithNothrowSwap>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(!std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ using V = std::variant<int, ThrowingMoveAssignNothrowMoveCtor>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(!std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ using V = std::variant<int, ThrowingMoveAssignNothrowMoveCtorWithSwap>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ using V = std::variant<int, NotMoveAssignableWithSwap>;
+ static_assert(std::is_swappable_v<V> && has_swap_member<V>(), "");
+ static_assert(std::is_nothrow_swappable_v<V>, "");
+ // instantiate swap
+ V v1, v2;
+ v1.swap(v2);
+ swap(v1, v2);
+ }
+ {
+ // This variant type does not provide either a member or non-member swap
+ // but is still swappable via the generic swap algorithm, since the
+ // variant is move constructible and move assignable.
+ using V = std::variant<int, NotSwappable>;
+ LIBCPP_STATIC_ASSERT(!has_swap_member<V>());
+ static_assert(std::is_swappable_v<V>, "");
+ static_assert(std::is_nothrow_swappable_v<V>, "");
+ V v1, v2;
+ swap(v1, v2);
+ }
+}
+
+#ifdef _LIBCPP_VERSION
+// This is why variant should SFINAE member swap. :-)
+template class std::variant<int, NotSwappable>;
+#endif
+
+int main() {
+ test_swap_valueless_by_exception();
+ test_swap_same_alternative();
+ test_swap_different_alternatives();
+ test_swap_sfinae();
+ test_swap_noexcept();
+}
diff --git a/test/std/utilities/variant/variant.variant/variant_array.fail.cpp b/test/std/utilities/variant/variant.variant/variant_array.fail.cpp
new file mode 100644
index 000000000000..11ee332e216e
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant_array.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+
+#include <variant>
+#include <type_traits>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include "test_convertible.hpp"
+
+int main()
+{
+ // expected-error@variant:* 3 {{static_assert failed}}
+ std::variant<int, int[]> v; // expected-note {{requested here}}
+ std::variant<int, int[42]> v2; // expected-note {{requested here}}
+ std::variant<int, int[][42]> v3; // expected-note {{requested here}}
+}
diff --git a/test/std/utilities/variant/variant.variant/variant_empty.fail.cpp b/test/std/utilities/variant/variant.variant/variant_empty.fail.cpp
new file mode 100644
index 000000000000..2d8cc0b3da0f
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant_empty.fail.cpp
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+int main()
+{
+ // expected-error@variant:* 1 {{static_assert failed}}
+ std::variant<> v; // expected-note {{requested here}}
+}
diff --git a/test/std/utilities/variant/variant.variant/variant_reference.fail.cpp b/test/std/utilities/variant/variant.variant/variant_reference.fail.cpp
new file mode 100644
index 000000000000..bda27f0e5eba
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant_reference.fail.cpp
@@ -0,0 +1,28 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+#include <variant>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+
+int main()
+{
+ // expected-error@variant:* 3 {{static_assert failed}}
+ std::variant<int, int&> v; // expected-note {{requested here}}
+ std::variant<int, const int &> v2; // expected-note {{requested here}}
+ std::variant<int, int&&> v3; // expected-note {{requested here}}
+}
diff --git a/test/std/utilities/variant/variant.variant/variant_void.fail.cpp b/test/std/utilities/variant/variant.variant/variant_void.fail.cpp
new file mode 100644
index 000000000000..3d0da5620b50
--- /dev/null
+++ b/test/std/utilities/variant/variant.variant/variant_void.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types> class variant;
+
+
+#include <variant>
+#include <type_traits>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "variant_test_helpers.hpp"
+#include "test_convertible.hpp"
+
+int main()
+{
+ // expected-error@variant:* 3 {{static_assert failed}}
+ std::variant<int, void> v; // expected-note {{requested here}}
+ std::variant<int, const void> v2; // expected-note {{requested here}}
+ std::variant<const volatile void, int> v3; // expected-note {{requested here}}
+}
diff --git a/test/std/utilities/variant/variant.visit/visit.pass.cpp b/test/std/utilities/variant/variant.visit/visit.pass.cpp
new file mode 100644
index 000000000000..46d225883ae9
--- /dev/null
+++ b/test/std/utilities/variant/variant.visit/visit.pass.cpp
@@ -0,0 +1,291 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+// template <class Visitor, class... Variants>
+// constexpr see below visit(Visitor&& vis, Variants&&... vars);
+
+#include <cassert>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+#include "test_macros.h"
+#include "type_id.h"
+#include "variant_test_helpers.hpp"
+
+enum CallType : unsigned {
+ CT_None,
+ CT_NonConst = 1,
+ CT_Const = 2,
+ CT_LValue = 4,
+ CT_RValue = 8
+};
+
+inline constexpr CallType operator|(CallType LHS, CallType RHS) {
+ return static_cast<CallType>(static_cast<unsigned>(LHS) |
+ static_cast<unsigned>(RHS));
+}
+
+struct ForwardingCallObject {
+
+ template <class... Args> bool operator()(Args &&...) & {
+ set_call<Args &&...>(CT_NonConst | CT_LValue);
+ return true;
+ }
+
+ template <class... Args> bool operator()(Args &&...) const & {
+ set_call<Args &&...>(CT_Const | CT_LValue);
+ return true;
+ }
+
+ // Don't allow the call operator to be invoked as an rvalue.
+ template <class... Args> bool operator()(Args &&...) && {
+ set_call<Args &&...>(CT_NonConst | CT_RValue);
+ return true;
+ }
+
+ template <class... Args> bool operator()(Args &&...) const && {
+ set_call<Args &&...>(CT_Const | CT_RValue);
+ return true;
+ }
+
+ template <class... Args> static void set_call(CallType type) {
+ assert(last_call_type == CT_None);
+ assert(last_call_args == nullptr);
+ last_call_type = type;
+ last_call_args = std::addressof(makeArgumentID<Args...>());
+ }
+
+ template <class... Args> static bool check_call(CallType type) {
+ bool result = last_call_type == type && last_call_args &&
+ *last_call_args == makeArgumentID<Args...>();
+ last_call_type = CT_None;
+ last_call_args = nullptr;
+ return result;
+ }
+
+ static CallType last_call_type;
+ static const TypeID *last_call_args;
+};
+
+CallType ForwardingCallObject::last_call_type = CT_None;
+const TypeID *ForwardingCallObject::last_call_args = nullptr;
+
+void test_call_operator_forwarding() {
+ using Fn = ForwardingCallObject;
+ Fn obj{};
+ const Fn &cobj = obj;
+ { // test call operator forwarding - single variant, single arg
+ using V = std::variant<int>;
+ V v(42);
+ std::visit(obj, v);
+ assert(Fn::check_call<int &>(CT_NonConst | CT_LValue));
+ std::visit(cobj, v);
+ assert(Fn::check_call<int &>(CT_Const | CT_LValue));
+ std::visit(std::move(obj), v);
+ assert(Fn::check_call<int &>(CT_NonConst | CT_RValue));
+ std::visit(std::move(cobj), v);
+ assert(Fn::check_call<int &>(CT_Const | CT_RValue));
+ }
+ { // test call operator forwarding - single variant, multi arg
+ using V = std::variant<int, long, double>;
+ V v(42l);
+ std::visit(obj, v);
+ assert(Fn::check_call<long &>(CT_NonConst | CT_LValue));
+ std::visit(cobj, v);
+ assert(Fn::check_call<long &>(CT_Const | CT_LValue));
+ std::visit(std::move(obj), v);
+ assert(Fn::check_call<long &>(CT_NonConst | CT_RValue));
+ std::visit(std::move(cobj), v);
+ assert(Fn::check_call<long &>(CT_Const | CT_RValue));
+ }
+ { // test call operator forwarding - multi variant, multi arg
+ using V = std::variant<int, long, double>;
+ using V2 = std::variant<int *, std::string>;
+ V v(42l);
+ V2 v2("hello");
+ std::visit(obj, v, v2);
+ assert((Fn::check_call<long &, std::string &>(CT_NonConst | CT_LValue)));
+ std::visit(cobj, v, v2);
+ assert((Fn::check_call<long &, std::string &>(CT_Const | CT_LValue)));
+ std::visit(std::move(obj), v, v2);
+ assert((Fn::check_call<long &, std::string &>(CT_NonConst | CT_RValue)));
+ std::visit(std::move(cobj), v, v2);
+ assert((Fn::check_call<long &, std::string &>(CT_Const | CT_RValue)));
+ }
+}
+
+void test_argument_forwarding() {
+ using Fn = ForwardingCallObject;
+ Fn obj{};
+ const auto Val = CT_LValue | CT_NonConst;
+ { // single argument - value type
+ using V = std::variant<int>;
+ V v(42);
+ const V &cv = v;
+ std::visit(obj, v);
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, cv);
+ assert(Fn::check_call<const int &>(Val));
+ std::visit(obj, std::move(v));
+ assert(Fn::check_call<int &&>(Val));
+ std::visit(obj, std::move(cv));
+ assert(Fn::check_call<const int &&>(Val));
+ }
+#if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
+ { // single argument - lvalue reference
+ using V = std::variant<int &>;
+ int x = 42;
+ V v(x);
+ const V &cv = v;
+ std::visit(obj, v);
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, cv);
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, std::move(v));
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, std::move(cv));
+ assert(Fn::check_call<int &>(Val));
+ }
+ { // single argument - rvalue reference
+ using V = std::variant<int &&>;
+ int x = 42;
+ V v(std::move(x));
+ const V &cv = v;
+ std::visit(obj, v);
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, cv);
+ assert(Fn::check_call<int &>(Val));
+ std::visit(obj, std::move(v));
+ assert(Fn::check_call<int &&>(Val));
+ std::visit(obj, std::move(cv));
+ assert(Fn::check_call<int &&>(Val));
+ }
+ { // multi argument - multi variant
+ using S = const std::string &;
+ using V = std::variant<int, S, long &&>;
+ const std::string str = "hello";
+ long l = 43;
+ V v1(42);
+ const V &cv1 = v1;
+ V v2(str);
+ const V &cv2 = v2;
+ V v3(std::move(l));
+ const V &cv3 = v3;
+ std::visit(obj, v1, v2, v3);
+ assert((Fn::check_call<int &, S, long &>(Val)));
+ std::visit(obj, cv1, cv2, std::move(v3));
+ assert((Fn::check_call<const int &, S, long &&>(Val)));
+ }
+#endif
+}
+
+struct ReturnFirst {
+ template <class... Args> constexpr int operator()(int f, Args &&...) const {
+ return f;
+ }
+};
+
+struct ReturnArity {
+ template <class... Args> constexpr int operator()(Args &&...) const {
+ return sizeof...(Args);
+ }
+};
+
+void test_constexpr() {
+ constexpr ReturnFirst obj{};
+ constexpr ReturnArity aobj{};
+ {
+ using V = std::variant<int>;
+ constexpr V v(42);
+ static_assert(std::visit(obj, v) == 42, "");
+ }
+ {
+ using V = std::variant<short, long, char>;
+ constexpr V v(42l);
+ static_assert(std::visit(obj, v) == 42, "");
+ }
+ {
+ using V1 = std::variant<int>;
+ using V2 = std::variant<int, char *, long long>;
+ using V3 = std::variant<bool, int, int>;
+ constexpr V1 v1;
+ constexpr V2 v2(nullptr);
+ constexpr V3 v3;
+ static_assert(std::visit(aobj, v1, v2, v3) == 3, "");
+ }
+ {
+ using V1 = std::variant<int>;
+ using V2 = std::variant<int, char *, long long>;
+ using V3 = std::variant<void *, int, int>;
+ constexpr V1 v1;
+ constexpr V2 v2(nullptr);
+ constexpr V3 v3;
+ static_assert(std::visit(aobj, v1, v2, v3) == 3, "");
+ }
+}
+
+void test_exceptions() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ ReturnArity obj{};
+ auto test = [&](auto &&... args) {
+ try {
+ std::visit(obj, args...);
+ } catch (const std::bad_variant_access &) {
+ return true;
+ } catch (...) {
+ }
+ return false;
+ };
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ V v;
+ makeEmpty(v);
+ assert(test(v));
+ }
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ using V2 = std::variant<long, std::string, void *>;
+ V v;
+ makeEmpty(v);
+ V2 v2("hello");
+ assert(test(v, v2));
+ }
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ using V2 = std::variant<long, std::string, void *>;
+ V v;
+ makeEmpty(v);
+ V2 v2("hello");
+ assert(test(v2, v));
+ }
+ {
+ using V = std::variant<int, MakeEmptyT>;
+ using V2 = std::variant<long, std::string, void *, MakeEmptyT>;
+ V v;
+ makeEmpty(v);
+ V2 v2;
+ makeEmpty(v2);
+ assert(test(v, v2));
+ }
+#endif
+}
+
+int main() {
+ test_call_operator_forwarding();
+ test_argument_forwarding();
+ test_constexpr();
+ test_exceptions();
+}
diff --git a/test/support/any_helpers.h b/test/support/any_helpers.h
index bb1ad175c1f2..a720ecd7c82f 100644
--- a/test/support/any_helpers.h
+++ b/test/support/any_helpers.h
@@ -9,12 +9,14 @@
#ifndef ANY_HELPERS_H
#define ANY_HELPERS_H
-#include <experimental/any>
#include <typeinfo>
#include <type_traits>
#include <cassert>
+namespace std { namespace experimental {} }
+
#include "test_macros.h"
+#include "type_id.h"
#if !defined(TEST_HAS_NO_RTTI)
#define RTTI_ASSERT(X) assert(X)
@@ -32,42 +34,64 @@ template <class _Tp>
>
{};
+template <class T>
+bool containsType(std::any const& a) {
+#if !defined(TEST_HAS_NO_RTTI)
+ return a.type() == typeid(T);
+#else
+ return a.has_value() && std::any_cast<T>(&a) != nullptr;
+#endif
+}
// Return 'true' if 'Type' will be considered a small type by 'any'
template <class Type>
bool isSmallType() {
-#if defined(_LIBCPP_VERSION)
- return std::experimental::__any_imp::_IsSmallObject<Type>::value;
-#else
return IsSmallObject<Type>::value;
-#endif
-
}
// Assert that an object is empty. If the object used to contain an object
// of type 'LastType' check that it can no longer be accessed.
template <class LastType = int>
-void assertEmpty(std::experimental::any const& a) {
- assert(a.empty());
+void assertEmpty(std::any const& a) {
+ using namespace std;
+ assert(!a.has_value());
RTTI_ASSERT(a.type() == typeid(void));
- assert(std::experimental::any_cast<LastType const>(&a) == nullptr);
+ assert(any_cast<LastType const>(&a) == nullptr);
}
+template <class Type>
+constexpr auto has_value_member(int) -> decltype(std::declval<Type&>().value, true)
+{ return true; }
+template <class> constexpr bool has_value_member(long) { return false; }
+
+
// Assert that an 'any' object stores the specified 'Type' and 'value'.
template <class Type>
-void assertContains(std::experimental::any const& a, int value = 1) {
- assert(!a.empty());
- RTTI_ASSERT(a.type() == typeid(Type));
- assert(std::experimental::any_cast<Type const &>(a).value == value);
+std::enable_if_t<has_value_member<Type>(0)>
+assertContains(std::any const& a, int value) {
+ assert(a.has_value());
+ assert(containsType<Type>(a));
+ assert(std::any_cast<Type const &>(a).value == value);
+}
+
+template <class Type, class Value>
+std::enable_if_t<!has_value_member<Type>(0)>
+assertContains(std::any const& a, Value value) {
+ assert(a.has_value());
+ assert(containsType<Type>(a));
+ assert(std::any_cast<Type const &>(a) == value);
}
+
// Modify the value of a "test type" stored within an any to the specified
// 'value'.
template <class Type>
-void modifyValue(std::experimental::any& a, int value) {
- assert(!a.empty());
- RTTI_ASSERT(a.type() == typeid(Type));
- std::experimental::any_cast<Type&>(a).value = value;
+void modifyValue(std::any& a, int value) {
+ using namespace std;
+ using namespace std::experimental;
+ assert(a.has_value());
+ assert(containsType<Type>(a));
+ any_cast<Type&>(a).value = value;
}
// A test type that will trigger the small object optimization within 'any'.
@@ -89,25 +113,31 @@ struct small_type
int value;
- explicit small_type(int val) : value(val) {
+ explicit small_type(int val = 0) : value(val) {
+ ++count;
+ }
+ explicit small_type(int, int val, int) : value(val) {
+ ++count;
+ }
+ small_type(std::initializer_list<int> il) : value(*il.begin()) {
++count;
}
- small_type(small_type const & other) throw() {
+ small_type(small_type const & other) noexcept {
value = other.value;
++count;
++copied;
++const_copied;
}
- small_type(small_type& other) throw() {
+ small_type(small_type& other) noexcept {
value = other.value;
++count;
++copied;
++non_const_copied;
}
- small_type(small_type && other) throw() {
+ small_type(small_type && other) noexcept {
value = other.value;
other.value = 0;
++count;
@@ -163,11 +193,17 @@ struct large_type
int value;
- large_type(int val) : value(val) {
+ large_type(int val = 0) : value(val) {
++count;
data[0] = 0;
}
-
+ large_type(int, int val, int) : value(val) {
+ ++count;
+ data[0] = 0;
+ }
+ large_type(std::initializer_list<int> il) : value(*il.begin()) {
+ ++count;
+ }
large_type(large_type const & other) {
value = other.value;
++count;
@@ -236,19 +272,24 @@ void throwMyAnyExpression() {
struct small_throws_on_copy
{
static int count;
+ static int copied;
+ static int moved;
+ static void reset() { count = copied = moved = 0; }
int value;
explicit small_throws_on_copy(int val = 0) : value(val) {
++count;
}
-
+ explicit small_throws_on_copy(int, int val, int) : value(val) {
+ ++count;
+ }
small_throws_on_copy(small_throws_on_copy const &) {
throwMyAnyExpression();
}
small_throws_on_copy(small_throws_on_copy && other) throw() {
value = other.value;
- ++count;
+ ++count; ++moved;
}
~small_throws_on_copy() {
@@ -260,26 +301,35 @@ private:
};
int small_throws_on_copy::count = 0;
+int small_throws_on_copy::copied = 0;
+int small_throws_on_copy::moved = 0;
+
// A test type that will NOT trigger the small object optimization within 'any'.
// this type throws if it is copied.
struct large_throws_on_copy
{
static int count;
+ static int copied;
+ static int moved;
+ static void reset() { count = copied = moved = 0; }
int value = 0;
explicit large_throws_on_copy(int val = 0) : value(val) {
data[0] = 0;
++count;
}
-
+ explicit large_throws_on_copy(int, int val, int) : value(val) {
+ data[0] = 0;
+ ++count;
+ }
large_throws_on_copy(large_throws_on_copy const &) {
throwMyAnyExpression();
}
large_throws_on_copy(large_throws_on_copy && other) throw() {
value = other.value;
- ++count;
+ ++count; ++moved;
}
~large_throws_on_copy() {
@@ -293,19 +343,24 @@ private:
};
int large_throws_on_copy::count = 0;
+int large_throws_on_copy::copied = 0;
+int large_throws_on_copy::moved = 0;
// A test type that throws when it is moved. This object will NOT trigger
// the small object optimization in 'any'.
struct throws_on_move
{
static int count;
+ static int copied;
+ static int moved;
+ static void reset() { count = copied = moved = 0; }
int value;
explicit throws_on_move(int val = 0) : value(val) { ++count; }
-
+ explicit throws_on_move(int, int val, int) : value(val) { ++count; }
throws_on_move(throws_on_move const & other) {
value = other.value;
- ++count;
+ ++count; ++copied;
}
throws_on_move(throws_on_move &&) {
@@ -321,6 +376,56 @@ private:
};
int throws_on_move::count = 0;
+int throws_on_move::copied = 0;
+int throws_on_move::moved = 0;
+
+struct small_tracked_t {
+ small_tracked_t()
+ : arg_types(&makeArgumentID<>()) {}
+ small_tracked_t(small_tracked_t const&) noexcept
+ : arg_types(&makeArgumentID<small_tracked_t const&>()) {}
+ small_tracked_t(small_tracked_t &&) noexcept
+ : arg_types(&makeArgumentID<small_tracked_t &&>()) {}
+ template <class ...Args>
+ explicit small_tracked_t(Args&&...)
+ : arg_types(&makeArgumentID<Args...>()) {}
+ template <class ...Args>
+ explicit small_tracked_t(std::initializer_list<int>, Args&&...)
+ : arg_types(&makeArgumentID<std::initializer_list<int>, Args...>()) {}
+
+ TypeID const* arg_types;
+};
+static_assert(IsSmallObject<small_tracked_t>::value, "must be small");
+
+struct large_tracked_t {
+ large_tracked_t()
+ : arg_types(&makeArgumentID<>()) { dummy[0] = 42; }
+ large_tracked_t(large_tracked_t const&) noexcept
+ : arg_types(&makeArgumentID<large_tracked_t const&>()) {}
+ large_tracked_t(large_tracked_t &&) noexcept
+ : arg_types(&makeArgumentID<large_tracked_t &&>()) {}
+ template <class ...Args>
+ explicit large_tracked_t(Args&&...)
+ : arg_types(&makeArgumentID<Args...>()) {}
+ template <class ...Args>
+ explicit large_tracked_t(std::initializer_list<int>, Args&&...)
+ : arg_types(&makeArgumentID<std::initializer_list<int>, Args...>()) {}
+
+ TypeID const* arg_types;
+ int dummy[10];
+};
+
+static_assert(!IsSmallObject<large_tracked_t>::value, "must be small");
+
+
+template <class Type, class ...Args>
+void assertArgsMatch(std::any const& a) {
+ using namespace std;
+ using namespace std::experimental;
+ assert(a.has_value());
+ assert(containsType<Type>(a));
+ assert(any_cast<Type const &>(a).arg_types == &makeArgumentID<Args...>());
+};
#endif
diff --git a/test/support/archetypes.hpp b/test/support/archetypes.hpp
new file mode 100644
index 000000000000..f442b592a26f
--- /dev/null
+++ b/test/support/archetypes.hpp
@@ -0,0 +1,379 @@
+#ifndef TEST_SUPPORT_ARCHETYPES_HPP
+#define TEST_SUPPORT_ARCHETYPES_HPP
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+
+namespace ArchetypeBases {
+
+template <bool, class T>
+struct DepType : T {};
+
+struct NullBase {
+protected:
+ NullBase() = default;
+ NullBase(NullBase const&) = default;
+ NullBase& operator=(NullBase const&) = default;
+ NullBase(NullBase &&) = default;
+ NullBase& operator=(NullBase &&) = default;
+};
+
+template <class Derived, bool Explicit = false>
+struct TestBase {
+ static int alive;
+ static int constructed;
+ static int value_constructed;
+ static int default_constructed;
+ static int copy_constructed;
+ static int move_constructed;
+ static int assigned;
+ static int value_assigned;
+ static int copy_assigned;
+ static int move_assigned;
+ static int destroyed;
+
+ static void reset() {
+ assert(alive == 0);
+ alive = 0;
+ reset_constructors();
+ }
+
+ static void reset_constructors() {
+ constructed = value_constructed = default_constructed =
+ copy_constructed = move_constructed = 0;
+ assigned = value_assigned = copy_assigned = move_assigned = destroyed = 0;
+ }
+
+ TestBase() noexcept : value(0) {
+ ++alive; ++constructed; ++default_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit TestBase(int x) noexcept : value(x) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ TestBase(int x) noexcept : value(x) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit TestBase(int, int y) noexcept : value(y) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ TestBase(int, int y) noexcept : value(y) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit TestBase(std::initializer_list<int>& il, int = 0) noexcept
+ : value(static_cast<int>(il.size())) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ explicit TestBase(std::initializer_list<int>& il, int = 0) noexcept : value(static_cast<int>(il.size())) {
+ ++alive; ++constructed; ++value_constructed;
+ }
+ TestBase& operator=(int xvalue) noexcept {
+ value = xvalue;
+ ++assigned; ++value_assigned;
+ return *this;
+ }
+protected:
+ ~TestBase() {
+ assert(value != -999); assert(alive > 0);
+ --alive; ++destroyed; value = -999;
+ }
+ explicit TestBase(TestBase const& o) noexcept : value(o.value) {
+ assert(o.value != -1); assert(o.value != -999);
+ ++alive; ++constructed; ++copy_constructed;
+ }
+ explicit TestBase(TestBase && o) noexcept : value(o.value) {
+ assert(o.value != -1); assert(o.value != -999);
+ ++alive; ++constructed; ++move_constructed;
+ o.value = -1;
+ }
+ TestBase& operator=(TestBase const& o) noexcept {
+ assert(o.value != -1); assert(o.value != -999);
+ ++assigned; ++copy_assigned;
+ value = o.value;
+ return *this;
+ }
+ TestBase& operator=(TestBase&& o) noexcept {
+ assert(o.value != -1); assert(o.value != -999);
+ ++assigned; ++move_assigned;
+ value = o.value;
+ o.value = -1;
+ return *this;
+ }
+public:
+ int value;
+};
+
+template <class D, bool E> int TestBase<D, E>::alive = 0;
+template <class D, bool E> int TestBase<D, E>::constructed = 0;
+template <class D, bool E> int TestBase<D, E>::value_constructed = 0;
+template <class D, bool E> int TestBase<D, E>::default_constructed = 0;
+template <class D, bool E> int TestBase<D, E>::copy_constructed = 0;
+template <class D, bool E> int TestBase<D, E>::move_constructed = 0;
+template <class D, bool E> int TestBase<D, E>::assigned = 0;
+template <class D, bool E> int TestBase<D, E>::value_assigned = 0;
+template <class D, bool E> int TestBase<D, E>::copy_assigned = 0;
+template <class D, bool E> int TestBase<D, E>::move_assigned = 0;
+template <class D, bool E> int TestBase<D, E>::destroyed = 0;
+
+template <bool Explicit = false>
+struct ValueBase {
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr ValueBase(int x) : value(x) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr ValueBase(int x) : value(x) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr ValueBase(int, int y) : value(y) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr ValueBase(int, int y) : value(y) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr ValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
+ TEST_CONSTEXPR_CXX14 ValueBase& operator=(int xvalue) noexcept {
+ value = xvalue;
+ return *this;
+ }
+ //~ValueBase() { assert(value != -999); value = -999; }
+ int value;
+protected:
+ constexpr static int check_value(int const& val) {
+#if TEST_STD_VER < 14
+ return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
+#else
+ assert(val != -1); assert(val != 999);
+ return val;
+#endif
+ }
+ constexpr static int check_value(int& val, int val_cp = 0) {
+#if TEST_STD_VER < 14
+ return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? (TEST_THROW(42), 0) : val_cp);
+#else
+ assert(val != -1); assert(val != 999);
+ val_cp = val;
+ val = -1;
+ return val_cp;
+#endif
+ }
+ constexpr ValueBase() noexcept : value(0) {}
+ constexpr ValueBase(ValueBase const& o) noexcept : value(check_value(o.value)) {
+ }
+ constexpr ValueBase(ValueBase && o) noexcept : value(check_value(o.value)) {
+ }
+ TEST_CONSTEXPR_CXX14 ValueBase& operator=(ValueBase const& o) noexcept {
+ assert(o.value != -1); assert(o.value != -999);
+ value = o.value;
+ return *this;
+ }
+ TEST_CONSTEXPR_CXX14 ValueBase& operator=(ValueBase&& o) noexcept {
+ assert(o.value != -1); assert(o.value != -999);
+ value = o.value;
+ o.value = -1;
+ return *this;
+ }
+};
+
+
+template <bool Explicit = false>
+struct TrivialValueBase {
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr TrivialValueBase(int x) : value(x) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr TrivialValueBase(int x) : value(x) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr TrivialValueBase(int, int y) : value(y) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr TrivialValueBase(int, int y) : value(y) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && Explicit, bool>::type = true>
+ explicit constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
+ template <bool Dummy = true, typename std::enable_if<Dummy && !Explicit, bool>::type = true>
+ constexpr TrivialValueBase(std::initializer_list<int>& il, int = 0) : value(static_cast<int>(il.size())) {}
+ int value;
+protected:
+ constexpr TrivialValueBase() noexcept : value(0) {}
+};
+
+}
+
+//============================================================================//
+// Trivial Implicit Test Types
+namespace ImplicitTypes {
+#include "archetypes.ipp"
+}
+
+//============================================================================//
+// Trivial Explicit Test Types
+namespace ExplicitTypes {
+#define DEFINE_EXPLICIT explicit
+#include "archetypes.ipp"
+}
+
+
+//============================================================================//
+//
+namespace NonConstexprTypes {
+#define DEFINE_CONSTEXPR
+#include "archetypes.ipp"
+}
+
+//============================================================================//
+// Non-literal implicit test types
+namespace NonLiteralTypes {
+#define DEFINE_ASSIGN_CONSTEXPR
+#define DEFINE_DTOR(Name) ~Name() {}
+#include "archetypes.ipp"
+}
+
+//============================================================================//
+// Non-Trivially Copyable Implicit Test Types
+namespace NonTrivialTypes {
+#define DEFINE_CTOR {}
+#define DEFINE_ASSIGN { return *this; }
+#define DEFINE_DEFAULT_CTOR = default
+#include "archetypes.ipp"
+}
+
+//============================================================================//
+// Implicit counting types
+namespace TestTypes {
+#define DEFINE_CONSTEXPR
+#define DEFINE_BASE(Name) ::ArchetypeBases::TestBase<Name>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+}
+
+//============================================================================//
+// Implicit counting types
+namespace ExplicitTestTypes {
+#define DEFINE_CONSTEXPR
+#define DEFINE_EXPLICIT explicit
+#define DEFINE_BASE(Name) ::ArchetypeBases::TestBase<Name, true>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+}
+
+//============================================================================//
+// Implicit value types
+namespace ConstexprTestTypes {
+#define DEFINE_BASE(Name) ::ArchetypeBases::ValueBase<>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+} // end namespace ValueTypes
+
+
+//============================================================================//
+//
+namespace ExplicitConstexprTestTypes {
+#define DEFINE_EXPLICIT explicit
+#define DEFINE_BASE(Name) ::ArchetypeBases::ValueBase<true>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+} // end namespace ValueTypes
+
+
+//============================================================================//
+//
+namespace TrivialTestTypes {
+#define DEFINE_BASE(Name) ::ArchetypeBases::TrivialValueBase<false>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+} // end namespace TrivialValueTypes
+
+//============================================================================//
+//
+namespace ExplicitTrivialTestTypes {
+#define DEFINE_EXPLICIT explicit
+#define DEFINE_BASE(Name) ::ArchetypeBases::TrivialValueBase<true>
+#include "archetypes.ipp"
+
+using TestType = AllCtors;
+
+// Add equality operators
+template <class Tp>
+constexpr bool operator==(Tp const& L, Tp const& R) noexcept {
+ return L.value == R.value;
+}
+
+template <class Tp>
+constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
+ return L.value != R.value;
+}
+
+} // end namespace ExplicitTrivialTestTypes
+
+#endif // TEST_STD_VER >= 11
+
+#endif // TEST_SUPPORT_ARCHETYPES_HPP
diff --git a/test/support/archetypes.ipp b/test/support/archetypes.ipp
new file mode 100644
index 000000000000..d8d1e5a9330b
--- /dev/null
+++ b/test/support/archetypes.ipp
@@ -0,0 +1,169 @@
+
+#ifndef DEFINE_BASE
+#define DEFINE_BASE(Name) ::ArchetypeBases::NullBase
+#endif
+#ifndef DEFINE_EXPLICIT
+#define DEFINE_EXPLICIT
+#endif
+#ifndef DEFINE_CONSTEXPR
+#define DEFINE_CONSTEXPR constexpr
+#endif
+#ifndef DEFINE_ASSIGN_CONSTEXPR
+#if TEST_STD_VER >= 14
+#define DEFINE_ASSIGN_CONSTEXPR DEFINE_CONSTEXPR
+#else
+#define DEFINE_ASSIGN_CONSTEXPR
+#endif
+#endif
+#ifndef DEFINE_CTOR
+#define DEFINE_CTOR = default
+#endif
+#ifndef DEFINE_DEFAULT_CTOR
+#define DEFINE_DEFAULT_CTOR DEFINE_CTOR
+#endif
+#ifndef DEFINE_ASSIGN
+#define DEFINE_ASSIGN = default
+#endif
+#ifndef DEFINE_DTOR
+#define DEFINE_DTOR(Name)
+#endif
+
+struct AllCtors : DEFINE_BASE(AllCtors) {
+ using Base = DEFINE_BASE(AllCtors);
+ using Base::Base;
+ using Base::operator=;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors const&) DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors &&) DEFINE_CTOR;
+ DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors const&) DEFINE_ASSIGN;
+ DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors &&) DEFINE_ASSIGN;
+ DEFINE_DTOR(AllCtors)
+};
+
+struct NoCtors : DEFINE_BASE(NoCtors) {
+ using Base = DEFINE_BASE(NoCtors);
+ DEFINE_EXPLICIT NoCtors() = delete;
+ DEFINE_EXPLICIT NoCtors(NoCtors const&) = delete;
+ NoCtors& operator=(NoCtors const&) = delete;
+ DEFINE_DTOR(NoCtors)
+};
+
+struct NoDefault : DEFINE_BASE(NoDefault) {
+ using Base = DEFINE_BASE(NoDefault);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NoDefault() = delete;
+ DEFINE_DTOR(NoDefault)
+};
+
+struct DefaultOnly : DEFINE_BASE(DefaultOnly) {
+ using Base = DEFINE_BASE(DefaultOnly);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR DefaultOnly() DEFINE_DEFAULT_CTOR;
+ DefaultOnly(DefaultOnly const&) = delete;
+ DefaultOnly& operator=(DefaultOnly const&) = delete;
+ DEFINE_DTOR(DefaultOnly)
+};
+
+struct Copyable : DEFINE_BASE(Copyable) {
+ using Base = DEFINE_BASE(Copyable);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable(Copyable const &) DEFINE_CTOR;
+ Copyable &operator=(Copyable const &) DEFINE_ASSIGN;
+ DEFINE_DTOR(Copyable)
+};
+
+struct CopyOnly : DEFINE_BASE(CopyOnly) {
+ using Base = DEFINE_BASE(CopyOnly);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly const &) DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly &&) = delete;
+ CopyOnly &operator=(CopyOnly const &) DEFINE_ASSIGN;
+ CopyOnly &operator=(CopyOnly &&) = delete;
+ DEFINE_DTOR(CopyOnly)
+};
+
+struct NonCopyable : DEFINE_BASE(NonCopyable) {
+ using Base = DEFINE_BASE(NonCopyable);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable(NonCopyable const &) = delete;
+ NonCopyable &operator=(NonCopyable const &) = delete;
+ DEFINE_DTOR(NonCopyable)
+};
+
+struct MoveOnly : DEFINE_BASE(MoveOnly) {
+ using Base = DEFINE_BASE(MoveOnly);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly(MoveOnly &&) DEFINE_CTOR;
+ MoveOnly &operator=(MoveOnly &&) DEFINE_ASSIGN;
+ DEFINE_DTOR(MoveOnly)
+};
+
+struct CopyAssignable : DEFINE_BASE(CopyAssignable) {
+ using Base = DEFINE_BASE(CopyAssignable);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignable() = delete;
+ CopyAssignable& operator=(CopyAssignable const&) DEFINE_ASSIGN;
+ DEFINE_DTOR(CopyAssignable)
+};
+
+struct CopyAssignOnly : DEFINE_BASE(CopyAssignOnly) {
+ using Base = DEFINE_BASE(CopyAssignOnly);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignOnly() = delete;
+ CopyAssignOnly& operator=(CopyAssignOnly const&) DEFINE_ASSIGN;
+ CopyAssignOnly& operator=(CopyAssignOnly &&) = delete;
+ DEFINE_DTOR(CopyAssignOnly)
+};
+
+struct MoveAssignOnly : DEFINE_BASE(MoveAssignOnly) {
+ using Base = DEFINE_BASE(MoveAssignOnly);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveAssignOnly() = delete;
+ MoveAssignOnly& operator=(MoveAssignOnly const&) = delete;
+ MoveAssignOnly& operator=(MoveAssignOnly &&) DEFINE_ASSIGN;
+ DEFINE_DTOR(MoveAssignOnly)
+};
+
+struct ConvertingType : DEFINE_BASE(ConvertingType) {
+ using Base = DEFINE_BASE(ConvertingType);
+ using Base::Base;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType() DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType const&) DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType &&) DEFINE_CTOR;
+ ConvertingType& operator=(ConvertingType const&) DEFINE_ASSIGN;
+ ConvertingType& operator=(ConvertingType &&) DEFINE_ASSIGN;
+ template <class ...Args>
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(Args&&...) {}
+ template <class Arg>
+ ConvertingType& operator=(Arg&&) { return *this; }
+ DEFINE_DTOR(ConvertingType)
+};
+
+template <template <class...> class List>
+using ApplyTypes = List<
+ AllCtors,
+ NoCtors,
+ NoDefault,
+ DefaultOnly,
+ Copyable,
+ CopyOnly,
+ NonCopyable,
+ MoveOnly,
+ CopyAssignable,
+ CopyAssignOnly,
+ MoveAssignOnly,
+ ConvertingType
+ >;
+
+#undef DEFINE_BASE
+#undef DEFINE_EXPLICIT
+#undef DEFINE_CONSTEXPR
+#undef DEFINE_ASSIGN_CONSTEXPR
+#undef DEFINE_CTOR
+#undef DEFINE_DEFAULT_CTOR
+#undef DEFINE_ASSIGN
+#undef DEFINE_DTOR
diff --git a/test/support/container_test_types.h b/test/support/container_test_types.h
index 0b97f2e94e75..c17ce9139484 100644
--- a/test/support/container_test_types.h
+++ b/test/support/container_test_types.h
@@ -371,7 +371,7 @@ struct CopyInsertable {
template <class ...Args>
- CopyInsertable(Args&&... args) {
+ CopyInsertable(Args&&...) {
assert(false);
}
diff --git a/test/support/controlled_allocators.hpp b/test/support/controlled_allocators.hpp
new file mode 100644
index 000000000000..280aaa564c69
--- /dev/null
+++ b/test/support/controlled_allocators.hpp
@@ -0,0 +1,502 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 SUPPORT_CONTROLLED_ALLOCATORS_HPP
+#define SUPPORT_CONTROLLED_ALLOCATORS_HPP
+
+#include <memory>
+#include <type_traits>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <cstdint>
+#include <cassert>
+#include "test_macros.h"
+#include "type_id.h"
+
+#if TEST_STD_VER < 11
+#error This header requires C++11 or greater
+#endif
+
+struct AllocController;
+ // 'AllocController' is a concrete type that instruments and controls the
+ // behavior of of test allocators.
+
+template <class T, size_t ID = 0>
+class CountingAllocator;
+ // 'CountingAllocator' is an basic implementation of the 'Allocator'
+ // requirements that use the 'AllocController' interface.
+
+template <class T>
+class MinAlignAllocator;
+ // 'MinAlignAllocator' is an instrumented test type which implements the
+ // 'Allocator' requirements. 'MinAlignAllocator' ensures that it *never*
+ // returns a pointer to over-aligned storage. For example
+ // 'MinAlignPointer<char>{}.allocate(...)' will never a 2-byte aligned
+ // pointer.
+
+template <class T>
+class NullAllocator;
+ // 'NullAllocator' is an instrumented test type which implements the
+ // 'Allocator' requirements except that 'allocator' and 'deallocate' are
+ // nops.
+
+
+#define DISALLOW_COPY(Type) \
+ Type(Type const&) = delete; \
+ Type& operator=(Type const&) = delete
+
+constexpr std::size_t MaxAlignV = alignof(std::max_align_t);
+
+struct TestException {};
+
+struct AllocController {
+ int copy_constructed = 0;
+ int move_constructed = 0;
+
+ int alive = 0;
+ int alloc_count = 0;
+ int dealloc_count = 0;
+ int is_equal_count = 0;
+
+ std::size_t alive_size;
+ std::size_t allocated_size;
+ std::size_t deallocated_size;
+
+ std::size_t last_size = 0;
+ std::size_t last_align = 0;
+ void * last_pointer = 0;
+
+ std::size_t last_alloc_size = 0;
+ std::size_t last_alloc_align = 0;
+ void * last_alloc_pointer = nullptr;
+
+ std::size_t last_dealloc_size = 0;
+ std::size_t last_dealloc_align = 0;
+ void * last_dealloc_pointer = nullptr;
+
+ bool throw_on_alloc = false;
+
+ int construct_called = 0;
+ void *last_construct_pointer = nullptr;
+ TypeID const* last_construct_alloc = nullptr;
+ TypeID const* last_construct_type = nullptr;
+ TypeID const* last_construct_args = nullptr;
+
+ int destroy_called = 0;
+ void *last_destroy_pointer = nullptr;
+ TypeID const* last_destroy_alloc = nullptr;
+ TypeID const* last_destroy_type = nullptr;
+
+ AllocController() = default;
+
+ void countAlloc(void* p, size_t s, size_t a) {
+ ++alive;
+ ++alloc_count;
+ alive_size += s;
+ allocated_size += s;
+ last_pointer = last_alloc_pointer = p;
+ last_size = last_alloc_size = s;
+ last_align = last_alloc_align = a;
+ }
+
+ void countDealloc(void* p, size_t s, size_t a) {
+ --alive;
+ ++dealloc_count;
+ alive_size -= s;
+ deallocated_size += s;
+ last_pointer = last_dealloc_pointer = p;
+ last_size = last_dealloc_size = s;
+ last_align = last_dealloc_align = a;
+ }
+
+ template <class ...Args, class Alloc, class Tp>
+ void countConstruct(Alloc const&, Tp *p) {
+ ++construct_called;
+ last_construct_pointer = p;
+ last_construct_alloc = &makeTypeID<Alloc>();
+ last_construct_type = &makeTypeID<Tp>();
+ last_construct_args = &makeArgumentID<Args...>();
+ }
+
+ template <class Alloc, class Tp>
+ void countDestroy(Alloc const&, Tp *p) {
+ ++destroy_called;
+ last_destroy_alloc = &makeTypeID<Alloc>();
+ last_destroy_type = &makeTypeID<Tp>();
+ last_destroy_pointer = p;
+ }
+
+ void reset() { std::memset(this, 0, sizeof(*this)); }
+ void resetConstructDestroy() {
+ construct_called = 0;
+ last_construct_pointer = nullptr;
+ last_construct_alloc = last_construct_args = last_construct_type = nullptr;
+ destroy_called = 0;
+ last_destroy_alloc = nullptr;
+ last_destroy_pointer = nullptr;
+ }
+public:
+ bool checkAlloc(void* p, size_t s, size_t a) const {
+ return p == last_alloc_pointer &&
+ s == last_alloc_size &&
+ a == last_alloc_align;
+ }
+
+ bool checkAlloc(void* p, size_t s) const {
+ return p == last_alloc_pointer &&
+ s == last_alloc_size;
+ }
+
+ bool checkAllocAtLeast(void* p, size_t s, size_t a) const {
+ return p == last_alloc_pointer &&
+ s <= last_alloc_size &&
+ a <= last_alloc_align;
+ }
+
+ bool checkAllocAtLeast(void* p, size_t s) const {
+ return p == last_alloc_pointer &&
+ s <= last_alloc_size;
+ }
+
+ bool checkDealloc(void* p, size_t s, size_t a) const {
+ return p == last_dealloc_pointer &&
+ s == last_dealloc_size &&
+ a == last_dealloc_align;
+ }
+
+ bool checkDealloc(void* p, size_t s) const {
+ return p == last_dealloc_pointer &&
+ s == last_dealloc_size;
+ }
+
+ bool checkDeallocMatchesAlloc() const {
+ return last_dealloc_pointer == last_alloc_pointer &&
+ last_dealloc_size == last_alloc_size &&
+ last_dealloc_align == last_alloc_align;
+ }
+
+ template <class ...Args, class Alloc, class Tp>
+ bool checkConstruct(Alloc const&, Tp *p) const {
+ auto expectAlloc = &makeTypeID<Alloc>();
+ auto expectTp = &makeTypeID<Tp>();
+ auto expectArgs = &makeArgumentID<Args...>();
+ return last_construct_pointer == p &&
+ COMPARE_TYPEID(last_construct_alloc, expectAlloc) &&
+ COMPARE_TYPEID(last_construct_type, expectTp) &&
+ COMPARE_TYPEID(last_construct_args, expectArgs);
+ }
+
+ template <class Alloc, class Tp>
+ bool checkDestroy(Alloc const&, Tp *p) const {
+ return last_destroy_pointer == p &&
+ last_destroy_alloc == &makeTypeID<Alloc>() &&
+ last_destroy_type == &makeTypeID<Tp>();
+ }
+
+ bool checkDestroyMatchesConstruct() const {
+ return last_destroy_pointer == last_construct_pointer &&
+ last_destroy_type == last_construct_type;
+ }
+
+ void countIsEqual() {
+ ++is_equal_count;
+ }
+
+ bool checkIsEqualCalledEq(int n) const {
+ return is_equal_count == n;
+ }
+private:
+ DISALLOW_COPY(AllocController);
+};
+
+template <class T, size_t ID>
+class CountingAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+
+ template <class U>
+ struct rebind { using other = CountingAllocator<U, ID>; };
+
+ CountingAllocator() = delete;
+ explicit CountingAllocator(AllocController& PP) : P(&PP) {}
+
+ CountingAllocator(CountingAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ CountingAllocator(CountingAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U, ID> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U, ID>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n)
+ {
+ void* ret = ::operator new(n*sizeof(T));
+ P->countAlloc(ret, n*sizeof(T), alignof(T));
+ return static_cast<T*>(ret);
+ }
+
+ void deallocate(T* p, std::size_t n)
+ {
+ void* vp = static_cast<void*>(p);
+ P->countDealloc(vp, n*sizeof(T), alignof(T));
+ ::operator delete(vp);
+ }
+
+ template <class U, class ...Args>
+ void construct(U *p, Args&&... args) {
+ ::new ((void*)p) U(std::forward<Args>(args)...);
+ P->countConstruct<Args&&...>(*this, p);
+ }
+
+ template <class U>
+ void destroy(U* p) {
+ p->~U();
+ P->countDestroy(*this, p);
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ template <class Tp, size_t XID> friend class CountingAllocator;
+ AllocController *P;
+};
+
+
+template <size_t ID>
+class CountingAllocator<void, ID>
+{
+public:
+ typedef void* pointer;
+ typedef const void* const_pointer;
+ typedef void value_type;
+
+ template <class U>
+ struct rebind { using other = CountingAllocator<U, ID>; };
+
+ CountingAllocator() = delete;
+ explicit CountingAllocator(AllocController& PP) : P(&PP) {}
+
+ CountingAllocator(CountingAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ CountingAllocator(CountingAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U, ID> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ CountingAllocator(CountingAllocator<U, ID>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ void construct(...) = delete;
+ void destroy(void*) = delete;
+
+ AllocController& getController() const { return *P; }
+
+private:
+ template <class Tp, size_t> friend class CountingAllocator;
+ AllocController *P;
+};
+
+template <class T, class U, size_t ID>
+inline bool operator==(CountingAllocator<T, ID> const& x,
+ CountingAllocator<U, ID> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U, size_t ID>
+inline bool operator!=(CountingAllocator<T, ID> const& x,
+ CountingAllocator<U, ID> const& y) {
+ return !(x == y);
+}
+
+template <class T>
+class MinAlignedAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+
+ MinAlignedAllocator() = delete;
+
+ explicit MinAlignedAllocator(AllocController& R) : P(&R) {}
+
+ MinAlignedAllocator(MinAlignedAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ MinAlignedAllocator(MinAlignedAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ MinAlignedAllocator(MinAlignedAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ MinAlignedAllocator(MinAlignedAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n) {
+ char* aligned_ptr = (char*)::operator new(alloc_size(n*sizeof(T)));
+ assert(is_max_aligned(aligned_ptr));
+
+ char* unaligned_ptr = aligned_ptr + alignof(T);
+ assert(is_min_aligned(unaligned_ptr));
+
+ P->countAlloc(unaligned_ptr, n * sizeof(T), alignof(T));
+
+ return ((T*)unaligned_ptr);
+ }
+
+ void deallocate(T* p, std::size_t n) {
+ assert(is_min_aligned(p));
+
+ char* aligned_ptr = ((char*)p) - alignof(T);
+ assert(is_max_aligned(aligned_ptr));
+
+ P->countDealloc(p, n*sizeof(T), alignof(T));
+
+ return ::operator delete(static_cast<void*>(aligned_ptr));
+ }
+
+ template <class U, class ...Args>
+ void construct(U *p, Args&&... args) {
+ auto *c = ::new ((void*)p) U(std::forward<Args>(args)...);
+ P->countConstruct<Args&&...>(*this, p);
+ }
+
+ template <class U>
+ void destroy(U* p) {
+ p->~U();
+ P->countDestroy(*this, p);
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ static const std::size_t BlockSize = alignof(std::max_align_t);
+
+ static std::size_t alloc_size(std::size_t s) {
+ std::size_t bytes = (s + BlockSize - 1) & ~(BlockSize - 1);
+ bytes += BlockSize;
+ assert(bytes % BlockSize == 0);
+ return bytes;
+ }
+
+ static bool is_max_aligned(void* p) {
+ return reinterpret_cast<std::uintptr_t>(p) % BlockSize == 0;
+ }
+
+ static bool is_min_aligned(void* p) {
+ if (alignof(T) == BlockSize) {
+ return is_max_aligned(p);
+ } else {
+ return reinterpret_cast<std::uintptr_t>(p) % BlockSize == alignof(T);
+ }
+ }
+
+ template <class Tp> friend class MinAlignedAllocator;
+ mutable AllocController *P;
+};
+
+
+template <class T, class U>
+inline bool operator==(MinAlignedAllocator<T> const& x,
+ MinAlignedAllocator<U> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U>
+inline bool operator!=(MinAlignedAllocator<T> const& x,
+ MinAlignedAllocator<U> const& y) {
+ return !(x == y);
+}
+
+template <class T>
+class NullAllocator
+{
+public:
+ typedef T value_type;
+ typedef T* pointer;
+ NullAllocator() = delete;
+ explicit NullAllocator(AllocController& PP) : P(&PP) {}
+
+ NullAllocator(NullAllocator const& other) : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ NullAllocator(NullAllocator&& other) : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ template <class U>
+ NullAllocator(NullAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
+ P->copy_constructed += 1;
+ }
+
+ template <class U>
+ NullAllocator(NullAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
+ P->move_constructed += 1;
+ }
+
+ T* allocate(std::size_t n)
+ {
+ P->countAlloc(nullptr, n*sizeof(T), alignof(T));
+ return nullptr;
+ }
+
+ void deallocate(T* p, std::size_t n)
+ {
+ void* vp = static_cast<void*>(p);
+ P->countDealloc(vp, n*sizeof(T), alignof(T));
+ }
+
+ AllocController& getController() const { return *P; }
+
+private:
+ template <class Tp> friend class NullAllocator;
+ AllocController *P;
+};
+
+template <class T, class U>
+inline bool operator==(NullAllocator<T> const& x,
+ NullAllocator<U> const& y) {
+ return &x.getController() == &y.getController();
+}
+
+template <class T, class U>
+inline bool operator!=(NullAllocator<T> const& x,
+ NullAllocator<U> const& y) {
+ return !(x == y);
+}
+
+
+#endif /* SUPPORT_CONTROLLED_ALLOCATORS_HPP */
diff --git a/test/support/count_new.hpp b/test/support/count_new.hpp
index 923e49513487..1b05fe35e948 100644
--- a/test/support/count_new.hpp
+++ b/test/support/count_new.hpp
@@ -59,12 +59,12 @@ public:
int outstanding_new;
int new_called;
int delete_called;
- int last_new_size;
+ std::size_t last_new_size;
int outstanding_array_new;
int new_array_called;
int delete_array_called;
- int last_new_array_size;
+ std::size_t last_new_array_size;
public:
void newCalled(std::size_t s)
@@ -174,12 +174,12 @@ public:
return disable_checking || n != delete_called;
}
- bool checkLastNewSizeEq(int n) const
+ bool checkLastNewSizeEq(std::size_t n) const
{
return disable_checking || n == last_new_size;
}
- bool checkLastNewSizeNotEq(int n) const
+ bool checkLastNewSizeNotEq(std::size_t n) const
{
return disable_checking || n != last_new_size;
}
@@ -214,12 +214,12 @@ public:
return disable_checking || n != delete_array_called;
}
- bool checkLastNewArraySizeEq(int n) const
+ bool checkLastNewArraySizeEq(std::size_t n) const
{
return disable_checking || n == last_new_array_size;
}
- bool checkLastNewArraySizeNotEq(int n) const
+ bool checkLastNewArraySizeNotEq(std::size_t n) const
{
return disable_checking || n != last_new_array_size;
}
@@ -234,7 +234,7 @@ public:
MemCounter globalMemCounter((MemCounter::MemCounterCtorArg_()));
#ifndef DISABLE_NEW_COUNT
-void* operator new(std::size_t s) throw(std::bad_alloc)
+void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
globalMemCounter.newCalled(s);
void* ret = std::malloc(s);
@@ -243,21 +243,21 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
return ret;
}
-void operator delete(void* p) throw()
+void operator delete(void* p) TEST_NOEXCEPT
{
globalMemCounter.deleteCalled(p);
std::free(p);
}
-void* operator new[](std::size_t s) throw(std::bad_alloc)
+void* operator new[](std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
{
globalMemCounter.newArrayCalled(s);
return operator new(s);
}
-void operator delete[](void* p) throw()
+void operator delete[](void* p) TEST_NOEXCEPT
{
globalMemCounter.deleteArrayCalled(p);
operator delete(p);
@@ -304,10 +304,10 @@ struct RequireAllocationGuard {
void requireExactly(std::size_t N) { m_req_alloc = N; m_exactly = true; }
~RequireAllocationGuard() {
- assert(globalMemCounter.checkOutstandingNewEq(m_outstanding_new_on_init));
+ assert(globalMemCounter.checkOutstandingNewEq(static_cast<int>(m_outstanding_new_on_init)));
std::size_t Expect = m_new_count_on_init + m_req_alloc;
- assert(globalMemCounter.checkNewCalledEq(Expect) ||
- (!m_exactly && globalMemCounter.checkNewCalledGreaterThan(Expect)));
+ assert(globalMemCounter.checkNewCalledEq(static_cast<int>(Expect)) ||
+ (!m_exactly && globalMemCounter.checkNewCalledGreaterThan(static_cast<int>(Expect))));
}
private:
diff --git a/test/support/debug_mode_helper.h b/test/support/debug_mode_helper.h
new file mode 100644
index 000000000000..0c6170589c2e
--- /dev/null
+++ b/test/support/debug_mode_helper.h
@@ -0,0 +1,382 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 TEST_SUPPORT_DEBUG_MODE_HELPER_H
+#define TEST_SUPPORT_DEBUG_MODE_HELPER_H
+
+#ifndef _LIBCPP_DEBUG
+#error _LIBCPP_DEBUG must be defined before including this header
+#endif
+#ifndef _LIBCPP_DEBUG_USE_EXCEPTIONS
+#error _LIBCPP_DEBUG_USE_EXCEPTIONS must be defined before including this header
+#endif
+
+#include <ciso646>
+#ifndef _LIBCPP_VERSION
+#error This header may only be used for libc++ tests"
+#endif
+
+#include <__debug>
+#include <utility>
+#include <cstddef>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+#include "assert_checkpoint.h"
+#include "test_allocator.h"
+
+// These test make use of 'if constexpr'.
+#if TEST_STD_VER <= 14
+#error This header may only be used in C++17 and greater
+#endif
+#ifdef TEST_HAS_NO_EXCEPTIONS
+#error These tests require exceptions
+#endif
+
+#ifndef __cpp_if_constexpr
+#error These tests require if constexpr
+#endif
+
+/// Assert that the specified expression throws a libc++ debug exception.
+#define CHECK_DEBUG_THROWS(...) assert((CheckDebugThrows( [&]() { __VA_ARGS__; } )))
+
+template <class Func>
+inline bool CheckDebugThrows(Func&& func) {
+ try {
+ func();
+ } catch (std::__libcpp_debug_exception const&) {
+ return true;
+ }
+ return false;
+}
+
+namespace IteratorDebugChecks {
+
+enum ContainerType {
+ CT_None,
+ CT_String,
+ CT_Vector,
+ CT_VectorBool,
+ CT_List,
+ CT_Deque,
+ CT_ForwardList,
+ CT_Map,
+ CT_Set,
+ CT_MultiMap,
+ CT_MultiSet,
+ CT_UnorderedMap,
+ CT_UnorderedSet,
+ CT_UnorderedMultiMap,
+ CT_UnorderedMultiSet
+};
+
+constexpr bool isSequential(ContainerType CT) {
+ return CT_Vector >= CT && CT_ForwardList <= CT;
+}
+
+constexpr bool isAssociative(ContainerType CT) {
+ return CT_Map >= CT && CT_MultiSet <= CT;
+}
+
+constexpr bool isUnordered(ContainerType CT) {
+ return CT_UnorderedMap >= CT && CT_UnorderedMultiSet <= CT;
+}
+
+constexpr bool isSet(ContainerType CT) {
+ return CT == CT_Set
+ || CT == CT_MultiSet
+ || CT == CT_UnorderedSet
+ || CT == CT_UnorderedMultiSet;
+}
+
+constexpr bool isMap(ContainerType CT) {
+ return CT == CT_Map
+ || CT == CT_MultiMap
+ || CT == CT_UnorderedMap
+ || CT == CT_UnorderedMultiMap;
+}
+
+constexpr bool isMulti(ContainerType CT) {
+ return CT == CT_MultiMap
+ || CT == CT_MultiSet
+ || CT == CT_UnorderedMultiMap
+ || CT == CT_UnorderedMultiSet;
+}
+
+template <class Container, class ValueType = typename Container::value_type>
+struct ContainerDebugHelper {
+ static_assert(std::is_constructible<ValueType, int>::value,
+ "must be constructible from int");
+
+ static ValueType makeValueType(int val = 0, int = 0) {
+ return ValueType(val);
+ }
+};
+
+template <class Container>
+struct ContainerDebugHelper<Container, char> {
+ static char makeValueType(int = 0, int = 0) {
+ return 'A';
+ }
+};
+
+template <class Container, class Key, class Value>
+struct ContainerDebugHelper<Container, std::pair<const Key, Value> > {
+ using ValueType = std::pair<const Key, Value>;
+ static_assert(std::is_constructible<Key, int>::value,
+ "must be constructible from int");
+ static_assert(std::is_constructible<Value, int>::value,
+ "must be constructible from int");
+
+ static ValueType makeValueType(int key = 0, int val = 0) {
+ return ValueType(key, val);
+ }
+};
+
+template <class Container, ContainerType CT,
+ class Helper = ContainerDebugHelper<Container> >
+struct BasicContainerChecks {
+ using value_type = typename Container::value_type;
+ using iterator = typename Container::iterator;
+ using const_iterator = typename Container::const_iterator;
+ using allocator_type = typename Container::allocator_type;
+ using traits = std::iterator_traits<iterator>;
+ using category = typename traits::iterator_category;
+
+ static_assert(std::is_same<test_allocator<value_type>, allocator_type>::value,
+ "the container must use a test allocator");
+
+ static constexpr bool IsBiDir =
+ std::is_convertible<category, std::bidirectional_iterator_tag>::value;
+
+public:
+ static void run() {
+ run_iterator_tests();
+ run_container_tests();
+ run_allocator_aware_tests();
+ }
+
+ static void run_iterator_tests() {
+ try {
+ TestNullIterators<iterator>();
+ TestNullIterators<const_iterator>();
+ if constexpr (IsBiDir) { DecrementBegin(); }
+ IncrementEnd();
+ DerefEndIterator();
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+ static void run_container_tests() {
+ try {
+ CopyInvalidatesIterators();
+ MoveInvalidatesIterators();
+ if constexpr (CT != CT_ForwardList) {
+ EraseIter();
+ EraseIterIter();
+ }
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+ static void run_allocator_aware_tests() {
+ try {
+ SwapNonEqualAllocators();
+ if constexpr (CT != CT_ForwardList) {
+ SwapInvalidatesIterators(); // FIXME: This should work
+ }
+ } catch (...) {
+ assert(false && "uncaught debug exception");
+ }
+ }
+
+ static Container makeContainer(int size, allocator_type A = allocator_type()) {
+ Container C(A);
+ if constexpr (CT == CT_ForwardList) {
+ for (int i = 0; i < size; ++i)
+ C.insert_after(C.before_begin(), Helper::makeValueType(i));
+ } else {
+ for (int i = 0; i < size; ++i)
+ C.insert(C.end(), Helper::makeValueType(i));
+ assert(C.size() == static_cast<std::size_t>(size));
+ }
+ return C;
+ }
+
+ static value_type makeValueType(int value) {
+ return Helper::makeValueType(value);
+ }
+
+private:
+ // Iterator tests
+ template <class Iter>
+ static void TestNullIterators() {
+ CHECKPOINT("testing null iterator");
+ Iter it;
+ CHECK_DEBUG_THROWS( ++it );
+ CHECK_DEBUG_THROWS( it++ );
+ CHECK_DEBUG_THROWS( *it );
+ if constexpr (CT != CT_VectorBool) {
+ CHECK_DEBUG_THROWS( it.operator->() );
+ }
+ if constexpr (IsBiDir) {
+ CHECK_DEBUG_THROWS( --it );
+ CHECK_DEBUG_THROWS( it-- );
+ }
+ }
+
+ static void DecrementBegin() {
+ CHECKPOINT("testing decrement on begin");
+ Container C = makeContainer(1);
+ iterator i = C.end();
+ const_iterator ci = C.cend();
+ --i;
+ --ci;
+ assert(i == C.begin());
+ CHECK_DEBUG_THROWS( --i );
+ CHECK_DEBUG_THROWS( i-- );
+ CHECK_DEBUG_THROWS( --ci );
+ CHECK_DEBUG_THROWS( ci-- );
+ }
+
+ static void IncrementEnd() {
+ CHECKPOINT("testing increment on end");
+ Container C = makeContainer(1);
+ iterator i = C.begin();
+ const_iterator ci = C.begin();
+ ++i;
+ ++ci;
+ assert(i == C.end());
+ CHECK_DEBUG_THROWS( ++i );
+ CHECK_DEBUG_THROWS( i++ );
+ CHECK_DEBUG_THROWS( ++ci );
+ CHECK_DEBUG_THROWS( ci++ );
+ }
+
+ static void DerefEndIterator() {
+ CHECKPOINT("testing deref end iterator");
+ Container C = makeContainer(1);
+ iterator i = C.begin();
+ const_iterator ci = C.cbegin();
+ (void)*i; (void)*ci;
+ if constexpr (CT != CT_VectorBool) {
+ i.operator->();
+ ci.operator->();
+ }
+ ++i; ++ci;
+ assert(i == C.end());
+ CHECK_DEBUG_THROWS( *i );
+ CHECK_DEBUG_THROWS( *ci );
+ if constexpr (CT != CT_VectorBool) {
+ CHECK_DEBUG_THROWS( i.operator->() );
+ CHECK_DEBUG_THROWS( ci.operator->() );
+ }
+ }
+
+ // Container tests
+ static void CopyInvalidatesIterators() {
+ CHECKPOINT("copy invalidates iterators");
+ Container C1 = makeContainer(3);
+ iterator i = C1.begin();
+ Container C2 = C1;
+ if constexpr (CT == CT_ForwardList) {
+ iterator i_next = i;
+ ++i_next;
+ (void)*i_next;
+ CHECK_DEBUG_THROWS( C2.erase_after(i) );
+ C1.erase_after(i);
+ CHECK_DEBUG_THROWS( *i_next );
+ } else {
+ CHECK_DEBUG_THROWS( C2.erase(i) );
+ (void)*i;
+ C1.erase(i);
+ CHECK_DEBUG_THROWS( *i );
+ }
+ }
+
+ static void MoveInvalidatesIterators() {
+ CHECKPOINT("copy move invalidates iterators");
+ Container C1 = makeContainer(3);
+ iterator i = C1.begin();
+ Container C2 = std::move(C1);
+ (void) *i;
+ if constexpr (CT == CT_ForwardList) {
+ CHECK_DEBUG_THROWS( C1.erase_after(i) );
+ C2.erase_after(i);
+ } else {
+ CHECK_DEBUG_THROWS( C1.erase(i) );
+ C2.erase(i);
+ CHECK_DEBUG_THROWS(*i);
+ }
+ }
+
+ static void EraseIter() {
+ CHECKPOINT("testing erase invalidation");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ CHECK_DEBUG_THROWS( C2.erase(it1) ); // wrong container
+ CHECK_DEBUG_THROWS( C2.erase(C2.end()) ); // erase with end
+ C1.erase(it1_next);
+ CHECK_DEBUG_THROWS( C1.erase(it1_next) ); // invalidated iterator
+ C1.erase(it1);
+ CHECK_DEBUG_THROWS( C1.erase(it1) ); // invalidated iterator
+ }
+
+ static void EraseIterIter() {
+ CHECKPOINT("testing erase iter iter invalidation");
+ Container C1 = makeContainer(2);
+ iterator it1 = C1.begin();
+ iterator it1_next = it1;
+ ++it1_next;
+ Container C2 = C1;
+ iterator it2 = C2.begin();
+ iterator it2_next = it2;
+ ++it2_next;
+ CHECK_DEBUG_THROWS( C2.erase(it1, it1_next) ); // begin from wrong container
+ CHECK_DEBUG_THROWS( C2.erase(it1, it2_next) ); // end from wrong container
+ CHECK_DEBUG_THROWS( C2.erase(it2, it1_next) ); // both from wrong container
+ C2.erase(it2, it2_next);
+ }
+
+ // Allocator aware tests
+ static void SwapInvalidatesIterators() {
+ CHECKPOINT("testing swap invalidates iterators");
+ Container C1 = makeContainer(3);
+ Container C2 = makeContainer(3);
+ iterator it1 = C1.begin();
+ iterator it2 = C2.begin();
+ swap(C1, C2);
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ C1.erase(it2);
+ //C2.erase(it1);
+ CHECK_DEBUG_THROWS( C1.erase(it1) );
+ }
+
+ static void SwapNonEqualAllocators() {
+ CHECKPOINT("testing swap with non-equal allocators");
+ Container C1 = makeContainer(3, allocator_type(1));
+ Container C2 = makeContainer(1, allocator_type(2));
+ Container C3 = makeContainer(2, allocator_type(2));
+ swap(C2, C3);
+ CHECK_DEBUG_THROWS( swap(C1, C2) );
+ }
+
+private:
+ BasicContainerChecks() = delete;
+};
+
+} // namespace IteratorDebugChecks
+
+#endif // TEST_SUPPORT_DEBUG_MODE_HELPER_H
diff --git a/test/support/demangle.h b/test/support/demangle.h
new file mode 100644
index 000000000000..2a9757d80454
--- /dev/null
+++ b/test/support/demangle.h
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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 SUPPORT_DEMANGLE_H
+#define SUPPORT_DEMANGLE_H
+
+#include "test_macros.h"
+#include <string>
+#include <cstdlib>
+
+#if !defined(TEST_HAS_NO_DEMANGLE)
+# if defined(__GNUC__) || defined(__clang__)
+# if __has_include("cxxabi.h")
+# include "cxxabi.h"
+# else
+# define TEST_HAS_NO_DEMANGLE
+# endif
+# else
+# define TEST_HAS_NO_DEMANGLE
+# endif
+#endif
+
+#if defined(TEST_HAS_NO_DEMANGLE)
+inline std::string demangle(const char* mangled_name) {
+ return mangled_name;
+}
+#else
+template <size_t N> struct Printer;
+inline std::string demangle(const char* mangled_name) {
+ int status = 0;
+ std::string input(mangled_name);
+ input.insert(0, "_Z");
+ char* out = __cxxabiv1::__cxa_demangle(input.c_str(), nullptr, nullptr, &status);
+ if (out != nullptr) {
+ std::string res(out);
+ std::free(out);
+ return res;
+ }
+ return mangled_name;
+}
+#endif
+
+#endif // SUPPORT_DEMANGLE_H
diff --git a/test/support/experimental_any_helpers.h b/test/support/experimental_any_helpers.h
new file mode 100644
index 000000000000..50bd6d68fba5
--- /dev/null
+++ b/test/support/experimental_any_helpers.h
@@ -0,0 +1,326 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 EXPERIMENTAL_ANY_HELPERS_H
+#define EXPERIMENTAL_ANY_HELPERS_H
+
+#include <experimental/any>
+#include <typeinfo>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if !defined(TEST_HAS_NO_RTTI)
+#define RTTI_ASSERT(X) assert(X)
+#else
+#define RTTI_ASSERT(X)
+#endif
+
+template <class _Tp>
+ struct IsSmallObject
+ : public std::integral_constant<bool
+ , sizeof(_Tp) <= (sizeof(void*)*3)
+ && std::alignment_of<void*>::value
+ % std::alignment_of<_Tp>::value == 0
+ && std::is_nothrow_move_constructible<_Tp>::value
+ >
+ {};
+
+
+// Return 'true' if 'Type' will be considered a small type by 'any'
+template <class Type>
+bool isSmallType() {
+#if defined(_LIBCPP_VERSION)
+ return std::experimental::__any_imp::_IsSmallObject<Type>::value;
+#else
+ return IsSmallObject<Type>::value;
+#endif
+
+}
+
+// Assert that an object is empty. If the object used to contain an object
+// of type 'LastType' check that it can no longer be accessed.
+template <class LastType = int>
+void assertEmpty(std::experimental::any const& a) {
+ assert(a.empty());
+ RTTI_ASSERT(a.type() == typeid(void));
+ assert(std::experimental::any_cast<LastType const>(&a) == nullptr);
+}
+
+// Assert that an 'any' object stores the specified 'Type' and 'value'.
+template <class Type>
+void assertContains(std::experimental::any const& a, int value = 1) {
+ assert(!a.empty());
+ RTTI_ASSERT(a.type() == typeid(Type));
+ assert(std::experimental::any_cast<Type const &>(a).value == value);
+}
+
+// Modify the value of a "test type" stored within an any to the specified
+// 'value'.
+template <class Type>
+void modifyValue(std::experimental::any& a, int value) {
+ assert(!a.empty());
+ RTTI_ASSERT(a.type() == typeid(Type));
+ std::experimental::any_cast<Type&>(a).value = value;
+}
+
+// A test type that will trigger the small object optimization within 'any'.
+template <int Dummy = 0>
+struct small_type
+{
+ static int count;
+ static int copied;
+ static int moved;
+ static int const_copied;
+ static int non_const_copied;
+
+ static void reset() {
+ small_type::copied = 0;
+ small_type::moved = 0;
+ small_type::const_copied = 0;
+ small_type::non_const_copied = 0;
+ }
+
+ int value;
+
+ explicit small_type(int val) : value(val) {
+ ++count;
+ }
+
+ small_type(small_type const & other) throw() {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++const_copied;
+ }
+
+ small_type(small_type& other) throw() {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++non_const_copied;
+ }
+
+ small_type(small_type && other) throw() {
+ value = other.value;
+ other.value = 0;
+ ++count;
+ ++moved;
+ }
+
+ ~small_type() {
+ value = -1;
+ --count;
+ }
+
+private:
+ small_type& operator=(small_type const&) = delete;
+ small_type& operator=(small_type&&) = delete;
+};
+
+template <int Dummy>
+int small_type<Dummy>::count = 0;
+
+template <int Dummy>
+int small_type<Dummy>::copied = 0;
+
+template <int Dummy>
+int small_type<Dummy>::moved = 0;
+
+template <int Dummy>
+int small_type<Dummy>::const_copied = 0;
+
+template <int Dummy>
+int small_type<Dummy>::non_const_copied = 0;
+
+typedef small_type<> small;
+typedef small_type<1> small1;
+typedef small_type<2> small2;
+
+
+// A test type that will NOT trigger the small object optimization in any.
+template <int Dummy = 0>
+struct large_type
+{
+ static int count;
+ static int copied;
+ static int moved;
+ static int const_copied;
+ static int non_const_copied;
+
+ static void reset() {
+ large_type::copied = 0;
+ large_type::moved = 0;
+ large_type::const_copied = 0;
+ large_type::non_const_copied = 0;
+ }
+
+ int value;
+
+ large_type(int val) : value(val) {
+ ++count;
+ data[0] = 0;
+ }
+
+ large_type(large_type const & other) {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++const_copied;
+ }
+
+ large_type(large_type & other) {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++non_const_copied;
+ }
+
+ large_type(large_type && other) {
+ value = other.value;
+ other.value = 0;
+ ++count;
+ ++moved;
+ }
+
+ ~large_type() {
+ value = 0;
+ --count;
+ }
+
+private:
+ large_type& operator=(large_type const&) = delete;
+ large_type& operator=(large_type &&) = delete;
+ int data[10];
+};
+
+template <int Dummy>
+int large_type<Dummy>::count = 0;
+
+template <int Dummy>
+int large_type<Dummy>::copied = 0;
+
+template <int Dummy>
+int large_type<Dummy>::moved = 0;
+
+template <int Dummy>
+int large_type<Dummy>::const_copied = 0;
+
+template <int Dummy>
+int large_type<Dummy>::non_const_copied = 0;
+
+typedef large_type<> large;
+typedef large_type<1> large1;
+typedef large_type<2> large2;
+
+// The exception type thrown by 'small_throws_on_copy', 'large_throws_on_copy'
+// and 'throws_on_move'.
+struct my_any_exception {};
+
+void throwMyAnyExpression() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ throw my_any_exception();
+#else
+ assert(false && "Exceptions are disabled");
+#endif
+}
+
+// A test type that will trigger the small object optimization within 'any'.
+// this type throws if it is copied.
+struct small_throws_on_copy
+{
+ static int count;
+ int value;
+
+ explicit small_throws_on_copy(int val = 0) : value(val) {
+ ++count;
+ }
+
+ small_throws_on_copy(small_throws_on_copy const &) {
+ throwMyAnyExpression();
+ }
+
+ small_throws_on_copy(small_throws_on_copy && other) throw() {
+ value = other.value;
+ ++count;
+ }
+
+ ~small_throws_on_copy() {
+ --count;
+ }
+private:
+ small_throws_on_copy& operator=(small_throws_on_copy const&) = delete;
+ small_throws_on_copy& operator=(small_throws_on_copy &&) = delete;
+};
+
+int small_throws_on_copy::count = 0;
+
+// A test type that will NOT trigger the small object optimization within 'any'.
+// this type throws if it is copied.
+struct large_throws_on_copy
+{
+ static int count;
+ int value = 0;
+
+ explicit large_throws_on_copy(int val = 0) : value(val) {
+ data[0] = 0;
+ ++count;
+ }
+
+ large_throws_on_copy(large_throws_on_copy const &) {
+ throwMyAnyExpression();
+ }
+
+ large_throws_on_copy(large_throws_on_copy && other) throw() {
+ value = other.value;
+ ++count;
+ }
+
+ ~large_throws_on_copy() {
+ --count;
+ }
+
+private:
+ large_throws_on_copy& operator=(large_throws_on_copy const&) = delete;
+ large_throws_on_copy& operator=(large_throws_on_copy &&) = delete;
+ int data[10];
+};
+
+int large_throws_on_copy::count = 0;
+
+// A test type that throws when it is moved. This object will NOT trigger
+// the small object optimization in 'any'.
+struct throws_on_move
+{
+ static int count;
+ int value;
+
+ explicit throws_on_move(int val = 0) : value(val) { ++count; }
+
+ throws_on_move(throws_on_move const & other) {
+ value = other.value;
+ ++count;
+ }
+
+ throws_on_move(throws_on_move &&) {
+ throwMyAnyExpression();
+ }
+
+ ~throws_on_move() {
+ --count;
+ }
+private:
+ throws_on_move& operator=(throws_on_move const&) = delete;
+ throws_on_move& operator=(throws_on_move &&) = delete;
+};
+
+int throws_on_move::count = 0;
+
+
+#endif
diff --git a/test/support/external_threads.cpp b/test/support/external_threads.cpp
new file mode 100644
index 000000000000..381ec651eefc
--- /dev/null
+++ b/test/support/external_threads.cpp
@@ -0,0 +1,10 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+#define _LIBCPP_BUILDING_EXTERNAL_THREADS
+#include <__threading_support>
diff --git a/test/support/filesystem_test_helper.hpp b/test/support/filesystem_test_helper.hpp
index 7150f79739b6..c2e41fca09c8 100644
--- a/test/support/filesystem_test_helper.hpp
+++ b/test/support/filesystem_test_helper.hpp
@@ -230,6 +230,7 @@ private:
// check that the fs test root in the enviroment matches what we were
// compiled with.
static bool checked = checkDynamicTestRoot();
+ ((void)checked);
std::string cmd = LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER;
cmd += " \"" + raw_cmd + "\"";
int ret = std::system(cmd.c_str());
diff --git a/test/support/is_transparent.h b/test/support/is_transparent.h
index d76b00536b52..541689314b8b 100644
--- a/test/support/is_transparent.h
+++ b/test/support/is_transparent.h
@@ -10,8 +10,10 @@
#ifndef TRANSPARENT_H
#define TRANSPARENT_H
+#include "test_macros.h"
+
// testing transparent
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
struct transparent_less
{
diff --git a/test/support/min_allocator.h b/test/support/min_allocator.h
index 8e0afab47634..d518e4a6d77c 100644
--- a/test/support/min_allocator.h
+++ b/test/support/min_allocator.h
@@ -42,6 +42,44 @@ public:
friend bool operator!=(bare_allocator x, bare_allocator y) {return !(x == y);}
};
+
+template <class T>
+class no_default_allocator
+{
+#if TEST_STD_VER >= 11
+ no_default_allocator() = delete;
+#else
+ no_default_allocator();
+#endif
+ struct construct_tag {};
+ explicit no_default_allocator(construct_tag) {}
+
+public:
+ static no_default_allocator create() {
+ construct_tag tag;
+ return no_default_allocator(tag);
+ }
+
+public:
+ typedef T value_type;
+
+ template <class U>
+ no_default_allocator(no_default_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n)
+ {
+ return static_cast<T*>(::operator new(n*sizeof(T)));
+ }
+
+ void deallocate(T* p, std::size_t)
+ {
+ return ::operator delete(static_cast<void*>(p));
+ }
+
+ friend bool operator==(no_default_allocator, no_default_allocator) {return true;}
+ friend bool operator!=(no_default_allocator x, no_default_allocator y) {return !(x == y);}
+};
+
struct malloc_allocator_base {
static size_t alloc_count;
static size_t dealloc_count;
diff --git a/test/support/nasty_containers.hpp b/test/support/nasty_containers.hpp
index b571469227d4..dcad6c259ff6 100644
--- a/test/support/nasty_containers.hpp
+++ b/test/support/nasty_containers.hpp
@@ -14,6 +14,8 @@
#include <vector>
#include <list>
+#include "test_macros.h"
+
template <class T>
class nasty_vector
{
@@ -49,27 +51,27 @@ public:
void assign(std::initializer_list<value_type> il) { v_.assign(il); }
#endif
- iterator begin() _NOEXCEPT { return v_.begin(); }
- const_iterator begin() const _NOEXCEPT { return v_.begin(); }
- iterator end() _NOEXCEPT { return v_.end(); }
- const_iterator end() const _NOEXCEPT { return v_.end(); }
-
- reverse_iterator rbegin() _NOEXCEPT { return v_.rbegin(); }
- const_reverse_iterator rbegin() const _NOEXCEPT { return v_.rbegin(); }
- reverse_iterator rend() _NOEXCEPT { return v_.rend(); }
- const_reverse_iterator rend() const _NOEXCEPT { return v_.rend(); }
-
- const_iterator cbegin() const _NOEXCEPT { return v_.cbegin(); }
- const_iterator cend() const _NOEXCEPT { return v_.cend(); }
- const_reverse_iterator crbegin() const _NOEXCEPT { return v_.crbegin(); }
- const_reverse_iterator crend() const _NOEXCEPT { return v_.crend(); }
-
- size_type size() const _NOEXCEPT { return v_.size(); }
- size_type max_size() const _NOEXCEPT { return v_.max_size(); }
- size_type capacity() const _NOEXCEPT { return v_.capacity(); }
- bool empty() const _NOEXCEPT { return v_.empty(); }
+ iterator begin() TEST_NOEXCEPT { return v_.begin(); }
+ const_iterator begin() const TEST_NOEXCEPT { return v_.begin(); }
+ iterator end() TEST_NOEXCEPT { return v_.end(); }
+ const_iterator end() const TEST_NOEXCEPT { return v_.end(); }
+
+ reverse_iterator rbegin() TEST_NOEXCEPT { return v_.rbegin(); }
+ const_reverse_iterator rbegin() const TEST_NOEXCEPT { return v_.rbegin(); }
+ reverse_iterator rend() TEST_NOEXCEPT { return v_.rend(); }
+ const_reverse_iterator rend() const TEST_NOEXCEPT { return v_.rend(); }
+
+ const_iterator cbegin() const TEST_NOEXCEPT { return v_.cbegin(); }
+ const_iterator cend() const TEST_NOEXCEPT { return v_.cend(); }
+ const_reverse_iterator crbegin() const TEST_NOEXCEPT { return v_.crbegin(); }
+ const_reverse_iterator crend() const TEST_NOEXCEPT { return v_.crend(); }
+
+ size_type size() const TEST_NOEXCEPT { return v_.size(); }
+ size_type max_size() const TEST_NOEXCEPT { return v_.max_size(); }
+ size_type capacity() const TEST_NOEXCEPT { return v_.capacity(); }
+ bool empty() const TEST_NOEXCEPT { return v_.empty(); }
void reserve(size_type n) { v_.reserve(n); };
- void shrink_to_fit() _NOEXCEPT { v_.shrink_to_fit(); }
+ void shrink_to_fit() TEST_NOEXCEPT { v_.shrink_to_fit(); }
reference operator[](size_type n) { return v_[n]; }
const_reference operator[](size_type n) const { return v_[n]; }
@@ -81,8 +83,8 @@ public:
reference back() { return v_.back(); }
const_reference back() const { return v_.back(); }
- value_type* data() _NOEXCEPT { return v_.data(); }
- const value_type* data() const _NOEXCEPT { return v_.data(); }
+ value_type* data() TEST_NOEXCEPT { return v_.data(); }
+ const value_type* data() const TEST_NOEXCEPT { return v_.data(); }
void push_back(const value_type& x) { v_.push_back(x); }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -117,12 +119,17 @@ public:
iterator erase(const_iterator pos) { return v_.erase(pos); }
iterator erase(const_iterator first, const_iterator last) { return v_.erase(first, last); }
- void clear() _NOEXCEPT { v_.clear(); }
+ void clear() TEST_NOEXCEPT { v_.clear(); }
void resize(size_type sz) { v_.resize(sz); }
void resize(size_type sz, const value_type& c) { v_.resize(sz, c); }
- void swap(nasty_vector &nv) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
+ void swap(nasty_vector &nv)
+#if TEST_STD_VER > 14
+ noexcept(std::is_nothrow_swappable<nested_container>::value)
+#elif defined(_LIBCPP_VERSION)
+ TEST_NOEXCEPT_COND(std::__is_nothrow_swappable<nested_container>::value)
+#endif
{ v_.swap(nv.v_); }
nasty_vector *operator &() { assert(false); return nullptr; } // nasty
@@ -176,29 +183,29 @@ public:
#endif
- iterator begin() _NOEXCEPT { return l_.begin(); }
- const_iterator begin() const _NOEXCEPT { return l_.begin(); }
- iterator end() _NOEXCEPT { return l_.end(); }
- const_iterator end() const _NOEXCEPT { return l_.end(); }
+ iterator begin() TEST_NOEXCEPT { return l_.begin(); }
+ const_iterator begin() const TEST_NOEXCEPT { return l_.begin(); }
+ iterator end() TEST_NOEXCEPT { return l_.end(); }
+ const_iterator end() const TEST_NOEXCEPT { return l_.end(); }
- reverse_iterator rbegin() _NOEXCEPT { return l_.rbegin(); }
- const_reverse_iterator rbegin() const _NOEXCEPT { return l_.rbegin(); }
- reverse_iterator rend() _NOEXCEPT { return l_.rend(); }
- const_reverse_iterator rend() const _NOEXCEPT { return l_.rend(); }
+ reverse_iterator rbegin() TEST_NOEXCEPT { return l_.rbegin(); }
+ const_reverse_iterator rbegin() const TEST_NOEXCEPT { return l_.rbegin(); }
+ reverse_iterator rend() TEST_NOEXCEPT { return l_.rend(); }
+ const_reverse_iterator rend() const TEST_NOEXCEPT { return l_.rend(); }
- const_iterator cbegin() const _NOEXCEPT { return l_.cbegin(); }
- const_iterator cend() const _NOEXCEPT { return l_.cend(); }
- const_reverse_iterator crbegin() const _NOEXCEPT { return l_.crbegin(); }
- const_reverse_iterator crend() const _NOEXCEPT { return l_.crend(); }
+ const_iterator cbegin() const TEST_NOEXCEPT { return l_.cbegin(); }
+ const_iterator cend() const TEST_NOEXCEPT { return l_.cend(); }
+ const_reverse_iterator crbegin() const TEST_NOEXCEPT { return l_.crbegin(); }
+ const_reverse_iterator crend() const TEST_NOEXCEPT { return l_.crend(); }
reference front() { return l_.front(); }
const_reference front() const { return l_.front(); }
reference back() { return l_.back(); }
const_reference back() const { return l_.back(); }
- size_type size() const _NOEXCEPT { return l_.size(); }
- size_type max_size() const _NOEXCEPT { return l_.max_size(); }
- bool empty() const _NOEXCEPT { return l_.empty(); }
+ size_type size() const TEST_NOEXCEPT { return l_.size(); }
+ size_type max_size() const TEST_NOEXCEPT { return l_.max_size(); }
+ bool empty() const TEST_NOEXCEPT { return l_.empty(); }
void push_front(const value_type& x) { l_.push_front(x); }
void push_back(const value_type& x) { l_.push_back(x); }
@@ -238,13 +245,18 @@ public:
iterator erase(const_iterator pos) { return l_.erase(pos); }
iterator erase(const_iterator pos, const_iterator last) { return l_.erase(pos, last); }
- void resize(size_type sz) { l_.resize(); }
- void resize(size_type sz, const value_type& c) { l_.resize(c); }
+ void resize(size_type) { l_.resize(); }
+ void resize(size_type, const value_type& c) { l_.resize(c); }
- void swap(nasty_list &nl) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
+ void swap(nasty_list &nl)
+#if TEST_STD_VER > 14
+ noexcept(std::is_nothrow_swappable<nested_container>::value)
+#elif defined(_LIBCPP_VERSION)
+ TEST_NOEXCEPT_COND(std::__is_nothrow_swappable<nested_container>::value)
+#endif
{ l_.swap(nl.l_); }
- void clear() _NOEXCEPT { l_.clear(); }
+ void clear() TEST_NOEXCEPT { l_.clear(); }
// void splice(const_iterator position, list& x);
// void splice(const_iterator position, list&& x);
@@ -284,7 +296,7 @@ bool operator==(const nasty_list<T>& x, const nasty_list<T>& y) { return x.l_ ==
class nasty_mutex
{
public:
- nasty_mutex() _NOEXCEPT {}
+ nasty_mutex() TEST_NOEXCEPT {}
~nasty_mutex() {}
nasty_mutex *operator& () { assert(false); return nullptr; }
@@ -297,8 +309,8 @@ private:
public:
void lock() {}
- bool try_lock() _NOEXCEPT { return true; }
- void unlock() _NOEXCEPT {}
+ bool try_lock() TEST_NOEXCEPT { return true; }
+ void unlock() TEST_NOEXCEPT {}
// Shared ownership
void lock_shared() {}
diff --git a/test/support/test.support/test_demangle.pass.cpp b/test/support/test.support/test_demangle.pass.cpp
new file mode 100644
index 000000000000..c924246e8c0b
--- /dev/null
+++ b/test/support/test.support/test_demangle.pass.cpp
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+#include "demangle.h"
+#include <typeinfo>
+#include <cassert>
+
+struct MyType {};
+
+template <class T, class U> struct ArgumentListID {};
+
+int main() {
+ struct {
+ const char* raw;
+ const char* expect;
+ } TestCases[] = {
+ {typeid(int).name(), "i"}, // FIXME
+ {typeid(MyType).name(), "MyType"},
+ {typeid(ArgumentListID<int, MyType>).name(), "ArgumentListID<int, MyType>"}
+ };
+ const size_t size = sizeof(TestCases) / sizeof(TestCases[0]);
+ for (size_t i=0; i < size; ++i) {
+ const char* raw = TestCases[i].raw;
+ const char* expect = TestCases[i].expect;
+#ifdef TEST_HAS_NO_DEMANGLE
+ assert(demangle(raw) == raw);
+ ((void)expect);
+#else
+ assert(demangle(raw) == expect);
+#endif
+ }
+}
diff --git a/test/support/test.support/test_macros_header_rtti.pass.cpp b/test/support/test.support/test_macros_header_rtti.pass.cpp
index d189a0efc2fc..dee1a049457e 100644
--- a/test/support/test.support/test_macros_header_rtti.pass.cpp
+++ b/test/support/test.support/test_macros_header_rtti.pass.cpp
@@ -25,4 +25,5 @@ struct B : A {};
int main() {
A* ptr = new B;
(void)dynamic_cast<B*>(ptr);
+ delete ptr;
}
diff --git a/test/support/test_allocator.h b/test/support/test_allocator.h
index 466c7fabc66d..e77796b676e7 100644
--- a/test/support/test_allocator.h
+++ b/test/support/test_allocator.h
@@ -10,15 +10,24 @@
#ifndef TEST_ALLOCATOR_H
#define TEST_ALLOCATOR_H
-#include <cstddef>
#include <type_traits>
-#include <cstdlib>
#include <new>
+#include <memory>
+#include <utility>
+#include <cstddef>
+#include <cstdlib>
#include <climits>
#include <cassert>
#include "test_macros.h"
+template <class Alloc>
+inline typename std::allocator_traits<Alloc>::size_type
+alloc_max_size(Alloc const &a) {
+ typedef std::allocator_traits<Alloc> AT;
+ return AT::max_size(a);
+}
+
class test_alloc_base
{
protected:
@@ -38,8 +47,8 @@ template <class T>
class test_allocator
: public test_alloc_base
{
- int data_;
-
+ int data_; // participates in equality
+ int id_; // unique identifier, doesn't participate in equality
template <class U> friend class test_allocator;
public:
@@ -53,20 +62,24 @@ public:
template <class U> struct rebind {typedef test_allocator<U> other;};
- test_allocator() throw() : data_(0) {++count;}
- explicit test_allocator(int i) throw() : data_(i) {++count;}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {++count;}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {++count;}
- ~test_allocator() throw() {assert(data_ >= 0); --count; data_ = -1;}
+ test_allocator() TEST_NOEXCEPT : data_(0), id_(0) {++count;}
+ explicit test_allocator(int i, int id = 0) TEST_NOEXCEPT : data_(i), id_(id)
+ {++count;}
+ test_allocator(const test_allocator& a) TEST_NOEXCEPT
+ : data_(a.data_), id_(a.id_) {++count;}
+ template <class U> test_allocator(const test_allocator<U>& a) TEST_NOEXCEPT
+ : data_(a.data_), id_(a.id_) {++count;}
+ ~test_allocator() TEST_NOEXCEPT {
+ assert(data_ >= 0); assert(id_ >= 0);
+ --count; data_ = -1; id_ = -1;
+ }
pointer address(reference x) const {return &x;}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
assert(data_ >= 0);
if (time_to_throw >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
throw std::bad_alloc();
#else
std::terminate();
@@ -78,7 +91,7 @@ public:
}
void deallocate(pointer p, size_type)
{assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
- size_type max_size() const throw()
+ size_type max_size() const TEST_NOEXCEPT
{return UINT_MAX / sizeof(T);}
#if TEST_STD_VER < 11
void construct(pointer p, const T& val)
@@ -88,14 +101,14 @@ public:
{::new(static_cast<void*>(p)) T(std::forward<U>(val));}
#endif
void destroy(pointer p)
- {
- p->~T();
- ((void)p); // Prevent MSVC's spurious unused warning
- }
+ {p->~T();}
friend bool operator==(const test_allocator& x, const test_allocator& y)
{return x.data_ == y.data_;}
friend bool operator!=(const test_allocator& x, const test_allocator& y)
{return !(x == y);}
+
+ int get_data() const { return data_; }
+ int get_id() const { return id_; }
};
template <class T>
@@ -117,20 +130,20 @@ public:
template <class U> struct rebind {typedef non_default_test_allocator<U> other;};
-// non_default_test_allocator() throw() : data_(0) {++count;}
- explicit non_default_test_allocator(int i) throw() : data_(i) {++count;}
- non_default_test_allocator(const non_default_test_allocator& a) throw()
+// non_default_test_allocator() TEST_NOEXCEPT : data_(0) {++count;}
+ explicit non_default_test_allocator(int i) TEST_NOEXCEPT : data_(i) {++count;}
+ non_default_test_allocator(const non_default_test_allocator& a) TEST_NOEXCEPT
: data_(a.data_) {++count;}
- template <class U> non_default_test_allocator(const non_default_test_allocator<U>& a) throw()
+ template <class U> non_default_test_allocator(const non_default_test_allocator<U>& a) TEST_NOEXCEPT
: data_(a.data_) {++count;}
- ~non_default_test_allocator() throw() {assert(data_ >= 0); --count; data_ = -1;}
+ ~non_default_test_allocator() TEST_NOEXCEPT {assert(data_ >= 0); --count; data_ = -1;}
pointer address(reference x) const {return &x;}
const_pointer address(const_reference x) const {return &x;}
pointer allocate(size_type n, const void* = 0)
{
assert(data_ >= 0);
if (time_to_throw >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
+#ifndef TEST_HAS_NO_EXCEPTIONS
throw std::bad_alloc();
#else
std::terminate();
@@ -142,7 +155,7 @@ public:
}
void deallocate(pointer p, size_type)
{assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
- size_type max_size() const throw()
+ size_type max_size() const TEST_NOEXCEPT
{return UINT_MAX / sizeof(T);}
#if TEST_STD_VER < 11
void construct(pointer p, const T& val)
@@ -164,6 +177,7 @@ class test_allocator<void>
: public test_alloc_base
{
int data_;
+ int id_;
template <class U> friend class test_allocator;
public:
@@ -176,13 +190,16 @@ public:
template <class U> struct rebind {typedef test_allocator<U> other;};
- test_allocator() throw() : data_(0) {}
- explicit test_allocator(int i) throw() : data_(i) {}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {}
- ~test_allocator() throw() {data_ = -1;}
+ test_allocator() TEST_NOEXCEPT : data_(0), id_(0) {}
+ explicit test_allocator(int i, int id = 0) TEST_NOEXCEPT : data_(i), id_(id) {}
+ test_allocator(const test_allocator& a) TEST_NOEXCEPT
+ : data_(a.data_), id_(a.id_) {}
+ template <class U> test_allocator(const test_allocator<U>& a) TEST_NOEXCEPT
+ : data_(a.data_), id_(a.id_) {}
+ ~test_allocator() TEST_NOEXCEPT {data_ = -1; id_ = -1; }
+
+ int get_id() const { return id_; }
+ int get_data() const { return data_; }
friend bool operator==(const test_allocator& x, const test_allocator& y)
{return x.data_ == y.data_;}
@@ -221,10 +238,10 @@ public:
typedef std::true_type propagate_on_container_move_assignment;
typedef std::true_type propagate_on_container_swap;
-#ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if TEST_STD_VER < 11
std::size_t max_size() const
{return UINT_MAX / sizeof(T);}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#endif
};
@@ -305,5 +322,79 @@ operator!=(const TaggingAllocator<T>&, const TaggingAllocator<U>&)
{ return false; }
#endif
+template <std::size_t MaxAllocs>
+struct limited_alloc_handle {
+ std::size_t outstanding_;
+ void* last_alloc_;
+
+ limited_alloc_handle() : outstanding_(0), last_alloc_(nullptr) {}
+
+ template <class T>
+ T *allocate(std::size_t N) {
+ if (N + outstanding_ > MaxAllocs)
+ TEST_THROW(std::bad_alloc());
+ last_alloc_ = ::operator new(N*sizeof(T));
+ outstanding_ += N;
+ return static_cast<T*>(last_alloc_);
+ }
+
+ void deallocate(void* ptr, std::size_t N) {
+ if (ptr == last_alloc_) {
+ last_alloc_ = nullptr;
+ assert(outstanding_ >= N);
+ outstanding_ -= N;
+ }
+ ::operator delete(ptr);
+ }
+};
+
+template <class T, std::size_t N>
+class limited_allocator
+{
+ template <class U, std::size_t UN> friend class limited_allocator;
+ typedef limited_alloc_handle<N> BuffT;
+ std::shared_ptr<BuffT> handle_;
+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 limited_allocator<U, N> other; };
+
+ limited_allocator() : handle_(new BuffT) {}
+
+ limited_allocator(limited_allocator const& other) : handle_(other.handle_) {}
+
+ template <class U>
+ explicit limited_allocator(limited_allocator<U, N> const& other)
+ : handle_(other.handle_) {}
+
+private:
+ limited_allocator& operator=(const limited_allocator&);// = delete;
+
+public:
+ pointer allocate(size_type n) { return handle_->template allocate<T>(n); }
+ void deallocate(pointer p, size_type n) { handle_->deallocate(p, n); }
+ size_type max_size() const {return N;}
+
+ BuffT* getHandle() const { return handle_.get(); }
+};
+
+template <class T, class U, std::size_t N>
+inline bool operator==(limited_allocator<T, N> const& LHS,
+ limited_allocator<U, N> const& RHS) {
+ return LHS.getHandle() == RHS.getHandle();
+}
+
+template <class T, class U, std::size_t N>
+inline bool operator!=(limited_allocator<T, N> const& LHS,
+ limited_allocator<U, N> const& RHS) {
+ return !(LHS == RHS);
+}
+
#endif // TEST_ALLOCATOR_H
diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h
index d4a079971b15..379933eb51b4 100644
--- a/test/support/test_iterators.h
+++ b/test/support/test_iterators.h
@@ -53,25 +53,27 @@ public:
void operator,(T const &) DELETE_FUNCTION;
};
-template <class It>
+template <class It,
+ class ItTraits = It>
class input_iterator
{
+ typedef std::iterator_traits<ItTraits> Traits;
It it_;
- template <class U> friend class input_iterator;
+ template <class U, class T> friend class input_iterator;
public:
typedef std::input_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef typename Traits::value_type value_type;
+ typedef typename Traits::difference_type difference_type;
typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
+ typedef typename Traits::reference reference;
It base() const {return it_;}
input_iterator() : it_() {}
explicit input_iterator(It it) : it_(it) {}
- template <class U>
- input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
+ template <class U, class T>
+ input_iterator(const input_iterator<U, T>& u) :it_(u.it_) {}
reference operator*() const {return *it_;}
pointer operator->() const {return it_;}
@@ -89,18 +91,18 @@ public:
void operator,(T const &) DELETE_FUNCTION;
};
-template <class T, class U>
+template <class T, class TV, class U, class UV>
inline
bool
-operator==(const input_iterator<T>& x, const input_iterator<U>& y)
+operator==(const input_iterator<T, TV>& x, const input_iterator<U, UV>& y)
{
return x.base() == y.base();
}
-template <class T, class U>
+template <class T, class TV, class U, class UV>
inline
bool
-operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
+operator!=(const input_iterator<T, TV>& x, const input_iterator<U, UV>& y)
{
return !(x == y);
}
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index a072e31b77b7..40d366ab19dd 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -22,6 +22,12 @@
#define TEST_HAS_FEATURE(X) 0
#endif
+#ifdef __has_include
+#define TEST_HAS_INCLUDE(X) __has_include(X)
+#else
+#define TEST_HAS_INCLUDE(X) 0
+#endif
+
#ifdef __has_extension
#define TEST_HAS_EXTENSION(X) __has_extension(X)
#else
@@ -33,6 +39,21 @@
#else
#define TEST_HAS_BUILTIN(X) 0
#endif
+#ifdef __is_identifier
+// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
+// the compiler and '1' otherwise.
+#define TEST_HAS_BUILTIN_IDENTIFIER(X) !__is_identifier(X)
+#else
+#define TEST_HAS_BUILTIN_IDENTIFIER(X) 0
+#endif
+
+#if defined(__apple_build_version__)
+#define TEST_APPLE_CLANG_VER (__clang_major__ * 100) + __clang_minor__
+#elif defined(__clang_major__)
+#define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__
+#elif defined(__GNUC__)
+#define TEST_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
/* Make a nice name for the standard version */
#ifndef TEST_STD_VER
@@ -47,6 +68,13 @@
#endif
#endif
+// Attempt to deduce GCC version
+#if defined(_LIBCPP_VERSION) && TEST_HAS_INCLUDE(<features.h>)
+#include <features.h>
+#define TEST_HAS_GLIBC
+#define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
+#endif
+
/* Features that were introduced in C++14 */
#if TEST_STD_VER >= 14
#define TEST_HAS_EXTENDED_CONSTEXPR
@@ -58,19 +86,33 @@
#endif
#if TEST_STD_VER >= 11
+#define TEST_ALIGNOF(...) alignof(__VA_ARGS__)
+#define TEST_ALIGNAS(...) alignas(__VA_ARGS__)
#define TEST_CONSTEXPR constexpr
#define TEST_NOEXCEPT noexcept
+#define TEST_NOEXCEPT_COND(...) noexcept(__VA_ARGS__)
# if TEST_STD_VER >= 14
# define TEST_CONSTEXPR_CXX14 constexpr
# else
# define TEST_CONSTEXPR_CXX14
# endif
+# if TEST_STD_VER > 14
+# define TEST_THROW_SPEC(...)
+# else
+# define TEST_THROW_SPEC(...) throw(__VA_ARGS__)
+# endif
#else
+#define TEST_ALIGNOF(...) __alignof(__VA_ARGS__)
+#define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__)))
#define TEST_CONSTEXPR
#define TEST_CONSTEXPR_CXX14
-#define TEST_NOEXCEPT
+#define TEST_NOEXCEPT throw()
+#define TEST_NOEXCEPT_COND(...)
+#define TEST_THROW_SPEC(...) throw(__VA_ARGS__)
#endif
+#define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__))
+
#if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \
&& !defined(__GXX_RTTI)
#define TEST_HAS_NO_RTTI
@@ -92,21 +134,27 @@
#define TEST_NORETURN [[noreturn]]
#endif
+#define ASSERT_NOEXCEPT(...) \
+ static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept")
+
+#define ASSERT_NOT_NOEXCEPT(...) \
+ static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept")
+
/* Macros for testing libc++ specific behavior and extensions */
#if defined(_LIBCPP_VERSION)
#define LIBCPP_ASSERT(...) assert(__VA_ARGS__)
#define LIBCPP_STATIC_ASSERT(...) static_assert(__VA_ARGS__)
+#define LIBCPP_ASSERT_NOEXCEPT(...) ASSERT_NOEXCEPT(__VA_ARGS__)
+#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ASSERT_NOT_NOEXCEPT(__VA_ARGS__)
+#define LIBCPP_ONLY(...) __VA_ARGS__
#else
#define LIBCPP_ASSERT(...) ((void)0)
#define LIBCPP_STATIC_ASSERT(...) ((void)0)
+#define LIBCPP_ASSERT_NOEXCEPT(...) ((void)0)
+#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ((void)0)
+#define LIBCPP_ONLY(...) ((void)0)
#endif
-#define ASSERT_NOEXCEPT(...) \
- static_assert(noexcept(__VA_ARGS__), "Operation must be noexcept")
-
-#define ASSERT_NOT_NOEXCEPT(...) \
- static_assert(!noexcept(__VA_ARGS__), "Operation must NOT be noexcept")
-
namespace test_macros_detail {
template <class T, class U>
struct is_same { enum { value = 0};} ;
@@ -118,4 +166,15 @@ struct is_same<T, T> { enum {value = 1}; };
static_assert(test_macros_detail::is_same<__VA_ARGS__>::value, \
"Types differ uexpectedly")
+#ifndef TEST_HAS_NO_EXCEPTIONS
+#define TEST_THROW(...) throw __VA_ARGS__
+#else
+#if defined(__GNUC__)
+#define TEST_THROW(...) __builtin_abort()
+#else
+#include <stdlib.h>
+#define TEST_THROW(...) ::abort()
+#endif
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP
diff --git a/test/support/test_memory_resource.hpp b/test/support/test_memory_resource.hpp
index e7b067cf631d..49dc1739a962 100644
--- a/test/support/test_memory_resource.hpp
+++ b/test/support/test_memory_resource.hpp
@@ -11,6 +11,7 @@
#define SUPPORT_TEST_MEMORY_RESOURCE_HPP
#include <experimental/memory_resource>
+#include <experimental/utility>
#include <memory>
#include <type_traits>
#include <cstddef>
@@ -19,354 +20,17 @@
#include <cstdint>
#include <cassert>
#include "test_macros.h"
-
-struct AllocController;
- // 'AllocController' is a concrete type that instruments and controls the
- // behavior of of test allocators.
-
-template <class T>
-class CountingAllocator;
- // 'CountingAllocator' is an basic implementation of the 'Allocator'
- // requirements that use the 'AllocController' interface.
-
-template <class T>
-class MinAlignAllocator;
- // 'MinAlignAllocator' is an instrumented test type which implements the
- // 'Allocator' requirements. 'MinAlignAllocator' ensures that it *never*
- // returns a pointer to over-aligned storage. For example
- // 'MinAlignPointer<char>{}.allocate(...)' will never a 2-byte aligned
- // pointer.
-
-template <class T>
-class NullAllocator;
- // 'NullAllocator' is an instrumented test type which implements the
- // 'Allocator' requirements except that 'allocator' and 'deallocate' are
- // nops.
-
-
-#define DISALLOW_COPY(Type) \
- Type(Type const&) = delete; \
- Type& operator=(Type const&) = delete
-
-constexpr std::size_t MaxAlignV = alignof(std::max_align_t);
-
-struct TestException {};
-
-struct AllocController {
- int copy_constructed = 0;
- int move_constructed = 0;
-
- int alive = 0;
- int alloc_count = 0;
- int dealloc_count = 0;
- int is_equal_count = 0;
-
- std::size_t alive_size;
- std::size_t allocated_size;
- std::size_t deallocated_size;
-
- std::size_t last_size = 0;
- std::size_t last_align = 0;
- void * last_pointer = 0;
-
- std::size_t last_alloc_size = 0;
- std::size_t last_alloc_align = 0;
- void * last_alloc_pointer = nullptr;
-
- std::size_t last_dealloc_size = 0;
- std::size_t last_dealloc_align = 0;
- void * last_dealloc_pointer = nullptr;
-
- bool throw_on_alloc = false;
-
- AllocController() = default;
-
- void countAlloc(void* p, size_t s, size_t a) {
- ++alive;
- ++alloc_count;
- alive_size += s;
- allocated_size += s;
- last_pointer = last_alloc_pointer = p;
- last_size = last_alloc_size = s;
- last_align = last_alloc_align = a;
- }
-
- void countDealloc(void* p, size_t s, size_t a) {
- --alive;
- ++dealloc_count;
- alive_size -= s;
- deallocated_size += s;
- last_pointer = last_dealloc_pointer = p;
- last_size = last_dealloc_size = s;
- last_align = last_dealloc_align = a;
- }
-
- void reset() { std::memset(this, 0, sizeof(*this)); }
-
-public:
- bool checkAlloc(void* p, size_t s, size_t a) const {
- return p == last_alloc_pointer &&
- s == last_alloc_size &&
- a == last_alloc_align;
- }
-
- bool checkAlloc(void* p, size_t s) const {
- return p == last_alloc_pointer &&
- s == last_alloc_size;
- }
-
- bool checkAllocAtLeast(void* p, size_t s, size_t a) const {
- return p == last_alloc_pointer &&
- s <= last_alloc_size &&
- a <= last_alloc_align;
- }
-
- bool checkAllocAtLeast(void* p, size_t s) const {
- return p == last_alloc_pointer &&
- s <= last_alloc_size;
- }
-
- bool checkDealloc(void* p, size_t s, size_t a) const {
- return p == last_dealloc_pointer &&
- s == last_dealloc_size &&
- a == last_dealloc_align;
- }
-
- bool checkDealloc(void* p, size_t s) const {
- return p == last_dealloc_pointer &&
- s == last_dealloc_size;
- }
-
- bool checkDeallocMatchesAlloc() const {
- return last_dealloc_pointer == last_alloc_pointer &&
- last_dealloc_size == last_alloc_size &&
- last_dealloc_align == last_alloc_align;
- }
-
- void countIsEqual() {
- ++is_equal_count;
- }
-
- bool checkIsEqualCalledEq(int n) const {
- return is_equal_count == n;
- }
-private:
- DISALLOW_COPY(AllocController);
+#include "controlled_allocators.hpp"
+#include "uses_alloc_types.hpp"
+
+// FIXME: This is a hack to allow uses_allocator_types.hpp to work with
+// erased_type. However we can't define that behavior directly in the header
+// because it con't include <experimental/memory_resource>
+template <>
+struct TransformErasedTypeAlloc<std::experimental::erased_type> {
+ using type = std::experimental::pmr::memory_resource*;
};
-template <class T>
-class CountingAllocator
-{
-public:
- typedef T value_type;
- typedef T* pointer;
- CountingAllocator() = delete;
- explicit CountingAllocator(AllocController& PP) : P(&PP) {}
-
- CountingAllocator(CountingAllocator const& other) : P(other.P) {
- P->copy_constructed += 1;
- }
-
- CountingAllocator(CountingAllocator&& other) : P(other.P) {
- P->move_constructed += 1;
- }
-
- template <class U>
- CountingAllocator(CountingAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
- P->copy_constructed += 1;
- }
-
- template <class U>
- CountingAllocator(CountingAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
- P->move_constructed += 1;
- }
-
- T* allocate(std::size_t n)
- {
- void* ret = ::operator new(n*sizeof(T));
- P->countAlloc(ret, n*sizeof(T), alignof(T));
- return static_cast<T*>(ret);
- }
-
- void deallocate(T* p, std::size_t n)
- {
- void* vp = static_cast<void*>(p);
- P->countDealloc(vp, n*sizeof(T), alignof(T));
- ::operator delete(vp);
- }
-
- AllocController& getController() const { return *P; }
-
-private:
- template <class Tp> friend class CountingAllocator;
- AllocController *P;
-};
-
-template <class T, class U>
-inline bool operator==(CountingAllocator<T> const& x,
- CountingAllocator<U> const& y) {
- return &x.getController() == &y.getController();
-}
-
-template <class T, class U>
-inline bool operator!=(CountingAllocator<T> const& x,
- CountingAllocator<U> const& y) {
- return !(x == y);
-}
-
-template <class T>
-class MinAlignedAllocator
-{
-public:
- typedef T value_type;
- typedef T* pointer;
-
- MinAlignedAllocator() = delete;
-
- explicit MinAlignedAllocator(AllocController& R) : P(&R) {}
-
- MinAlignedAllocator(MinAlignedAllocator const& other) : P(other.P) {
- P->copy_constructed += 1;
- }
-
- MinAlignedAllocator(MinAlignedAllocator&& other) : P(other.P) {
- P->move_constructed += 1;
- }
-
- template <class U>
- MinAlignedAllocator(MinAlignedAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
- P->copy_constructed += 1;
- }
-
- template <class U>
- MinAlignedAllocator(MinAlignedAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
- P->move_constructed += 1;
- }
-
- T* allocate(std::size_t n) {
- char* aligned_ptr = (char*)::operator new(alloc_size(n*sizeof(T)));
- assert(is_max_aligned(aligned_ptr));
-
- char* unaligned_ptr = aligned_ptr + alignof(T);
- assert(is_min_aligned(unaligned_ptr));
-
- P->countAlloc(unaligned_ptr, n * sizeof(T), alignof(T));
-
- return ((T*)unaligned_ptr);
- }
-
- void deallocate(T* p, std::size_t n) {
- assert(is_min_aligned(p));
-
- char* aligned_ptr = ((char*)p) - alignof(T);
- assert(is_max_aligned(aligned_ptr));
-
- P->countDealloc(p, n*sizeof(T), alignof(T));
-
- return ::operator delete(static_cast<void*>(aligned_ptr));
- }
-
- AllocController& getController() const { return *P; }
-
-private:
- static const std::size_t BlockSize = alignof(std::max_align_t);
-
- static std::size_t alloc_size(std::size_t s) {
- std::size_t bytes = (s + BlockSize - 1) & ~(BlockSize - 1);
- bytes += BlockSize;
- assert(bytes % BlockSize == 0);
- return bytes;
- }
-
- static bool is_max_aligned(void* p) {
- return reinterpret_cast<std::uintptr_t>(p) % BlockSize == 0;
- }
-
- static bool is_min_aligned(void* p) {
- if (alignof(T) == BlockSize) {
- return is_max_aligned(p);
- } else {
- return reinterpret_cast<std::uintptr_t>(p) % BlockSize == alignof(T);
- }
- }
-
- template <class Tp> friend class MinAlignedAllocator;
- mutable AllocController *P;
-};
-
-
-template <class T, class U>
-inline bool operator==(MinAlignedAllocator<T> const& x,
- MinAlignedAllocator<U> const& y) {
- return &x.getController() == &y.getController();
-}
-
-template <class T, class U>
-inline bool operator!=(MinAlignedAllocator<T> const& x,
- MinAlignedAllocator<U> const& y) {
- return !(x == y);
-}
-
-template <class T>
-class NullAllocator
-{
-public:
- typedef T value_type;
- typedef T* pointer;
- NullAllocator() = delete;
- explicit NullAllocator(AllocController& PP) : P(&PP) {}
-
- NullAllocator(NullAllocator const& other) : P(other.P) {
- P->copy_constructed += 1;
- }
-
- NullAllocator(NullAllocator&& other) : P(other.P) {
- P->move_constructed += 1;
- }
-
- template <class U>
- NullAllocator(NullAllocator<U> const& other) TEST_NOEXCEPT : P(other.P) {
- P->copy_constructed += 1;
- }
-
- template <class U>
- NullAllocator(NullAllocator<U>&& other) TEST_NOEXCEPT : P(other.P) {
- P->move_constructed += 1;
- }
-
- T* allocate(std::size_t n)
- {
- P->countAlloc(nullptr, n*sizeof(T), alignof(T));
- return nullptr;
- }
-
- void deallocate(T* p, std::size_t n)
- {
- void* vp = static_cast<void*>(p);
- P->countDealloc(vp, n*sizeof(T), alignof(T));
- }
-
- AllocController& getController() const { return *P; }
-
-private:
- template <class Tp> friend class NullAllocator;
- AllocController *P;
-};
-
-template <class T, class U>
-inline bool operator==(NullAllocator<T> const& x,
- NullAllocator<U> const& y) {
- return &x.getController() == &y.getController();
-}
-
-template <class T, class U>
-inline bool operator!=(NullAllocator<T> const& x,
- NullAllocator<U> const& y) {
- return !(x == y);
-}
-
-
-
template <class ProviderT, int = 0>
class TestResourceImp : public std::experimental::pmr::memory_resource
{
diff --git a/test/support/type_id.h b/test/support/type_id.h
index 309f0884e4a7..0463365388fc 100644
--- a/test/support/type_id.h
+++ b/test/support/type_id.h
@@ -10,9 +10,13 @@
#define SUPPORT_TYPE_ID_H
#include <functional>
+#include <typeinfo>
+#include <string>
+#include <cstdio>
#include <cassert>
#include "test_macros.h"
+#include "demangle.h"
#if TEST_STD_VER < 11
#error This header requires C++11 or greater
@@ -25,25 +29,41 @@ struct TypeID {
{return LHS.m_id == RHS.m_id; }
friend bool operator!=(TypeID const& LHS, TypeID const& RHS)
{return LHS.m_id != RHS.m_id; }
+
+ std::string name() const {
+ return demangle(m_id);
+ }
+
+ void dump() const {
+ std::string s = name();
+ std::printf("TypeID: %s\n", s.c_str());
+ }
+
private:
- explicit constexpr TypeID(const int* xid) : m_id(xid) {}
+ explicit constexpr TypeID(const char* xid) : m_id(xid) {}
TypeID(const TypeID&) = delete;
TypeID& operator=(TypeID const&) = delete;
- const int* const m_id;
- template <class T> friend TypeID const& makeTypeID();
-
+ const char* const m_id;
+ template <class T> friend TypeID const& makeTypeIDImp();
};
// makeTypeID - Return the TypeID for the specified type 'T'.
template <class T>
-inline TypeID const& makeTypeID() {
- static int dummy;
- static const TypeID id(&dummy);
+inline TypeID const& makeTypeIDImp() {
+ static const TypeID id(typeid(T).name());
return id;
}
+template <class T>
+struct TypeWrapper {};
+
+template <class T>
+inline TypeID const& makeTypeID() {
+ return makeTypeIDImp<TypeWrapper<T>>();
+}
+
template <class ...Args>
struct ArgumentListID {};
@@ -51,7 +71,23 @@ struct ArgumentListID {};
// of arguments.
template <class ...Args>
inline TypeID const& makeArgumentID() {
- return makeTypeID<ArgumentListID<Args...>>();
+ return makeTypeIDImp<ArgumentListID<Args...>>();
+}
+
+
+// COMPARE_TYPEID(...) is a utility macro for generating diagnostics when
+// two typeid's are expected to be equal
+#define COMPARE_TYPEID(LHS, RHS) CompareTypeIDVerbose(#LHS, LHS, #RHS, RHS)
+
+inline bool CompareTypeIDVerbose(const char* LHSString, TypeID const* LHS,
+ const char* RHSString, TypeID const* RHS) {
+ if (*LHS == *RHS)
+ return true;
+ std::printf("TypeID's not equal:\n");
+ std::printf("%s: %s\n----------\n%s: %s\n",
+ LHSString, LHS->name().c_str(),
+ RHSString, RHS->name().c_str());
+ return false;
}
#endif // SUPPORT_TYPE_ID_H
diff --git a/test/support/uses_alloc_types.hpp b/test/support/uses_alloc_types.hpp
index 834e57729a7a..8422f809ba76 100644
--- a/test/support/uses_alloc_types.hpp
+++ b/test/support/uses_alloc_types.hpp
@@ -10,12 +10,11 @@
#ifndef USES_ALLOC_TYPES_HPP
#define USES_ALLOC_TYPES_HPP
-# include <experimental/memory_resource>
-# include <experimental/utility>
# include <memory>
# include <cassert>
+#include <cstdlib>
-#include "test_memory_resource.hpp"
+#include "test_macros.h"
#include "type_id.h"
// There are two forms of uses-allocator construction:
@@ -31,6 +30,30 @@ constexpr UsesAllocatorType UA_None = UsesAllocatorType::UA_None;
constexpr UsesAllocatorType UA_AllocArg = UsesAllocatorType::UA_AllocArg;
constexpr UsesAllocatorType UA_AllocLast = UsesAllocatorType::UA_AllocLast;
+inline const char* toString(UsesAllocatorType UA) {
+ switch (UA) {
+ case UA_None:
+ return "UA_None";
+ case UA_AllocArg:
+ return "UA_AllocArg";
+ case UA_AllocLast:
+ return "UA_AllocLast";
+ default:
+ std::abort();
+ }
+}
+
+#define COMPARE_ALLOC_TYPE(LHS, RHS) CompareVerbose(#LHS, LHS, #RHS, RHS)
+
+inline bool CompareVerbose(const char* LHSString, UsesAllocatorType LHS,
+ const char* RHSString, UsesAllocatorType RHS) {
+ if (LHS == RHS)
+ return true;
+ std::printf("UsesAllocatorType's don't match:\n%s %s\n----------\n%s %s\n",
+ LHSString, toString(LHS), RHSString, toString(RHS));
+ return false;
+}
+
template <class Alloc, std::size_t N>
class UsesAllocatorV1;
// Implements form (1) of uses-allocator construction from the specified
@@ -115,56 +138,107 @@ using EnableIfB = typename std::enable_if<Value, bool>::type;
} // end namespace detail
+// FIXME: UsesAllocatorTestBase needs some special logic to deal with
+// polymorphic allocators. However we don't want to include
+// <experimental/memory_resource> in this header. Therefore in order
+// to inject this behavior later we use a trait.
+// See test_memory_resource.hpp for more info.
+template <class Alloc>
+struct TransformErasedTypeAlloc {
+ using type = Alloc;
+};
+
using detail::EnableIfB;
struct AllocLastTag {};
+template <class Alloc, bool = std::is_default_constructible<Alloc>::value>
+struct UsesAllocatorTestBaseStorage {
+ Alloc allocator;
+ UsesAllocatorTestBaseStorage() = default;
+ UsesAllocatorTestBaseStorage(Alloc const& a) : allocator(a) {}
+ const Alloc* get_allocator() const { return &allocator; }
+};
+
template <class Alloc>
+struct UsesAllocatorTestBaseStorage<Alloc, false> {
+ union {
+ char dummy;
+ Alloc alloc;
+ };
+ bool has_alloc = false;
+
+ UsesAllocatorTestBaseStorage() : dummy(), has_alloc(false) {}
+ UsesAllocatorTestBaseStorage(Alloc const& a) : alloc(a), has_alloc(true) {}
+ ~UsesAllocatorTestBaseStorage() {
+ if (has_alloc)
+ alloc.~Alloc();
+ }
+
+ Alloc const* get_allocator() const {
+ if (!has_alloc)
+ return nullptr;
+ return &alloc;
+ }
+};
+
+template <class Self, class Alloc>
struct UsesAllocatorTestBase {
public:
- using CtorAlloc = typename std::conditional<
- std::is_same<Alloc, std::experimental::erased_type>::value,
- std::experimental::pmr::memory_resource*,
- Alloc
- >::type;
+ using CtorAlloc = typename TransformErasedTypeAlloc<Alloc>::type;
template <class ...ArgTypes>
bool checkConstruct(UsesAllocatorType expectType) const {
- return expectType == constructor_called &&
- makeArgumentID<ArgTypes...>() == *args_id;
+ auto expectArgs = &makeArgumentID<ArgTypes...>();
+ return COMPARE_ALLOC_TYPE(expectType, constructor_called) &&
+ COMPARE_TYPEID(args_id, expectArgs);
}
template <class ...ArgTypes>
bool checkConstruct(UsesAllocatorType expectType,
CtorAlloc const& expectAlloc) const {
- return expectType == constructor_called &&
- makeArgumentID<ArgTypes...>() == *args_id &&
- expectAlloc == allocator;
+ auto ExpectID = &makeArgumentID<ArgTypes...>() ;
+ return COMPARE_ALLOC_TYPE(expectType, constructor_called) &&
+ COMPARE_TYPEID(args_id, ExpectID) &&
+ has_alloc() && expectAlloc == *get_alloc();
+
}
bool checkConstructEquiv(UsesAllocatorTestBase& O) const {
- return constructor_called == O.constructor_called
- && *args_id == *O.args_id
- && allocator == O.allocator;
+ if (has_alloc() != O.has_alloc())
+ return false;
+ return COMPARE_ALLOC_TYPE(constructor_called, O.constructor_called)
+ && COMPARE_TYPEID(args_id, O.args_id)
+ && (!has_alloc() || *get_alloc() == *O.get_alloc());
}
protected:
explicit UsesAllocatorTestBase(const TypeID* aid)
- : args_id(aid), constructor_called(UA_None), allocator()
+ : args_id(aid), constructor_called(UA_None), alloc_store()
+ {}
+
+ UsesAllocatorTestBase(UsesAllocatorTestBase const&)
+ : args_id(&makeArgumentID<Self const&>()), constructor_called(UA_None),
+ alloc_store()
+ {}
+
+ UsesAllocatorTestBase(UsesAllocatorTestBase&&)
+ : args_id(&makeArgumentID<Self&&>()), constructor_called(UA_None),
+ alloc_store()
{}
template <class ...Args>
UsesAllocatorTestBase(std::allocator_arg_t, CtorAlloc const& a, Args&&...)
: args_id(&makeArgumentID<Args&&...>()),
constructor_called(UA_AllocArg),
- allocator(a)
+ alloc_store(a)
{}
template <class ...Args, class ArgsIDL = detail::TakeNArgs<sizeof...(Args) - 1, Args&&...>>
UsesAllocatorTestBase(AllocLastTag, Args&&... args)
- : args_id(&makeTypeID<typename ArgsIDL::type>()),
+ : args_id(&makeTypeIDImp<typename ArgsIDL::type>()),
constructor_called(UA_AllocLast),
- allocator(getAllocatorFromPack(
+ alloc_store(UsesAllocatorTestBase::getAllocatorFromPack(
typename ArgsIDL::type{},
std::forward<Args>(args)...))
{
@@ -173,7 +247,7 @@ protected:
private:
template <class ...LArgs, class ...Args>
static CtorAlloc getAllocatorFromPack(ArgumentListID<LArgs...>, Args&&... args) {
- return getAllocatorFromPackImp<LArgs const&...>(args...);
+ return UsesAllocatorTestBase::getAllocatorFromPackImp<LArgs const&...>(args...);
}
template <class ...LArgs>
@@ -182,25 +256,32 @@ private:
return alloc;
}
+ bool has_alloc() const { return alloc_store.get_allocator() != nullptr; }
+ const CtorAlloc *get_alloc() const { return alloc_store.get_allocator(); }
+public:
const TypeID* args_id;
UsesAllocatorType constructor_called = UA_None;
- CtorAlloc allocator;
+ UsesAllocatorTestBaseStorage<CtorAlloc> alloc_store;
};
template <class Alloc, size_t Arity>
-class UsesAllocatorV1 : public UsesAllocatorTestBase<Alloc>
+class UsesAllocatorV1 : public UsesAllocatorTestBase<UsesAllocatorV1<Alloc, Arity>, Alloc>
{
public:
typedef Alloc allocator_type;
- using Base = UsesAllocatorTestBase<Alloc>;
+ using Base = UsesAllocatorTestBase<UsesAllocatorV1, Alloc>;
using CtorAlloc = typename Base::CtorAlloc;
UsesAllocatorV1() : Base(&makeArgumentID<>()) {}
+ UsesAllocatorV1(UsesAllocatorV1 const&)
+ : Base(&makeArgumentID<UsesAllocatorV1 const&>()) {}
+ UsesAllocatorV1(UsesAllocatorV1 &&)
+ : Base(&makeArgumentID<UsesAllocatorV1 &&>()) {}
// Non-Uses Allocator Ctor
template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
- UsesAllocatorV1(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+ UsesAllocatorV1(Args&&...) : Base(&makeArgumentID<Args&&...>()) {}
// Uses Allocator Arg Ctor
template <class ...Args>
@@ -209,28 +290,32 @@ public:
{ }
// BLOWS UP: Uses Allocator Last Ctor
- template <class _First, class ...Args, EnableIfB<sizeof...(Args) == Arity> _Dummy = false>
- constexpr UsesAllocatorV1(_First&& __first, Args&&... args)
+ template <class First, class ...Args, EnableIfB<sizeof...(Args) == Arity> Dummy = false>
+ constexpr UsesAllocatorV1(First&&, Args&&...)
{
- static_assert(!std::is_same<_First, _First>::value, "");
+ static_assert(!std::is_same<First, First>::value, "");
}
};
template <class Alloc, size_t Arity>
-class UsesAllocatorV2 : public UsesAllocatorTestBase<Alloc>
+class UsesAllocatorV2 : public UsesAllocatorTestBase<UsesAllocatorV2<Alloc, Arity>, Alloc>
{
public:
typedef Alloc allocator_type;
- using Base = UsesAllocatorTestBase<Alloc>;
+ using Base = UsesAllocatorTestBase<UsesAllocatorV2, Alloc>;
using CtorAlloc = typename Base::CtorAlloc;
UsesAllocatorV2() : Base(&makeArgumentID<>()) {}
+ UsesAllocatorV2(UsesAllocatorV2 const&)
+ : Base(&makeArgumentID<UsesAllocatorV2 const&>()) {}
+ UsesAllocatorV2(UsesAllocatorV2 &&)
+ : Base(&makeArgumentID<UsesAllocatorV2 &&>()) {}
// Non-Uses Allocator Ctor
template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
- UsesAllocatorV2(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+ UsesAllocatorV2(Args&&...) : Base(&makeArgumentID<Args&&...>()) {}
// Uses Allocator Last Ctor
template <class ...Args, EnableIfB<sizeof...(Args) == Arity + 1> = false>
@@ -240,19 +325,23 @@ public:
};
template <class Alloc, size_t Arity>
-class UsesAllocatorV3 : public UsesAllocatorTestBase<Alloc>
+class UsesAllocatorV3 : public UsesAllocatorTestBase<UsesAllocatorV3<Alloc, Arity>, Alloc>
{
public:
typedef Alloc allocator_type;
- using Base = UsesAllocatorTestBase<Alloc>;
+ using Base = UsesAllocatorTestBase<UsesAllocatorV3, Alloc>;
using CtorAlloc = typename Base::CtorAlloc;
UsesAllocatorV3() : Base(&makeArgumentID<>()) {}
+ UsesAllocatorV3(UsesAllocatorV3 const&)
+ : Base(&makeArgumentID<UsesAllocatorV3 const&>()) {}
+ UsesAllocatorV3(UsesAllocatorV3 &&)
+ : Base(&makeArgumentID<UsesAllocatorV3 &&>()) {}
// Non-Uses Allocator Ctor
template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
- UsesAllocatorV3(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+ UsesAllocatorV3(Args&&...) : Base(&makeArgumentID<Args&&...>()) {}
// Uses Allocator Arg Ctor
template <class ...Args>
@@ -268,19 +357,22 @@ public:
};
template <class Alloc, size_t Arity>
-class NotUsesAllocator : public UsesAllocatorTestBase<Alloc>
+class NotUsesAllocator : public UsesAllocatorTestBase<NotUsesAllocator<Alloc, Arity>, Alloc>
{
public:
// no allocator_type typedef provided
- using Base = UsesAllocatorTestBase<Alloc>;
+ using Base = UsesAllocatorTestBase<NotUsesAllocator, Alloc>;
using CtorAlloc = typename Base::CtorAlloc;
NotUsesAllocator() : Base(&makeArgumentID<>()) {}
-
+ NotUsesAllocator(NotUsesAllocator const&)
+ : Base(&makeArgumentID<NotUsesAllocator const&>()) {}
+ NotUsesAllocator(NotUsesAllocator &&)
+ : Base(&makeArgumentID<NotUsesAllocator &&>()) {}
// Non-Uses Allocator Ctor
template <class ...Args, EnableIfB<sizeof...(Args) == Arity> = false>
- NotUsesAllocator(Args&&... args) : Base(&makeArgumentID<Args&&...>()) {};
+ NotUsesAllocator(Args&&...) : Base(&makeArgumentID<Args&&...>()) {}
// Uses Allocator Arg Ctor
template <class ...Args>
diff --git a/test/support/variant_test_helpers.hpp b/test/support/variant_test_helpers.hpp
new file mode 100644
index 000000000000..277167233714
--- /dev/null
+++ b/test/support/variant_test_helpers.hpp
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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 SUPPORT_VARIANT_TEST_HELPERS_HPP
+#define SUPPORT_VARIANT_TEST_HELPERS_HPP
+
+#include <type_traits>
+#include <utility>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER <= 14
+#error This file requires C++17
+#endif
+
+// FIXME: Currently the variant<T&> tests are disabled using this macro.
+#define TEST_VARIANT_HAS_NO_REFERENCES
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct CopyThrows {
+ CopyThrows() = default;
+ CopyThrows(CopyThrows const&) { throw 42; }
+ CopyThrows& operator=(CopyThrows const&) { throw 42; }
+};
+
+struct MoveThrows {
+ static int alive;
+ MoveThrows() { ++alive; }
+ MoveThrows(MoveThrows const&) {++alive;}
+ MoveThrows(MoveThrows&&) { throw 42; }
+ MoveThrows& operator=(MoveThrows const&) { return *this; }
+ MoveThrows& operator=(MoveThrows&&) { throw 42; }
+ ~MoveThrows() { --alive; }
+};
+
+int MoveThrows::alive = 0;
+
+struct MakeEmptyT {
+ static int alive;
+ MakeEmptyT() { ++alive; }
+ MakeEmptyT(MakeEmptyT const&) {
+ ++alive;
+ // Don't throw from the copy constructor since variant's assignment
+ // operator performs a copy before committing to the assignment.
+ }
+ MakeEmptyT(MakeEmptyT &&) {
+ throw 42;
+ }
+ MakeEmptyT& operator=(MakeEmptyT const&) {
+ throw 42;
+ }
+ MakeEmptyT& operator=(MakeEmptyT&&) {
+ throw 42;
+ }
+ ~MakeEmptyT() { --alive; }
+};
+static_assert(std::is_swappable_v<MakeEmptyT>, ""); // required for test
+
+int MakeEmptyT::alive = 0;
+
+template <class Variant>
+void makeEmpty(Variant& v) {
+ Variant v2(std::in_place_type<MakeEmptyT>);
+ try {
+ v = v2;
+ assert(false);
+ } catch (...) {
+ assert(v.valueless_by_exception());
+ }
+}
+#endif // TEST_HAS_NO_EXCEPTIONS
+
+
+#endif // SUPPORT_VARIANT_TEST_HELPERS_HPP
diff --git a/test/ubsan_blacklist.txt b/test/ubsan_blacklist.txt
deleted file mode 100644
index 8331d7f41f63..000000000000
--- a/test/ubsan_blacklist.txt
+++ /dev/null
@@ -1 +0,0 @@
-fun:*__hash_table*