Add tests for unordered container tests and std::string

llvm-svn: 290655
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 780b51df1de3edc87c988964de00971d646c8c19
diff --git a/include/string b/include/string
index 2e5ffc1..98f538c 100644
--- a/include/string
+++ b/include/string
@@ -1105,9 +1105,9 @@
     _LIBCPP_INLINE_VISIBILITY
     void swap(basic_string& __str)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT;
+        _NOEXCEPT_DEBUG;
 #else
-        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value);
 #endif
 
@@ -2996,9 +2996,9 @@
 void
 basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
 #if _LIBCPP_STD_VER >= 14
-        _NOEXCEPT
+        _NOEXCEPT_DEBUG
 #else
-        _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || 
+        _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value ||
                     __is_nothrow_swappable<allocator_type>::value)
 #endif
 {
@@ -3009,6 +3009,10 @@
         __get_db()->__invalidate_all(&__str);
     __get_db()->swap(this, &__str);
 #endif
+    _LIBCPP_ASSERT(
+        __alloc_traits::propagate_on_container_swap::value ||
+        __alloc_traits::is_always_equal::value ||
+        __alloc() == __str.__alloc(), "swapping non-equal allocators");
     _VSTD::swap(__r_.first(), __str.__r_.first());
     __swap_allocator(__alloc(), __str.__alloc());
 }