1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 #include "../../../test_compare.h"
25 typedef std::set
<int> M
;
32 assert(m1
== m2_save
);
33 assert(m2
== m1_save
);
48 M
m2(ar2
, ar2
+sizeof(ar2
)/sizeof(ar2
[0]));
52 assert(m1
== m2_save
);
53 assert(m2
== m1_save
);
63 M
m1(ar1
, ar1
+sizeof(ar1
)/sizeof(ar1
[0]));
68 assert(m1
== m2_save
);
69 assert(m2
== m1_save
);
90 M
m1(ar1
, ar1
+sizeof(ar1
)/sizeof(ar1
[0]));
91 M
m2(ar2
, ar2
+sizeof(ar2
)/sizeof(ar2
[0]));
95 assert(m1
== m2_save
);
96 assert(m2
== m1_save
);
100 typedef test_allocator
<V
> A
;
101 typedef test_less
<int> C
;
102 typedef std::set
<int, C
, A
> M
;
121 M
m1(ar1
, ar1
+sizeof(ar1
)/sizeof(ar1
[0]), C(1), A(1, 1));
122 M
m2(ar2
, ar2
+sizeof(ar2
)/sizeof(ar2
[0]), C(2), A(1, 2));
126 assert(m1
== m2_save
);
127 assert(m2
== m1_save
);
128 assert(m1
.key_comp() == C(2));
129 assert(m1
.get_allocator().get_id() == 1);
130 assert(m2
.key_comp() == C(1));
131 assert(m2
.get_allocator().get_id() == 2);
134 typedef other_allocator
<V
> A
;
135 typedef test_less
<int> C
;
136 typedef std::set
<int, C
, A
> M
;
155 M
m1(ar1
, ar1
+sizeof(ar1
)/sizeof(ar1
[0]), C(1), A(1));
156 M
m2(ar2
, ar2
+sizeof(ar2
)/sizeof(ar2
[0]), C(2), A(2));
160 assert(m1
== m2_save
);
161 assert(m2
== m1_save
);
162 assert(m1
.key_comp() == C(2));
163 assert(m1
.get_allocator() == A(2));
164 assert(m2
.key_comp() == C(1));
165 assert(m2
.get_allocator() == A(1));