From adcb15f02f5e4cadaa9162eeb8e1a8ccd7ac7a95 Mon Sep 17 00:00:00 2001 From: morzhovets Date: Tue, 28 Nov 2023 21:17:07 +0400 Subject: [PATCH] Update libcxx/map --- test/sources/LibcxxMapTests.h | 4 ++ .../libcxx/map/iterator_types.pass.cpp | 68 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 test/sources/libcxx/map/iterator_types.pass.cpp diff --git a/test/sources/LibcxxMapTests.h b/test/sources/LibcxxMapTests.h index bf29919d..15352287 100644 --- a/test/sources/LibcxxMapTests.h +++ b/test/sources/LibcxxMapTests.h @@ -28,6 +28,10 @@ LIBCXX_TEST_BEGIN(iterator_concept_conformance) #include "libcxx/map/iterator_concept_conformance.compile.pass.cpp" LIBCXX_TEST_END +LIBCXX_TEST_BEGIN(iterator_types) +#include "libcxx/map/iterator_types.pass.cpp" +LIBCXX_TEST_END + LIBCXX_TEST_BEGIN(range_concept_conformance) #include "libcxx/map/range_concept_conformance.compile.pass.cpp" LIBCXX_TEST_END diff --git a/test/sources/libcxx/map/iterator_types.pass.cpp b/test/sources/libcxx/map/iterator_types.pass.cpp new file mode 100644 index 00000000..d17f2090 --- /dev/null +++ b/test/sources/libcxx/map/iterator_types.pass.cpp @@ -0,0 +1,68 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + + +template +void testMap() { + typedef typename Map::difference_type Diff; + { +#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO + typedef typename Map::iterator It; +#else + typedef std::iterator_traits It; +#endif +#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif + static_assert((std::is_same::value), ""); + } + { +#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO + typedef typename Map::const_iterator It; +#else + typedef std::iterator_traits It; +#endif +#ifdef LIBCPP_HAS_BAD_NEWS_FOR_MOMO + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif + static_assert((std::is_same::value), ""); + } +} + + +int main(int, char**) { + { + typedef std::map Map; + typedef std::pair ValueTp; + testMap(); + } + { + typedef std::pair ValueTp; + typedef test_allocator Alloc; + typedef std::map, Alloc> Map; + testMap(); + } +#if TEST_STD_VER >= 11 + { + typedef std::pair ValueTp; + typedef min_allocator Alloc; + typedef std::map, Alloc> Map; + testMap, min_pointer>(); + } +#endif + + return 0; +}