1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03, c++11, c++14 11 // UNSUPPORTED: libcpp-no-exceptions, libcpp-no-if-constexpr 12 // MODULES_DEFINES: _LIBCPP_DEBUG=1 13 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS 14 15 // Can't test the system lib because this test enables debug mode 16 // UNSUPPORTED: with_system_cxx_lib 17 18 // test container debugging 19 20 #define _LIBCPP_DEBUG 1 21 #define _LIBCPP_DEBUG_USE_EXCEPTIONS 22 23 #include <map> 24 #include <set> 25 #include <utility> 26 #include <cassert> 27 #include "debug_mode_helper.h" 28 29 using namespace IteratorDebugChecks; 30 31 template <class Container, ContainerType CT> 32 struct AssociativeContainerChecks : BasicContainerChecks<Container, CT> { 33 using Base = BasicContainerChecks<Container, CT>; 34 using value_type = typename Container::value_type; 35 using iterator = typename Container::iterator; 36 using const_iterator = typename Container::const_iterator; 37 using traits = std::iterator_traits<iterator>; 38 using category = typename traits::iterator_category; 39 40 using Base::makeContainer; 41 public: 42 static void run() { 43 Base::run(); 44 try { 45 // FIXME Add tests 46 } catch (...) { 47 assert(false && "uncaught debug exception"); 48 } 49 } 50 51 private: 52 // FIXME Add tests here 53 }; 54 55 int main() 56 { 57 using SetAlloc = test_allocator<int>; 58 using MapAlloc = test_allocator<std::pair<const int, int>>; 59 // FIXME: Add debug mode to these containers 60 if ((false)) { 61 AssociativeContainerChecks< 62 std::set<int, std::less<int>, SetAlloc>, CT_Set>::run(); 63 AssociativeContainerChecks< 64 std::multiset<int, std::less<int>, SetAlloc>, CT_MultiSet>::run(); 65 AssociativeContainerChecks< 66 std::map<int, int, std::less<int>, MapAlloc>, CT_Map>::run(); 67 AssociativeContainerChecks< 68 std::multimap<int, int, std::less<int>, MapAlloc>, CT_MultiMap>::run(); 69 } 70 } 71