1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <string>
10 
11 // basic_string<charT,traits,Allocator>&
12 //   replace(const_iterator i1, const_iterator i2, basic_string_view<charT,traits> sv); // constexpr since C++20
13 
14 #include <string>
15 #include <algorithm>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "min_allocator.h"
20 
21 template <class S, class SV>
test(S s,typename S::size_type pos1,typename S::size_type n1,SV sv,S expected)22 TEST_CONSTEXPR_CXX20 void test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, S expected) {
23   typename S::size_type old_size   = s.size();
24   typename S::const_iterator first = s.begin() + pos1;
25   typename S::const_iterator last  = s.begin() + pos1 + n1;
26   typename S::size_type xlen       = last - first;
27   s.replace(first, last, sv);
28   LIBCPP_ASSERT(s.__invariants());
29   assert(s == expected);
30   typename S::size_type rlen = sv.size();
31   assert(s.size() == old_size - xlen + rlen);
32 }
33 
34 template <class S, class SV>
test0()35 TEST_CONSTEXPR_CXX20 bool test0() {
36   test(S(""), 0, 0, SV(""), S(""));
37   test(S(""), 0, 0, SV("12345"), S("12345"));
38   test(S(""), 0, 0, SV("1234567890"), S("1234567890"));
39   test(S(""), 0, 0, SV("12345678901234567890"), S("12345678901234567890"));
40   test(S("abcde"), 0, 0, SV(""), S("abcde"));
41   test(S("abcde"), 0, 0, SV("12345"), S("12345abcde"));
42   test(S("abcde"), 0, 0, SV("1234567890"), S("1234567890abcde"));
43   test(S("abcde"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcde"));
44   test(S("abcde"), 0, 1, SV(""), S("bcde"));
45   test(S("abcde"), 0, 1, SV("12345"), S("12345bcde"));
46   test(S("abcde"), 0, 1, SV("1234567890"), S("1234567890bcde"));
47   test(S("abcde"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcde"));
48   test(S("abcde"), 0, 2, SV(""), S("cde"));
49   test(S("abcde"), 0, 2, SV("12345"), S("12345cde"));
50   test(S("abcde"), 0, 2, SV("1234567890"), S("1234567890cde"));
51   test(S("abcde"), 0, 2, SV("12345678901234567890"), S("12345678901234567890cde"));
52   test(S("abcde"), 0, 4, SV(""), S("e"));
53   test(S("abcde"), 0, 4, SV("12345"), S("12345e"));
54   test(S("abcde"), 0, 4, SV("1234567890"), S("1234567890e"));
55   test(S("abcde"), 0, 4, SV("12345678901234567890"), S("12345678901234567890e"));
56   test(S("abcde"), 0, 5, SV(""), S(""));
57   test(S("abcde"), 0, 5, SV("12345"), S("12345"));
58   test(S("abcde"), 0, 5, SV("1234567890"), S("1234567890"));
59   test(S("abcde"), 0, 5, SV("12345678901234567890"), S("12345678901234567890"));
60   test(S("abcde"), 1, 0, SV(""), S("abcde"));
61   test(S("abcde"), 1, 0, SV("12345"), S("a12345bcde"));
62   test(S("abcde"), 1, 0, SV("1234567890"), S("a1234567890bcde"));
63   test(S("abcde"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcde"));
64   test(S("abcde"), 1, 1, SV(""), S("acde"));
65   test(S("abcde"), 1, 1, SV("12345"), S("a12345cde"));
66   test(S("abcde"), 1, 1, SV("1234567890"), S("a1234567890cde"));
67   test(S("abcde"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cde"));
68   test(S("abcde"), 1, 2, SV(""), S("ade"));
69   test(S("abcde"), 1, 2, SV("12345"), S("a12345de"));
70   test(S("abcde"), 1, 2, SV("1234567890"), S("a1234567890de"));
71   test(S("abcde"), 1, 2, SV("12345678901234567890"), S("a12345678901234567890de"));
72   test(S("abcde"), 1, 3, SV(""), S("ae"));
73   test(S("abcde"), 1, 3, SV("12345"), S("a12345e"));
74   test(S("abcde"), 1, 3, SV("1234567890"), S("a1234567890e"));
75   test(S("abcde"), 1, 3, SV("12345678901234567890"), S("a12345678901234567890e"));
76   test(S("abcde"), 1, 4, SV(""), S("a"));
77   test(S("abcde"), 1, 4, SV("12345"), S("a12345"));
78   test(S("abcde"), 1, 4, SV("1234567890"), S("a1234567890"));
79   test(S("abcde"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890"));
80   test(S("abcde"), 2, 0, SV(""), S("abcde"));
81   test(S("abcde"), 2, 0, SV("12345"), S("ab12345cde"));
82   test(S("abcde"), 2, 0, SV("1234567890"), S("ab1234567890cde"));
83   test(S("abcde"), 2, 0, SV("12345678901234567890"), S("ab12345678901234567890cde"));
84   test(S("abcde"), 2, 1, SV(""), S("abde"));
85   test(S("abcde"), 2, 1, SV("12345"), S("ab12345de"));
86   test(S("abcde"), 2, 1, SV("1234567890"), S("ab1234567890de"));
87   test(S("abcde"), 2, 1, SV("12345678901234567890"), S("ab12345678901234567890de"));
88   test(S("abcde"), 2, 2, SV(""), S("abe"));
89   test(S("abcde"), 2, 2, SV("12345"), S("ab12345e"));
90   test(S("abcde"), 2, 2, SV("1234567890"), S("ab1234567890e"));
91   test(S("abcde"), 2, 2, SV("12345678901234567890"), S("ab12345678901234567890e"));
92   test(S("abcde"), 2, 3, SV(""), S("ab"));
93   test(S("abcde"), 2, 3, SV("12345"), S("ab12345"));
94   test(S("abcde"), 2, 3, SV("1234567890"), S("ab1234567890"));
95   test(S("abcde"), 2, 3, SV("12345678901234567890"), S("ab12345678901234567890"));
96   test(S("abcde"), 4, 0, SV(""), S("abcde"));
97   test(S("abcde"), 4, 0, SV("12345"), S("abcd12345e"));
98   test(S("abcde"), 4, 0, SV("1234567890"), S("abcd1234567890e"));
99   test(S("abcde"), 4, 0, SV("12345678901234567890"), S("abcd12345678901234567890e"));
100   test(S("abcde"), 4, 1, SV(""), S("abcd"));
101   test(S("abcde"), 4, 1, SV("12345"), S("abcd12345"));
102   test(S("abcde"), 4, 1, SV("1234567890"), S("abcd1234567890"));
103   test(S("abcde"), 4, 1, SV("12345678901234567890"), S("abcd12345678901234567890"));
104   test(S("abcde"), 5, 0, SV(""), S("abcde"));
105   test(S("abcde"), 5, 0, SV("12345"), S("abcde12345"));
106   test(S("abcde"), 5, 0, SV("1234567890"), S("abcde1234567890"));
107   test(S("abcde"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890"));
108   test(S("abcdefghij"), 0, 0, SV(""), S("abcdefghij"));
109   test(S("abcdefghij"), 0, 0, SV("12345"), S("12345abcdefghij"));
110   test(S("abcdefghij"), 0, 0, SV("1234567890"), S("1234567890abcdefghij"));
111   test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghij"));
112   test(S("abcdefghij"), 0, 1, SV(""), S("bcdefghij"));
113   test(S("abcdefghij"), 0, 1, SV("12345"), S("12345bcdefghij"));
114   test(S("abcdefghij"), 0, 1, SV("1234567890"), S("1234567890bcdefghij"));
115   test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghij"));
116   test(S("abcdefghij"), 0, 5, SV(""), S("fghij"));
117   test(S("abcdefghij"), 0, 5, SV("12345"), S("12345fghij"));
118   test(S("abcdefghij"), 0, 5, SV("1234567890"), S("1234567890fghij"));
119   test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), S("12345678901234567890fghij"));
120   test(S("abcdefghij"), 0, 9, SV(""), S("j"));
121   test(S("abcdefghij"), 0, 9, SV("12345"), S("12345j"));
122   test(S("abcdefghij"), 0, 9, SV("1234567890"), S("1234567890j"));
123   test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), S("12345678901234567890j"));
124   test(S("abcdefghij"), 0, 10, SV(""), S(""));
125   test(S("abcdefghij"), 0, 10, SV("12345"), S("12345"));
126   test(S("abcdefghij"), 0, 10, SV("1234567890"), S("1234567890"));
127   test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), S("12345678901234567890"));
128   test(S("abcdefghij"), 1, 0, SV(""), S("abcdefghij"));
129   test(S("abcdefghij"), 1, 0, SV("12345"), S("a12345bcdefghij"));
130   test(S("abcdefghij"), 1, 0, SV("1234567890"), S("a1234567890bcdefghij"));
131   test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghij"));
132   test(S("abcdefghij"), 1, 1, SV(""), S("acdefghij"));
133   test(S("abcdefghij"), 1, 1, SV("12345"), S("a12345cdefghij"));
134   test(S("abcdefghij"), 1, 1, SV("1234567890"), S("a1234567890cdefghij"));
135   test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghij"));
136 
137   return true;
138 }
139 
140 template <class S, class SV>
test1()141 TEST_CONSTEXPR_CXX20 bool test1() {
142   test(S("abcdefghij"), 1, 4, SV(""), S("afghij"));
143   test(S("abcdefghij"), 1, 4, SV("12345"), S("a12345fghij"));
144   test(S("abcdefghij"), 1, 4, SV("1234567890"), S("a1234567890fghij"));
145   test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), S("a12345678901234567890fghij"));
146   test(S("abcdefghij"), 1, 8, SV(""), S("aj"));
147   test(S("abcdefghij"), 1, 8, SV("12345"), S("a12345j"));
148   test(S("abcdefghij"), 1, 8, SV("1234567890"), S("a1234567890j"));
149   test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), S("a12345678901234567890j"));
150   test(S("abcdefghij"), 1, 9, SV(""), S("a"));
151   test(S("abcdefghij"), 1, 9, SV("12345"), S("a12345"));
152   test(S("abcdefghij"), 1, 9, SV("1234567890"), S("a1234567890"));
153   test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890"));
154   test(S("abcdefghij"), 5, 0, SV(""), S("abcdefghij"));
155   test(S("abcdefghij"), 5, 0, SV("12345"), S("abcde12345fghij"));
156   test(S("abcdefghij"), 5, 0, SV("1234567890"), S("abcde1234567890fghij"));
157   test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), S("abcde12345678901234567890fghij"));
158   test(S("abcdefghij"), 5, 1, SV(""), S("abcdeghij"));
159   test(S("abcdefghij"), 5, 1, SV("12345"), S("abcde12345ghij"));
160   test(S("abcdefghij"), 5, 1, SV("1234567890"), S("abcde1234567890ghij"));
161   test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), S("abcde12345678901234567890ghij"));
162   test(S("abcdefghij"), 5, 2, SV(""), S("abcdehij"));
163   test(S("abcdefghij"), 5, 2, SV("12345"), S("abcde12345hij"));
164   test(S("abcdefghij"), 5, 2, SV("1234567890"), S("abcde1234567890hij"));
165   test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), S("abcde12345678901234567890hij"));
166   test(S("abcdefghij"), 5, 4, SV(""), S("abcdej"));
167   test(S("abcdefghij"), 5, 4, SV("12345"), S("abcde12345j"));
168   test(S("abcdefghij"), 5, 4, SV("1234567890"), S("abcde1234567890j"));
169   test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), S("abcde12345678901234567890j"));
170   test(S("abcdefghij"), 5, 5, SV(""), S("abcde"));
171   test(S("abcdefghij"), 5, 5, SV("12345"), S("abcde12345"));
172   test(S("abcdefghij"), 5, 5, SV("1234567890"), S("abcde1234567890"));
173   test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), S("abcde12345678901234567890"));
174   test(S("abcdefghij"), 9, 0, SV(""), S("abcdefghij"));
175   test(S("abcdefghij"), 9, 0, SV("12345"), S("abcdefghi12345j"));
176   test(S("abcdefghij"), 9, 0, SV("1234567890"), S("abcdefghi1234567890j"));
177   test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), S("abcdefghi12345678901234567890j"));
178   test(S("abcdefghij"), 9, 1, SV(""), S("abcdefghi"));
179   test(S("abcdefghij"), 9, 1, SV("12345"), S("abcdefghi12345"));
180   test(S("abcdefghij"), 9, 1, SV("1234567890"), S("abcdefghi1234567890"));
181   test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), S("abcdefghi12345678901234567890"));
182   test(S("abcdefghij"), 10, 0, SV(""), S("abcdefghij"));
183   test(S("abcdefghij"), 10, 0, SV("12345"), S("abcdefghij12345"));
184   test(S("abcdefghij"), 10, 0, SV("1234567890"), S("abcdefghij1234567890"));
185   test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
186   test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), S("abcdefghijklmnopqrst"));
187   test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), S("12345abcdefghijklmnopqrst"));
188   test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), S("1234567890abcdefghijklmnopqrst"));
189   test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), S("12345678901234567890abcdefghijklmnopqrst"));
190   test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), S("bcdefghijklmnopqrst"));
191   test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), S("12345bcdefghijklmnopqrst"));
192   test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), S("1234567890bcdefghijklmnopqrst"));
193   test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), S("12345678901234567890bcdefghijklmnopqrst"));
194   test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), S("klmnopqrst"));
195   test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), S("12345klmnopqrst"));
196   test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), S("1234567890klmnopqrst"));
197   test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), S("12345678901234567890klmnopqrst"));
198   test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), S("t"));
199   test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), S("12345t"));
200   test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), S("1234567890t"));
201   test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), S("12345678901234567890t"));
202   test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), S(""));
203   test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), S("12345"));
204   test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), S("1234567890"));
205   test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), S("12345678901234567890"));
206   test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), S("abcdefghijklmnopqrst"));
207   test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), S("a12345bcdefghijklmnopqrst"));
208   test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), S("a1234567890bcdefghijklmnopqrst"));
209   test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), S("a12345678901234567890bcdefghijklmnopqrst"));
210   test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), S("acdefghijklmnopqrst"));
211   test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), S("a12345cdefghijklmnopqrst"));
212   test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), S("a1234567890cdefghijklmnopqrst"));
213   test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), S("a12345678901234567890cdefghijklmnopqrst"));
214   test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), S("aklmnopqrst"));
215   test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), S("a12345klmnopqrst"));
216   test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), S("a1234567890klmnopqrst"));
217   test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), S("a12345678901234567890klmnopqrst"));
218   test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), S("at"));
219   test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), S("a12345t"));
220   test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), S("a1234567890t"));
221   test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), S("a12345678901234567890t"));
222   test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), S("a"));
223   test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), S("a12345"));
224   test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), S("a1234567890"));
225   test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), S("a12345678901234567890"));
226   test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), S("abcdefghijklmnopqrst"));
227   test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), S("abcdefghij12345klmnopqrst"));
228   test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), S("abcdefghij1234567890klmnopqrst"));
229   test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), S("abcdefghij12345678901234567890klmnopqrst"));
230   test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), S("abcdefghijlmnopqrst"));
231   test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), S("abcdefghij12345lmnopqrst"));
232   test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), S("abcdefghij1234567890lmnopqrst"));
233   test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), S("abcdefghij12345678901234567890lmnopqrst"));
234   test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), S("abcdefghijpqrst"));
235   test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), S("abcdefghij12345pqrst"));
236   test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), S("abcdefghij1234567890pqrst"));
237   test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), S("abcdefghij12345678901234567890pqrst"));
238   test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), S("abcdefghijt"));
239   test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), S("abcdefghij12345t"));
240   test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), S("abcdefghij1234567890t"));
241   test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), S("abcdefghij12345678901234567890t"));
242 
243   return true;
244 }
245 
246 template <class S, class SV>
test2()247 TEST_CONSTEXPR_CXX20 bool test2() {
248   test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), S("abcdefghij"));
249   test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), S("abcdefghij12345"));
250   test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), S("abcdefghij1234567890"));
251   test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), S("abcdefghij12345678901234567890"));
252   test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), S("abcdefghijklmnopqrst"));
253   test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), S("abcdefghijklmnopqrs12345t"));
254   test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), S("abcdefghijklmnopqrs1234567890t"));
255   test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890t"));
256   test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), S("abcdefghijklmnopqrs"));
257   test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), S("abcdefghijklmnopqrs12345"));
258   test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), S("abcdefghijklmnopqrs1234567890"));
259   test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), S("abcdefghijklmnopqrs12345678901234567890"));
260   test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), S("abcdefghijklmnopqrst"));
261   test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), S("abcdefghijklmnopqrst12345"));
262   test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), S("abcdefghijklmnopqrst1234567890"));
263   test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890"));
264 
265   return true;
266 }
267 
268 template <class CharT, template <class> class Alloc>
test()269 TEST_CONSTEXPR_CXX20 void test() {
270   using S  = std::basic_string<CharT, std::char_traits<CharT>, Alloc<CharT> >;
271   using SV = std::basic_string_view<CharT, std::char_traits<CharT> >;
272   test0<S, SV>();
273   test1<S, SV>();
274   test2<S, SV>();
275 #if TEST_STD_VER > 17
276   static_assert(test0<S, SV>());
277   static_assert(test1<S, SV>());
278   static_assert(test2<S, SV>());
279 #endif
280 }
281 
main(int,char **)282 int main(int, char**) {
283   test<char, std::allocator>();
284 #if TEST_STD_VER >= 11
285   test<char, min_allocator>();
286 #endif
287 
288   return 0;
289 }
290