Skip to content

Commit

Permalink
Update libcxx/multiset
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Nov 25, 2023
1 parent c223a68 commit 02fe8ee
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/sources/LibcxxMultiSetTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,18 @@ LIBCXX_TEST_BEGIN(erasure_erase_if)
#include "libcxx/multiset/multiset.erasure/erase_if.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(nonmember_compare_three_way)
#include "libcxx/multiset/multiset.nonmember/compare.three_way.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(nonmember_op_compare)
#include "libcxx/multiset/multiset.nonmember/op_compare.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(observers_comp)
#include "libcxx/multiset/multiset.observers/comp.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(special_member_swap)
#include "libcxx/multiset/multiset.special/member_swap.pass.cpp"
LIBCXX_TEST_END
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// 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

// <set>

// class multiset

// template<class Key, class Compare, class Allocator>
// synth-three-way-result<Key> operator<=>(const multiset<Key, Compare, Allocator>& x,
// const multiset<Key, Compare, Allocator>& y);

int main(int, char**) {
assert(test_ordered_set_container_spaceship<std::multiset>());
// `std::multiset` is not constexpr, so no `static_assert` test here.
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//

// <set>

// template<class Key, class Compare, class Alloc>
// bool operator==(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);
//
// template<class Key, class Compare, class Alloc>
// bool operator!=(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);
//
// template<class Key, class Compare, class Alloc>
// bool operator<(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);
//
// template<class Key, class Compare, class Alloc>
// bool operator>(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);
//
// template<class Key, class Compare, class Alloc>
// bool operator<=(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);
//
// template<class Key, class Compare, class Alloc>
// bool operator>=(const std::multiset<Key, Compare, Alloc>& lhs,
// const std::multiset<Key, Compare, Alloc>& rhs);

int main(int, char**) {
{
std::multiset<int> s1, s2;
s1.insert(1);
s2.insert(2);
const std::multiset<int>& cs1 = s1, cs2 = s2;
assert(testComparisons(cs1, cs2, false, true));
}
{
std::multiset<int> s1, s2;
s1.insert(1);
s2.insert(1);
const std::multiset<int>& cs1 = s1, cs2 = s2;
assert(testComparisons(cs1, cs2, true, false));
}
{
std::multiset<int> s1, s2;
s1.insert(1);
s2.insert(1);
s2.insert(2);
const std::multiset<int>& cs1 = s1, cs2 = s2;
assert(testComparisons(cs1, cs2, false, true));
}
{
std::multiset<int> s1, s2;
s1.insert(1);
s2.insert(1);
s2.insert(1);
s2.insert(1);
const std::multiset<int>& cs1 = s1, cs2 = s2;
assert(testComparisons(cs1, cs2, false, true));
}
return 0;
}
38 changes: 38 additions & 0 deletions test/sources/libcxx/multiset/multiset.observers/comp.pass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//

// <set>

// key_compare key_comp() const;
// value_compare value_comp() const;

int main(int, char**) {
typedef std::multiset<int> set_type;

set_type s;
set_type::iterator i1 = s.insert(1);
set_type::iterator i2 = s.insert(2);

#ifndef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
i1 = s.find(1);
#endif

const set_type& cs = s;

assert(cs.key_comp()(*i1, *i2));
assert(!cs.key_comp()(*i2, *i1));

assert(cs.value_comp()(*i1, *i2));
assert(!cs.value_comp()(*i2, *i1));

return 0;
}

0 comments on commit 02fe8ee

Please sign in to comment.