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 // <set> 11 12 // class multiset 13 14 // template <class InputIterator> 15 // multiset(InputIterator first, InputIterator last, 16 // const value_compare& comp, const allocator_type& a); 17 18 #include <set> 19 #include <cassert> 20 21 #include "test_iterators.h" 22 #include "../../../test_compare.h" 23 #include "../../../test_allocator.h" 24 25 int main() 26 { 27 typedef int V; 28 V ar[] = 29 { 30 1, 31 1, 32 1, 33 2, 34 2, 35 2, 36 3, 37 3, 38 3 39 }; 40 typedef test_compare<std::less<V> > C; 41 typedef test_allocator<V> A; 42 std::multiset<V, C, A> m(input_iterator<const V*>(ar), 43 input_iterator<const V*>(ar+sizeof(ar)/sizeof(ar[0])), 44 C(5), A(7)); 45 assert(m.value_comp() == C(5)); 46 assert(m.get_allocator() == A(7)); 47 assert(m.size() == 9); 48 assert(distance(m.begin(), m.end()) == 9); 49 assert(*next(m.begin(), 0) == 1); 50 assert(*next(m.begin(), 1) == 1); 51 assert(*next(m.begin(), 2) == 1); 52 assert(*next(m.begin(), 3) == 2); 53 assert(*next(m.begin(), 4) == 2); 54 assert(*next(m.begin(), 5) == 2); 55 assert(*next(m.begin(), 6) == 3); 56 assert(*next(m.begin(), 7) == 3); 57 assert(*next(m.begin(), 8) == 3); 58 } 59