-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b9a4cb
commit 8c6faed
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/sources/libcxx/multimap/multimap.cons/from_range.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Modified for https://github.com/morzhovets/momo project. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 | ||
|
||
// template<container-compatible-range<value_type> R> | ||
// multimap(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23 | ||
// | ||
// template<container-compatible-range<value_type> R> | ||
// multimap(from_range_t, R&& rg, const Allocator& a)) | ||
// : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23 | ||
|
||
void test_duplicates() { | ||
using T = std::pair<const int, char>; | ||
std::array input = { | ||
T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'} | ||
}; | ||
auto c = std::multimap<int, char>(std::from_range, input); | ||
assert(std::ranges::is_permutation(input, c)); | ||
} | ||
|
||
int main(int, char**) { | ||
using T = std::pair<const int, int>; | ||
for_all_iterators_and_allocators<T>([]<class Iter, class Sent, class Alloc>() { | ||
test_associative_map<std::multimap, int, int, Iter, Sent, test_less<int>, Alloc>(); | ||
}); | ||
test_associative_map_move_only<std::multimap>(); | ||
test_duplicates(); | ||
|
||
static_assert(test_map_constraints<std::multimap, int, int, double, double>()); | ||
|
||
test_map_exception_safety_throwing_copy<std::multimap>(); | ||
test_map_exception_safety_throwing_allocator<std::multimap, int, int>(); | ||
|
||
return 0; | ||
} |
40 changes: 40 additions & 0 deletions
40
test/sources/libcxx/multimap/multimap.modifiers/insert_range.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Modified for https://github.com/morzhovets/momo project. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 | ||
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC. | ||
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers | ||
|
||
// <map> | ||
|
||
// template<container-compatible-range<value_type> R> | ||
// void insert_range(R&& rg); // C++23 | ||
|
||
int main(int, char**) { | ||
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but | ||
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator. | ||
using Pair = std::pair<int, char>; | ||
using ConstPair = std::pair<const int, char>; | ||
for_all_iterators_and_allocators<ConstPair, const Pair*>([]<class Iter, class Sent, class Alloc>() { | ||
test_map_set_insert_range<std::multimap<int, char, test_less<int>, Alloc>, Pair, Iter, Sent>(/*allow_duplicates=*/true); | ||
}); | ||
|
||
static_assert(test_map_constraints_insert_range<std::multimap, int, int, char, double>()); | ||
|
||
test_map_insert_range_move_only<std::multimap>(); | ||
|
||
test_map_insert_range_exception_safety_throwing_copy<std::multimap>(); | ||
test_assoc_map_insert_range_exception_safety_throwing_allocator<std::multimap, int, int>(); | ||
|
||
return 0; | ||
} | ||
|