Skip to content

Commit

Permalink
Update libcxx/map
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed Nov 26, 2023
1 parent 0985a13 commit 5d221ff
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
40 changes: 22 additions & 18 deletions test/sources/LibcxxMapTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,29 @@ LIBCXX_TEST_BEGIN(cons_deduct)
#include "libcxx/map/map.cons/deduct.pass.cpp"
LIBCXX_TEST_END

//LIBCXX_TEST_BEGIN(cons_deduct_const)
//#include "libcxx/map/map.cons/deduct_const.pass.cpp"
//LIBCXX_TEST_END
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
LIBCXX_TEST_BEGIN(cons_deduct_const)
#include "libcxx/map/map.cons/deduct_const.pass.cpp"
LIBCXX_TEST_END
#endif

LIBCXX_TEST_BEGIN(cons_default)
#include "libcxx/map/map.cons/default.pass.cpp"
LIBCXX_TEST_END

//LIBCXX_TEST_BEGIN(cons_default_noexcept)
//#include "libcxx/map/map.cons/default_noexcept.pass.cpp"
//LIBCXX_TEST_END
LIBCXX_TEST_BEGIN(cons_default_noexcept)
#include "libcxx/map/map.cons/default_noexcept.pass.cpp"
LIBCXX_TEST_END

//LIBCXX_TEST_BEGIN(cons_default_recursive)
//#include "libcxx/map/map.cons/default_recursive.pass.cpp"
//LIBCXX_TEST_END
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
LIBCXX_TEST_BEGIN(cons_default_recursive)
#include "libcxx/map/map.cons/default_recursive.pass.cpp"
LIBCXX_TEST_END
#endif

//LIBCXX_TEST_BEGIN(cons_dtor_noexcept)
//#include "libcxx/map/map.cons/dtor_noexcept.pass.cpp"
//LIBCXX_TEST_END
LIBCXX_TEST_BEGIN(cons_dtor_noexcept)
#include "libcxx/map/map.cons/dtor_noexcept.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(cons_initializer_list)
#include "libcxx/map/map.cons/initializer_list.pass.cpp"
Expand Down Expand Up @@ -152,13 +156,13 @@ LIBCXX_TEST_BEGIN(cons_move_assign)
#include "libcxx/map/map.cons/move_assign.pass.cpp"
LIBCXX_TEST_END

//LIBCXX_TEST_BEGIN(cons_move_assign_noexcept)
//#include "libcxx/map/map.cons/move_assign_noexcept.pass.cpp"
//LIBCXX_TEST_END
LIBCXX_TEST_BEGIN(cons_move_assign_noexcept)
#include "libcxx/map/map.cons/move_assign_noexcept.pass.cpp"
LIBCXX_TEST_END

//LIBCXX_TEST_BEGIN(cons_move_noexcept)
//#include "libcxx/map/map.cons/move_noexcept.pass.cpp"
//LIBCXX_TEST_END
LIBCXX_TEST_BEGIN(cons_move_noexcept)
#include "libcxx/map/map.cons/move_noexcept.pass.cpp"
LIBCXX_TEST_END

LIBCXX_TEST_BEGIN(erasure_erase_if)
#include "libcxx/map/map.erasure/erase_if.pass.cpp"
Expand Down
2 changes: 1 addition & 1 deletion test/sources/libcxx/map/map.access/max_size.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int, char**)
LIBCPP_ASSERT(c.max_size() == 10);
}
{
typedef limited_allocator<KV, (std::size_t)-1> A;
typedef limited_allocator<KV, static_cast<std::size_t>(-1)> A;
typedef std::map<int, int, std::less<int>, A> C;
const C::size_type max_dist =
static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
Expand Down
6 changes: 5 additions & 1 deletion test/sources/libcxx/map/map.cons/deduct.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,12 @@ int main(int, char**)

{
// Examples from LWG3025
#if !defined(TEST_GCC)
momo::stdish::map m{std::pair{1, 1}, {2, 2}, {3, 3}};
ASSERT_SAME_TYPE(decltype(m), momo::stdish::map<int, int>);
#endif

#if !defined(TEST_MSVC)
#if !defined(TEST_MSVC) && !defined(TEST_CLANG)
momo::stdish::map m2{m.begin(), m.end()};
ASSERT_SAME_TYPE(decltype(m2), momo::stdish::map<int, int>);
#endif
Expand All @@ -147,9 +149,11 @@ int main(int, char**)
momo::stdish::map m1{{std::pair{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m1), momo::stdish::map<int, int>);

#if !defined(TEST_GCC) && !defined(TEST_CLANG)
using value_type = std::pair<const int, int>;
momo::stdish::map m2{{value_type{1, 2}, {3, 4}}, std::less<int>()};
ASSERT_SAME_TYPE(decltype(m2), momo::stdish::map<int, int>);
#endif
}

AssociativeContainerDeductionGuidesSfinaeAway<momo::stdish::map, momo::stdish::map<int, long>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ int main(int, char**)
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
#endif // _LIBCPP_VERSION
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif

return 0;
}
2 changes: 2 additions & 0 deletions test/sources/libcxx/map/map.cons/move_noexcept.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ int main(int, char**)
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
#endif // _LIBCPP_VERSION
#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO
{
typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
#endif

return 0;
}

0 comments on commit 5d221ff

Please sign in to comment.