From ded27f5d853c9e71f82ae8eed0f9310e9fcdf5db Mon Sep 17 00:00:00 2001 From: cpplearner Date: Wed, 3 Jan 2024 22:29:49 +0800 Subject: [PATCH] Cleanup mentions of GH-395 --- .../GH_000545_include_compare/test_ranges.cpp | 5 - tests/std/tests/P0220R1_optional/test.cpp | 2 +- .../tests/P0980R1_constexpr_strings/test.cpp | 332 +++++++++--------- 3 files changed, 162 insertions(+), 177 deletions(-) diff --git a/tests/std/tests/GH_000545_include_compare/test_ranges.cpp b/tests/std/tests/GH_000545_include_compare/test_ranges.cpp index 289277c640..d98a62588f 100644 --- a/tests/std/tests/GH_000545_include_compare/test_ranges.cpp +++ b/tests/std/tests/GH_000545_include_compare/test_ranges.cpp @@ -1,15 +1,10 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include // TRANSITION, GH-395 -#if _HAS_CXX20 - #include // Testing LWG-3330 "Include from most library headers" by intentionally NOT including static_assert(std::is_eq(std::partial_ordering::equivalent)); -#endif // _HAS_CXX20 - void test_ranges() {} diff --git a/tests/std/tests/P0220R1_optional/test.cpp b/tests/std/tests/P0220R1_optional/test.cpp index 459de3e062..853936a664 100644 --- a/tests/std/tests/P0220R1_optional/test.cpp +++ b/tests/std/tests/P0220R1_optional/test.cpp @@ -144,7 +144,7 @@ static_assert(!std::indirectly_movable, std::optional>); static_assert(!std::indirectly_movable_storable, std::optional>); static_assert(!std::indirectly_copyable, std::optional>); static_assert(!std::indirectly_copyable_storable, std::optional>); -#endif // TRANSITION, GH-395 +#endif // _HAS_CXX20 // -- END: test/std/utilities/optional/iterator_concept_conformance.compile.pass.cpp // -- BEGIN: test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp diff --git a/tests/std/tests/P0980R1_constexpr_strings/test.cpp b/tests/std/tests/P0980R1_constexpr_strings/test.cpp index b8ae8ae6de..706ab1d067 100644 --- a/tests/std/tests/P0980R1_constexpr_strings/test.cpp +++ b/tests/std/tests/P0980R1_constexpr_strings/test.cpp @@ -165,16 +165,6 @@ struct string_view_convertible { } }; -// TRANSITION, GH-395 (equalRanges should be replaced by direct calls to ranges::equal) -template -constexpr bool equalRanges(const Range1& range1, const Range2& range2) noexcept { -#if _HAS_CXX20 - return ranges::equal(range1, range2); -#else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv - return equal(begin(range1), end(range1), begin(range2), end(range2)); -#endif // ^^^ !_HAS_CXX20 ^^^ -} - template class MyAlloc { private: @@ -241,56 +231,56 @@ constexpr bool test_interface() { { // constructors // range constructors str literal_constructed{get_literal_input()}; - assert(equalRanges(literal_constructed, get_view_input())); + assert(ranges::equal(literal_constructed, get_view_input())); str view_constructed(get_view_input()); - assert(equalRanges(view_constructed, literal_constructed)); + assert(ranges::equal(view_constructed, literal_constructed)); str initializer_list_constructed({CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}); - assert(equalRanges(initializer_list_constructed, "meow"sv)); + assert(ranges::equal(initializer_list_constructed, "meow"sv)); // special member functions str default_constructed; assert(default_constructed.empty()); str copy_constructed(literal_constructed); - assert(equalRanges(copy_constructed, literal_constructed)); + assert(ranges::equal(copy_constructed, literal_constructed)); str move_constructed(move(copy_constructed)); - assert(equalRanges(move_constructed, literal_constructed)); + assert(ranges::equal(move_constructed, literal_constructed)); assert(copy_constructed.empty()); str copy_assigned(get_dog()); copy_assigned = literal_constructed; - assert(equalRanges(copy_assigned, literal_constructed)); + assert(ranges::equal(copy_assigned, literal_constructed)); str move_assigned(get_dog()); move_assigned = move(copy_assigned); - assert(equalRanges(move_assigned, literal_constructed)); + assert(ranges::equal(move_assigned, literal_constructed)); assert(copy_assigned.empty()); // Other constructors str size_value_constructed(5, CharType{'a'}); - assert(equalRanges(size_value_constructed, "aaaaa"sv)); + assert(ranges::equal(size_value_constructed, "aaaaa"sv)); str copy_start_constructed(literal_constructed, 2); - assert(equalRanges(copy_start_constructed, "llo fluffy kittens"sv)); + assert(ranges::equal(copy_start_constructed, "llo fluffy kittens"sv)); str copy_start_length_constructed(literal_constructed, 2, 3); - assert(equalRanges(copy_start_length_constructed, "llo"sv)); + assert(ranges::equal(copy_start_length_constructed, "llo"sv)); str ptr_size_constructed(get_literal_input(), 2); - assert(equalRanges(ptr_size_constructed, "He"sv)); + assert(ranges::equal(ptr_size_constructed, "He"sv)); str iterator_constructed(literal_constructed.begin(), literal_constructed.end()); - assert(equalRanges(iterator_constructed, literal_constructed)); + assert(ranges::equal(iterator_constructed, literal_constructed)); const string_view_convertible convertible; str conversion_constructed(convertible); - assert(equalRanges(conversion_constructed, literal_constructed)); + assert(ranges::equal(conversion_constructed, literal_constructed)); str conversion_start_length_constructed(convertible, 2, 3); - assert(equalRanges(conversion_start_length_constructed, "llo"sv)); + assert(ranges::equal(conversion_start_length_constructed, "llo"sv)); } { // allocator constructors @@ -298,47 +288,47 @@ constexpr bool test_interface() { // range constructors str literal_constructed{get_literal_input(), alloc}; - assert(equalRanges(literal_constructed, get_view_input())); + assert(ranges::equal(literal_constructed, get_view_input())); str view_constructed{get_view_input(), alloc}; - assert(equalRanges(view_constructed, literal_constructed)); + assert(ranges::equal(view_constructed, literal_constructed)); str initializer_list_constructed({CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}, alloc); - assert(equalRanges(initializer_list_constructed, "meow"sv)); + assert(ranges::equal(initializer_list_constructed, "meow"sv)); // special member functions str default_constructed{alloc}; assert(default_constructed.empty()); str copy_constructed{literal_constructed, alloc}; - assert(equalRanges(copy_constructed, literal_constructed)); + assert(ranges::equal(copy_constructed, literal_constructed)); str move_constructed{move(copy_constructed), alloc}; - assert(equalRanges(move_constructed, literal_constructed)); + assert(ranges::equal(move_constructed, literal_constructed)); assert(copy_constructed.empty()); // Other constructors str size_value_constructed(5, CharType{'a'}, alloc); - assert(equalRanges(size_value_constructed, "aaaaa"sv)); + assert(ranges::equal(size_value_constructed, "aaaaa"sv)); str copy_start_constructed(literal_constructed, 2, alloc); - assert(equalRanges(copy_start_constructed, "llo fluffy kittens"sv)); + assert(ranges::equal(copy_start_constructed, "llo fluffy kittens"sv)); str copy_start_length_constructed(literal_constructed, 2, 3, alloc); - assert(equalRanges(copy_start_length_constructed, "llo"sv)); + assert(ranges::equal(copy_start_length_constructed, "llo"sv)); str ptr_size_constructed(get_literal_input(), 2, alloc); - assert(equalRanges(ptr_size_constructed, "He"sv)); + assert(ranges::equal(ptr_size_constructed, "He"sv)); str iterator_constructed(literal_constructed.begin(), literal_constructed.end(), alloc); - assert(equalRanges(iterator_constructed, literal_constructed)); + assert(ranges::equal(iterator_constructed, literal_constructed)); const string_view_convertible convertible; str conversion_constructed(convertible, alloc); - assert(equalRanges(conversion_constructed, literal_constructed)); + assert(ranges::equal(conversion_constructed, literal_constructed)); str conversion_start_length_constructed(convertible, 2, 3, alloc); - assert(equalRanges(conversion_start_length_constructed, "llo"sv)); + assert(ranges::equal(conversion_start_length_constructed, "llo"sv)); } { // assignment operator @@ -346,29 +336,29 @@ constexpr bool test_interface() { str copy_assigned; copy_assigned = literal_constructed; - assert(equalRanges(copy_assigned, literal_constructed)); + assert(ranges::equal(copy_assigned, literal_constructed)); str move_assigned; move_assigned = move(copy_assigned); - assert(equalRanges(move_assigned, literal_constructed)); + assert(ranges::equal(move_assigned, literal_constructed)); assert(copy_assigned.empty()); str literal_assigned; literal_assigned = get_literal_input(); - assert(equalRanges(literal_assigned, literal_constructed)); + assert(ranges::equal(literal_assigned, literal_constructed)); str char_assigned; char_assigned = CharType{'!'}; - assert(equalRanges(char_assigned, "!"sv)); + assert(ranges::equal(char_assigned, "!"sv)); str initializer_list_assigned; initializer_list_assigned = {CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}; - assert(equalRanges(initializer_list_assigned, "meow"sv)); + assert(ranges::equal(initializer_list_assigned, "meow"sv)); const string_view_convertible convertible; str conversion_assigned; conversion_assigned = convertible; - assert(equalRanges(conversion_assigned, literal_constructed)); + assert(ranges::equal(conversion_assigned, literal_constructed)); } { // assign @@ -376,49 +366,49 @@ constexpr bool test_interface() { str assign_size_char; assign_size_char.assign(5, CharType{'a'}); - assert(equalRanges(assign_size_char, "aaaaa"sv)); + assert(ranges::equal(assign_size_char, "aaaaa"sv)); str assign_str; assign_str.assign(literal_constructed); - assert(equalRanges(assign_str, literal_constructed)); + assert(ranges::equal(assign_str, literal_constructed)); str assign_str_pos; assign_str_pos.assign(literal_constructed, 2); - assert(equalRanges(assign_str_pos, "llo fluffy kittens"sv)); + assert(ranges::equal(assign_str_pos, "llo fluffy kittens"sv)); str assign_str_pos_len; assign_str_pos_len.assign(literal_constructed, 2, 3); - assert(equalRanges(assign_str_pos_len, "llo"sv)); + assert(ranges::equal(assign_str_pos_len, "llo"sv)); str assign_moved_str; assign_moved_str.assign(move(assign_str_pos_len)); - assert(equalRanges(assign_moved_str, "llo"sv)); + assert(ranges::equal(assign_moved_str, "llo"sv)); assert(assign_str_pos_len.empty()); str assign_literal; assign_literal.assign(get_literal_input()); - assert(equalRanges(assign_literal, literal_constructed)); + assert(ranges::equal(assign_literal, literal_constructed)); str assign_literal_count; assign_literal_count.assign(get_literal_input(), 2); - assert(equalRanges(assign_literal_count, "He"sv)); + assert(ranges::equal(assign_literal_count, "He"sv)); str assign_iterator; assign_iterator.assign(begin(get_view_input()), end(get_view_input())); - assert(equalRanges(assign_iterator, get_view_input())); + assert(ranges::equal(assign_iterator, get_view_input())); str assign_initializer_list; assign_initializer_list.assign({CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}); - assert(equalRanges(assign_initializer_list, "meow"sv)); + assert(ranges::equal(assign_initializer_list, "meow"sv)); const string_view_convertible convertible; str assign_conversion; assign_conversion.assign(convertible); - assert(equalRanges(assign_conversion, literal_constructed)); + assert(ranges::equal(assign_conversion, literal_constructed)); str assign_conversion_start_length; assign_conversion_start_length.assign(convertible, 2, 3); - assert(equalRanges(assign_conversion_start_length, "llo"sv)); + assert(ranges::equal(assign_conversion_start_length, "llo"sv)); } { // allocator @@ -612,107 +602,107 @@ constexpr bool test_interface() { str insert_char = get_literal_input(); const CharType to_be_inserted = CharType{','}; insert_char.insert(insert_char.begin() + 5, to_be_inserted); - assert(equalRanges(insert_char, "Hello, fluffy kittens"sv)); + assert(ranges::equal(insert_char, "Hello, fluffy kittens"sv)); str insert_const_char = get_literal_input(); insert_const_char.insert(insert_const_char.cbegin() + 5, to_be_inserted); - assert(equalRanges(insert_const_char, "Hello, fluffy kittens"sv)); + assert(ranges::equal(insert_const_char, "Hello, fluffy kittens"sv)); str insert_char_rvalue = get_literal_input(); insert_char_rvalue.insert(insert_char_rvalue.begin() + 5, CharType{','}); - assert(equalRanges(insert_char_rvalue, "Hello, fluffy kittens"sv)); + assert(ranges::equal(insert_char_rvalue, "Hello, fluffy kittens"sv)); str insert_const_char_rvalue = get_literal_input(); insert_const_char_rvalue.insert(insert_const_char_rvalue.cbegin() + 5, CharType{','}); - assert(equalRanges(insert_const_char_rvalue, "Hello, fluffy kittens"sv)); + assert(ranges::equal(insert_const_char_rvalue, "Hello, fluffy kittens"sv)); str insert_range(2, CharType{'b'}); const auto it = insert_range.insert( insert_range.begin() + 1, begin(get_view_input()), end(get_view_input())); assert(it == insert_range.begin() + 1); - assert(equalRanges(insert_range, "bHello fluffy kittensb"sv)); + assert(ranges::equal(insert_range, "bHello fluffy kittensb"sv)); str insert_const_range(2, CharType{'b'}); const auto cit = insert_const_range.insert( insert_const_range.cbegin() + 1, begin(get_view_input()), end(get_view_input())); assert(cit == insert_const_range.cbegin() + 1); - assert(equalRanges(insert_const_range, "bHello fluffy kittensb"sv)); + assert(ranges::equal(insert_const_range, "bHello fluffy kittensb"sv)); str insert_initializer_list = get_literal_input(); const auto it_ilist = insert_initializer_list.insert(insert_initializer_list.begin() + 6, {CharType{'c'}, CharType{'u'}, CharType{'t'}, CharType{'e'}, CharType{' '}}); assert(it_ilist == insert_initializer_list.begin() + 6); - assert(equalRanges(insert_initializer_list, "Hello cute fluffy kittens"sv)); + assert(ranges::equal(insert_initializer_list, "Hello cute fluffy kittens"sv)); str insert_const_initializer_list = get_literal_input(); const auto cit_ilist = insert_const_initializer_list.insert(insert_const_initializer_list.cbegin() + 6, {CharType{'c'}, CharType{'u'}, CharType{'t'}, CharType{'e'}, CharType{' '}}); assert(cit_ilist == insert_const_initializer_list.cbegin() + 6); - assert(equalRanges(insert_const_initializer_list, "Hello cute fluffy kittens"sv)); + assert(ranges::equal(insert_const_initializer_list, "Hello cute fluffy kittens"sv)); str insert_pos_str = get_literal_input(); const str to_insert = get_cute_and_scratchy(); insert_pos_str.insert(6, to_insert); - assert(equalRanges(insert_pos_str, "Hello cute and scratchy fluffy kittens"sv)); + assert(ranges::equal(insert_pos_str, "Hello cute and scratchy fluffy kittens"sv)); str insert_pos_substr = get_literal_input(); insert_pos_substr.insert(6, to_insert, 0, 5); - assert(equalRanges(insert_pos_substr, "Hello cute fluffy kittens"sv)); + assert(ranges::equal(insert_pos_substr, "Hello cute fluffy kittens"sv)); const string_view_convertible convertible; str insert_pos_conversion = get_literal_input(); insert_pos_conversion.insert(6, convertible); - assert(equalRanges(insert_pos_conversion, "Hello Hello fluffy kittensfluffy kittens"sv)); + assert(ranges::equal(insert_pos_conversion, "Hello Hello fluffy kittensfluffy kittens"sv)); str insert_pos_conversion_substr = get_literal_input(); insert_pos_conversion_substr.insert(6, convertible, 6, 7); - assert(equalRanges(insert_pos_conversion_substr, "Hello fluffy fluffy kittens"sv)); + assert(ranges::equal(insert_pos_conversion_substr, "Hello fluffy fluffy kittens"sv)); str insert_pos_literal = get_literal_input(); insert_pos_literal.insert(6, get_literal_input()); - assert(equalRanges(insert_pos_literal, "Hello Hello fluffy kittensfluffy kittens"sv)); + assert(ranges::equal(insert_pos_literal, "Hello Hello fluffy kittensfluffy kittens"sv)); str insert_pos_literal_substr = get_literal_input(); insert_pos_literal_substr.insert(6, get_literal_input(), 6); - assert(equalRanges(insert_pos_literal_substr, "Hello Hello fluffy kittens"sv)); + assert(ranges::equal(insert_pos_literal_substr, "Hello Hello fluffy kittens"sv)); str insert_pos_count_char = get_literal_input(); insert_pos_count_char.insert(6, 3, CharType{'b'}); - assert(equalRanges(insert_pos_count_char, "Hello bbbfluffy kittens"sv)); + assert(ranges::equal(insert_pos_count_char, "Hello bbbfluffy kittens"sv)); str insert_iter_count_char = get_literal_input(); insert_iter_count_char.insert(begin(insert_iter_count_char) + 5, 4, CharType{'o'}); - assert(equalRanges(insert_iter_count_char, "Hellooooo fluffy kittens"sv)); + assert(ranges::equal(insert_iter_count_char, "Hellooooo fluffy kittens"sv)); } { // erase str erase_pos_count = get_literal_input(); erase_pos_count.erase(0, 6); - assert(equalRanges(erase_pos_count, "fluffy kittens"sv)); + assert(ranges::equal(erase_pos_count, "fluffy kittens"sv)); str erase_iter = get_literal_input(); erase_iter.erase(erase_iter.begin()); - assert(equalRanges(erase_iter, "ello fluffy kittens"sv)); + assert(ranges::equal(erase_iter, "ello fluffy kittens"sv)); str erase_const_iter = get_literal_input(); erase_const_iter.erase(erase_const_iter.cbegin()); - assert(equalRanges(erase_const_iter, "ello fluffy kittens"sv)); + assert(ranges::equal(erase_const_iter, "ello fluffy kittens"sv)); str erase_iter_iter = get_literal_input(); erase_iter_iter.erase(erase_iter_iter.begin(), erase_iter_iter.begin() + 6); - assert(equalRanges(erase_iter_iter, "fluffy kittens"sv)); + assert(ranges::equal(erase_iter_iter, "fluffy kittens"sv)); str erase_const_iter_iter = get_literal_input(); erase_const_iter_iter.erase(erase_const_iter_iter.cbegin(), erase_const_iter_iter.cbegin() + 6); - assert(equalRanges(erase_const_iter_iter, "fluffy kittens"sv)); + assert(ranges::equal(erase_const_iter_iter, "fluffy kittens"sv)); str erased_free = get_literal_input(); erase(erased_free, CharType{'l'}); - assert(equalRanges(erased_free, "Heo fuffy kittens"sv)); + assert(ranges::equal(erased_free, "Heo fuffy kittens"sv)); str erased_free_if = get_literal_input(); erase_if(erased_free_if, [](const CharType val) { return val == CharType{'t'}; }); - assert(equalRanges(erased_free_if, "Hello fluffy kiens"sv)); + assert(ranges::equal(erased_free_if, "Hello fluffy kiens"sv)); } { // push_back / pop_back @@ -736,44 +726,44 @@ constexpr bool test_interface() { str append_size_char(2, CharType{'b'}); append_size_char.append(5, CharType{'a'}); - assert(equalRanges(append_size_char, "bbaaaaa"sv)); + assert(ranges::equal(append_size_char, "bbaaaaa"sv)); str append_str(2, CharType{'b'}); append_str.append(literal_constructed); - assert(equalRanges(append_str, "bbHello fluffy kittens"sv)); + assert(ranges::equal(append_str, "bbHello fluffy kittens"sv)); str append_str_pos(2, CharType{'b'}); append_str_pos.append(literal_constructed, 2); - assert(equalRanges(append_str_pos, "bbllo fluffy kittens"sv)); + assert(ranges::equal(append_str_pos, "bbllo fluffy kittens"sv)); str append_str_pos_len(2, CharType{'b'}); append_str_pos_len.append(literal_constructed, 2, 3); - assert(equalRanges(append_str_pos_len, "bbllo"sv)); + assert(ranges::equal(append_str_pos_len, "bbllo"sv)); str append_literal(2, CharType{'b'}); append_literal.append(get_literal_input()); - assert(equalRanges(append_literal, "bbHello fluffy kittens"sv)); + assert(ranges::equal(append_literal, "bbHello fluffy kittens"sv)); str append_literal_count(2, CharType{'b'}); append_literal_count.append(get_literal_input(), 2); - assert(equalRanges(append_literal_count, "bbHe"sv)); + assert(ranges::equal(append_literal_count, "bbHe"sv)); str append_iterator(2, CharType{'b'}); append_iterator.append(begin(get_view_input()), end(get_view_input())); - assert(equalRanges(append_iterator, "bbHello fluffy kittens"sv)); + assert(ranges::equal(append_iterator, "bbHello fluffy kittens"sv)); str append_initializer_list(2, CharType{'b'}); append_initializer_list.append({CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}); - assert(equalRanges(append_initializer_list, "bbmeow"sv)); + assert(ranges::equal(append_initializer_list, "bbmeow"sv)); const string_view_convertible convertible; str append_conversion(2, CharType{'b'}); append_conversion.append(convertible); - assert(equalRanges(append_conversion, "bbHello fluffy kittens"sv)); + assert(ranges::equal(append_conversion, "bbHello fluffy kittens"sv)); str append_conversion_start_length(2, CharType{'b'}); append_conversion_start_length.append(convertible, 2, 3); - assert(equalRanges(append_conversion_start_length, "bbllo"sv)); + assert(ranges::equal(append_conversion_start_length, "bbllo"sv)); } { // operator+= @@ -781,24 +771,24 @@ constexpr bool test_interface() { str plus_string(2, CharType{'b'}); plus_string += literal_constructed; - assert(equalRanges(plus_string, "bbHello fluffy kittens"sv)); + assert(ranges::equal(plus_string, "bbHello fluffy kittens"sv)); str plus_character(2, CharType{'b'}); plus_character += CharType{'a'}; - assert(equalRanges(plus_character, "bba"sv)); + assert(ranges::equal(plus_character, "bba"sv)); str plus_literal(2, CharType{'b'}); plus_literal += get_literal_input(); - assert(equalRanges(plus_literal, "bbHello fluffy kittens"sv)); + assert(ranges::equal(plus_literal, "bbHello fluffy kittens"sv)); str plus_initializer_list(2, CharType{'b'}); plus_initializer_list += {CharType{'m'}, CharType{'e'}, CharType{'o'}, CharType{'w'}}; - assert(equalRanges(plus_initializer_list, "bbmeow"sv)); + assert(ranges::equal(plus_initializer_list, "bbmeow"sv)); const string_view_convertible convertible; str plus_conversion(2, CharType{'b'}); plus_conversion += convertible; - assert(equalRanges(plus_conversion, "bbHello fluffy kittens"sv)); + assert(ranges::equal(plus_conversion, "bbHello fluffy kittens"sv)); } { // compare @@ -966,98 +956,98 @@ constexpr bool test_interface() { str replaced_pos_count_str = get_literal_input(); replaced_pos_count_str.replace(13, 7, input); - assert(equalRanges(replaced_pos_count_str, "Hello fluffy dog"sv)); + assert(ranges::equal(replaced_pos_count_str, "Hello fluffy dog"sv)); str replaced_pos_count_str_shift = get_literal_input(); replaced_pos_count_str_shift.replace(13, 2, input); - assert(equalRanges(replaced_pos_count_str_shift, "Hello fluffy dogttens"sv)); + assert(ranges::equal(replaced_pos_count_str_shift, "Hello fluffy dogttens"sv)); str replaced_iter_str = get_literal_input(); replaced_iter_str.replace(replaced_iter_str.cbegin() + 13, replaced_iter_str.cend(), input); - assert(equalRanges(replaced_iter_str, "Hello fluffy dog"sv)); + assert(ranges::equal(replaced_iter_str, "Hello fluffy dog"sv)); str replaced_iter_str_shift = get_literal_input(); replaced_iter_str_shift.replace( replaced_iter_str_shift.cbegin() + 13, replaced_iter_str_shift.cbegin() + 15, input); - assert(equalRanges(replaced_iter_str_shift, "Hello fluffy dogttens"sv)); + assert(ranges::equal(replaced_iter_str_shift, "Hello fluffy dogttens"sv)); str replaced_pos_count_str_pos_count = get_literal_input(); replaced_pos_count_str_pos_count.replace(13, 7, input, 1); - assert(equalRanges(replaced_pos_count_str_pos_count, "Hello fluffy og"sv)); + assert(ranges::equal(replaced_pos_count_str_pos_count, "Hello fluffy og"sv)); str replaced_pos_count_str_pos_count_less = get_literal_input(); replaced_pos_count_str_pos_count_less.replace(13, 2, input, 1, 2); - assert(equalRanges(replaced_pos_count_str_pos_count_less, "Hello fluffy ogttens"sv)); + assert(ranges::equal(replaced_pos_count_str_pos_count_less, "Hello fluffy ogttens"sv)); str replaced_iter_iter = get_literal_input(); replaced_iter_iter.replace( replaced_iter_iter.cbegin() + 13, replaced_iter_iter.cend(), input.begin(), input.end()); - assert(equalRanges(replaced_iter_iter, "Hello fluffy dog"sv)); + assert(ranges::equal(replaced_iter_iter, "Hello fluffy dog"sv)); str replaced_iter_iter_less = get_literal_input(); replaced_iter_iter_less.replace(replaced_iter_iter_less.cbegin() + 13, replaced_iter_iter_less.cbegin() + 15, input.begin() + 1, input.end()); - assert(equalRanges(replaced_iter_iter_less, "Hello fluffy ogttens"sv)); + assert(ranges::equal(replaced_iter_iter_less, "Hello fluffy ogttens"sv)); str replaced_pos_count_literal = get_literal_input(); replaced_pos_count_literal.replace(13, 2, get_dog()); - assert(equalRanges(replaced_pos_count_literal, "Hello fluffy dogttens"sv)); + assert(ranges::equal(replaced_pos_count_literal, "Hello fluffy dogttens"sv)); str replaced_pos_count_literal_count = get_literal_input(); replaced_pos_count_literal_count.replace(13, 2, get_dog(), 2); - assert(equalRanges(replaced_pos_count_literal_count, "Hello fluffy dottens"sv)); + assert(ranges::equal(replaced_pos_count_literal_count, "Hello fluffy dottens"sv)); str replaced_iter_literal = get_literal_input(); replaced_iter_literal.replace( replaced_iter_literal.cbegin() + 13, replaced_iter_literal.cbegin() + 15, get_dog()); - assert(equalRanges(replaced_iter_literal, "Hello fluffy dogttens"sv)); + assert(ranges::equal(replaced_iter_literal, "Hello fluffy dogttens"sv)); str replaced_iter_literal_count = get_literal_input(); replaced_iter_literal_count.replace(replaced_iter_literal_count.cbegin() + 13, replaced_iter_literal_count.cbegin() + 15, get_dog(), 2); - assert(equalRanges(replaced_iter_literal_count, "Hello fluffy dottens"sv)); + assert(ranges::equal(replaced_iter_literal_count, "Hello fluffy dottens"sv)); str replaced_pos_count_chars = get_literal_input(); replaced_pos_count_chars.replace(13, 2, 5, CharType{'a'}); - assert(equalRanges(replaced_pos_count_chars, "Hello fluffy aaaaattens"sv)); + assert(ranges::equal(replaced_pos_count_chars, "Hello fluffy aaaaattens"sv)); str replaced_iter_chars = get_literal_input(); replaced_iter_chars.replace( replaced_iter_chars.cbegin() + 13, replaced_iter_chars.cbegin() + 15, 5, CharType{'a'}); - assert(equalRanges(replaced_iter_chars, "Hello fluffy aaaaattens"sv)); + assert(ranges::equal(replaced_iter_chars, "Hello fluffy aaaaattens"sv)); str replaced_iter_init = get_literal_input(); replaced_iter_init.replace(replaced_iter_init.cbegin() + 13, replaced_iter_init.cbegin() + 15, {CharType{'c'}, CharType{'u'}, CharType{'t'}, CharType{'e'}, CharType{' '}}); - assert(equalRanges(replaced_iter_init, "Hello fluffy cute ttens"sv)); + assert(ranges::equal(replaced_iter_init, "Hello fluffy cute ttens"sv)); const string_view_convertible convertible; str replaced_pos_count_conversion = get_dog(); replaced_pos_count_conversion.replace(1, 5, convertible); - assert(equalRanges(replaced_pos_count_conversion, "dHello fluffy kittens"sv)); + assert(ranges::equal(replaced_pos_count_conversion, "dHello fluffy kittens"sv)); str replaced_iter_conversion = get_dog(); replaced_iter_conversion.replace( replaced_iter_conversion.cbegin() + 1, replaced_iter_conversion.cbegin() + 2, convertible); - assert(equalRanges(replaced_iter_conversion, "dHello fluffy kittensg"sv)); + assert(ranges::equal(replaced_iter_conversion, "dHello fluffy kittensg"sv)); str replaced_pos_count_conversion_pos = get_dog(); replaced_pos_count_conversion_pos.replace(1, 5, convertible, 6); - assert(equalRanges(replaced_pos_count_conversion_pos, "dfluffy kittens"sv)); + assert(ranges::equal(replaced_pos_count_conversion_pos, "dfluffy kittens"sv)); str replaced_pos_count_conversion_pos_count = get_dog(); replaced_pos_count_conversion_pos_count.replace(1, 5, convertible, 6, 6); - assert(equalRanges(replaced_pos_count_conversion_pos_count, "dfluffy"sv)); + assert(ranges::equal(replaced_pos_count_conversion_pos_count, "dfluffy"sv)); } { // substr const str input = get_literal_input(); const str substr_pos = input.substr(6); - assert(equalRanges(substr_pos, "fluffy kittens"sv)); + assert(ranges::equal(substr_pos, "fluffy kittens"sv)); const str substr_pos_count = input.substr(6, 6); - assert(equalRanges(substr_pos_count, "fluffy"sv)); + assert(ranges::equal(substr_pos_count, "fluffy"sv)); } { // copy @@ -1065,24 +1055,24 @@ constexpr bool test_interface() { CharType copy_count[5]; input.copy(copy_count, 5); - assert(equalRanges(copy_count, "Hello"sv)); + assert(ranges::equal(copy_count, "Hello"sv)); CharType copy_count_pos[6]; input.copy(copy_count_pos, 6, 6); - assert(equalRanges(copy_count_pos, "fluffy"sv)); + assert(ranges::equal(copy_count_pos, "fluffy"sv)); } { // resize str resized = get_literal_input(); resized.resize(3); - assert(equalRanges(resized, "Hel"sv)); + assert(ranges::equal(resized, "Hel"sv)); resized.resize(6, CharType{'a'}); - assert(equalRanges(resized, "Helaaa"sv)); + assert(ranges::equal(resized, "Helaaa"sv)); // ensure we grow properly from small string resized.resize(26, CharType{'a'}); - assert(equalRanges(resized, "Helaaaaaaaaaaaaaaaaaaaaaaa"sv)); + assert(ranges::equal(resized, "Helaaaaaaaaaaaaaaaaaaaaaaa"sv)); } #if _HAS_CXX23 @@ -1194,12 +1184,12 @@ constexpr bool test_interface() { str second{get_dog()}; swap(first, second); - assert(equalRanges(first, expected_first)); - assert(equalRanges(second, expected_second)); + assert(ranges::equal(first, expected_first)); + assert(ranges::equal(second, expected_second)); first.swap(second); - assert(equalRanges(second, expected_first)); - assert(equalRanges(first, expected_second)); + assert(ranges::equal(second, expected_first)); + assert(ranges::equal(first, expected_second)); } { // find @@ -1551,40 +1541,40 @@ constexpr bool test_interface() { const str second = get_dog(); const str op_str_str = first + second; - assert(equalRanges(op_str_str, "kittendog"sv)); + assert(ranges::equal(op_str_str, "kittendog"sv)); const str op_str_literal = first + get_dog(); - assert(equalRanges(op_str_literal, "kittendog"sv)); + assert(ranges::equal(op_str_literal, "kittendog"sv)); const str op_str_char = first + CharType{'!'}; - assert(equalRanges(op_str_char, "kitten!"sv)); + assert(ranges::equal(op_str_char, "kitten!"sv)); const str op_literal_str = get_cat() + second; - assert(equalRanges(op_literal_str, "kittendog"sv)); + assert(ranges::equal(op_literal_str, "kittendog"sv)); const str op_char_str = CharType{'!'} + second; - assert(equalRanges(op_char_str, "!dog"sv)); + assert(ranges::equal(op_char_str, "!dog"sv)); const str op_rstr_rstr = str{get_cat()} + str{get_dog()}; - assert(equalRanges(op_rstr_rstr, "kittendog"sv)); + assert(ranges::equal(op_rstr_rstr, "kittendog"sv)); const str op_rstr_str = str{get_cat()} + second; - assert(equalRanges(op_rstr_str, "kittendog"sv)); + assert(ranges::equal(op_rstr_str, "kittendog"sv)); const str op_rstr_literal = str{get_cat()} + get_dog(); - assert(equalRanges(op_rstr_literal, "kittendog"sv)); + assert(ranges::equal(op_rstr_literal, "kittendog"sv)); const str op_rstr_char = str{get_cat()} + CharType{'!'}; - assert(equalRanges(op_rstr_char, "kitten!"sv)); + assert(ranges::equal(op_rstr_char, "kitten!"sv)); const str op_str_rstr = first + str{get_dog()}; - assert(equalRanges(op_str_rstr, "kittendog"sv)); + assert(ranges::equal(op_str_rstr, "kittendog"sv)); const str op_literal_rstr = get_cat() + str{get_dog()}; - assert(equalRanges(op_literal_rstr, "kittendog"sv)); + assert(ranges::equal(op_literal_rstr, "kittendog"sv)); const str op_char_rstr = CharType{'!'} + str{get_dog()}; - assert(equalRanges(op_char_rstr, "!dog"sv)); + assert(ranges::equal(op_char_rstr, "!dog"sv)); } { // comparison @@ -1668,20 +1658,20 @@ constexpr bool test_interface() { { // basic_string_view conversion str s = get_literal_input(); basic_string_view sv = s; - assert(equalRanges(sv, "Hello fluffy kittens"sv)); + assert(ranges::equal(sv, "Hello fluffy kittens"sv)); } return true; } constexpr bool test_udls() { - assert(equalRanges("purr purr"s, "purr purr"sv)); + assert(ranges::equal("purr purr"s, "purr purr"sv)); #ifdef __cpp_char8_t - assert(equalRanges(u8"purr purr"s, "purr purr"sv)); + assert(ranges::equal(u8"purr purr"s, "purr purr"sv)); #endif // __cpp_char8_t - assert(equalRanges(u"purr purr"s, "purr purr"sv)); - assert(equalRanges(U"purr purr"s, "purr purr"sv)); - assert(equalRanges(L"purr purr"s, "purr purr"sv)); + assert(ranges::equal(u"purr purr"s, "purr purr"sv)); + assert(ranges::equal(U"purr purr"s, "purr purr"sv)); + assert(ranges::equal(L"purr purr"s, "purr purr"sv)); return true; } @@ -1926,8 +1916,8 @@ constexpr void test_copy_ctor() { { // Allocated Str range_constructed(get_view_input(), StationaryAlloc{11}); Str copy_constructed(range_constructed); - assert(equalRanges(range_constructed, get_view_input())); - assert(equalRanges(copy_constructed, get_view_input())); + assert(ranges::equal(range_constructed, get_view_input())); + assert(ranges::equal(copy_constructed, get_view_input())); assert(range_constructed.get_allocator().id() == 11); assert(copy_constructed.get_allocator().id() == 11); } @@ -1935,8 +1925,8 @@ constexpr void test_copy_ctor() { { // SSO Str range_constructed_sso(get_cat_view(), StationaryAlloc{11}); Str copy_constructed_sso(range_constructed_sso); - assert(equalRanges(range_constructed_sso, get_cat_view())); - assert(equalRanges(copy_constructed_sso, get_cat_view())); + assert(ranges::equal(range_constructed_sso, get_cat_view())); + assert(ranges::equal(copy_constructed_sso, get_cat_view())); assert(range_constructed_sso.get_allocator().id() == 11); assert(copy_constructed_sso.get_allocator().id() == 11); } @@ -1949,8 +1939,8 @@ constexpr void test_copy_alloc_ctor(const size_t id1, const size_t id2) { { // Allocated Str range_constructed(get_view_input(), StationaryAlloc{id1}); Str copy_constructed(range_constructed, StationaryAlloc{id2}); - assert(equalRanges(range_constructed, get_view_input())); - assert(equalRanges(copy_constructed, get_view_input())); + assert(ranges::equal(range_constructed, get_view_input())); + assert(ranges::equal(copy_constructed, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(copy_constructed.get_allocator().id() == id2); } @@ -1958,8 +1948,8 @@ constexpr void test_copy_alloc_ctor(const size_t id1, const size_t id2) { { // SSO Str range_constructed_sso(get_cat_view(), StationaryAlloc{id1}); Str copy_constructed_sso(range_constructed_sso, StationaryAlloc{id2}); - assert(equalRanges(range_constructed_sso, get_cat_view())); - assert(equalRanges(copy_constructed_sso, get_cat_view())); + assert(ranges::equal(range_constructed_sso, get_cat_view())); + assert(ranges::equal(copy_constructed_sso, get_cat_view())); assert(range_constructed_sso.get_allocator().id() == id1); assert(copy_constructed_sso.get_allocator().id() == id2); } @@ -1974,8 +1964,8 @@ constexpr void test_copy_assign(const size_t id1, const size_t id2, const size_t Str copy_assigned(get_cat_view(), Alloc{id2}); copy_assigned = range_constructed; - assert(equalRanges(range_constructed, get_view_input())); - assert(equalRanges(copy_assigned, get_view_input())); + assert(ranges::equal(range_constructed, get_view_input())); + assert(ranges::equal(copy_assigned, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(copy_assigned.get_allocator().id() == id3); } @@ -1985,8 +1975,8 @@ constexpr void test_copy_assign(const size_t id1, const size_t id2, const size_t Str copy_assigned(get_cat_view(), Alloc{id2}); copy_assigned = range_constructed; - assert(equalRanges(range_constructed, get_dog_view())); - assert(equalRanges(copy_assigned, get_dog_view())); + assert(ranges::equal(range_constructed, get_dog_view())); + assert(ranges::equal(copy_assigned, get_dog_view())); assert(range_constructed.get_allocator().id() == id1); assert(copy_assigned.get_allocator().id() == id3); } @@ -1996,8 +1986,8 @@ constexpr void test_copy_assign(const size_t id1, const size_t id2, const size_t Str copy_assigned(get_view_input(), Alloc{id2}); copy_assigned = range_constructed; - assert(equalRanges(range_constructed, get_dog_view())); - assert(equalRanges(copy_assigned, get_dog_view())); + assert(ranges::equal(range_constructed, get_dog_view())); + assert(ranges::equal(copy_assigned, get_dog_view())); assert(range_constructed.get_allocator().id() == id1); assert(copy_assigned.get_allocator().id() == id3); } @@ -2008,8 +1998,8 @@ constexpr void test_copy_assign(const size_t id1, const size_t id2, const size_t copy_assigned.resize(30, 'a'); copy_assigned = range_constructed; - assert(equalRanges(range_constructed, get_view_input())); - assert(equalRanges(copy_assigned, get_view_input())); + assert(ranges::equal(range_constructed, get_view_input())); + assert(ranges::equal(copy_assigned, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(copy_assigned.get_allocator().id() == id3); } @@ -2027,7 +2017,7 @@ constexpr void test_move_ctor() { assert(test_it == move_constructed.begin()); assert(range_constructed.empty()); - assert(equalRanges(move_constructed, get_view_input())); + assert(ranges::equal(move_constructed, get_view_input())); assert(range_constructed.get_allocator().id() == 11); assert(move_constructed.get_allocator().id() == 11); } @@ -2037,7 +2027,7 @@ constexpr void test_move_ctor() { Str move_constructed(move(range_constructed)); assert(range_constructed.empty()); - assert(equalRanges(move_constructed, get_cat_view())); + assert(ranges::equal(move_constructed, get_cat_view())); assert(range_constructed.get_allocator().id() == 11); assert(move_constructed.get_allocator().id() == 11); } @@ -2055,7 +2045,7 @@ constexpr void test_move_alloc_ctor(const size_t id1, const size_t id2) { assert(id1 != id2 || test_it == move_constructed.begin()); assert((id1 == id2) == range_constructed.empty()); - assert(equalRanges(move_constructed, get_view_input())); + assert(ranges::equal(move_constructed, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(move_constructed.get_allocator().id() == id2); } @@ -2065,7 +2055,7 @@ constexpr void test_move_alloc_ctor(const size_t id1, const size_t id2) { Str move_constructed(move(range_constructed), StationaryAlloc{id2}); assert((id1 == id2) == range_constructed.empty()); - assert(equalRanges(move_constructed, get_cat_view())); + assert(ranges::equal(move_constructed, get_cat_view())); assert(range_constructed.get_allocator().id() == id1); assert(move_constructed.get_allocator().id() == id2); } @@ -2084,7 +2074,7 @@ constexpr void test_move_assign(const size_t id1, const size_t id2, const size_t move_assigned = move(range_constructed); assert(id1 != id3 || test_it == move_assigned.begin()); assert((id1 == id3) == range_constructed.empty()); - assert(equalRanges(move_assigned, get_view_input())); + assert(ranges::equal(move_assigned, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(move_assigned.get_allocator().id() == id3); } @@ -2095,7 +2085,7 @@ constexpr void test_move_assign(const size_t id1, const size_t id2, const size_t move_assigned = move(range_constructed); assert((id1 == id3) == range_constructed.empty()); - assert(equalRanges(move_assigned, get_dog_view())); + assert(ranges::equal(move_assigned, get_dog_view())); assert(range_constructed.get_allocator().id() == id1); assert(move_assigned.get_allocator().id() == id3); } @@ -2106,7 +2096,7 @@ constexpr void test_move_assign(const size_t id1, const size_t id2, const size_t move_assigned = move(range_constructed); assert((id1 == id3) == range_constructed.empty()); - assert(equalRanges(move_assigned, get_dog_view())); + assert(ranges::equal(move_assigned, get_dog_view())); assert(range_constructed.get_allocator().id() == id1); assert(move_assigned.get_allocator().id() == id3); } @@ -2120,7 +2110,7 @@ constexpr void test_move_assign(const size_t id1, const size_t id2, const size_t move_assigned = move(range_constructed); assert(id1 != id3 || test_it == move_assigned.begin()); assert((id1 == id3) == range_constructed.empty()); - assert(equalRanges(move_assigned, get_view_input())); + assert(ranges::equal(move_assigned, get_view_input())); assert(range_constructed.get_allocator().id() == id1); assert(move_assigned.get_allocator().id() == id3); } @@ -2137,8 +2127,8 @@ constexpr void test_swap(const size_t id1, const size_t id2) { lhs.swap(rhs); assert(lhs_begin == rhs.begin()); - assert(equalRanges(lhs, get_cat_view())); - assert(equalRanges(rhs, get_view_input())); + assert(ranges::equal(lhs, get_cat_view())); + assert(ranges::equal(rhs, get_view_input())); assert(lhs.get_allocator().id() == id2); assert(rhs.get_allocator().id() == id1); @@ -2149,8 +2139,8 @@ constexpr void test_swap(const size_t id1, const size_t id2) { Str rhs(get_cat_view(), Alloc{id2}); lhs.swap(rhs); - assert(equalRanges(lhs, get_cat_view())); - assert(equalRanges(rhs, get_dog_view())); + assert(ranges::equal(lhs, get_cat_view())); + assert(ranges::equal(rhs, get_dog_view())); assert(lhs.get_allocator().id() == id2); assert(rhs.get_allocator().id() == id1); @@ -2164,8 +2154,8 @@ constexpr void test_swap(const size_t id1, const size_t id2) { lhs.swap(rhs); assert(rhs_begin == lhs.begin()); - assert(equalRanges(lhs, get_view_input())); - assert(equalRanges(rhs, get_dog_view())); + assert(ranges::equal(lhs, get_view_input())); + assert(ranges::equal(rhs, get_dog_view())); assert(lhs.get_allocator().id() == id2); assert(rhs.get_allocator().id() == id1); @@ -2184,8 +2174,8 @@ constexpr void test_swap(const size_t id1, const size_t id2) { assert(lhs_begin == rhs.begin()); assert(rhs_begin == lhs.begin()); - assert(equalRanges(lhs, expected_lhs)); - assert(equalRanges(rhs, get_view_input())); + assert(ranges::equal(lhs, expected_lhs)); + assert(ranges::equal(rhs, get_view_input())); assert(lhs.get_allocator().id() == id2); assert(rhs.get_allocator().id() == id1);