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 // test container debugging
16 
17 #define _LIBCPP_DEBUG 1
18 #define _LIBCPP_DEBUG_USE_EXCEPTIONS
19 
20 #include <map>
21 #include <set>
22 #include <utility>
23 #include <cassert>
24 #include "debug_mode_helper.h"
25 
26 using namespace IteratorDebugChecks;
27 
28 template <class Container, ContainerType CT>
29 struct AssociativeContainerChecks : BasicContainerChecks<Container, CT> {
30   using Base = BasicContainerChecks<Container, CT>;
31   using value_type = typename Container::value_type;
32   using iterator = typename Container::iterator;
33   using const_iterator = typename Container::const_iterator;
34   using traits = std::iterator_traits<iterator>;
35   using category = typename traits::iterator_category;
36 
37   using Base::makeContainer;
38 public:
runAssociativeContainerChecks39   static void run() {
40     Base::run();
41     try {
42      // FIXME Add tests
43     } catch (...) {
44       assert(false && "uncaught debug exception");
45     }
46   }
47 
48 private:
49   // FIXME Add tests here
50 };
51 
main()52 int main()
53 {
54   using SetAlloc = test_allocator<int>;
55   using MapAlloc = test_allocator<std::pair<const int, int>>;
56   // FIXME: Add debug mode to these containers
57   if ((false)) {
58     AssociativeContainerChecks<
59         std::set<int, std::less<int>, SetAlloc>, CT_Set>::run();
60     AssociativeContainerChecks<
61         std::multiset<int, std::less<int>, SetAlloc>, CT_MultiSet>::run();
62     AssociativeContainerChecks<
63         std::map<int, int, std::less<int>, MapAlloc>, CT_Map>::run();
64     AssociativeContainerChecks<
65         std::multimap<int, int, std::less<int>, MapAlloc>, CT_MultiMap>::run();
66   }
67 }
68