1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // XFAIL: libcpp-no-exceptions
13 // basic_string<charT,traits,Allocator>&
14 // replace(size_type pos, size_type n1, const charT* s, size_type n2);
23 #include "min_allocator.h"
27 test(S s, typename S::size_type pos, typename S::size_type n1,
28 const typename S::value_type* str, typename S::size_type n2,
31 typename S::size_type old_size = s.size();
35 s.replace(pos, n1, str, n2);
36 assert(s.__invariants());
37 assert(pos <= old_size);
38 assert(s == expected);
39 typename S::size_type xlen = std::min(n1, old_size - pos);
40 typename S::size_type rlen = n2;
41 assert(s.size() == old_size - xlen + rlen);
43 catch (std::out_of_range&)
45 assert(pos > old_size);
53 test(S(""), 0, 0, "", 0, S(""));
54 test(S(""), 0, 0, "12345", 0, S(""));
55 test(S(""), 0, 0, "12345", 1, S("1"));
56 test(S(""), 0, 0, "12345", 2, S("12"));
57 test(S(""), 0, 0, "12345", 4, S("1234"));
58 test(S(""), 0, 0, "12345", 5, S("12345"));
59 test(S(""), 0, 0, "1234567890", 0, S(""));
60 test(S(""), 0, 0, "1234567890", 1, S("1"));
61 test(S(""), 0, 0, "1234567890", 5, S("12345"));
62 test(S(""), 0, 0, "1234567890", 9, S("123456789"));
63 test(S(""), 0, 0, "1234567890", 10, S("1234567890"));
64 test(S(""), 0, 0, "12345678901234567890", 0, S(""));
65 test(S(""), 0, 0, "12345678901234567890", 1, S("1"));
66 test(S(""), 0, 0, "12345678901234567890", 10, S("1234567890"));
67 test(S(""), 0, 0, "12345678901234567890", 19, S("1234567890123456789"));
68 test(S(""), 0, 0, "12345678901234567890", 20, S("12345678901234567890"));
69 test(S(""), 0, 1, "", 0, S(""));
70 test(S(""), 0, 1, "12345", 0, S(""));
71 test(S(""), 0, 1, "12345", 1, S("1"));
72 test(S(""), 0, 1, "12345", 2, S("12"));
73 test(S(""), 0, 1, "12345", 4, S("1234"));
74 test(S(""), 0, 1, "12345", 5, S("12345"));
75 test(S(""), 0, 1, "1234567890", 0, S(""));
76 test(S(""), 0, 1, "1234567890", 1, S("1"));
77 test(S(""), 0, 1, "1234567890", 5, S("12345"));
78 test(S(""), 0, 1, "1234567890", 9, S("123456789"));
79 test(S(""), 0, 1, "1234567890", 10, S("1234567890"));
80 test(S(""), 0, 1, "12345678901234567890", 0, S(""));
81 test(S(""), 0, 1, "12345678901234567890", 1, S("1"));
82 test(S(""), 0, 1, "12345678901234567890", 10, S("1234567890"));
83 test(S(""), 0, 1, "12345678901234567890", 19, S("1234567890123456789"));
84 test(S(""), 0, 1, "12345678901234567890", 20, S("12345678901234567890"));
85 test(S(""), 1, 0, "", 0, S("can't happen"));
86 test(S(""), 1, 0, "12345", 0, S("can't happen"));
87 test(S(""), 1, 0, "12345", 1, S("can't happen"));
88 test(S(""), 1, 0, "12345", 2, S("can't happen"));
89 test(S(""), 1, 0, "12345", 4, S("can't happen"));
90 test(S(""), 1, 0, "12345", 5, S("can't happen"));
91 test(S(""), 1, 0, "1234567890", 0, S("can't happen"));
92 test(S(""), 1, 0, "1234567890", 1, S("can't happen"));
93 test(S(""), 1, 0, "1234567890", 5, S("can't happen"));
94 test(S(""), 1, 0, "1234567890", 9, S("can't happen"));
95 test(S(""), 1, 0, "1234567890", 10, S("can't happen"));
96 test(S(""), 1, 0, "12345678901234567890", 0, S("can't happen"));
97 test(S(""), 1, 0, "12345678901234567890", 1, S("can't happen"));
98 test(S(""), 1, 0, "12345678901234567890", 10, S("can't happen"));
99 test(S(""), 1, 0, "12345678901234567890", 19, S("can't happen"));
100 test(S(""), 1, 0, "12345678901234567890", 20, S("can't happen"));
101 test(S("abcde"), 0, 0, "", 0, S("abcde"));
102 test(S("abcde"), 0, 0, "12345", 0, S("abcde"));
103 test(S("abcde"), 0, 0, "12345", 1, S("1abcde"));
104 test(S("abcde"), 0, 0, "12345", 2, S("12abcde"));
105 test(S("abcde"), 0, 0, "12345", 4, S("1234abcde"));
106 test(S("abcde"), 0, 0, "12345", 5, S("12345abcde"));
107 test(S("abcde"), 0, 0, "1234567890", 0, S("abcde"));
108 test(S("abcde"), 0, 0, "1234567890", 1, S("1abcde"));
109 test(S("abcde"), 0, 0, "1234567890", 5, S("12345abcde"));
110 test(S("abcde"), 0, 0, "1234567890", 9, S("123456789abcde"));
111 test(S("abcde"), 0, 0, "1234567890", 10, S("1234567890abcde"));
112 test(S("abcde"), 0, 0, "12345678901234567890", 0, S("abcde"));
113 test(S("abcde"), 0, 0, "12345678901234567890", 1, S("1abcde"));
114 test(S("abcde"), 0, 0, "12345678901234567890", 10, S("1234567890abcde"));
115 test(S("abcde"), 0, 0, "12345678901234567890", 19, S("1234567890123456789abcde"));
116 test(S("abcde"), 0, 0, "12345678901234567890", 20, S("12345678901234567890abcde"));
117 test(S("abcde"), 0, 1, "", 0, S("bcde"));
118 test(S("abcde"), 0, 1, "12345", 0, S("bcde"));
119 test(S("abcde"), 0, 1, "12345", 1, S("1bcde"));
120 test(S("abcde"), 0, 1, "12345", 2, S("12bcde"));
121 test(S("abcde"), 0, 1, "12345", 4, S("1234bcde"));
122 test(S("abcde"), 0, 1, "12345", 5, S("12345bcde"));
123 test(S("abcde"), 0, 1, "1234567890", 0, S("bcde"));
124 test(S("abcde"), 0, 1, "1234567890", 1, S("1bcde"));
125 test(S("abcde"), 0, 1, "1234567890", 5, S("12345bcde"));
126 test(S("abcde"), 0, 1, "1234567890", 9, S("123456789bcde"));
127 test(S("abcde"), 0, 1, "1234567890", 10, S("1234567890bcde"));
128 test(S("abcde"), 0, 1, "12345678901234567890", 0, S("bcde"));
129 test(S("abcde"), 0, 1, "12345678901234567890", 1, S("1bcde"));
130 test(S("abcde"), 0, 1, "12345678901234567890", 10, S("1234567890bcde"));
131 test(S("abcde"), 0, 1, "12345678901234567890", 19, S("1234567890123456789bcde"));
132 test(S("abcde"), 0, 1, "12345678901234567890", 20, S("12345678901234567890bcde"));
133 test(S("abcde"), 0, 2, "", 0, S("cde"));
134 test(S("abcde"), 0, 2, "12345", 0, S("cde"));
135 test(S("abcde"), 0, 2, "12345", 1, S("1cde"));
136 test(S("abcde"), 0, 2, "12345", 2, S("12cde"));
137 test(S("abcde"), 0, 2, "12345", 4, S("1234cde"));
138 test(S("abcde"), 0, 2, "12345", 5, S("12345cde"));
139 test(S("abcde"), 0, 2, "1234567890", 0, S("cde"));
140 test(S("abcde"), 0, 2, "1234567890", 1, S("1cde"));
141 test(S("abcde"), 0, 2, "1234567890", 5, S("12345cde"));
142 test(S("abcde"), 0, 2, "1234567890", 9, S("123456789cde"));
143 test(S("abcde"), 0, 2, "1234567890", 10, S("1234567890cde"));
144 test(S("abcde"), 0, 2, "12345678901234567890", 0, S("cde"));
145 test(S("abcde"), 0, 2, "12345678901234567890", 1, S("1cde"));
146 test(S("abcde"), 0, 2, "12345678901234567890", 10, S("1234567890cde"));
147 test(S("abcde"), 0, 2, "12345678901234567890", 19, S("1234567890123456789cde"));
148 test(S("abcde"), 0, 2, "12345678901234567890", 20, S("12345678901234567890cde"));
149 test(S("abcde"), 0, 4, "", 0, S("e"));
150 test(S("abcde"), 0, 4, "12345", 0, S("e"));
151 test(S("abcde"), 0, 4, "12345", 1, S("1e"));
152 test(S("abcde"), 0, 4, "12345", 2, S("12e"));
158 test(S("abcde"), 0, 4, "12345", 4, S("1234e"));
159 test(S("abcde"), 0, 4, "12345", 5, S("12345e"));
160 test(S("abcde"), 0, 4, "1234567890", 0, S("e"));
161 test(S("abcde"), 0, 4, "1234567890", 1, S("1e"));
162 test(S("abcde"), 0, 4, "1234567890", 5, S("12345e"));
163 test(S("abcde"), 0, 4, "1234567890", 9, S("123456789e"));
164 test(S("abcde"), 0, 4, "1234567890", 10, S("1234567890e"));
165 test(S("abcde"), 0, 4, "12345678901234567890", 0, S("e"));
166 test(S("abcde"), 0, 4, "12345678901234567890", 1, S("1e"));
167 test(S("abcde"), 0, 4, "12345678901234567890", 10, S("1234567890e"));
168 test(S("abcde"), 0, 4, "12345678901234567890", 19, S("1234567890123456789e"));
169 test(S("abcde"), 0, 4, "12345678901234567890", 20, S("12345678901234567890e"));
170 test(S("abcde"), 0, 5, "", 0, S(""));
171 test(S("abcde"), 0, 5, "12345", 0, S(""));
172 test(S("abcde"), 0, 5, "12345", 1, S("1"));
173 test(S("abcde"), 0, 5, "12345", 2, S("12"));
174 test(S("abcde"), 0, 5, "12345", 4, S("1234"));
175 test(S("abcde"), 0, 5, "12345", 5, S("12345"));
176 test(S("abcde"), 0, 5, "1234567890", 0, S(""));
177 test(S("abcde"), 0, 5, "1234567890", 1, S("1"));
178 test(S("abcde"), 0, 5, "1234567890", 5, S("12345"));
179 test(S("abcde"), 0, 5, "1234567890", 9, S("123456789"));
180 test(S("abcde"), 0, 5, "1234567890", 10, S("1234567890"));
181 test(S("abcde"), 0, 5, "12345678901234567890", 0, S(""));
182 test(S("abcde"), 0, 5, "12345678901234567890", 1, S("1"));
183 test(S("abcde"), 0, 5, "12345678901234567890", 10, S("1234567890"));
184 test(S("abcde"), 0, 5, "12345678901234567890", 19, S("1234567890123456789"));
185 test(S("abcde"), 0, 5, "12345678901234567890", 20, S("12345678901234567890"));
186 test(S("abcde"), 0, 6, "", 0, S(""));
187 test(S("abcde"), 0, 6, "12345", 0, S(""));
188 test(S("abcde"), 0, 6, "12345", 1, S("1"));
189 test(S("abcde"), 0, 6, "12345", 2, S("12"));
190 test(S("abcde"), 0, 6, "12345", 4, S("1234"));
191 test(S("abcde"), 0, 6, "12345", 5, S("12345"));
192 test(S("abcde"), 0, 6, "1234567890", 0, S(""));
193 test(S("abcde"), 0, 6, "1234567890", 1, S("1"));
194 test(S("abcde"), 0, 6, "1234567890", 5, S("12345"));
195 test(S("abcde"), 0, 6, "1234567890", 9, S("123456789"));
196 test(S("abcde"), 0, 6, "1234567890", 10, S("1234567890"));
197 test(S("abcde"), 0, 6, "12345678901234567890", 0, S(""));
198 test(S("abcde"), 0, 6, "12345678901234567890", 1, S("1"));
199 test(S("abcde"), 0, 6, "12345678901234567890", 10, S("1234567890"));
200 test(S("abcde"), 0, 6, "12345678901234567890", 19, S("1234567890123456789"));
201 test(S("abcde"), 0, 6, "12345678901234567890", 20, S("12345678901234567890"));
202 test(S("abcde"), 1, 0, "", 0, S("abcde"));
203 test(S("abcde"), 1, 0, "12345", 0, S("abcde"));
204 test(S("abcde"), 1, 0, "12345", 1, S("a1bcde"));
205 test(S("abcde"), 1, 0, "12345", 2, S("a12bcde"));
206 test(S("abcde"), 1, 0, "12345", 4, S("a1234bcde"));
207 test(S("abcde"), 1, 0, "12345", 5, S("a12345bcde"));
208 test(S("abcde"), 1, 0, "1234567890", 0, S("abcde"));
209 test(S("abcde"), 1, 0, "1234567890", 1, S("a1bcde"));
210 test(S("abcde"), 1, 0, "1234567890", 5, S("a12345bcde"));
211 test(S("abcde"), 1, 0, "1234567890", 9, S("a123456789bcde"));
212 test(S("abcde"), 1, 0, "1234567890", 10, S("a1234567890bcde"));
213 test(S("abcde"), 1, 0, "12345678901234567890", 0, S("abcde"));
214 test(S("abcde"), 1, 0, "12345678901234567890", 1, S("a1bcde"));
215 test(S("abcde"), 1, 0, "12345678901234567890", 10, S("a1234567890bcde"));
216 test(S("abcde"), 1, 0, "12345678901234567890", 19, S("a1234567890123456789bcde"));
217 test(S("abcde"), 1, 0, "12345678901234567890", 20, S("a12345678901234567890bcde"));
218 test(S("abcde"), 1, 1, "", 0, S("acde"));
219 test(S("abcde"), 1, 1, "12345", 0, S("acde"));
220 test(S("abcde"), 1, 1, "12345", 1, S("a1cde"));
221 test(S("abcde"), 1, 1, "12345", 2, S("a12cde"));
222 test(S("abcde"), 1, 1, "12345", 4, S("a1234cde"));
223 test(S("abcde"), 1, 1, "12345", 5, S("a12345cde"));
224 test(S("abcde"), 1, 1, "1234567890", 0, S("acde"));
225 test(S("abcde"), 1, 1, "1234567890", 1, S("a1cde"));
226 test(S("abcde"), 1, 1, "1234567890", 5, S("a12345cde"));
227 test(S("abcde"), 1, 1, "1234567890", 9, S("a123456789cde"));
228 test(S("abcde"), 1, 1, "1234567890", 10, S("a1234567890cde"));
229 test(S("abcde"), 1, 1, "12345678901234567890", 0, S("acde"));
230 test(S("abcde"), 1, 1, "12345678901234567890", 1, S("a1cde"));
231 test(S("abcde"), 1, 1, "12345678901234567890", 10, S("a1234567890cde"));
232 test(S("abcde"), 1, 1, "12345678901234567890", 19, S("a1234567890123456789cde"));
233 test(S("abcde"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cde"));
234 test(S("abcde"), 1, 2, "", 0, S("ade"));
235 test(S("abcde"), 1, 2, "12345", 0, S("ade"));
236 test(S("abcde"), 1, 2, "12345", 1, S("a1de"));
237 test(S("abcde"), 1, 2, "12345", 2, S("a12de"));
238 test(S("abcde"), 1, 2, "12345", 4, S("a1234de"));
239 test(S("abcde"), 1, 2, "12345", 5, S("a12345de"));
240 test(S("abcde"), 1, 2, "1234567890", 0, S("ade"));
241 test(S("abcde"), 1, 2, "1234567890", 1, S("a1de"));
242 test(S("abcde"), 1, 2, "1234567890", 5, S("a12345de"));
243 test(S("abcde"), 1, 2, "1234567890", 9, S("a123456789de"));
244 test(S("abcde"), 1, 2, "1234567890", 10, S("a1234567890de"));
245 test(S("abcde"), 1, 2, "12345678901234567890", 0, S("ade"));
246 test(S("abcde"), 1, 2, "12345678901234567890", 1, S("a1de"));
247 test(S("abcde"), 1, 2, "12345678901234567890", 10, S("a1234567890de"));
248 test(S("abcde"), 1, 2, "12345678901234567890", 19, S("a1234567890123456789de"));
249 test(S("abcde"), 1, 2, "12345678901234567890", 20, S("a12345678901234567890de"));
250 test(S("abcde"), 1, 3, "", 0, S("ae"));
251 test(S("abcde"), 1, 3, "12345", 0, S("ae"));
252 test(S("abcde"), 1, 3, "12345", 1, S("a1e"));
253 test(S("abcde"), 1, 3, "12345", 2, S("a12e"));
254 test(S("abcde"), 1, 3, "12345", 4, S("a1234e"));
255 test(S("abcde"), 1, 3, "12345", 5, S("a12345e"));
256 test(S("abcde"), 1, 3, "1234567890", 0, S("ae"));
257 test(S("abcde"), 1, 3, "1234567890", 1, S("a1e"));
263 test(S("abcde"), 1, 3, "1234567890", 5, S("a12345e"));
264 test(S("abcde"), 1, 3, "1234567890", 9, S("a123456789e"));
265 test(S("abcde"), 1, 3, "1234567890", 10, S("a1234567890e"));
266 test(S("abcde"), 1, 3, "12345678901234567890", 0, S("ae"));
267 test(S("abcde"), 1, 3, "12345678901234567890", 1, S("a1e"));
268 test(S("abcde"), 1, 3, "12345678901234567890", 10, S("a1234567890e"));
269 test(S("abcde"), 1, 3, "12345678901234567890", 19, S("a1234567890123456789e"));
270 test(S("abcde"), 1, 3, "12345678901234567890", 20, S("a12345678901234567890e"));
271 test(S("abcde"), 1, 4, "", 0, S("a"));
272 test(S("abcde"), 1, 4, "12345", 0, S("a"));
273 test(S("abcde"), 1, 4, "12345", 1, S("a1"));
274 test(S("abcde"), 1, 4, "12345", 2, S("a12"));
275 test(S("abcde"), 1, 4, "12345", 4, S("a1234"));
276 test(S("abcde"), 1, 4, "12345", 5, S("a12345"));
277 test(S("abcde"), 1, 4, "1234567890", 0, S("a"));
278 test(S("abcde"), 1, 4, "1234567890", 1, S("a1"));
279 test(S("abcde"), 1, 4, "1234567890", 5, S("a12345"));
280 test(S("abcde"), 1, 4, "1234567890", 9, S("a123456789"));
281 test(S("abcde"), 1, 4, "1234567890", 10, S("a1234567890"));
282 test(S("abcde"), 1, 4, "12345678901234567890", 0, S("a"));
283 test(S("abcde"), 1, 4, "12345678901234567890", 1, S("a1"));
284 test(S("abcde"), 1, 4, "12345678901234567890", 10, S("a1234567890"));
285 test(S("abcde"), 1, 4, "12345678901234567890", 19, S("a1234567890123456789"));
286 test(S("abcde"), 1, 4, "12345678901234567890", 20, S("a12345678901234567890"));
287 test(S("abcde"), 1, 5, "", 0, S("a"));
288 test(S("abcde"), 1, 5, "12345", 0, S("a"));
289 test(S("abcde"), 1, 5, "12345", 1, S("a1"));
290 test(S("abcde"), 1, 5, "12345", 2, S("a12"));
291 test(S("abcde"), 1, 5, "12345", 4, S("a1234"));
292 test(S("abcde"), 1, 5, "12345", 5, S("a12345"));
293 test(S("abcde"), 1, 5, "1234567890", 0, S("a"));
294 test(S("abcde"), 1, 5, "1234567890", 1, S("a1"));
295 test(S("abcde"), 1, 5, "1234567890", 5, S("a12345"));
296 test(S("abcde"), 1, 5, "1234567890", 9, S("a123456789"));
297 test(S("abcde"), 1, 5, "1234567890", 10, S("a1234567890"));
298 test(S("abcde"), 1, 5, "12345678901234567890", 0, S("a"));
299 test(S("abcde"), 1, 5, "12345678901234567890", 1, S("a1"));
300 test(S("abcde"), 1, 5, "12345678901234567890", 10, S("a1234567890"));
301 test(S("abcde"), 1, 5, "12345678901234567890", 19, S("a1234567890123456789"));
302 test(S("abcde"), 1, 5, "12345678901234567890", 20, S("a12345678901234567890"));
303 test(S("abcde"), 2, 0, "", 0, S("abcde"));
304 test(S("abcde"), 2, 0, "12345", 0, S("abcde"));
305 test(S("abcde"), 2, 0, "12345", 1, S("ab1cde"));
306 test(S("abcde"), 2, 0, "12345", 2, S("ab12cde"));
307 test(S("abcde"), 2, 0, "12345", 4, S("ab1234cde"));
308 test(S("abcde"), 2, 0, "12345", 5, S("ab12345cde"));
309 test(S("abcde"), 2, 0, "1234567890", 0, S("abcde"));
310 test(S("abcde"), 2, 0, "1234567890", 1, S("ab1cde"));
311 test(S("abcde"), 2, 0, "1234567890", 5, S("ab12345cde"));
312 test(S("abcde"), 2, 0, "1234567890", 9, S("ab123456789cde"));
313 test(S("abcde"), 2, 0, "1234567890", 10, S("ab1234567890cde"));
314 test(S("abcde"), 2, 0, "12345678901234567890", 0, S("abcde"));
315 test(S("abcde"), 2, 0, "12345678901234567890", 1, S("ab1cde"));
316 test(S("abcde"), 2, 0, "12345678901234567890", 10, S("ab1234567890cde"));
317 test(S("abcde"), 2, 0, "12345678901234567890", 19, S("ab1234567890123456789cde"));
318 test(S("abcde"), 2, 0, "12345678901234567890", 20, S("ab12345678901234567890cde"));
319 test(S("abcde"), 2, 1, "", 0, S("abde"));
320 test(S("abcde"), 2, 1, "12345", 0, S("abde"));
321 test(S("abcde"), 2, 1, "12345", 1, S("ab1de"));
322 test(S("abcde"), 2, 1, "12345", 2, S("ab12de"));
323 test(S("abcde"), 2, 1, "12345", 4, S("ab1234de"));
324 test(S("abcde"), 2, 1, "12345", 5, S("ab12345de"));
325 test(S("abcde"), 2, 1, "1234567890", 0, S("abde"));
326 test(S("abcde"), 2, 1, "1234567890", 1, S("ab1de"));
327 test(S("abcde"), 2, 1, "1234567890", 5, S("ab12345de"));
328 test(S("abcde"), 2, 1, "1234567890", 9, S("ab123456789de"));
329 test(S("abcde"), 2, 1, "1234567890", 10, S("ab1234567890de"));
330 test(S("abcde"), 2, 1, "12345678901234567890", 0, S("abde"));
331 test(S("abcde"), 2, 1, "12345678901234567890", 1, S("ab1de"));
332 test(S("abcde"), 2, 1, "12345678901234567890", 10, S("ab1234567890de"));
333 test(S("abcde"), 2, 1, "12345678901234567890", 19, S("ab1234567890123456789de"));
334 test(S("abcde"), 2, 1, "12345678901234567890", 20, S("ab12345678901234567890de"));
335 test(S("abcde"), 2, 2, "", 0, S("abe"));
336 test(S("abcde"), 2, 2, "12345", 0, S("abe"));
337 test(S("abcde"), 2, 2, "12345", 1, S("ab1e"));
338 test(S("abcde"), 2, 2, "12345", 2, S("ab12e"));
339 test(S("abcde"), 2, 2, "12345", 4, S("ab1234e"));
340 test(S("abcde"), 2, 2, "12345", 5, S("ab12345e"));
341 test(S("abcde"), 2, 2, "1234567890", 0, S("abe"));
342 test(S("abcde"), 2, 2, "1234567890", 1, S("ab1e"));
343 test(S("abcde"), 2, 2, "1234567890", 5, S("ab12345e"));
344 test(S("abcde"), 2, 2, "1234567890", 9, S("ab123456789e"));
345 test(S("abcde"), 2, 2, "1234567890", 10, S("ab1234567890e"));
346 test(S("abcde"), 2, 2, "12345678901234567890", 0, S("abe"));
347 test(S("abcde"), 2, 2, "12345678901234567890", 1, S("ab1e"));
348 test(S("abcde"), 2, 2, "12345678901234567890", 10, S("ab1234567890e"));
349 test(S("abcde"), 2, 2, "12345678901234567890", 19, S("ab1234567890123456789e"));
350 test(S("abcde"), 2, 2, "12345678901234567890", 20, S("ab12345678901234567890e"));
351 test(S("abcde"), 2, 3, "", 0, S("ab"));
352 test(S("abcde"), 2, 3, "12345", 0, S("ab"));
353 test(S("abcde"), 2, 3, "12345", 1, S("ab1"));
354 test(S("abcde"), 2, 3, "12345", 2, S("ab12"));
355 test(S("abcde"), 2, 3, "12345", 4, S("ab1234"));
356 test(S("abcde"), 2, 3, "12345", 5, S("ab12345"));
357 test(S("abcde"), 2, 3, "1234567890", 0, S("ab"));
358 test(S("abcde"), 2, 3, "1234567890", 1, S("ab1"));
359 test(S("abcde"), 2, 3, "1234567890", 5, S("ab12345"));
360 test(S("abcde"), 2, 3, "1234567890", 9, S("ab123456789"));
361 test(S("abcde"), 2, 3, "1234567890", 10, S("ab1234567890"));
362 test(S("abcde"), 2, 3, "12345678901234567890", 0, S("ab"));
368 test(S("abcde"), 2, 3, "12345678901234567890", 1, S("ab1"));
369 test(S("abcde"), 2, 3, "12345678901234567890", 10, S("ab1234567890"));
370 test(S("abcde"), 2, 3, "12345678901234567890", 19, S("ab1234567890123456789"));
371 test(S("abcde"), 2, 3, "12345678901234567890", 20, S("ab12345678901234567890"));
372 test(S("abcde"), 2, 4, "", 0, S("ab"));
373 test(S("abcde"), 2, 4, "12345", 0, S("ab"));
374 test(S("abcde"), 2, 4, "12345", 1, S("ab1"));
375 test(S("abcde"), 2, 4, "12345", 2, S("ab12"));
376 test(S("abcde"), 2, 4, "12345", 4, S("ab1234"));
377 test(S("abcde"), 2, 4, "12345", 5, S("ab12345"));
378 test(S("abcde"), 2, 4, "1234567890", 0, S("ab"));
379 test(S("abcde"), 2, 4, "1234567890", 1, S("ab1"));
380 test(S("abcde"), 2, 4, "1234567890", 5, S("ab12345"));
381 test(S("abcde"), 2, 4, "1234567890", 9, S("ab123456789"));
382 test(S("abcde"), 2, 4, "1234567890", 10, S("ab1234567890"));
383 test(S("abcde"), 2, 4, "12345678901234567890", 0, S("ab"));
384 test(S("abcde"), 2, 4, "12345678901234567890", 1, S("ab1"));
385 test(S("abcde"), 2, 4, "12345678901234567890", 10, S("ab1234567890"));
386 test(S("abcde"), 2, 4, "12345678901234567890", 19, S("ab1234567890123456789"));
387 test(S("abcde"), 2, 4, "12345678901234567890", 20, S("ab12345678901234567890"));
388 test(S("abcde"), 4, 0, "", 0, S("abcde"));
389 test(S("abcde"), 4, 0, "12345", 0, S("abcde"));
390 test(S("abcde"), 4, 0, "12345", 1, S("abcd1e"));
391 test(S("abcde"), 4, 0, "12345", 2, S("abcd12e"));
392 test(S("abcde"), 4, 0, "12345", 4, S("abcd1234e"));
393 test(S("abcde"), 4, 0, "12345", 5, S("abcd12345e"));
394 test(S("abcde"), 4, 0, "1234567890", 0, S("abcde"));
395 test(S("abcde"), 4, 0, "1234567890", 1, S("abcd1e"));
396 test(S("abcde"), 4, 0, "1234567890", 5, S("abcd12345e"));
397 test(S("abcde"), 4, 0, "1234567890", 9, S("abcd123456789e"));
398 test(S("abcde"), 4, 0, "1234567890", 10, S("abcd1234567890e"));
399 test(S("abcde"), 4, 0, "12345678901234567890", 0, S("abcde"));
400 test(S("abcde"), 4, 0, "12345678901234567890", 1, S("abcd1e"));
401 test(S("abcde"), 4, 0, "12345678901234567890", 10, S("abcd1234567890e"));
402 test(S("abcde"), 4, 0, "12345678901234567890", 19, S("abcd1234567890123456789e"));
403 test(S("abcde"), 4, 0, "12345678901234567890", 20, S("abcd12345678901234567890e"));
404 test(S("abcde"), 4, 1, "", 0, S("abcd"));
405 test(S("abcde"), 4, 1, "12345", 0, S("abcd"));
406 test(S("abcde"), 4, 1, "12345", 1, S("abcd1"));
407 test(S("abcde"), 4, 1, "12345", 2, S("abcd12"));
408 test(S("abcde"), 4, 1, "12345", 4, S("abcd1234"));
409 test(S("abcde"), 4, 1, "12345", 5, S("abcd12345"));
410 test(S("abcde"), 4, 1, "1234567890", 0, S("abcd"));
411 test(S("abcde"), 4, 1, "1234567890", 1, S("abcd1"));
412 test(S("abcde"), 4, 1, "1234567890", 5, S("abcd12345"));
413 test(S("abcde"), 4, 1, "1234567890", 9, S("abcd123456789"));
414 test(S("abcde"), 4, 1, "1234567890", 10, S("abcd1234567890"));
415 test(S("abcde"), 4, 1, "12345678901234567890", 0, S("abcd"));
416 test(S("abcde"), 4, 1, "12345678901234567890", 1, S("abcd1"));
417 test(S("abcde"), 4, 1, "12345678901234567890", 10, S("abcd1234567890"));
418 test(S("abcde"), 4, 1, "12345678901234567890", 19, S("abcd1234567890123456789"));
419 test(S("abcde"), 4, 1, "12345678901234567890", 20, S("abcd12345678901234567890"));
420 test(S("abcde"), 4, 2, "", 0, S("abcd"));
421 test(S("abcde"), 4, 2, "12345", 0, S("abcd"));
422 test(S("abcde"), 4, 2, "12345", 1, S("abcd1"));
423 test(S("abcde"), 4, 2, "12345", 2, S("abcd12"));
424 test(S("abcde"), 4, 2, "12345", 4, S("abcd1234"));
425 test(S("abcde"), 4, 2, "12345", 5, S("abcd12345"));
426 test(S("abcde"), 4, 2, "1234567890", 0, S("abcd"));
427 test(S("abcde"), 4, 2, "1234567890", 1, S("abcd1"));
428 test(S("abcde"), 4, 2, "1234567890", 5, S("abcd12345"));
429 test(S("abcde"), 4, 2, "1234567890", 9, S("abcd123456789"));
430 test(S("abcde"), 4, 2, "1234567890", 10, S("abcd1234567890"));
431 test(S("abcde"), 4, 2, "12345678901234567890", 0, S("abcd"));
432 test(S("abcde"), 4, 2, "12345678901234567890", 1, S("abcd1"));
433 test(S("abcde"), 4, 2, "12345678901234567890", 10, S("abcd1234567890"));
434 test(S("abcde"), 4, 2, "12345678901234567890", 19, S("abcd1234567890123456789"));
435 test(S("abcde"), 4, 2, "12345678901234567890", 20, S("abcd12345678901234567890"));
436 test(S("abcde"), 5, 0, "", 0, S("abcde"));
437 test(S("abcde"), 5, 0, "12345", 0, S("abcde"));
438 test(S("abcde"), 5, 0, "12345", 1, S("abcde1"));
439 test(S("abcde"), 5, 0, "12345", 2, S("abcde12"));
440 test(S("abcde"), 5, 0, "12345", 4, S("abcde1234"));
441 test(S("abcde"), 5, 0, "12345", 5, S("abcde12345"));
442 test(S("abcde"), 5, 0, "1234567890", 0, S("abcde"));
443 test(S("abcde"), 5, 0, "1234567890", 1, S("abcde1"));
444 test(S("abcde"), 5, 0, "1234567890", 5, S("abcde12345"));
445 test(S("abcde"), 5, 0, "1234567890", 9, S("abcde123456789"));
446 test(S("abcde"), 5, 0, "1234567890", 10, S("abcde1234567890"));
447 test(S("abcde"), 5, 0, "12345678901234567890", 0, S("abcde"));
448 test(S("abcde"), 5, 0, "12345678901234567890", 1, S("abcde1"));
449 test(S("abcde"), 5, 0, "12345678901234567890", 10, S("abcde1234567890"));
450 test(S("abcde"), 5, 0, "12345678901234567890", 19, S("abcde1234567890123456789"));
451 test(S("abcde"), 5, 0, "12345678901234567890", 20, S("abcde12345678901234567890"));
452 test(S("abcde"), 5, 1, "", 0, S("abcde"));
453 test(S("abcde"), 5, 1, "12345", 0, S("abcde"));
454 test(S("abcde"), 5, 1, "12345", 1, S("abcde1"));
455 test(S("abcde"), 5, 1, "12345", 2, S("abcde12"));
456 test(S("abcde"), 5, 1, "12345", 4, S("abcde1234"));
457 test(S("abcde"), 5, 1, "12345", 5, S("abcde12345"));
458 test(S("abcde"), 5, 1, "1234567890", 0, S("abcde"));
459 test(S("abcde"), 5, 1, "1234567890", 1, S("abcde1"));
460 test(S("abcde"), 5, 1, "1234567890", 5, S("abcde12345"));
461 test(S("abcde"), 5, 1, "1234567890", 9, S("abcde123456789"));
462 test(S("abcde"), 5, 1, "1234567890", 10, S("abcde1234567890"));
463 test(S("abcde"), 5, 1, "12345678901234567890", 0, S("abcde"));
464 test(S("abcde"), 5, 1, "12345678901234567890", 1, S("abcde1"));
465 test(S("abcde"), 5, 1, "12345678901234567890", 10, S("abcde1234567890"));
466 test(S("abcde"), 5, 1, "12345678901234567890", 19, S("abcde1234567890123456789"));
467 test(S("abcde"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890"));
473 test(S("abcde"), 6, 0, "", 0, S("can't happen"));
474 test(S("abcde"), 6, 0, "12345", 0, S("can't happen"));
475 test(S("abcde"), 6, 0, "12345", 1, S("can't happen"));
476 test(S("abcde"), 6, 0, "12345", 2, S("can't happen"));
477 test(S("abcde"), 6, 0, "12345", 4, S("can't happen"));
478 test(S("abcde"), 6, 0, "12345", 5, S("can't happen"));
479 test(S("abcde"), 6, 0, "1234567890", 0, S("can't happen"));
480 test(S("abcde"), 6, 0, "1234567890", 1, S("can't happen"));
481 test(S("abcde"), 6, 0, "1234567890", 5, S("can't happen"));
482 test(S("abcde"), 6, 0, "1234567890", 9, S("can't happen"));
483 test(S("abcde"), 6, 0, "1234567890", 10, S("can't happen"));
484 test(S("abcde"), 6, 0, "12345678901234567890", 0, S("can't happen"));
485 test(S("abcde"), 6, 0, "12345678901234567890", 1, S("can't happen"));
486 test(S("abcde"), 6, 0, "12345678901234567890", 10, S("can't happen"));
487 test(S("abcde"), 6, 0, "12345678901234567890", 19, S("can't happen"));
488 test(S("abcde"), 6, 0, "12345678901234567890", 20, S("can't happen"));
489 test(S("abcdefghij"), 0, 0, "", 0, S("abcdefghij"));
490 test(S("abcdefghij"), 0, 0, "12345", 0, S("abcdefghij"));
491 test(S("abcdefghij"), 0, 0, "12345", 1, S("1abcdefghij"));
492 test(S("abcdefghij"), 0, 0, "12345", 2, S("12abcdefghij"));
493 test(S("abcdefghij"), 0, 0, "12345", 4, S("1234abcdefghij"));
494 test(S("abcdefghij"), 0, 0, "12345", 5, S("12345abcdefghij"));
495 test(S("abcdefghij"), 0, 0, "1234567890", 0, S("abcdefghij"));
496 test(S("abcdefghij"), 0, 0, "1234567890", 1, S("1abcdefghij"));
497 test(S("abcdefghij"), 0, 0, "1234567890", 5, S("12345abcdefghij"));
498 test(S("abcdefghij"), 0, 0, "1234567890", 9, S("123456789abcdefghij"));
499 test(S("abcdefghij"), 0, 0, "1234567890", 10, S("1234567890abcdefghij"));
500 test(S("abcdefghij"), 0, 0, "12345678901234567890", 0, S("abcdefghij"));
501 test(S("abcdefghij"), 0, 0, "12345678901234567890", 1, S("1abcdefghij"));
502 test(S("abcdefghij"), 0, 0, "12345678901234567890", 10, S("1234567890abcdefghij"));
503 test(S("abcdefghij"), 0, 0, "12345678901234567890", 19, S("1234567890123456789abcdefghij"));
504 test(S("abcdefghij"), 0, 0, "12345678901234567890", 20, S("12345678901234567890abcdefghij"));
505 test(S("abcdefghij"), 0, 1, "", 0, S("bcdefghij"));
506 test(S("abcdefghij"), 0, 1, "12345", 0, S("bcdefghij"));
507 test(S("abcdefghij"), 0, 1, "12345", 1, S("1bcdefghij"));
508 test(S("abcdefghij"), 0, 1, "12345", 2, S("12bcdefghij"));
509 test(S("abcdefghij"), 0, 1, "12345", 4, S("1234bcdefghij"));
510 test(S("abcdefghij"), 0, 1, "12345", 5, S("12345bcdefghij"));
511 test(S("abcdefghij"), 0, 1, "1234567890", 0, S("bcdefghij"));
512 test(S("abcdefghij"), 0, 1, "1234567890", 1, S("1bcdefghij"));
513 test(S("abcdefghij"), 0, 1, "1234567890", 5, S("12345bcdefghij"));
514 test(S("abcdefghij"), 0, 1, "1234567890", 9, S("123456789bcdefghij"));
515 test(S("abcdefghij"), 0, 1, "1234567890", 10, S("1234567890bcdefghij"));
516 test(S("abcdefghij"), 0, 1, "12345678901234567890", 0, S("bcdefghij"));
517 test(S("abcdefghij"), 0, 1, "12345678901234567890", 1, S("1bcdefghij"));
518 test(S("abcdefghij"), 0, 1, "12345678901234567890", 10, S("1234567890bcdefghij"));
519 test(S("abcdefghij"), 0, 1, "12345678901234567890", 19, S("1234567890123456789bcdefghij"));
520 test(S("abcdefghij"), 0, 1, "12345678901234567890", 20, S("12345678901234567890bcdefghij"));
521 test(S("abcdefghij"), 0, 5, "", 0, S("fghij"));
522 test(S("abcdefghij"), 0, 5, "12345", 0, S("fghij"));
523 test(S("abcdefghij"), 0, 5, "12345", 1, S("1fghij"));
524 test(S("abcdefghij"), 0, 5, "12345", 2, S("12fghij"));
525 test(S("abcdefghij"), 0, 5, "12345", 4, S("1234fghij"));
526 test(S("abcdefghij"), 0, 5, "12345", 5, S("12345fghij"));
527 test(S("abcdefghij"), 0, 5, "1234567890", 0, S("fghij"));
528 test(S("abcdefghij"), 0, 5, "1234567890", 1, S("1fghij"));
529 test(S("abcdefghij"), 0, 5, "1234567890", 5, S("12345fghij"));
530 test(S("abcdefghij"), 0, 5, "1234567890", 9, S("123456789fghij"));
531 test(S("abcdefghij"), 0, 5, "1234567890", 10, S("1234567890fghij"));
532 test(S("abcdefghij"), 0, 5, "12345678901234567890", 0, S("fghij"));
533 test(S("abcdefghij"), 0, 5, "12345678901234567890", 1, S("1fghij"));
534 test(S("abcdefghij"), 0, 5, "12345678901234567890", 10, S("1234567890fghij"));
535 test(S("abcdefghij"), 0, 5, "12345678901234567890", 19, S("1234567890123456789fghij"));
536 test(S("abcdefghij"), 0, 5, "12345678901234567890", 20, S("12345678901234567890fghij"));
537 test(S("abcdefghij"), 0, 9, "", 0, S("j"));
538 test(S("abcdefghij"), 0, 9, "12345", 0, S("j"));
539 test(S("abcdefghij"), 0, 9, "12345", 1, S("1j"));
540 test(S("abcdefghij"), 0, 9, "12345", 2, S("12j"));
541 test(S("abcdefghij"), 0, 9, "12345", 4, S("1234j"));
542 test(S("abcdefghij"), 0, 9, "12345", 5, S("12345j"));
543 test(S("abcdefghij"), 0, 9, "1234567890", 0, S("j"));
544 test(S("abcdefghij"), 0, 9, "1234567890", 1, S("1j"));
545 test(S("abcdefghij"), 0, 9, "1234567890", 5, S("12345j"));
546 test(S("abcdefghij"), 0, 9, "1234567890", 9, S("123456789j"));
547 test(S("abcdefghij"), 0, 9, "1234567890", 10, S("1234567890j"));
548 test(S("abcdefghij"), 0, 9, "12345678901234567890", 0, S("j"));
549 test(S("abcdefghij"), 0, 9, "12345678901234567890", 1, S("1j"));
550 test(S("abcdefghij"), 0, 9, "12345678901234567890", 10, S("1234567890j"));
551 test(S("abcdefghij"), 0, 9, "12345678901234567890", 19, S("1234567890123456789j"));
552 test(S("abcdefghij"), 0, 9, "12345678901234567890", 20, S("12345678901234567890j"));
553 test(S("abcdefghij"), 0, 10, "", 0, S(""));
554 test(S("abcdefghij"), 0, 10, "12345", 0, S(""));
555 test(S("abcdefghij"), 0, 10, "12345", 1, S("1"));
556 test(S("abcdefghij"), 0, 10, "12345", 2, S("12"));
557 test(S("abcdefghij"), 0, 10, "12345", 4, S("1234"));
558 test(S("abcdefghij"), 0, 10, "12345", 5, S("12345"));
559 test(S("abcdefghij"), 0, 10, "1234567890", 0, S(""));
560 test(S("abcdefghij"), 0, 10, "1234567890", 1, S("1"));
561 test(S("abcdefghij"), 0, 10, "1234567890", 5, S("12345"));
562 test(S("abcdefghij"), 0, 10, "1234567890", 9, S("123456789"));
563 test(S("abcdefghij"), 0, 10, "1234567890", 10, S("1234567890"));
564 test(S("abcdefghij"), 0, 10, "12345678901234567890", 0, S(""));
565 test(S("abcdefghij"), 0, 10, "12345678901234567890", 1, S("1"));
566 test(S("abcdefghij"), 0, 10, "12345678901234567890", 10, S("1234567890"));
567 test(S("abcdefghij"), 0, 10, "12345678901234567890", 19, S("1234567890123456789"));
568 test(S("abcdefghij"), 0, 10, "12345678901234567890", 20, S("12345678901234567890"));
569 test(S("abcdefghij"), 0, 11, "", 0, S(""));
570 test(S("abcdefghij"), 0, 11, "12345", 0, S(""));
571 test(S("abcdefghij"), 0, 11, "12345", 1, S("1"));
572 test(S("abcdefghij"), 0, 11, "12345", 2, S("12"));
578 test(S("abcdefghij"), 0, 11, "12345", 4, S("1234"));
579 test(S("abcdefghij"), 0, 11, "12345", 5, S("12345"));
580 test(S("abcdefghij"), 0, 11, "1234567890", 0, S(""));
581 test(S("abcdefghij"), 0, 11, "1234567890", 1, S("1"));
582 test(S("abcdefghij"), 0, 11, "1234567890", 5, S("12345"));
583 test(S("abcdefghij"), 0, 11, "1234567890", 9, S("123456789"));
584 test(S("abcdefghij"), 0, 11, "1234567890", 10, S("1234567890"));
585 test(S("abcdefghij"), 0, 11, "12345678901234567890", 0, S(""));
586 test(S("abcdefghij"), 0, 11, "12345678901234567890", 1, S("1"));
587 test(S("abcdefghij"), 0, 11, "12345678901234567890", 10, S("1234567890"));
588 test(S("abcdefghij"), 0, 11, "12345678901234567890", 19, S("1234567890123456789"));
589 test(S("abcdefghij"), 0, 11, "12345678901234567890", 20, S("12345678901234567890"));
590 test(S("abcdefghij"), 1, 0, "", 0, S("abcdefghij"));
591 test(S("abcdefghij"), 1, 0, "12345", 0, S("abcdefghij"));
592 test(S("abcdefghij"), 1, 0, "12345", 1, S("a1bcdefghij"));
593 test(S("abcdefghij"), 1, 0, "12345", 2, S("a12bcdefghij"));
594 test(S("abcdefghij"), 1, 0, "12345", 4, S("a1234bcdefghij"));
595 test(S("abcdefghij"), 1, 0, "12345", 5, S("a12345bcdefghij"));
596 test(S("abcdefghij"), 1, 0, "1234567890", 0, S("abcdefghij"));
597 test(S("abcdefghij"), 1, 0, "1234567890", 1, S("a1bcdefghij"));
598 test(S("abcdefghij"), 1, 0, "1234567890", 5, S("a12345bcdefghij"));
599 test(S("abcdefghij"), 1, 0, "1234567890", 9, S("a123456789bcdefghij"));
600 test(S("abcdefghij"), 1, 0, "1234567890", 10, S("a1234567890bcdefghij"));
601 test(S("abcdefghij"), 1, 0, "12345678901234567890", 0, S("abcdefghij"));
602 test(S("abcdefghij"), 1, 0, "12345678901234567890", 1, S("a1bcdefghij"));
603 test(S("abcdefghij"), 1, 0, "12345678901234567890", 10, S("a1234567890bcdefghij"));
604 test(S("abcdefghij"), 1, 0, "12345678901234567890", 19, S("a1234567890123456789bcdefghij"));
605 test(S("abcdefghij"), 1, 0, "12345678901234567890", 20, S("a12345678901234567890bcdefghij"));
606 test(S("abcdefghij"), 1, 1, "", 0, S("acdefghij"));
607 test(S("abcdefghij"), 1, 1, "12345", 0, S("acdefghij"));
608 test(S("abcdefghij"), 1, 1, "12345", 1, S("a1cdefghij"));
609 test(S("abcdefghij"), 1, 1, "12345", 2, S("a12cdefghij"));
610 test(S("abcdefghij"), 1, 1, "12345", 4, S("a1234cdefghij"));
611 test(S("abcdefghij"), 1, 1, "12345", 5, S("a12345cdefghij"));
612 test(S("abcdefghij"), 1, 1, "1234567890", 0, S("acdefghij"));
613 test(S("abcdefghij"), 1, 1, "1234567890", 1, S("a1cdefghij"));
614 test(S("abcdefghij"), 1, 1, "1234567890", 5, S("a12345cdefghij"));
615 test(S("abcdefghij"), 1, 1, "1234567890", 9, S("a123456789cdefghij"));
616 test(S("abcdefghij"), 1, 1, "1234567890", 10, S("a1234567890cdefghij"));
617 test(S("abcdefghij"), 1, 1, "12345678901234567890", 0, S("acdefghij"));
618 test(S("abcdefghij"), 1, 1, "12345678901234567890", 1, S("a1cdefghij"));
619 test(S("abcdefghij"), 1, 1, "12345678901234567890", 10, S("a1234567890cdefghij"));
620 test(S("abcdefghij"), 1, 1, "12345678901234567890", 19, S("a1234567890123456789cdefghij"));
621 test(S("abcdefghij"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghij"));
622 test(S("abcdefghij"), 1, 4, "", 0, S("afghij"));
623 test(S("abcdefghij"), 1, 4, "12345", 0, S("afghij"));
624 test(S("abcdefghij"), 1, 4, "12345", 1, S("a1fghij"));
625 test(S("abcdefghij"), 1, 4, "12345", 2, S("a12fghij"));
626 test(S("abcdefghij"), 1, 4, "12345", 4, S("a1234fghij"));
627 test(S("abcdefghij"), 1, 4, "12345", 5, S("a12345fghij"));
628 test(S("abcdefghij"), 1, 4, "1234567890", 0, S("afghij"));
629 test(S("abcdefghij"), 1, 4, "1234567890", 1, S("a1fghij"));
630 test(S("abcdefghij"), 1, 4, "1234567890", 5, S("a12345fghij"));
631 test(S("abcdefghij"), 1, 4, "1234567890", 9, S("a123456789fghij"));
632 test(S("abcdefghij"), 1, 4, "1234567890", 10, S("a1234567890fghij"));
633 test(S("abcdefghij"), 1, 4, "12345678901234567890", 0, S("afghij"));
634 test(S("abcdefghij"), 1, 4, "12345678901234567890", 1, S("a1fghij"));
635 test(S("abcdefghij"), 1, 4, "12345678901234567890", 10, S("a1234567890fghij"));
636 test(S("abcdefghij"), 1, 4, "12345678901234567890", 19, S("a1234567890123456789fghij"));
637 test(S("abcdefghij"), 1, 4, "12345678901234567890", 20, S("a12345678901234567890fghij"));
638 test(S("abcdefghij"), 1, 8, "", 0, S("aj"));
639 test(S("abcdefghij"), 1, 8, "12345", 0, S("aj"));
640 test(S("abcdefghij"), 1, 8, "12345", 1, S("a1j"));
641 test(S("abcdefghij"), 1, 8, "12345", 2, S("a12j"));
642 test(S("abcdefghij"), 1, 8, "12345", 4, S("a1234j"));
643 test(S("abcdefghij"), 1, 8, "12345", 5, S("a12345j"));
644 test(S("abcdefghij"), 1, 8, "1234567890", 0, S("aj"));
645 test(S("abcdefghij"), 1, 8, "1234567890", 1, S("a1j"));
646 test(S("abcdefghij"), 1, 8, "1234567890", 5, S("a12345j"));
647 test(S("abcdefghij"), 1, 8, "1234567890", 9, S("a123456789j"));
648 test(S("abcdefghij"), 1, 8, "1234567890", 10, S("a1234567890j"));
649 test(S("abcdefghij"), 1, 8, "12345678901234567890", 0, S("aj"));
650 test(S("abcdefghij"), 1, 8, "12345678901234567890", 1, S("a1j"));
651 test(S("abcdefghij"), 1, 8, "12345678901234567890", 10, S("a1234567890j"));
652 test(S("abcdefghij"), 1, 8, "12345678901234567890", 19, S("a1234567890123456789j"));
653 test(S("abcdefghij"), 1, 8, "12345678901234567890", 20, S("a12345678901234567890j"));
654 test(S("abcdefghij"), 1, 9, "", 0, S("a"));
655 test(S("abcdefghij"), 1, 9, "12345", 0, S("a"));
656 test(S("abcdefghij"), 1, 9, "12345", 1, S("a1"));
657 test(S("abcdefghij"), 1, 9, "12345", 2, S("a12"));
658 test(S("abcdefghij"), 1, 9, "12345", 4, S("a1234"));
659 test(S("abcdefghij"), 1, 9, "12345", 5, S("a12345"));
660 test(S("abcdefghij"), 1, 9, "1234567890", 0, S("a"));
661 test(S("abcdefghij"), 1, 9, "1234567890", 1, S("a1"));
662 test(S("abcdefghij"), 1, 9, "1234567890", 5, S("a12345"));
663 test(S("abcdefghij"), 1, 9, "1234567890", 9, S("a123456789"));
664 test(S("abcdefghij"), 1, 9, "1234567890", 10, S("a1234567890"));
665 test(S("abcdefghij"), 1, 9, "12345678901234567890", 0, S("a"));
666 test(S("abcdefghij"), 1, 9, "12345678901234567890", 1, S("a1"));
667 test(S("abcdefghij"), 1, 9, "12345678901234567890", 10, S("a1234567890"));
668 test(S("abcdefghij"), 1, 9, "12345678901234567890", 19, S("a1234567890123456789"));
669 test(S("abcdefghij"), 1, 9, "12345678901234567890", 20, S("a12345678901234567890"));
670 test(S("abcdefghij"), 1, 10, "", 0, S("a"));
671 test(S("abcdefghij"), 1, 10, "12345", 0, S("a"));
672 test(S("abcdefghij"), 1, 10, "12345", 1, S("a1"));
673 test(S("abcdefghij"), 1, 10, "12345", 2, S("a12"));
674 test(S("abcdefghij"), 1, 10, "12345", 4, S("a1234"));
675 test(S("abcdefghij"), 1, 10, "12345", 5, S("a12345"));
676 test(S("abcdefghij"), 1, 10, "1234567890", 0, S("a"));
677 test(S("abcdefghij"), 1, 10, "1234567890", 1, S("a1"));
683 test(S("abcdefghij"), 1, 10, "1234567890", 5, S("a12345"));
684 test(S("abcdefghij"), 1, 10, "1234567890", 9, S("a123456789"));
685 test(S("abcdefghij"), 1, 10, "1234567890", 10, S("a1234567890"));
686 test(S("abcdefghij"), 1, 10, "12345678901234567890", 0, S("a"));
687 test(S("abcdefghij"), 1, 10, "12345678901234567890", 1, S("a1"));
688 test(S("abcdefghij"), 1, 10, "12345678901234567890", 10, S("a1234567890"));
689 test(S("abcdefghij"), 1, 10, "12345678901234567890", 19, S("a1234567890123456789"));
690 test(S("abcdefghij"), 1, 10, "12345678901234567890", 20, S("a12345678901234567890"));
691 test(S("abcdefghij"), 5, 0, "", 0, S("abcdefghij"));
692 test(S("abcdefghij"), 5, 0, "12345", 0, S("abcdefghij"));
693 test(S("abcdefghij"), 5, 0, "12345", 1, S("abcde1fghij"));
694 test(S("abcdefghij"), 5, 0, "12345", 2, S("abcde12fghij"));
695 test(S("abcdefghij"), 5, 0, "12345", 4, S("abcde1234fghij"));
696 test(S("abcdefghij"), 5, 0, "12345", 5, S("abcde12345fghij"));
697 test(S("abcdefghij"), 5, 0, "1234567890", 0, S("abcdefghij"));
698 test(S("abcdefghij"), 5, 0, "1234567890", 1, S("abcde1fghij"));
699 test(S("abcdefghij"), 5, 0, "1234567890", 5, S("abcde12345fghij"));
700 test(S("abcdefghij"), 5, 0, "1234567890", 9, S("abcde123456789fghij"));
701 test(S("abcdefghij"), 5, 0, "1234567890", 10, S("abcde1234567890fghij"));
702 test(S("abcdefghij"), 5, 0, "12345678901234567890", 0, S("abcdefghij"));
703 test(S("abcdefghij"), 5, 0, "12345678901234567890", 1, S("abcde1fghij"));
704 test(S("abcdefghij"), 5, 0, "12345678901234567890", 10, S("abcde1234567890fghij"));
705 test(S("abcdefghij"), 5, 0, "12345678901234567890", 19, S("abcde1234567890123456789fghij"));
706 test(S("abcdefghij"), 5, 0, "12345678901234567890", 20, S("abcde12345678901234567890fghij"));
707 test(S("abcdefghij"), 5, 1, "", 0, S("abcdeghij"));
708 test(S("abcdefghij"), 5, 1, "12345", 0, S("abcdeghij"));
709 test(S("abcdefghij"), 5, 1, "12345", 1, S("abcde1ghij"));
710 test(S("abcdefghij"), 5, 1, "12345", 2, S("abcde12ghij"));
711 test(S("abcdefghij"), 5, 1, "12345", 4, S("abcde1234ghij"));
712 test(S("abcdefghij"), 5, 1, "12345", 5, S("abcde12345ghij"));
713 test(S("abcdefghij"), 5, 1, "1234567890", 0, S("abcdeghij"));
714 test(S("abcdefghij"), 5, 1, "1234567890", 1, S("abcde1ghij"));
715 test(S("abcdefghij"), 5, 1, "1234567890", 5, S("abcde12345ghij"));
716 test(S("abcdefghij"), 5, 1, "1234567890", 9, S("abcde123456789ghij"));
717 test(S("abcdefghij"), 5, 1, "1234567890", 10, S("abcde1234567890ghij"));
718 test(S("abcdefghij"), 5, 1, "12345678901234567890", 0, S("abcdeghij"));
719 test(S("abcdefghij"), 5, 1, "12345678901234567890", 1, S("abcde1ghij"));
720 test(S("abcdefghij"), 5, 1, "12345678901234567890", 10, S("abcde1234567890ghij"));
721 test(S("abcdefghij"), 5, 1, "12345678901234567890", 19, S("abcde1234567890123456789ghij"));
722 test(S("abcdefghij"), 5, 1, "12345678901234567890", 20, S("abcde12345678901234567890ghij"));
723 test(S("abcdefghij"), 5, 2, "", 0, S("abcdehij"));
724 test(S("abcdefghij"), 5, 2, "12345", 0, S("abcdehij"));
725 test(S("abcdefghij"), 5, 2, "12345", 1, S("abcde1hij"));
726 test(S("abcdefghij"), 5, 2, "12345", 2, S("abcde12hij"));
727 test(S("abcdefghij"), 5, 2, "12345", 4, S("abcde1234hij"));
728 test(S("abcdefghij"), 5, 2, "12345", 5, S("abcde12345hij"));
729 test(S("abcdefghij"), 5, 2, "1234567890", 0, S("abcdehij"));
730 test(S("abcdefghij"), 5, 2, "1234567890", 1, S("abcde1hij"));
731 test(S("abcdefghij"), 5, 2, "1234567890", 5, S("abcde12345hij"));
732 test(S("abcdefghij"), 5, 2, "1234567890", 9, S("abcde123456789hij"));
733 test(S("abcdefghij"), 5, 2, "1234567890", 10, S("abcde1234567890hij"));
734 test(S("abcdefghij"), 5, 2, "12345678901234567890", 0, S("abcdehij"));
735 test(S("abcdefghij"), 5, 2, "12345678901234567890", 1, S("abcde1hij"));
736 test(S("abcdefghij"), 5, 2, "12345678901234567890", 10, S("abcde1234567890hij"));
737 test(S("abcdefghij"), 5, 2, "12345678901234567890", 19, S("abcde1234567890123456789hij"));
738 test(S("abcdefghij"), 5, 2, "12345678901234567890", 20, S("abcde12345678901234567890hij"));
739 test(S("abcdefghij"), 5, 4, "", 0, S("abcdej"));
740 test(S("abcdefghij"), 5, 4, "12345", 0, S("abcdej"));
741 test(S("abcdefghij"), 5, 4, "12345", 1, S("abcde1j"));
742 test(S("abcdefghij"), 5, 4, "12345", 2, S("abcde12j"));
743 test(S("abcdefghij"), 5, 4, "12345", 4, S("abcde1234j"));
744 test(S("abcdefghij"), 5, 4, "12345", 5, S("abcde12345j"));
745 test(S("abcdefghij"), 5, 4, "1234567890", 0, S("abcdej"));
746 test(S("abcdefghij"), 5, 4, "1234567890", 1, S("abcde1j"));
747 test(S("abcdefghij"), 5, 4, "1234567890", 5, S("abcde12345j"));
748 test(S("abcdefghij"), 5, 4, "1234567890", 9, S("abcde123456789j"));
749 test(S("abcdefghij"), 5, 4, "1234567890", 10, S("abcde1234567890j"));
750 test(S("abcdefghij"), 5, 4, "12345678901234567890", 0, S("abcdej"));
751 test(S("abcdefghij"), 5, 4, "12345678901234567890", 1, S("abcde1j"));
752 test(S("abcdefghij"), 5, 4, "12345678901234567890", 10, S("abcde1234567890j"));
753 test(S("abcdefghij"), 5, 4, "12345678901234567890", 19, S("abcde1234567890123456789j"));
754 test(S("abcdefghij"), 5, 4, "12345678901234567890", 20, S("abcde12345678901234567890j"));
755 test(S("abcdefghij"), 5, 5, "", 0, S("abcde"));
756 test(S("abcdefghij"), 5, 5, "12345", 0, S("abcde"));
757 test(S("abcdefghij"), 5, 5, "12345", 1, S("abcde1"));
758 test(S("abcdefghij"), 5, 5, "12345", 2, S("abcde12"));
759 test(S("abcdefghij"), 5, 5, "12345", 4, S("abcde1234"));
760 test(S("abcdefghij"), 5, 5, "12345", 5, S("abcde12345"));
761 test(S("abcdefghij"), 5, 5, "1234567890", 0, S("abcde"));
762 test(S("abcdefghij"), 5, 5, "1234567890", 1, S("abcde1"));
763 test(S("abcdefghij"), 5, 5, "1234567890", 5, S("abcde12345"));
764 test(S("abcdefghij"), 5, 5, "1234567890", 9, S("abcde123456789"));
765 test(S("abcdefghij"), 5, 5, "1234567890", 10, S("abcde1234567890"));
766 test(S("abcdefghij"), 5, 5, "12345678901234567890", 0, S("abcde"));
767 test(S("abcdefghij"), 5, 5, "12345678901234567890", 1, S("abcde1"));
768 test(S("abcdefghij"), 5, 5, "12345678901234567890", 10, S("abcde1234567890"));
769 test(S("abcdefghij"), 5, 5, "12345678901234567890", 19, S("abcde1234567890123456789"));
770 test(S("abcdefghij"), 5, 5, "12345678901234567890", 20, S("abcde12345678901234567890"));
771 test(S("abcdefghij"), 5, 6, "", 0, S("abcde"));
772 test(S("abcdefghij"), 5, 6, "12345", 0, S("abcde"));
773 test(S("abcdefghij"), 5, 6, "12345", 1, S("abcde1"));
774 test(S("abcdefghij"), 5, 6, "12345", 2, S("abcde12"));
775 test(S("abcdefghij"), 5, 6, "12345", 4, S("abcde1234"));
776 test(S("abcdefghij"), 5, 6, "12345", 5, S("abcde12345"));
777 test(S("abcdefghij"), 5, 6, "1234567890", 0, S("abcde"));
778 test(S("abcdefghij"), 5, 6, "1234567890", 1, S("abcde1"));
779 test(S("abcdefghij"), 5, 6, "1234567890", 5, S("abcde12345"));
780 test(S("abcdefghij"), 5, 6, "1234567890", 9, S("abcde123456789"));
781 test(S("abcdefghij"), 5, 6, "1234567890", 10, S("abcde1234567890"));
782 test(S("abcdefghij"), 5, 6, "12345678901234567890", 0, S("abcde"));
788 test(S("abcdefghij"), 5, 6, "12345678901234567890", 1, S("abcde1"));
789 test(S("abcdefghij"), 5, 6, "12345678901234567890", 10, S("abcde1234567890"));
790 test(S("abcdefghij"), 5, 6, "12345678901234567890", 19, S("abcde1234567890123456789"));
791 test(S("abcdefghij"), 5, 6, "12345678901234567890", 20, S("abcde12345678901234567890"));
792 test(S("abcdefghij"), 9, 0, "", 0, S("abcdefghij"));
793 test(S("abcdefghij"), 9, 0, "12345", 0, S("abcdefghij"));
794 test(S("abcdefghij"), 9, 0, "12345", 1, S("abcdefghi1j"));
795 test(S("abcdefghij"), 9, 0, "12345", 2, S("abcdefghi12j"));
796 test(S("abcdefghij"), 9, 0, "12345", 4, S("abcdefghi1234j"));
797 test(S("abcdefghij"), 9, 0, "12345", 5, S("abcdefghi12345j"));
798 test(S("abcdefghij"), 9, 0, "1234567890", 0, S("abcdefghij"));
799 test(S("abcdefghij"), 9, 0, "1234567890", 1, S("abcdefghi1j"));
800 test(S("abcdefghij"), 9, 0, "1234567890", 5, S("abcdefghi12345j"));
801 test(S("abcdefghij"), 9, 0, "1234567890", 9, S("abcdefghi123456789j"));
802 test(S("abcdefghij"), 9, 0, "1234567890", 10, S("abcdefghi1234567890j"));
803 test(S("abcdefghij"), 9, 0, "12345678901234567890", 0, S("abcdefghij"));
804 test(S("abcdefghij"), 9, 0, "12345678901234567890", 1, S("abcdefghi1j"));
805 test(S("abcdefghij"), 9, 0, "12345678901234567890", 10, S("abcdefghi1234567890j"));
806 test(S("abcdefghij"), 9, 0, "12345678901234567890", 19, S("abcdefghi1234567890123456789j"));
807 test(S("abcdefghij"), 9, 0, "12345678901234567890", 20, S("abcdefghi12345678901234567890j"));
808 test(S("abcdefghij"), 9, 1, "", 0, S("abcdefghi"));
809 test(S("abcdefghij"), 9, 1, "12345", 0, S("abcdefghi"));
810 test(S("abcdefghij"), 9, 1, "12345", 1, S("abcdefghi1"));
811 test(S("abcdefghij"), 9, 1, "12345", 2, S("abcdefghi12"));
812 test(S("abcdefghij"), 9, 1, "12345", 4, S("abcdefghi1234"));
813 test(S("abcdefghij"), 9, 1, "12345", 5, S("abcdefghi12345"));
814 test(S("abcdefghij"), 9, 1, "1234567890", 0, S("abcdefghi"));
815 test(S("abcdefghij"), 9, 1, "1234567890", 1, S("abcdefghi1"));
816 test(S("abcdefghij"), 9, 1, "1234567890", 5, S("abcdefghi12345"));
817 test(S("abcdefghij"), 9, 1, "1234567890", 9, S("abcdefghi123456789"));
818 test(S("abcdefghij"), 9, 1, "1234567890", 10, S("abcdefghi1234567890"));
819 test(S("abcdefghij"), 9, 1, "12345678901234567890", 0, S("abcdefghi"));
820 test(S("abcdefghij"), 9, 1, "12345678901234567890", 1, S("abcdefghi1"));
821 test(S("abcdefghij"), 9, 1, "12345678901234567890", 10, S("abcdefghi1234567890"));
822 test(S("abcdefghij"), 9, 1, "12345678901234567890", 19, S("abcdefghi1234567890123456789"));
823 test(S("abcdefghij"), 9, 1, "12345678901234567890", 20, S("abcdefghi12345678901234567890"));
824 test(S("abcdefghij"), 9, 2, "", 0, S("abcdefghi"));
825 test(S("abcdefghij"), 9, 2, "12345", 0, S("abcdefghi"));
826 test(S("abcdefghij"), 9, 2, "12345", 1, S("abcdefghi1"));
827 test(S("abcdefghij"), 9, 2, "12345", 2, S("abcdefghi12"));
828 test(S("abcdefghij"), 9, 2, "12345", 4, S("abcdefghi1234"));
829 test(S("abcdefghij"), 9, 2, "12345", 5, S("abcdefghi12345"));
830 test(S("abcdefghij"), 9, 2, "1234567890", 0, S("abcdefghi"));
831 test(S("abcdefghij"), 9, 2, "1234567890", 1, S("abcdefghi1"));
832 test(S("abcdefghij"), 9, 2, "1234567890", 5, S("abcdefghi12345"));
833 test(S("abcdefghij"), 9, 2, "1234567890", 9, S("abcdefghi123456789"));
834 test(S("abcdefghij"), 9, 2, "1234567890", 10, S("abcdefghi1234567890"));
835 test(S("abcdefghij"), 9, 2, "12345678901234567890", 0, S("abcdefghi"));
836 test(S("abcdefghij"), 9, 2, "12345678901234567890", 1, S("abcdefghi1"));
837 test(S("abcdefghij"), 9, 2, "12345678901234567890", 10, S("abcdefghi1234567890"));
838 test(S("abcdefghij"), 9, 2, "12345678901234567890", 19, S("abcdefghi1234567890123456789"));
839 test(S("abcdefghij"), 9, 2, "12345678901234567890", 20, S("abcdefghi12345678901234567890"));
840 test(S("abcdefghij"), 10, 0, "", 0, S("abcdefghij"));
841 test(S("abcdefghij"), 10, 0, "12345", 0, S("abcdefghij"));
842 test(S("abcdefghij"), 10, 0, "12345", 1, S("abcdefghij1"));
843 test(S("abcdefghij"), 10, 0, "12345", 2, S("abcdefghij12"));
844 test(S("abcdefghij"), 10, 0, "12345", 4, S("abcdefghij1234"));
845 test(S("abcdefghij"), 10, 0, "12345", 5, S("abcdefghij12345"));
846 test(S("abcdefghij"), 10, 0, "1234567890", 0, S("abcdefghij"));
847 test(S("abcdefghij"), 10, 0, "1234567890", 1, S("abcdefghij1"));
848 test(S("abcdefghij"), 10, 0, "1234567890", 5, S("abcdefghij12345"));
849 test(S("abcdefghij"), 10, 0, "1234567890", 9, S("abcdefghij123456789"));
850 test(S("abcdefghij"), 10, 0, "1234567890", 10, S("abcdefghij1234567890"));
851 test(S("abcdefghij"), 10, 0, "12345678901234567890", 0, S("abcdefghij"));
852 test(S("abcdefghij"), 10, 0, "12345678901234567890", 1, S("abcdefghij1"));
853 test(S("abcdefghij"), 10, 0, "12345678901234567890", 10, S("abcdefghij1234567890"));
854 test(S("abcdefghij"), 10, 0, "12345678901234567890", 19, S("abcdefghij1234567890123456789"));
855 test(S("abcdefghij"), 10, 0, "12345678901234567890", 20, S("abcdefghij12345678901234567890"));
856 test(S("abcdefghij"), 10, 1, "", 0, S("abcdefghij"));
857 test(S("abcdefghij"), 10, 1, "12345", 0, S("abcdefghij"));
858 test(S("abcdefghij"), 10, 1, "12345", 1, S("abcdefghij1"));
859 test(S("abcdefghij"), 10, 1, "12345", 2, S("abcdefghij12"));
860 test(S("abcdefghij"), 10, 1, "12345", 4, S("abcdefghij1234"));
861 test(S("abcdefghij"), 10, 1, "12345", 5, S("abcdefghij12345"));
862 test(S("abcdefghij"), 10, 1, "1234567890", 0, S("abcdefghij"));
863 test(S("abcdefghij"), 10, 1, "1234567890", 1, S("abcdefghij1"));
864 test(S("abcdefghij"), 10, 1, "1234567890", 5, S("abcdefghij12345"));
865 test(S("abcdefghij"), 10, 1, "1234567890", 9, S("abcdefghij123456789"));
866 test(S("abcdefghij"), 10, 1, "1234567890", 10, S("abcdefghij1234567890"));
867 test(S("abcdefghij"), 10, 1, "12345678901234567890", 0, S("abcdefghij"));
868 test(S("abcdefghij"), 10, 1, "12345678901234567890", 1, S("abcdefghij1"));
869 test(S("abcdefghij"), 10, 1, "12345678901234567890", 10, S("abcdefghij1234567890"));
870 test(S("abcdefghij"), 10, 1, "12345678901234567890", 19, S("abcdefghij1234567890123456789"));
871 test(S("abcdefghij"), 10, 1, "12345678901234567890", 20, S("abcdefghij12345678901234567890"));
872 test(S("abcdefghij"), 11, 0, "", 0, S("can't happen"));
873 test(S("abcdefghij"), 11, 0, "12345", 0, S("can't happen"));
874 test(S("abcdefghij"), 11, 0, "12345", 1, S("can't happen"));
875 test(S("abcdefghij"), 11, 0, "12345", 2, S("can't happen"));
876 test(S("abcdefghij"), 11, 0, "12345", 4, S("can't happen"));
877 test(S("abcdefghij"), 11, 0, "12345", 5, S("can't happen"));
878 test(S("abcdefghij"), 11, 0, "1234567890", 0, S("can't happen"));
879 test(S("abcdefghij"), 11, 0, "1234567890", 1, S("can't happen"));
880 test(S("abcdefghij"), 11, 0, "1234567890", 5, S("can't happen"));
881 test(S("abcdefghij"), 11, 0, "1234567890", 9, S("can't happen"));
882 test(S("abcdefghij"), 11, 0, "1234567890", 10, S("can't happen"));
883 test(S("abcdefghij"), 11, 0, "12345678901234567890", 0, S("can't happen"));
884 test(S("abcdefghij"), 11, 0, "12345678901234567890", 1, S("can't happen"));
885 test(S("abcdefghij"), 11, 0, "12345678901234567890", 10, S("can't happen"));
886 test(S("abcdefghij"), 11, 0, "12345678901234567890", 19, S("can't happen"));
887 test(S("abcdefghij"), 11, 0, "12345678901234567890", 20, S("can't happen"));
893 test(S("abcdefghijklmnopqrst"), 0, 0, "", 0, S("abcdefghijklmnopqrst"));
894 test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 0, S("abcdefghijklmnopqrst"));
895 test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 1, S("1abcdefghijklmnopqrst"));
896 test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 2, S("12abcdefghijklmnopqrst"));
897 test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 4, S("1234abcdefghijklmnopqrst"));
898 test(S("abcdefghijklmnopqrst"), 0, 0, "12345", 5, S("12345abcdefghijklmnopqrst"));
899 test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
900 test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", 1, S("1abcdefghijklmnopqrst"));
901 test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", 5, S("12345abcdefghijklmnopqrst"));
902 test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", 9, S("123456789abcdefghijklmnopqrst"));
903 test(S("abcdefghijklmnopqrst"), 0, 0, "1234567890", 10, S("1234567890abcdefghijklmnopqrst"));
904 test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
905 test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", 1, S("1abcdefghijklmnopqrst"));
906 test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", 10, S("1234567890abcdefghijklmnopqrst"));
907 test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", 19, S("1234567890123456789abcdefghijklmnopqrst"));
908 test(S("abcdefghijklmnopqrst"), 0, 0, "12345678901234567890", 20, S("12345678901234567890abcdefghijklmnopqrst"));
909 test(S("abcdefghijklmnopqrst"), 0, 1, "", 0, S("bcdefghijklmnopqrst"));
910 test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 0, S("bcdefghijklmnopqrst"));
911 test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 1, S("1bcdefghijklmnopqrst"));
912 test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 2, S("12bcdefghijklmnopqrst"));
913 test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 4, S("1234bcdefghijklmnopqrst"));
914 test(S("abcdefghijklmnopqrst"), 0, 1, "12345", 5, S("12345bcdefghijklmnopqrst"));
915 test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 0, S("bcdefghijklmnopqrst"));
916 test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 1, S("1bcdefghijklmnopqrst"));
917 test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 5, S("12345bcdefghijklmnopqrst"));
918 test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 9, S("123456789bcdefghijklmnopqrst"));
919 test(S("abcdefghijklmnopqrst"), 0, 1, "1234567890", 10, S("1234567890bcdefghijklmnopqrst"));
920 test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", 0, S("bcdefghijklmnopqrst"));
921 test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", 1, S("1bcdefghijklmnopqrst"));
922 test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", 10, S("1234567890bcdefghijklmnopqrst"));
923 test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", 19, S("1234567890123456789bcdefghijklmnopqrst"));
924 test(S("abcdefghijklmnopqrst"), 0, 1, "12345678901234567890", 20, S("12345678901234567890bcdefghijklmnopqrst"));
925 test(S("abcdefghijklmnopqrst"), 0, 10, "", 0, S("klmnopqrst"));
926 test(S("abcdefghijklmnopqrst"), 0, 10, "12345", 0, S("klmnopqrst"));
927 test(S("abcdefghijklmnopqrst"), 0, 10, "12345", 1, S("1klmnopqrst"));
928 test(S("abcdefghijklmnopqrst"), 0, 10, "12345", 2, S("12klmnopqrst"));
929 test(S("abcdefghijklmnopqrst"), 0, 10, "12345", 4, S("1234klmnopqrst"));
930 test(S("abcdefghijklmnopqrst"), 0, 10, "12345", 5, S("12345klmnopqrst"));
931 test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", 0, S("klmnopqrst"));
932 test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", 1, S("1klmnopqrst"));
933 test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", 5, S("12345klmnopqrst"));
934 test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", 9, S("123456789klmnopqrst"));
935 test(S("abcdefghijklmnopqrst"), 0, 10, "1234567890", 10, S("1234567890klmnopqrst"));
936 test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", 0, S("klmnopqrst"));
937 test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", 1, S("1klmnopqrst"));
938 test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", 10, S("1234567890klmnopqrst"));
939 test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", 19, S("1234567890123456789klmnopqrst"));
940 test(S("abcdefghijklmnopqrst"), 0, 10, "12345678901234567890", 20, S("12345678901234567890klmnopqrst"));
941 test(S("abcdefghijklmnopqrst"), 0, 19, "", 0, S("t"));
942 test(S("abcdefghijklmnopqrst"), 0, 19, "12345", 0, S("t"));
943 test(S("abcdefghijklmnopqrst"), 0, 19, "12345", 1, S("1t"));
944 test(S("abcdefghijklmnopqrst"), 0, 19, "12345", 2, S("12t"));
945 test(S("abcdefghijklmnopqrst"), 0, 19, "12345", 4, S("1234t"));
946 test(S("abcdefghijklmnopqrst"), 0, 19, "12345", 5, S("12345t"));
947 test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", 0, S("t"));
948 test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", 1, S("1t"));
949 test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", 5, S("12345t"));
950 test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", 9, S("123456789t"));
951 test(S("abcdefghijklmnopqrst"), 0, 19, "1234567890", 10, S("1234567890t"));
952 test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", 0, S("t"));
953 test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", 1, S("1t"));
954 test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", 10, S("1234567890t"));
955 test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", 19, S("1234567890123456789t"));
956 test(S("abcdefghijklmnopqrst"), 0, 19, "12345678901234567890", 20, S("12345678901234567890t"));
957 test(S("abcdefghijklmnopqrst"), 0, 20, "", 0, S(""));
958 test(S("abcdefghijklmnopqrst"), 0, 20, "12345", 0, S(""));
959 test(S("abcdefghijklmnopqrst"), 0, 20, "12345", 1, S("1"));
960 test(S("abcdefghijklmnopqrst"), 0, 20, "12345", 2, S("12"));
961 test(S("abcdefghijklmnopqrst"), 0, 20, "12345", 4, S("1234"));
962 test(S("abcdefghijklmnopqrst"), 0, 20, "12345", 5, S("12345"));
963 test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", 0, S(""));
964 test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", 1, S("1"));
965 test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", 5, S("12345"));
966 test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", 9, S("123456789"));
967 test(S("abcdefghijklmnopqrst"), 0, 20, "1234567890", 10, S("1234567890"));
968 test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", 0, S(""));
969 test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", 1, S("1"));
970 test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", 10, S("1234567890"));
971 test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", 19, S("1234567890123456789"));
972 test(S("abcdefghijklmnopqrst"), 0, 20, "12345678901234567890", 20, S("12345678901234567890"));
973 test(S("abcdefghijklmnopqrst"), 0, 21, "", 0, S(""));
974 test(S("abcdefghijklmnopqrst"), 0, 21, "12345", 0, S(""));
975 test(S("abcdefghijklmnopqrst"), 0, 21, "12345", 1, S("1"));
976 test(S("abcdefghijklmnopqrst"), 0, 21, "12345", 2, S("12"));
977 test(S("abcdefghijklmnopqrst"), 0, 21, "12345", 4, S("1234"));
978 test(S("abcdefghijklmnopqrst"), 0, 21, "12345", 5, S("12345"));
979 test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", 0, S(""));
980 test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", 1, S("1"));
981 test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", 5, S("12345"));
982 test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", 9, S("123456789"));
983 test(S("abcdefghijklmnopqrst"), 0, 21, "1234567890", 10, S("1234567890"));
984 test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", 0, S(""));
985 test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", 1, S("1"));
986 test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", 10, S("1234567890"));
987 test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", 19, S("1234567890123456789"));
988 test(S("abcdefghijklmnopqrst"), 0, 21, "12345678901234567890", 20, S("12345678901234567890"));
989 test(S("abcdefghijklmnopqrst"), 1, 0, "", 0, S("abcdefghijklmnopqrst"));
990 test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 0, S("abcdefghijklmnopqrst"));
991 test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 1, S("a1bcdefghijklmnopqrst"));
992 test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 2, S("a12bcdefghijklmnopqrst"));
998 test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 4, S("a1234bcdefghijklmnopqrst"));
999 test(S("abcdefghijklmnopqrst"), 1, 0, "12345", 5, S("a12345bcdefghijklmnopqrst"));
1000 test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
1001 test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", 1, S("a1bcdefghijklmnopqrst"));
1002 test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", 5, S("a12345bcdefghijklmnopqrst"));
1003 test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", 9, S("a123456789bcdefghijklmnopqrst"));
1004 test(S("abcdefghijklmnopqrst"), 1, 0, "1234567890", 10, S("a1234567890bcdefghijklmnopqrst"));
1005 test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
1006 test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", 1, S("a1bcdefghijklmnopqrst"));
1007 test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", 10, S("a1234567890bcdefghijklmnopqrst"));
1008 test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", 19, S("a1234567890123456789bcdefghijklmnopqrst"));
1009 test(S("abcdefghijklmnopqrst"), 1, 0, "12345678901234567890", 20, S("a12345678901234567890bcdefghijklmnopqrst"));
1010 test(S("abcdefghijklmnopqrst"), 1, 1, "", 0, S("acdefghijklmnopqrst"));
1011 test(S("abcdefghijklmnopqrst"), 1, 1, "12345", 0, S("acdefghijklmnopqrst"));
1012 test(S("abcdefghijklmnopqrst"), 1, 1, "12345", 1, S("a1cdefghijklmnopqrst"));
1013 test(S("abcdefghijklmnopqrst"), 1, 1, "12345", 2, S("a12cdefghijklmnopqrst"));
1014 test(S("abcdefghijklmnopqrst"), 1, 1, "12345", 4, S("a1234cdefghijklmnopqrst"));
1015 test(S("abcdefghijklmnopqrst"), 1, 1, "12345", 5, S("a12345cdefghijklmnopqrst"));
1016 test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", 0, S("acdefghijklmnopqrst"));
1017 test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", 1, S("a1cdefghijklmnopqrst"));
1018 test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", 5, S("a12345cdefghijklmnopqrst"));
1019 test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", 9, S("a123456789cdefghijklmnopqrst"));
1020 test(S("abcdefghijklmnopqrst"), 1, 1, "1234567890", 10, S("a1234567890cdefghijklmnopqrst"));
1021 test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", 0, S("acdefghijklmnopqrst"));
1022 test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", 1, S("a1cdefghijklmnopqrst"));
1023 test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", 10, S("a1234567890cdefghijklmnopqrst"));
1024 test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", 19, S("a1234567890123456789cdefghijklmnopqrst"));
1025 test(S("abcdefghijklmnopqrst"), 1, 1, "12345678901234567890", 20, S("a12345678901234567890cdefghijklmnopqrst"));
1026 test(S("abcdefghijklmnopqrst"), 1, 9, "", 0, S("aklmnopqrst"));
1027 test(S("abcdefghijklmnopqrst"), 1, 9, "12345", 0, S("aklmnopqrst"));
1028 test(S("abcdefghijklmnopqrst"), 1, 9, "12345", 1, S("a1klmnopqrst"));
1029 test(S("abcdefghijklmnopqrst"), 1, 9, "12345", 2, S("a12klmnopqrst"));
1030 test(S("abcdefghijklmnopqrst"), 1, 9, "12345", 4, S("a1234klmnopqrst"));
1031 test(S("abcdefghijklmnopqrst"), 1, 9, "12345", 5, S("a12345klmnopqrst"));
1032 test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 0, S("aklmnopqrst"));
1033 test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 1, S("a1klmnopqrst"));
1034 test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 5, S("a12345klmnopqrst"));
1035 test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 9, S("a123456789klmnopqrst"));
1036 test(S("abcdefghijklmnopqrst"), 1, 9, "1234567890", 10, S("a1234567890klmnopqrst"));
1037 test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 0, S("aklmnopqrst"));
1038 test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 1, S("a1klmnopqrst"));
1039 test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 10, S("a1234567890klmnopqrst"));
1040 test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 19, S("a1234567890123456789klmnopqrst"));
1041 test(S("abcdefghijklmnopqrst"), 1, 9, "12345678901234567890", 20, S("a12345678901234567890klmnopqrst"));
1042 test(S("abcdefghijklmnopqrst"), 1, 18, "", 0, S("at"));
1043 test(S("abcdefghijklmnopqrst"), 1, 18, "12345", 0, S("at"));
1044 test(S("abcdefghijklmnopqrst"), 1, 18, "12345", 1, S("a1t"));
1045 test(S("abcdefghijklmnopqrst"), 1, 18, "12345", 2, S("a12t"));
1046 test(S("abcdefghijklmnopqrst"), 1, 18, "12345", 4, S("a1234t"));
1047 test(S("abcdefghijklmnopqrst"), 1, 18, "12345", 5, S("a12345t"));
1048 test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", 0, S("at"));
1049 test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", 1, S("a1t"));
1050 test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", 5, S("a12345t"));
1051 test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", 9, S("a123456789t"));
1052 test(S("abcdefghijklmnopqrst"), 1, 18, "1234567890", 10, S("a1234567890t"));
1053 test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", 0, S("at"));
1054 test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", 1, S("a1t"));
1055 test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", 10, S("a1234567890t"));
1056 test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", 19, S("a1234567890123456789t"));
1057 test(S("abcdefghijklmnopqrst"), 1, 18, "12345678901234567890", 20, S("a12345678901234567890t"));
1058 test(S("abcdefghijklmnopqrst"), 1, 19, "", 0, S("a"));
1059 test(S("abcdefghijklmnopqrst"), 1, 19, "12345", 0, S("a"));
1060 test(S("abcdefghijklmnopqrst"), 1, 19, "12345", 1, S("a1"));
1061 test(S("abcdefghijklmnopqrst"), 1, 19, "12345", 2, S("a12"));
1062 test(S("abcdefghijklmnopqrst"), 1, 19, "12345", 4, S("a1234"));
1063 test(S("abcdefghijklmnopqrst"), 1, 19, "12345", 5, S("a12345"));
1064 test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", 0, S("a"));
1065 test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", 1, S("a1"));
1066 test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", 5, S("a12345"));
1067 test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", 9, S("a123456789"));
1068 test(S("abcdefghijklmnopqrst"), 1, 19, "1234567890", 10, S("a1234567890"));
1069 test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", 0, S("a"));
1070 test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", 1, S("a1"));
1071 test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", 10, S("a1234567890"));
1072 test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", 19, S("a1234567890123456789"));
1073 test(S("abcdefghijklmnopqrst"), 1, 19, "12345678901234567890", 20, S("a12345678901234567890"));
1074 test(S("abcdefghijklmnopqrst"), 1, 20, "", 0, S("a"));
1075 test(S("abcdefghijklmnopqrst"), 1, 20, "12345", 0, S("a"));
1076 test(S("abcdefghijklmnopqrst"), 1, 20, "12345", 1, S("a1"));
1077 test(S("abcdefghijklmnopqrst"), 1, 20, "12345", 2, S("a12"));
1078 test(S("abcdefghijklmnopqrst"), 1, 20, "12345", 4, S("a1234"));
1079 test(S("abcdefghijklmnopqrst"), 1, 20, "12345", 5, S("a12345"));
1080 test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", 0, S("a"));
1081 test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", 1, S("a1"));
1082 test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", 5, S("a12345"));
1083 test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", 9, S("a123456789"));
1084 test(S("abcdefghijklmnopqrst"), 1, 20, "1234567890", 10, S("a1234567890"));
1085 test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", 0, S("a"));
1086 test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", 1, S("a1"));
1087 test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", 10, S("a1234567890"));
1088 test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", 19, S("a1234567890123456789"));
1089 test(S("abcdefghijklmnopqrst"), 1, 20, "12345678901234567890", 20, S("a12345678901234567890"));
1090 test(S("abcdefghijklmnopqrst"), 10, 0, "", 0, S("abcdefghijklmnopqrst"));
1091 test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 0, S("abcdefghijklmnopqrst"));
1092 test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 1, S("abcdefghij1klmnopqrst"));
1093 test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 2, S("abcdefghij12klmnopqrst"));
1094 test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 4, S("abcdefghij1234klmnopqrst"));
1095 test(S("abcdefghijklmnopqrst"), 10, 0, "12345", 5, S("abcdefghij12345klmnopqrst"));
1096 test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
1097 test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 1, S("abcdefghij1klmnopqrst"));
1103 test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 5, S("abcdefghij12345klmnopqrst"));
1104 test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 9, S("abcdefghij123456789klmnopqrst"));
1105 test(S("abcdefghijklmnopqrst"), 10, 0, "1234567890", 10, S("abcdefghij1234567890klmnopqrst"));
1106 test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
1107 test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", 1, S("abcdefghij1klmnopqrst"));
1108 test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", 10, S("abcdefghij1234567890klmnopqrst"));
1109 test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", 19, S("abcdefghij1234567890123456789klmnopqrst"));
1110 test(S("abcdefghijklmnopqrst"), 10, 0, "12345678901234567890", 20, S("abcdefghij12345678901234567890klmnopqrst"));
1111 test(S("abcdefghijklmnopqrst"), 10, 1, "", 0, S("abcdefghijlmnopqrst"));
1112 test(S("abcdefghijklmnopqrst"), 10, 1, "12345", 0, S("abcdefghijlmnopqrst"));
1113 test(S("abcdefghijklmnopqrst"), 10, 1, "12345", 1, S("abcdefghij1lmnopqrst"));
1114 test(S("abcdefghijklmnopqrst"), 10, 1, "12345", 2, S("abcdefghij12lmnopqrst"));
1115 test(S("abcdefghijklmnopqrst"), 10, 1, "12345", 4, S("abcdefghij1234lmnopqrst"));
1116 test(S("abcdefghijklmnopqrst"), 10, 1, "12345", 5, S("abcdefghij12345lmnopqrst"));
1117 test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", 0, S("abcdefghijlmnopqrst"));
1118 test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", 1, S("abcdefghij1lmnopqrst"));
1119 test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", 5, S("abcdefghij12345lmnopqrst"));
1120 test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", 9, S("abcdefghij123456789lmnopqrst"));
1121 test(S("abcdefghijklmnopqrst"), 10, 1, "1234567890", 10, S("abcdefghij1234567890lmnopqrst"));
1122 test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", 0, S("abcdefghijlmnopqrst"));
1123 test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", 1, S("abcdefghij1lmnopqrst"));
1124 test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", 10, S("abcdefghij1234567890lmnopqrst"));
1125 test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", 19, S("abcdefghij1234567890123456789lmnopqrst"));
1126 test(S("abcdefghijklmnopqrst"), 10, 1, "12345678901234567890", 20, S("abcdefghij12345678901234567890lmnopqrst"));
1127 test(S("abcdefghijklmnopqrst"), 10, 5, "", 0, S("abcdefghijpqrst"));
1128 test(S("abcdefghijklmnopqrst"), 10, 5, "12345", 0, S("abcdefghijpqrst"));
1129 test(S("abcdefghijklmnopqrst"), 10, 5, "12345", 1, S("abcdefghij1pqrst"));
1130 test(S("abcdefghijklmnopqrst"), 10, 5, "12345", 2, S("abcdefghij12pqrst"));
1131 test(S("abcdefghijklmnopqrst"), 10, 5, "12345", 4, S("abcdefghij1234pqrst"));
1132 test(S("abcdefghijklmnopqrst"), 10, 5, "12345", 5, S("abcdefghij12345pqrst"));
1133 test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", 0, S("abcdefghijpqrst"));
1134 test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", 1, S("abcdefghij1pqrst"));
1135 test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", 5, S("abcdefghij12345pqrst"));
1136 test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", 9, S("abcdefghij123456789pqrst"));
1137 test(S("abcdefghijklmnopqrst"), 10, 5, "1234567890", 10, S("abcdefghij1234567890pqrst"));
1138 test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", 0, S("abcdefghijpqrst"));
1139 test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", 1, S("abcdefghij1pqrst"));
1140 test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", 10, S("abcdefghij1234567890pqrst"));
1141 test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", 19, S("abcdefghij1234567890123456789pqrst"));
1142 test(S("abcdefghijklmnopqrst"), 10, 5, "12345678901234567890", 20, S("abcdefghij12345678901234567890pqrst"));
1143 test(S("abcdefghijklmnopqrst"), 10, 9, "", 0, S("abcdefghijt"));
1144 test(S("abcdefghijklmnopqrst"), 10, 9, "12345", 0, S("abcdefghijt"));
1145 test(S("abcdefghijklmnopqrst"), 10, 9, "12345", 1, S("abcdefghij1t"));
1146 test(S("abcdefghijklmnopqrst"), 10, 9, "12345", 2, S("abcdefghij12t"));
1147 test(S("abcdefghijklmnopqrst"), 10, 9, "12345", 4, S("abcdefghij1234t"));
1148 test(S("abcdefghijklmnopqrst"), 10, 9, "12345", 5, S("abcdefghij12345t"));
1149 test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", 0, S("abcdefghijt"));
1150 test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", 1, S("abcdefghij1t"));
1151 test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", 5, S("abcdefghij12345t"));
1152 test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", 9, S("abcdefghij123456789t"));
1153 test(S("abcdefghijklmnopqrst"), 10, 9, "1234567890", 10, S("abcdefghij1234567890t"));
1154 test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 0, S("abcdefghijt"));
1155 test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 1, S("abcdefghij1t"));
1156 test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 10, S("abcdefghij1234567890t"));
1157 test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 19, S("abcdefghij1234567890123456789t"));
1158 test(S("abcdefghijklmnopqrst"), 10, 9, "12345678901234567890", 20, S("abcdefghij12345678901234567890t"));
1159 test(S("abcdefghijklmnopqrst"), 10, 10, "", 0, S("abcdefghij"));
1160 test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 0, S("abcdefghij"));
1161 test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 1, S("abcdefghij1"));
1162 test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 2, S("abcdefghij12"));
1163 test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 4, S("abcdefghij1234"));
1164 test(S("abcdefghijklmnopqrst"), 10, 10, "12345", 5, S("abcdefghij12345"));
1165 test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", 0, S("abcdefghij"));
1166 test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", 1, S("abcdefghij1"));
1167 test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", 5, S("abcdefghij12345"));
1168 test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", 9, S("abcdefghij123456789"));
1169 test(S("abcdefghijklmnopqrst"), 10, 10, "1234567890", 10, S("abcdefghij1234567890"));
1170 test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", 0, S("abcdefghij"));
1171 test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", 1, S("abcdefghij1"));
1172 test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", 10, S("abcdefghij1234567890"));
1173 test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789"));
1174 test(S("abcdefghijklmnopqrst"), 10, 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890"));
1175 test(S("abcdefghijklmnopqrst"), 10, 11, "", 0, S("abcdefghij"));
1176 test(S("abcdefghijklmnopqrst"), 10, 11, "12345", 0, S("abcdefghij"));
1177 test(S("abcdefghijklmnopqrst"), 10, 11, "12345", 1, S("abcdefghij1"));
1178 test(S("abcdefghijklmnopqrst"), 10, 11, "12345", 2, S("abcdefghij12"));
1179 test(S("abcdefghijklmnopqrst"), 10, 11, "12345", 4, S("abcdefghij1234"));
1180 test(S("abcdefghijklmnopqrst"), 10, 11, "12345", 5, S("abcdefghij12345"));
1181 test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", 0, S("abcdefghij"));
1182 test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", 1, S("abcdefghij1"));
1183 test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", 5, S("abcdefghij12345"));
1184 test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", 9, S("abcdefghij123456789"));
1185 test(S("abcdefghijklmnopqrst"), 10, 11, "1234567890", 10, S("abcdefghij1234567890"));
1186 test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", 0, S("abcdefghij"));
1187 test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", 1, S("abcdefghij1"));
1188 test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", 10, S("abcdefghij1234567890"));
1189 test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", 19, S("abcdefghij1234567890123456789"));
1190 test(S("abcdefghijklmnopqrst"), 10, 11, "12345678901234567890", 20, S("abcdefghij12345678901234567890"));
1191 test(S("abcdefghijklmnopqrst"), 19, 0, "", 0, S("abcdefghijklmnopqrst"));
1192 test(S("abcdefghijklmnopqrst"), 19, 0, "12345", 0, S("abcdefghijklmnopqrst"));
1193 test(S("abcdefghijklmnopqrst"), 19, 0, "12345", 1, S("abcdefghijklmnopqrs1t"));
1194 test(S("abcdefghijklmnopqrst"), 19, 0, "12345", 2, S("abcdefghijklmnopqrs12t"));
1195 test(S("abcdefghijklmnopqrst"), 19, 0, "12345", 4, S("abcdefghijklmnopqrs1234t"));
1196 test(S("abcdefghijklmnopqrst"), 19, 0, "12345", 5, S("abcdefghijklmnopqrs12345t"));
1197 test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
1198 test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 1, S("abcdefghijklmnopqrs1t"));
1199 test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 5, S("abcdefghijklmnopqrs12345t"));
1200 test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 9, S("abcdefghijklmnopqrs123456789t"));
1201 test(S("abcdefghijklmnopqrst"), 19, 0, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
1202 test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
1208 test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t"));
1209 test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t"));
1210 test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789t"));
1211 test(S("abcdefghijklmnopqrst"), 19, 0, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890t"));
1212 test(S("abcdefghijklmnopqrst"), 19, 1, "", 0, S("abcdefghijklmnopqrs"));
1213 test(S("abcdefghijklmnopqrst"), 19, 1, "12345", 0, S("abcdefghijklmnopqrs"));
1214 test(S("abcdefghijklmnopqrst"), 19, 1, "12345", 1, S("abcdefghijklmnopqrs1"));
1215 test(S("abcdefghijklmnopqrst"), 19, 1, "12345", 2, S("abcdefghijklmnopqrs12"));
1216 test(S("abcdefghijklmnopqrst"), 19, 1, "12345", 4, S("abcdefghijklmnopqrs1234"));
1217 test(S("abcdefghijklmnopqrst"), 19, 1, "12345", 5, S("abcdefghijklmnopqrs12345"));
1218 test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", 0, S("abcdefghijklmnopqrs"));
1219 test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", 1, S("abcdefghijklmnopqrs1"));
1220 test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", 5, S("abcdefghijklmnopqrs12345"));
1221 test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", 9, S("abcdefghijklmnopqrs123456789"));
1222 test(S("abcdefghijklmnopqrst"), 19, 1, "1234567890", 10, S("abcdefghijklmnopqrs1234567890"));
1223 test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", 0, S("abcdefghijklmnopqrs"));
1224 test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", 1, S("abcdefghijklmnopqrs1"));
1225 test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890"));
1226 test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789"));
1227 test(S("abcdefghijklmnopqrst"), 19, 1, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890"));
1228 test(S("abcdefghijklmnopqrst"), 19, 2, "", 0, S("abcdefghijklmnopqrs"));
1229 test(S("abcdefghijklmnopqrst"), 19, 2, "12345", 0, S("abcdefghijklmnopqrs"));
1230 test(S("abcdefghijklmnopqrst"), 19, 2, "12345", 1, S("abcdefghijklmnopqrs1"));
1231 test(S("abcdefghijklmnopqrst"), 19, 2, "12345", 2, S("abcdefghijklmnopqrs12"));
1232 test(S("abcdefghijklmnopqrst"), 19, 2, "12345", 4, S("abcdefghijklmnopqrs1234"));
1233 test(S("abcdefghijklmnopqrst"), 19, 2, "12345", 5, S("abcdefghijklmnopqrs12345"));
1234 test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", 0, S("abcdefghijklmnopqrs"));
1235 test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", 1, S("abcdefghijklmnopqrs1"));
1236 test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", 5, S("abcdefghijklmnopqrs12345"));
1237 test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", 9, S("abcdefghijklmnopqrs123456789"));
1238 test(S("abcdefghijklmnopqrst"), 19, 2, "1234567890", 10, S("abcdefghijklmnopqrs1234567890"));
1239 test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", 0, S("abcdefghijklmnopqrs"));
1240 test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", 1, S("abcdefghijklmnopqrs1"));
1241 test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890"));
1242 test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789"));
1243 test(S("abcdefghijklmnopqrst"), 19, 2, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890"));
1244 test(S("abcdefghijklmnopqrst"), 20, 0, "", 0, S("abcdefghijklmnopqrst"));
1245 test(S("abcdefghijklmnopqrst"), 20, 0, "12345", 0, S("abcdefghijklmnopqrst"));
1246 test(S("abcdefghijklmnopqrst"), 20, 0, "12345", 1, S("abcdefghijklmnopqrst1"));
1247 test(S("abcdefghijklmnopqrst"), 20, 0, "12345", 2, S("abcdefghijklmnopqrst12"));
1248 test(S("abcdefghijklmnopqrst"), 20, 0, "12345", 4, S("abcdefghijklmnopqrst1234"));
1249 test(S("abcdefghijklmnopqrst"), 20, 0, "12345", 5, S("abcdefghijklmnopqrst12345"));
1250 test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", 0, S("abcdefghijklmnopqrst"));
1251 test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", 1, S("abcdefghijklmnopqrst1"));
1252 test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", 5, S("abcdefghijklmnopqrst12345"));
1253 test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", 9, S("abcdefghijklmnopqrst123456789"));
1254 test(S("abcdefghijklmnopqrst"), 20, 0, "1234567890", 10, S("abcdefghijklmnopqrst1234567890"));
1255 test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
1256 test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 1, S("abcdefghijklmnopqrst1"));
1257 test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890"));
1258 test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789"));
1259 test(S("abcdefghijklmnopqrst"), 20, 0, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890"));
1260 test(S("abcdefghijklmnopqrst"), 20, 1, "", 0, S("abcdefghijklmnopqrst"));
1261 test(S("abcdefghijklmnopqrst"), 20, 1, "12345", 0, S("abcdefghijklmnopqrst"));
1262 test(S("abcdefghijklmnopqrst"), 20, 1, "12345", 1, S("abcdefghijklmnopqrst1"));
1263 test(S("abcdefghijklmnopqrst"), 20, 1, "12345", 2, S("abcdefghijklmnopqrst12"));
1264 test(S("abcdefghijklmnopqrst"), 20, 1, "12345", 4, S("abcdefghijklmnopqrst1234"));
1265 test(S("abcdefghijklmnopqrst"), 20, 1, "12345", 5, S("abcdefghijklmnopqrst12345"));
1266 test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", 0, S("abcdefghijklmnopqrst"));
1267 test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", 1, S("abcdefghijklmnopqrst1"));
1268 test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", 5, S("abcdefghijklmnopqrst12345"));
1269 test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", 9, S("abcdefghijklmnopqrst123456789"));
1270 test(S("abcdefghijklmnopqrst"), 20, 1, "1234567890", 10, S("abcdefghijklmnopqrst1234567890"));
1271 test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", 0, S("abcdefghijklmnopqrst"));
1272 test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", 1, S("abcdefghijklmnopqrst1"));
1273 test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890"));
1274 test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789"));
1275 test(S("abcdefghijklmnopqrst"), 20, 1, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890"));
1276 test(S("abcdefghijklmnopqrst"), 21, 0, "", 0, S("can't happen"));
1277 test(S("abcdefghijklmnopqrst"), 21, 0, "12345", 0, S("can't happen"));
1278 test(S("abcdefghijklmnopqrst"), 21, 0, "12345", 1, S("can't happen"));
1279 test(S("abcdefghijklmnopqrst"), 21, 0, "12345", 2, S("can't happen"));
1280 test(S("abcdefghijklmnopqrst"), 21, 0, "12345", 4, S("can't happen"));
1281 test(S("abcdefghijklmnopqrst"), 21, 0, "12345", 5, S("can't happen"));
1282 test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", 0, S("can't happen"));
1283 test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", 1, S("can't happen"));
1284 test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", 5, S("can't happen"));
1285 test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", 9, S("can't happen"));
1286 test(S("abcdefghijklmnopqrst"), 21, 0, "1234567890", 10, S("can't happen"));
1287 test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 0, S("can't happen"));
1288 test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 1, S("can't happen"));
1289 test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 10, S("can't happen"));
1290 test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 19, S("can't happen"));
1291 test(S("abcdefghijklmnopqrst"), 21, 0, "12345678901234567890", 20, S("can't happen"));
1297 typedef std::string S;
1311 #if __cplusplus >= 201103L
1313 typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;