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 //===----------------------------------------------------------------------===//
12 // basic_string<charT,traits,Allocator>&
13 // replace(size_type pos1, size_type n1, const basic_string<charT,traits,Allocator>& str,
14 // size_type pos2, size_type n2);
21 #include "min_allocator.h"
25 test(S s, typename S::size_type pos1, typename S::size_type n1,
26 S str, typename S::size_type pos2, typename S::size_type n2,
29 typename S::size_type old_size = s.size();
33 s.replace(pos1, n1, str, pos2, n2);
34 assert(s.__invariants());
35 assert(pos1 <= old_size && pos2 <= str.size());
36 assert(s == expected);
37 typename S::size_type xlen = std::min(n1, old_size - pos1);
38 typename S::size_type rlen = std::min(n2, str.size() - pos2);
39 assert(s.size() == old_size - xlen + rlen);
41 catch (std::out_of_range&)
43 assert(pos1 > old_size || pos2 > str.size());
51 test(S(""), 0, 0, S(""), 0, 0, S(""));
52 test(S(""), 0, 0, S(""), 0, 1, S(""));
53 test(S(""), 0, 0, S(""), 1, 0, S("can't happen"));
54 test(S(""), 0, 0, S("12345"), 0, 0, S(""));
55 test(S(""), 0, 0, S("12345"), 0, 1, S("1"));
56 test(S(""), 0, 0, S("12345"), 0, 2, S("12"));
57 test(S(""), 0, 0, S("12345"), 0, 4, S("1234"));
58 test(S(""), 0, 0, S("12345"), 0, 5, S("12345"));
59 test(S(""), 0, 0, S("12345"), 0, 6, S("12345"));
60 test(S(""), 0, 0, S("12345"), 1, 0, S(""));
61 test(S(""), 0, 0, S("12345"), 1, 1, S("2"));
62 test(S(""), 0, 0, S("12345"), 1, 2, S("23"));
63 test(S(""), 0, 0, S("12345"), 1, 3, S("234"));
64 test(S(""), 0, 0, S("12345"), 1, 4, S("2345"));
65 test(S(""), 0, 0, S("12345"), 1, 5, S("2345"));
66 test(S(""), 0, 0, S("12345"), 2, 0, S(""));
67 test(S(""), 0, 0, S("12345"), 2, 1, S("3"));
68 test(S(""), 0, 0, S("12345"), 2, 2, S("34"));
69 test(S(""), 0, 0, S("12345"), 2, 3, S("345"));
70 test(S(""), 0, 0, S("12345"), 2, 4, S("345"));
71 test(S(""), 0, 0, S("12345"), 4, 0, S(""));
72 test(S(""), 0, 0, S("12345"), 4, 1, S("5"));
73 test(S(""), 0, 0, S("12345"), 4, 2, S("5"));
74 test(S(""), 0, 0, S("12345"), 5, 0, S(""));
75 test(S(""), 0, 0, S("12345"), 5, 1, S(""));
76 test(S(""), 0, 0, S("12345"), 6, 0, S("can't happen"));
77 test(S(""), 0, 0, S("1234567890"), 0, 0, S(""));
78 test(S(""), 0, 0, S("1234567890"), 0, 1, S("1"));
79 test(S(""), 0, 0, S("1234567890"), 0, 5, S("12345"));
80 test(S(""), 0, 0, S("1234567890"), 0, 9, S("123456789"));
81 test(S(""), 0, 0, S("1234567890"), 0, 10, S("1234567890"));
82 test(S(""), 0, 0, S("1234567890"), 0, 11, S("1234567890"));
83 test(S(""), 0, 0, S("1234567890"), 1, 0, S(""));
84 test(S(""), 0, 0, S("1234567890"), 1, 1, S("2"));
85 test(S(""), 0, 0, S("1234567890"), 1, 4, S("2345"));
86 test(S(""), 0, 0, S("1234567890"), 1, 8, S("23456789"));
87 test(S(""), 0, 0, S("1234567890"), 1, 9, S("234567890"));
88 test(S(""), 0, 0, S("1234567890"), 1, 10, S("234567890"));
89 test(S(""), 0, 0, S("1234567890"), 5, 0, S(""));
90 test(S(""), 0, 0, S("1234567890"), 5, 1, S("6"));
91 test(S(""), 0, 0, S("1234567890"), 5, 2, S("67"));
92 test(S(""), 0, 0, S("1234567890"), 5, 4, S("6789"));
93 test(S(""), 0, 0, S("1234567890"), 5, 5, S("67890"));
94 test(S(""), 0, 0, S("1234567890"), 5, 6, S("67890"));
95 test(S(""), 0, 0, S("1234567890"), 9, 0, S(""));
96 test(S(""), 0, 0, S("1234567890"), 9, 1, S("0"));
97 test(S(""), 0, 0, S("1234567890"), 9, 2, S("0"));
98 test(S(""), 0, 0, S("1234567890"), 10, 0, S(""));
99 test(S(""), 0, 0, S("1234567890"), 10, 1, S(""));
100 test(S(""), 0, 0, S("1234567890"), 11, 0, S("can't happen"));
101 test(S(""), 0, 0, S("12345678901234567890"), 0, 0, S(""));
102 test(S(""), 0, 0, S("12345678901234567890"), 0, 1, S("1"));
103 test(S(""), 0, 0, S("12345678901234567890"), 0, 10, S("1234567890"));
104 test(S(""), 0, 0, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
105 test(S(""), 0, 0, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
106 test(S(""), 0, 0, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
107 test(S(""), 0, 0, S("12345678901234567890"), 1, 0, S(""));
108 test(S(""), 0, 0, S("12345678901234567890"), 1, 1, S("2"));
109 test(S(""), 0, 0, S("12345678901234567890"), 1, 9, S("234567890"));
110 test(S(""), 0, 0, S("12345678901234567890"), 1, 18, S("234567890123456789"));
111 test(S(""), 0, 0, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
112 test(S(""), 0, 0, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
113 test(S(""), 0, 0, S("12345678901234567890"), 10, 0, S(""));
114 test(S(""), 0, 0, S("12345678901234567890"), 10, 1, S("1"));
115 test(S(""), 0, 0, S("12345678901234567890"), 10, 5, S("12345"));
116 test(S(""), 0, 0, S("12345678901234567890"), 10, 9, S("123456789"));
117 test(S(""), 0, 0, S("12345678901234567890"), 10, 10, S("1234567890"));
118 test(S(""), 0, 0, S("12345678901234567890"), 10, 11, S("1234567890"));
119 test(S(""), 0, 0, S("12345678901234567890"), 19, 0, S(""));
120 test(S(""), 0, 0, S("12345678901234567890"), 19, 1, S("0"));
121 test(S(""), 0, 0, S("12345678901234567890"), 19, 2, S("0"));
122 test(S(""), 0, 0, S("12345678901234567890"), 20, 0, S(""));
123 test(S(""), 0, 0, S("12345678901234567890"), 20, 1, S(""));
124 test(S(""), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
125 test(S(""), 0, 1, S(""), 0, 0, S(""));
126 test(S(""), 0, 1, S(""), 0, 1, S(""));
127 test(S(""), 0, 1, S(""), 1, 0, S("can't happen"));
128 test(S(""), 0, 1, S("12345"), 0, 0, S(""));
129 test(S(""), 0, 1, S("12345"), 0, 1, S("1"));
130 test(S(""), 0, 1, S("12345"), 0, 2, S("12"));
131 test(S(""), 0, 1, S("12345"), 0, 4, S("1234"));
132 test(S(""), 0, 1, S("12345"), 0, 5, S("12345"));
133 test(S(""), 0, 1, S("12345"), 0, 6, S("12345"));
134 test(S(""), 0, 1, S("12345"), 1, 0, S(""));
135 test(S(""), 0, 1, S("12345"), 1, 1, S("2"));
136 test(S(""), 0, 1, S("12345"), 1, 2, S("23"));
137 test(S(""), 0, 1, S("12345"), 1, 3, S("234"));
138 test(S(""), 0, 1, S("12345"), 1, 4, S("2345"));
139 test(S(""), 0, 1, S("12345"), 1, 5, S("2345"));
140 test(S(""), 0, 1, S("12345"), 2, 0, S(""));
141 test(S(""), 0, 1, S("12345"), 2, 1, S("3"));
142 test(S(""), 0, 1, S("12345"), 2, 2, S("34"));
143 test(S(""), 0, 1, S("12345"), 2, 3, S("345"));
144 test(S(""), 0, 1, S("12345"), 2, 4, S("345"));
145 test(S(""), 0, 1, S("12345"), 4, 0, S(""));
146 test(S(""), 0, 1, S("12345"), 4, 1, S("5"));
147 test(S(""), 0, 1, S("12345"), 4, 2, S("5"));
148 test(S(""), 0, 1, S("12345"), 5, 0, S(""));
149 test(S(""), 0, 1, S("12345"), 5, 1, S(""));
150 test(S(""), 0, 1, S("12345"), 6, 0, S("can't happen"));
156 test(S(""), 0, 1, S("1234567890"), 0, 0, S(""));
157 test(S(""), 0, 1, S("1234567890"), 0, 1, S("1"));
158 test(S(""), 0, 1, S("1234567890"), 0, 5, S("12345"));
159 test(S(""), 0, 1, S("1234567890"), 0, 9, S("123456789"));
160 test(S(""), 0, 1, S("1234567890"), 0, 10, S("1234567890"));
161 test(S(""), 0, 1, S("1234567890"), 0, 11, S("1234567890"));
162 test(S(""), 0, 1, S("1234567890"), 1, 0, S(""));
163 test(S(""), 0, 1, S("1234567890"), 1, 1, S("2"));
164 test(S(""), 0, 1, S("1234567890"), 1, 4, S("2345"));
165 test(S(""), 0, 1, S("1234567890"), 1, 8, S("23456789"));
166 test(S(""), 0, 1, S("1234567890"), 1, 9, S("234567890"));
167 test(S(""), 0, 1, S("1234567890"), 1, 10, S("234567890"));
168 test(S(""), 0, 1, S("1234567890"), 5, 0, S(""));
169 test(S(""), 0, 1, S("1234567890"), 5, 1, S("6"));
170 test(S(""), 0, 1, S("1234567890"), 5, 2, S("67"));
171 test(S(""), 0, 1, S("1234567890"), 5, 4, S("6789"));
172 test(S(""), 0, 1, S("1234567890"), 5, 5, S("67890"));
173 test(S(""), 0, 1, S("1234567890"), 5, 6, S("67890"));
174 test(S(""), 0, 1, S("1234567890"), 9, 0, S(""));
175 test(S(""), 0, 1, S("1234567890"), 9, 1, S("0"));
176 test(S(""), 0, 1, S("1234567890"), 9, 2, S("0"));
177 test(S(""), 0, 1, S("1234567890"), 10, 0, S(""));
178 test(S(""), 0, 1, S("1234567890"), 10, 1, S(""));
179 test(S(""), 0, 1, S("1234567890"), 11, 0, S("can't happen"));
180 test(S(""), 0, 1, S("12345678901234567890"), 0, 0, S(""));
181 test(S(""), 0, 1, S("12345678901234567890"), 0, 1, S("1"));
182 test(S(""), 0, 1, S("12345678901234567890"), 0, 10, S("1234567890"));
183 test(S(""), 0, 1, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
184 test(S(""), 0, 1, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
185 test(S(""), 0, 1, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
186 test(S(""), 0, 1, S("12345678901234567890"), 1, 0, S(""));
187 test(S(""), 0, 1, S("12345678901234567890"), 1, 1, S("2"));
188 test(S(""), 0, 1, S("12345678901234567890"), 1, 9, S("234567890"));
189 test(S(""), 0, 1, S("12345678901234567890"), 1, 18, S("234567890123456789"));
190 test(S(""), 0, 1, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
191 test(S(""), 0, 1, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
192 test(S(""), 0, 1, S("12345678901234567890"), 10, 0, S(""));
193 test(S(""), 0, 1, S("12345678901234567890"), 10, 1, S("1"));
194 test(S(""), 0, 1, S("12345678901234567890"), 10, 5, S("12345"));
195 test(S(""), 0, 1, S("12345678901234567890"), 10, 9, S("123456789"));
196 test(S(""), 0, 1, S("12345678901234567890"), 10, 10, S("1234567890"));
197 test(S(""), 0, 1, S("12345678901234567890"), 10, 11, S("1234567890"));
198 test(S(""), 0, 1, S("12345678901234567890"), 19, 0, S(""));
199 test(S(""), 0, 1, S("12345678901234567890"), 19, 1, S("0"));
200 test(S(""), 0, 1, S("12345678901234567890"), 19, 2, S("0"));
201 test(S(""), 0, 1, S("12345678901234567890"), 20, 0, S(""));
202 test(S(""), 0, 1, S("12345678901234567890"), 20, 1, S(""));
203 test(S(""), 0, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
204 test(S(""), 1, 0, S(""), 0, 0, S("can't happen"));
205 test(S(""), 1, 0, S(""), 0, 1, S("can't happen"));
206 test(S(""), 1, 0, S(""), 1, 0, S("can't happen"));
207 test(S(""), 1, 0, S("12345"), 0, 0, S("can't happen"));
208 test(S(""), 1, 0, S("12345"), 0, 1, S("can't happen"));
209 test(S(""), 1, 0, S("12345"), 0, 2, S("can't happen"));
210 test(S(""), 1, 0, S("12345"), 0, 4, S("can't happen"));
211 test(S(""), 1, 0, S("12345"), 0, 5, S("can't happen"));
212 test(S(""), 1, 0, S("12345"), 0, 6, S("can't happen"));
213 test(S(""), 1, 0, S("12345"), 1, 0, S("can't happen"));
214 test(S(""), 1, 0, S("12345"), 1, 1, S("can't happen"));
215 test(S(""), 1, 0, S("12345"), 1, 2, S("can't happen"));
216 test(S(""), 1, 0, S("12345"), 1, 3, S("can't happen"));
217 test(S(""), 1, 0, S("12345"), 1, 4, S("can't happen"));
218 test(S(""), 1, 0, S("12345"), 1, 5, S("can't happen"));
219 test(S(""), 1, 0, S("12345"), 2, 0, S("can't happen"));
220 test(S(""), 1, 0, S("12345"), 2, 1, S("can't happen"));
221 test(S(""), 1, 0, S("12345"), 2, 2, S("can't happen"));
222 test(S(""), 1, 0, S("12345"), 2, 3, S("can't happen"));
223 test(S(""), 1, 0, S("12345"), 2, 4, S("can't happen"));
224 test(S(""), 1, 0, S("12345"), 4, 0, S("can't happen"));
225 test(S(""), 1, 0, S("12345"), 4, 1, S("can't happen"));
226 test(S(""), 1, 0, S("12345"), 4, 2, S("can't happen"));
227 test(S(""), 1, 0, S("12345"), 5, 0, S("can't happen"));
228 test(S(""), 1, 0, S("12345"), 5, 1, S("can't happen"));
229 test(S(""), 1, 0, S("12345"), 6, 0, S("can't happen"));
230 test(S(""), 1, 0, S("1234567890"), 0, 0, S("can't happen"));
231 test(S(""), 1, 0, S("1234567890"), 0, 1, S("can't happen"));
232 test(S(""), 1, 0, S("1234567890"), 0, 5, S("can't happen"));
233 test(S(""), 1, 0, S("1234567890"), 0, 9, S("can't happen"));
234 test(S(""), 1, 0, S("1234567890"), 0, 10, S("can't happen"));
235 test(S(""), 1, 0, S("1234567890"), 0, 11, S("can't happen"));
236 test(S(""), 1, 0, S("1234567890"), 1, 0, S("can't happen"));
237 test(S(""), 1, 0, S("1234567890"), 1, 1, S("can't happen"));
238 test(S(""), 1, 0, S("1234567890"), 1, 4, S("can't happen"));
239 test(S(""), 1, 0, S("1234567890"), 1, 8, S("can't happen"));
240 test(S(""), 1, 0, S("1234567890"), 1, 9, S("can't happen"));
241 test(S(""), 1, 0, S("1234567890"), 1, 10, S("can't happen"));
242 test(S(""), 1, 0, S("1234567890"), 5, 0, S("can't happen"));
243 test(S(""), 1, 0, S("1234567890"), 5, 1, S("can't happen"));
244 test(S(""), 1, 0, S("1234567890"), 5, 2, S("can't happen"));
245 test(S(""), 1, 0, S("1234567890"), 5, 4, S("can't happen"));
246 test(S(""), 1, 0, S("1234567890"), 5, 5, S("can't happen"));
247 test(S(""), 1, 0, S("1234567890"), 5, 6, S("can't happen"));
248 test(S(""), 1, 0, S("1234567890"), 9, 0, S("can't happen"));
249 test(S(""), 1, 0, S("1234567890"), 9, 1, S("can't happen"));
250 test(S(""), 1, 0, S("1234567890"), 9, 2, S("can't happen"));
251 test(S(""), 1, 0, S("1234567890"), 10, 0, S("can't happen"));
252 test(S(""), 1, 0, S("1234567890"), 10, 1, S("can't happen"));
253 test(S(""), 1, 0, S("1234567890"), 11, 0, S("can't happen"));
254 test(S(""), 1, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
255 test(S(""), 1, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
261 test(S(""), 1, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
262 test(S(""), 1, 0, S("12345678901234567890"), 0, 19, S("can't happen"));
263 test(S(""), 1, 0, S("12345678901234567890"), 0, 20, S("can't happen"));
264 test(S(""), 1, 0, S("12345678901234567890"), 0, 21, S("can't happen"));
265 test(S(""), 1, 0, S("12345678901234567890"), 1, 0, S("can't happen"));
266 test(S(""), 1, 0, S("12345678901234567890"), 1, 1, S("can't happen"));
267 test(S(""), 1, 0, S("12345678901234567890"), 1, 9, S("can't happen"));
268 test(S(""), 1, 0, S("12345678901234567890"), 1, 18, S("can't happen"));
269 test(S(""), 1, 0, S("12345678901234567890"), 1, 19, S("can't happen"));
270 test(S(""), 1, 0, S("12345678901234567890"), 1, 20, S("can't happen"));
271 test(S(""), 1, 0, S("12345678901234567890"), 10, 0, S("can't happen"));
272 test(S(""), 1, 0, S("12345678901234567890"), 10, 1, S("can't happen"));
273 test(S(""), 1, 0, S("12345678901234567890"), 10, 5, S("can't happen"));
274 test(S(""), 1, 0, S("12345678901234567890"), 10, 9, S("can't happen"));
275 test(S(""), 1, 0, S("12345678901234567890"), 10, 10, S("can't happen"));
276 test(S(""), 1, 0, S("12345678901234567890"), 10, 11, S("can't happen"));
277 test(S(""), 1, 0, S("12345678901234567890"), 19, 0, S("can't happen"));
278 test(S(""), 1, 0, S("12345678901234567890"), 19, 1, S("can't happen"));
279 test(S(""), 1, 0, S("12345678901234567890"), 19, 2, S("can't happen"));
280 test(S(""), 1, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
281 test(S(""), 1, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
282 test(S(""), 1, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
283 test(S("abcde"), 0, 0, S(""), 0, 0, S("abcde"));
284 test(S("abcde"), 0, 0, S(""), 0, 1, S("abcde"));
285 test(S("abcde"), 0, 0, S(""), 1, 0, S("can't happen"));
286 test(S("abcde"), 0, 0, S("12345"), 0, 0, S("abcde"));
287 test(S("abcde"), 0, 0, S("12345"), 0, 1, S("1abcde"));
288 test(S("abcde"), 0, 0, S("12345"), 0, 2, S("12abcde"));
289 test(S("abcde"), 0, 0, S("12345"), 0, 4, S("1234abcde"));
290 test(S("abcde"), 0, 0, S("12345"), 0, 5, S("12345abcde"));
291 test(S("abcde"), 0, 0, S("12345"), 0, 6, S("12345abcde"));
292 test(S("abcde"), 0, 0, S("12345"), 1, 0, S("abcde"));
293 test(S("abcde"), 0, 0, S("12345"), 1, 1, S("2abcde"));
294 test(S("abcde"), 0, 0, S("12345"), 1, 2, S("23abcde"));
295 test(S("abcde"), 0, 0, S("12345"), 1, 3, S("234abcde"));
296 test(S("abcde"), 0, 0, S("12345"), 1, 4, S("2345abcde"));
297 test(S("abcde"), 0, 0, S("12345"), 1, 5, S("2345abcde"));
298 test(S("abcde"), 0, 0, S("12345"), 2, 0, S("abcde"));
299 test(S("abcde"), 0, 0, S("12345"), 2, 1, S("3abcde"));
300 test(S("abcde"), 0, 0, S("12345"), 2, 2, S("34abcde"));
301 test(S("abcde"), 0, 0, S("12345"), 2, 3, S("345abcde"));
302 test(S("abcde"), 0, 0, S("12345"), 2, 4, S("345abcde"));
303 test(S("abcde"), 0, 0, S("12345"), 4, 0, S("abcde"));
304 test(S("abcde"), 0, 0, S("12345"), 4, 1, S("5abcde"));
305 test(S("abcde"), 0, 0, S("12345"), 4, 2, S("5abcde"));
306 test(S("abcde"), 0, 0, S("12345"), 5, 0, S("abcde"));
307 test(S("abcde"), 0, 0, S("12345"), 5, 1, S("abcde"));
308 test(S("abcde"), 0, 0, S("12345"), 6, 0, S("can't happen"));
309 test(S("abcde"), 0, 0, S("1234567890"), 0, 0, S("abcde"));
310 test(S("abcde"), 0, 0, S("1234567890"), 0, 1, S("1abcde"));
311 test(S("abcde"), 0, 0, S("1234567890"), 0, 5, S("12345abcde"));
312 test(S("abcde"), 0, 0, S("1234567890"), 0, 9, S("123456789abcde"));
313 test(S("abcde"), 0, 0, S("1234567890"), 0, 10, S("1234567890abcde"));
314 test(S("abcde"), 0, 0, S("1234567890"), 0, 11, S("1234567890abcde"));
315 test(S("abcde"), 0, 0, S("1234567890"), 1, 0, S("abcde"));
316 test(S("abcde"), 0, 0, S("1234567890"), 1, 1, S("2abcde"));
317 test(S("abcde"), 0, 0, S("1234567890"), 1, 4, S("2345abcde"));
318 test(S("abcde"), 0, 0, S("1234567890"), 1, 8, S("23456789abcde"));
319 test(S("abcde"), 0, 0, S("1234567890"), 1, 9, S("234567890abcde"));
320 test(S("abcde"), 0, 0, S("1234567890"), 1, 10, S("234567890abcde"));
321 test(S("abcde"), 0, 0, S("1234567890"), 5, 0, S("abcde"));
322 test(S("abcde"), 0, 0, S("1234567890"), 5, 1, S("6abcde"));
323 test(S("abcde"), 0, 0, S("1234567890"), 5, 2, S("67abcde"));
324 test(S("abcde"), 0, 0, S("1234567890"), 5, 4, S("6789abcde"));
325 test(S("abcde"), 0, 0, S("1234567890"), 5, 5, S("67890abcde"));
326 test(S("abcde"), 0, 0, S("1234567890"), 5, 6, S("67890abcde"));
327 test(S("abcde"), 0, 0, S("1234567890"), 9, 0, S("abcde"));
328 test(S("abcde"), 0, 0, S("1234567890"), 9, 1, S("0abcde"));
329 test(S("abcde"), 0, 0, S("1234567890"), 9, 2, S("0abcde"));
330 test(S("abcde"), 0, 0, S("1234567890"), 10, 0, S("abcde"));
331 test(S("abcde"), 0, 0, S("1234567890"), 10, 1, S("abcde"));
332 test(S("abcde"), 0, 0, S("1234567890"), 11, 0, S("can't happen"));
333 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 0, S("abcde"));
334 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 1, S("1abcde"));
335 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 10, S("1234567890abcde"));
336 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
337 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 20, S("12345678901234567890abcde"));
338 test(S("abcde"), 0, 0, S("12345678901234567890"), 0, 21, S("12345678901234567890abcde"));
339 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 0, S("abcde"));
340 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 1, S("2abcde"));
341 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 9, S("234567890abcde"));
342 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 18, S("234567890123456789abcde"));
343 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 19, S("2345678901234567890abcde"));
344 test(S("abcde"), 0, 0, S("12345678901234567890"), 1, 20, S("2345678901234567890abcde"));
345 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 0, S("abcde"));
346 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 1, S("1abcde"));
347 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 5, S("12345abcde"));
348 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 9, S("123456789abcde"));
349 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 10, S("1234567890abcde"));
350 test(S("abcde"), 0, 0, S("12345678901234567890"), 10, 11, S("1234567890abcde"));
351 test(S("abcde"), 0, 0, S("12345678901234567890"), 19, 0, S("abcde"));
352 test(S("abcde"), 0, 0, S("12345678901234567890"), 19, 1, S("0abcde"));
353 test(S("abcde"), 0, 0, S("12345678901234567890"), 19, 2, S("0abcde"));
354 test(S("abcde"), 0, 0, S("12345678901234567890"), 20, 0, S("abcde"));
355 test(S("abcde"), 0, 0, S("12345678901234567890"), 20, 1, S("abcde"));
356 test(S("abcde"), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
357 test(S("abcde"), 0, 1, S(""), 0, 0, S("bcde"));
358 test(S("abcde"), 0, 1, S(""), 0, 1, S("bcde"));
359 test(S("abcde"), 0, 1, S(""), 1, 0, S("can't happen"));
360 test(S("abcde"), 0, 1, S("12345"), 0, 0, S("bcde"));
366 test(S("abcde"), 0, 1, S("12345"), 0, 1, S("1bcde"));
367 test(S("abcde"), 0, 1, S("12345"), 0, 2, S("12bcde"));
368 test(S("abcde"), 0, 1, S("12345"), 0, 4, S("1234bcde"));
369 test(S("abcde"), 0, 1, S("12345"), 0, 5, S("12345bcde"));
370 test(S("abcde"), 0, 1, S("12345"), 0, 6, S("12345bcde"));
371 test(S("abcde"), 0, 1, S("12345"), 1, 0, S("bcde"));
372 test(S("abcde"), 0, 1, S("12345"), 1, 1, S("2bcde"));
373 test(S("abcde"), 0, 1, S("12345"), 1, 2, S("23bcde"));
374 test(S("abcde"), 0, 1, S("12345"), 1, 3, S("234bcde"));
375 test(S("abcde"), 0, 1, S("12345"), 1, 4, S("2345bcde"));
376 test(S("abcde"), 0, 1, S("12345"), 1, 5, S("2345bcde"));
377 test(S("abcde"), 0, 1, S("12345"), 2, 0, S("bcde"));
378 test(S("abcde"), 0, 1, S("12345"), 2, 1, S("3bcde"));
379 test(S("abcde"), 0, 1, S("12345"), 2, 2, S("34bcde"));
380 test(S("abcde"), 0, 1, S("12345"), 2, 3, S("345bcde"));
381 test(S("abcde"), 0, 1, S("12345"), 2, 4, S("345bcde"));
382 test(S("abcde"), 0, 1, S("12345"), 4, 0, S("bcde"));
383 test(S("abcde"), 0, 1, S("12345"), 4, 1, S("5bcde"));
384 test(S("abcde"), 0, 1, S("12345"), 4, 2, S("5bcde"));
385 test(S("abcde"), 0, 1, S("12345"), 5, 0, S("bcde"));
386 test(S("abcde"), 0, 1, S("12345"), 5, 1, S("bcde"));
387 test(S("abcde"), 0, 1, S("12345"), 6, 0, S("can't happen"));
388 test(S("abcde"), 0, 1, S("1234567890"), 0, 0, S("bcde"));
389 test(S("abcde"), 0, 1, S("1234567890"), 0, 1, S("1bcde"));
390 test(S("abcde"), 0, 1, S("1234567890"), 0, 5, S("12345bcde"));
391 test(S("abcde"), 0, 1, S("1234567890"), 0, 9, S("123456789bcde"));
392 test(S("abcde"), 0, 1, S("1234567890"), 0, 10, S("1234567890bcde"));
393 test(S("abcde"), 0, 1, S("1234567890"), 0, 11, S("1234567890bcde"));
394 test(S("abcde"), 0, 1, S("1234567890"), 1, 0, S("bcde"));
395 test(S("abcde"), 0, 1, S("1234567890"), 1, 1, S("2bcde"));
396 test(S("abcde"), 0, 1, S("1234567890"), 1, 4, S("2345bcde"));
397 test(S("abcde"), 0, 1, S("1234567890"), 1, 8, S("23456789bcde"));
398 test(S("abcde"), 0, 1, S("1234567890"), 1, 9, S("234567890bcde"));
399 test(S("abcde"), 0, 1, S("1234567890"), 1, 10, S("234567890bcde"));
400 test(S("abcde"), 0, 1, S("1234567890"), 5, 0, S("bcde"));
401 test(S("abcde"), 0, 1, S("1234567890"), 5, 1, S("6bcde"));
402 test(S("abcde"), 0, 1, S("1234567890"), 5, 2, S("67bcde"));
403 test(S("abcde"), 0, 1, S("1234567890"), 5, 4, S("6789bcde"));
404 test(S("abcde"), 0, 1, S("1234567890"), 5, 5, S("67890bcde"));
405 test(S("abcde"), 0, 1, S("1234567890"), 5, 6, S("67890bcde"));
406 test(S("abcde"), 0, 1, S("1234567890"), 9, 0, S("bcde"));
407 test(S("abcde"), 0, 1, S("1234567890"), 9, 1, S("0bcde"));
408 test(S("abcde"), 0, 1, S("1234567890"), 9, 2, S("0bcde"));
409 test(S("abcde"), 0, 1, S("1234567890"), 10, 0, S("bcde"));
410 test(S("abcde"), 0, 1, S("1234567890"), 10, 1, S("bcde"));
411 test(S("abcde"), 0, 1, S("1234567890"), 11, 0, S("can't happen"));
412 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 0, S("bcde"));
413 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 1, S("1bcde"));
414 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 10, S("1234567890bcde"));
415 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 19, S("1234567890123456789bcde"));
416 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 20, S("12345678901234567890bcde"));
417 test(S("abcde"), 0, 1, S("12345678901234567890"), 0, 21, S("12345678901234567890bcde"));
418 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 0, S("bcde"));
419 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 1, S("2bcde"));
420 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 9, S("234567890bcde"));
421 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 18, S("234567890123456789bcde"));
422 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 19, S("2345678901234567890bcde"));
423 test(S("abcde"), 0, 1, S("12345678901234567890"), 1, 20, S("2345678901234567890bcde"));
424 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 0, S("bcde"));
425 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 1, S("1bcde"));
426 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 5, S("12345bcde"));
427 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 9, S("123456789bcde"));
428 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 10, S("1234567890bcde"));
429 test(S("abcde"), 0, 1, S("12345678901234567890"), 10, 11, S("1234567890bcde"));
430 test(S("abcde"), 0, 1, S("12345678901234567890"), 19, 0, S("bcde"));
431 test(S("abcde"), 0, 1, S("12345678901234567890"), 19, 1, S("0bcde"));
432 test(S("abcde"), 0, 1, S("12345678901234567890"), 19, 2, S("0bcde"));
433 test(S("abcde"), 0, 1, S("12345678901234567890"), 20, 0, S("bcde"));
434 test(S("abcde"), 0, 1, S("12345678901234567890"), 20, 1, S("bcde"));
435 test(S("abcde"), 0, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
436 test(S("abcde"), 0, 2, S(""), 0, 0, S("cde"));
437 test(S("abcde"), 0, 2, S(""), 0, 1, S("cde"));
438 test(S("abcde"), 0, 2, S(""), 1, 0, S("can't happen"));
439 test(S("abcde"), 0, 2, S("12345"), 0, 0, S("cde"));
440 test(S("abcde"), 0, 2, S("12345"), 0, 1, S("1cde"));
441 test(S("abcde"), 0, 2, S("12345"), 0, 2, S("12cde"));
442 test(S("abcde"), 0, 2, S("12345"), 0, 4, S("1234cde"));
443 test(S("abcde"), 0, 2, S("12345"), 0, 5, S("12345cde"));
444 test(S("abcde"), 0, 2, S("12345"), 0, 6, S("12345cde"));
445 test(S("abcde"), 0, 2, S("12345"), 1, 0, S("cde"));
446 test(S("abcde"), 0, 2, S("12345"), 1, 1, S("2cde"));
447 test(S("abcde"), 0, 2, S("12345"), 1, 2, S("23cde"));
448 test(S("abcde"), 0, 2, S("12345"), 1, 3, S("234cde"));
449 test(S("abcde"), 0, 2, S("12345"), 1, 4, S("2345cde"));
450 test(S("abcde"), 0, 2, S("12345"), 1, 5, S("2345cde"));
451 test(S("abcde"), 0, 2, S("12345"), 2, 0, S("cde"));
452 test(S("abcde"), 0, 2, S("12345"), 2, 1, S("3cde"));
453 test(S("abcde"), 0, 2, S("12345"), 2, 2, S("34cde"));
454 test(S("abcde"), 0, 2, S("12345"), 2, 3, S("345cde"));
455 test(S("abcde"), 0, 2, S("12345"), 2, 4, S("345cde"));
456 test(S("abcde"), 0, 2, S("12345"), 4, 0, S("cde"));
457 test(S("abcde"), 0, 2, S("12345"), 4, 1, S("5cde"));
458 test(S("abcde"), 0, 2, S("12345"), 4, 2, S("5cde"));
459 test(S("abcde"), 0, 2, S("12345"), 5, 0, S("cde"));
460 test(S("abcde"), 0, 2, S("12345"), 5, 1, S("cde"));
461 test(S("abcde"), 0, 2, S("12345"), 6, 0, S("can't happen"));
462 test(S("abcde"), 0, 2, S("1234567890"), 0, 0, S("cde"));
463 test(S("abcde"), 0, 2, S("1234567890"), 0, 1, S("1cde"));
464 test(S("abcde"), 0, 2, S("1234567890"), 0, 5, S("12345cde"));
465 test(S("abcde"), 0, 2, S("1234567890"), 0, 9, S("123456789cde"));
471 test(S("abcde"), 0, 2, S("1234567890"), 0, 10, S("1234567890cde"));
472 test(S("abcde"), 0, 2, S("1234567890"), 0, 11, S("1234567890cde"));
473 test(S("abcde"), 0, 2, S("1234567890"), 1, 0, S("cde"));
474 test(S("abcde"), 0, 2, S("1234567890"), 1, 1, S("2cde"));
475 test(S("abcde"), 0, 2, S("1234567890"), 1, 4, S("2345cde"));
476 test(S("abcde"), 0, 2, S("1234567890"), 1, 8, S("23456789cde"));
477 test(S("abcde"), 0, 2, S("1234567890"), 1, 9, S("234567890cde"));
478 test(S("abcde"), 0, 2, S("1234567890"), 1, 10, S("234567890cde"));
479 test(S("abcde"), 0, 2, S("1234567890"), 5, 0, S("cde"));
480 test(S("abcde"), 0, 2, S("1234567890"), 5, 1, S("6cde"));
481 test(S("abcde"), 0, 2, S("1234567890"), 5, 2, S("67cde"));
482 test(S("abcde"), 0, 2, S("1234567890"), 5, 4, S("6789cde"));
483 test(S("abcde"), 0, 2, S("1234567890"), 5, 5, S("67890cde"));
484 test(S("abcde"), 0, 2, S("1234567890"), 5, 6, S("67890cde"));
485 test(S("abcde"), 0, 2, S("1234567890"), 9, 0, S("cde"));
486 test(S("abcde"), 0, 2, S("1234567890"), 9, 1, S("0cde"));
487 test(S("abcde"), 0, 2, S("1234567890"), 9, 2, S("0cde"));
488 test(S("abcde"), 0, 2, S("1234567890"), 10, 0, S("cde"));
489 test(S("abcde"), 0, 2, S("1234567890"), 10, 1, S("cde"));
490 test(S("abcde"), 0, 2, S("1234567890"), 11, 0, S("can't happen"));
491 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 0, S("cde"));
492 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 1, S("1cde"));
493 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 10, S("1234567890cde"));
494 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 19, S("1234567890123456789cde"));
495 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 20, S("12345678901234567890cde"));
496 test(S("abcde"), 0, 2, S("12345678901234567890"), 0, 21, S("12345678901234567890cde"));
497 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 0, S("cde"));
498 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 1, S("2cde"));
499 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 9, S("234567890cde"));
500 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 18, S("234567890123456789cde"));
501 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 19, S("2345678901234567890cde"));
502 test(S("abcde"), 0, 2, S("12345678901234567890"), 1, 20, S("2345678901234567890cde"));
503 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 0, S("cde"));
504 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 1, S("1cde"));
505 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 5, S("12345cde"));
506 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 9, S("123456789cde"));
507 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 10, S("1234567890cde"));
508 test(S("abcde"), 0, 2, S("12345678901234567890"), 10, 11, S("1234567890cde"));
509 test(S("abcde"), 0, 2, S("12345678901234567890"), 19, 0, S("cde"));
510 test(S("abcde"), 0, 2, S("12345678901234567890"), 19, 1, S("0cde"));
511 test(S("abcde"), 0, 2, S("12345678901234567890"), 19, 2, S("0cde"));
512 test(S("abcde"), 0, 2, S("12345678901234567890"), 20, 0, S("cde"));
513 test(S("abcde"), 0, 2, S("12345678901234567890"), 20, 1, S("cde"));
514 test(S("abcde"), 0, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
515 test(S("abcde"), 0, 4, S(""), 0, 0, S("e"));
516 test(S("abcde"), 0, 4, S(""), 0, 1, S("e"));
517 test(S("abcde"), 0, 4, S(""), 1, 0, S("can't happen"));
518 test(S("abcde"), 0, 4, S("12345"), 0, 0, S("e"));
519 test(S("abcde"), 0, 4, S("12345"), 0, 1, S("1e"));
520 test(S("abcde"), 0, 4, S("12345"), 0, 2, S("12e"));
521 test(S("abcde"), 0, 4, S("12345"), 0, 4, S("1234e"));
522 test(S("abcde"), 0, 4, S("12345"), 0, 5, S("12345e"));
523 test(S("abcde"), 0, 4, S("12345"), 0, 6, S("12345e"));
524 test(S("abcde"), 0, 4, S("12345"), 1, 0, S("e"));
525 test(S("abcde"), 0, 4, S("12345"), 1, 1, S("2e"));
526 test(S("abcde"), 0, 4, S("12345"), 1, 2, S("23e"));
527 test(S("abcde"), 0, 4, S("12345"), 1, 3, S("234e"));
528 test(S("abcde"), 0, 4, S("12345"), 1, 4, S("2345e"));
529 test(S("abcde"), 0, 4, S("12345"), 1, 5, S("2345e"));
530 test(S("abcde"), 0, 4, S("12345"), 2, 0, S("e"));
531 test(S("abcde"), 0, 4, S("12345"), 2, 1, S("3e"));
532 test(S("abcde"), 0, 4, S("12345"), 2, 2, S("34e"));
533 test(S("abcde"), 0, 4, S("12345"), 2, 3, S("345e"));
534 test(S("abcde"), 0, 4, S("12345"), 2, 4, S("345e"));
535 test(S("abcde"), 0, 4, S("12345"), 4, 0, S("e"));
536 test(S("abcde"), 0, 4, S("12345"), 4, 1, S("5e"));
537 test(S("abcde"), 0, 4, S("12345"), 4, 2, S("5e"));
538 test(S("abcde"), 0, 4, S("12345"), 5, 0, S("e"));
539 test(S("abcde"), 0, 4, S("12345"), 5, 1, S("e"));
540 test(S("abcde"), 0, 4, S("12345"), 6, 0, S("can't happen"));
541 test(S("abcde"), 0, 4, S("1234567890"), 0, 0, S("e"));
542 test(S("abcde"), 0, 4, S("1234567890"), 0, 1, S("1e"));
543 test(S("abcde"), 0, 4, S("1234567890"), 0, 5, S("12345e"));
544 test(S("abcde"), 0, 4, S("1234567890"), 0, 9, S("123456789e"));
545 test(S("abcde"), 0, 4, S("1234567890"), 0, 10, S("1234567890e"));
546 test(S("abcde"), 0, 4, S("1234567890"), 0, 11, S("1234567890e"));
547 test(S("abcde"), 0, 4, S("1234567890"), 1, 0, S("e"));
548 test(S("abcde"), 0, 4, S("1234567890"), 1, 1, S("2e"));
549 test(S("abcde"), 0, 4, S("1234567890"), 1, 4, S("2345e"));
550 test(S("abcde"), 0, 4, S("1234567890"), 1, 8, S("23456789e"));
551 test(S("abcde"), 0, 4, S("1234567890"), 1, 9, S("234567890e"));
552 test(S("abcde"), 0, 4, S("1234567890"), 1, 10, S("234567890e"));
553 test(S("abcde"), 0, 4, S("1234567890"), 5, 0, S("e"));
554 test(S("abcde"), 0, 4, S("1234567890"), 5, 1, S("6e"));
555 test(S("abcde"), 0, 4, S("1234567890"), 5, 2, S("67e"));
556 test(S("abcde"), 0, 4, S("1234567890"), 5, 4, S("6789e"));
557 test(S("abcde"), 0, 4, S("1234567890"), 5, 5, S("67890e"));
558 test(S("abcde"), 0, 4, S("1234567890"), 5, 6, S("67890e"));
559 test(S("abcde"), 0, 4, S("1234567890"), 9, 0, S("e"));
560 test(S("abcde"), 0, 4, S("1234567890"), 9, 1, S("0e"));
561 test(S("abcde"), 0, 4, S("1234567890"), 9, 2, S("0e"));
562 test(S("abcde"), 0, 4, S("1234567890"), 10, 0, S("e"));
563 test(S("abcde"), 0, 4, S("1234567890"), 10, 1, S("e"));
564 test(S("abcde"), 0, 4, S("1234567890"), 11, 0, S("can't happen"));
565 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 0, S("e"));
566 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 1, S("1e"));
567 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 10, S("1234567890e"));
568 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 19, S("1234567890123456789e"));
569 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 20, S("12345678901234567890e"));
570 test(S("abcde"), 0, 4, S("12345678901234567890"), 0, 21, S("12345678901234567890e"));
576 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 0, S("e"));
577 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 1, S("2e"));
578 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 9, S("234567890e"));
579 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 18, S("234567890123456789e"));
580 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 19, S("2345678901234567890e"));
581 test(S("abcde"), 0, 4, S("12345678901234567890"), 1, 20, S("2345678901234567890e"));
582 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 0, S("e"));
583 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 1, S("1e"));
584 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 5, S("12345e"));
585 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 9, S("123456789e"));
586 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 10, S("1234567890e"));
587 test(S("abcde"), 0, 4, S("12345678901234567890"), 10, 11, S("1234567890e"));
588 test(S("abcde"), 0, 4, S("12345678901234567890"), 19, 0, S("e"));
589 test(S("abcde"), 0, 4, S("12345678901234567890"), 19, 1, S("0e"));
590 test(S("abcde"), 0, 4, S("12345678901234567890"), 19, 2, S("0e"));
591 test(S("abcde"), 0, 4, S("12345678901234567890"), 20, 0, S("e"));
592 test(S("abcde"), 0, 4, S("12345678901234567890"), 20, 1, S("e"));
593 test(S("abcde"), 0, 4, S("12345678901234567890"), 21, 0, S("can't happen"));
594 test(S("abcde"), 0, 5, S(""), 0, 0, S(""));
595 test(S("abcde"), 0, 5, S(""), 0, 1, S(""));
596 test(S("abcde"), 0, 5, S(""), 1, 0, S("can't happen"));
597 test(S("abcde"), 0, 5, S("12345"), 0, 0, S(""));
598 test(S("abcde"), 0, 5, S("12345"), 0, 1, S("1"));
599 test(S("abcde"), 0, 5, S("12345"), 0, 2, S("12"));
600 test(S("abcde"), 0, 5, S("12345"), 0, 4, S("1234"));
601 test(S("abcde"), 0, 5, S("12345"), 0, 5, S("12345"));
602 test(S("abcde"), 0, 5, S("12345"), 0, 6, S("12345"));
603 test(S("abcde"), 0, 5, S("12345"), 1, 0, S(""));
604 test(S("abcde"), 0, 5, S("12345"), 1, 1, S("2"));
605 test(S("abcde"), 0, 5, S("12345"), 1, 2, S("23"));
606 test(S("abcde"), 0, 5, S("12345"), 1, 3, S("234"));
607 test(S("abcde"), 0, 5, S("12345"), 1, 4, S("2345"));
608 test(S("abcde"), 0, 5, S("12345"), 1, 5, S("2345"));
609 test(S("abcde"), 0, 5, S("12345"), 2, 0, S(""));
610 test(S("abcde"), 0, 5, S("12345"), 2, 1, S("3"));
611 test(S("abcde"), 0, 5, S("12345"), 2, 2, S("34"));
612 test(S("abcde"), 0, 5, S("12345"), 2, 3, S("345"));
613 test(S("abcde"), 0, 5, S("12345"), 2, 4, S("345"));
614 test(S("abcde"), 0, 5, S("12345"), 4, 0, S(""));
615 test(S("abcde"), 0, 5, S("12345"), 4, 1, S("5"));
616 test(S("abcde"), 0, 5, S("12345"), 4, 2, S("5"));
617 test(S("abcde"), 0, 5, S("12345"), 5, 0, S(""));
618 test(S("abcde"), 0, 5, S("12345"), 5, 1, S(""));
619 test(S("abcde"), 0, 5, S("12345"), 6, 0, S("can't happen"));
620 test(S("abcde"), 0, 5, S("1234567890"), 0, 0, S(""));
621 test(S("abcde"), 0, 5, S("1234567890"), 0, 1, S("1"));
622 test(S("abcde"), 0, 5, S("1234567890"), 0, 5, S("12345"));
623 test(S("abcde"), 0, 5, S("1234567890"), 0, 9, S("123456789"));
624 test(S("abcde"), 0, 5, S("1234567890"), 0, 10, S("1234567890"));
625 test(S("abcde"), 0, 5, S("1234567890"), 0, 11, S("1234567890"));
626 test(S("abcde"), 0, 5, S("1234567890"), 1, 0, S(""));
627 test(S("abcde"), 0, 5, S("1234567890"), 1, 1, S("2"));
628 test(S("abcde"), 0, 5, S("1234567890"), 1, 4, S("2345"));
629 test(S("abcde"), 0, 5, S("1234567890"), 1, 8, S("23456789"));
630 test(S("abcde"), 0, 5, S("1234567890"), 1, 9, S("234567890"));
631 test(S("abcde"), 0, 5, S("1234567890"), 1, 10, S("234567890"));
632 test(S("abcde"), 0, 5, S("1234567890"), 5, 0, S(""));
633 test(S("abcde"), 0, 5, S("1234567890"), 5, 1, S("6"));
634 test(S("abcde"), 0, 5, S("1234567890"), 5, 2, S("67"));
635 test(S("abcde"), 0, 5, S("1234567890"), 5, 4, S("6789"));
636 test(S("abcde"), 0, 5, S("1234567890"), 5, 5, S("67890"));
637 test(S("abcde"), 0, 5, S("1234567890"), 5, 6, S("67890"));
638 test(S("abcde"), 0, 5, S("1234567890"), 9, 0, S(""));
639 test(S("abcde"), 0, 5, S("1234567890"), 9, 1, S("0"));
640 test(S("abcde"), 0, 5, S("1234567890"), 9, 2, S("0"));
641 test(S("abcde"), 0, 5, S("1234567890"), 10, 0, S(""));
642 test(S("abcde"), 0, 5, S("1234567890"), 10, 1, S(""));
643 test(S("abcde"), 0, 5, S("1234567890"), 11, 0, S("can't happen"));
644 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 0, S(""));
645 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 1, S("1"));
646 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 10, S("1234567890"));
647 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
648 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
649 test(S("abcde"), 0, 5, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
650 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 0, S(""));
651 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 1, S("2"));
652 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 9, S("234567890"));
653 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 18, S("234567890123456789"));
654 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
655 test(S("abcde"), 0, 5, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
656 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 0, S(""));
657 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 1, S("1"));
658 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 5, S("12345"));
659 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 9, S("123456789"));
660 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 10, S("1234567890"));
661 test(S("abcde"), 0, 5, S("12345678901234567890"), 10, 11, S("1234567890"));
662 test(S("abcde"), 0, 5, S("12345678901234567890"), 19, 0, S(""));
663 test(S("abcde"), 0, 5, S("12345678901234567890"), 19, 1, S("0"));
664 test(S("abcde"), 0, 5, S("12345678901234567890"), 19, 2, S("0"));
665 test(S("abcde"), 0, 5, S("12345678901234567890"), 20, 0, S(""));
666 test(S("abcde"), 0, 5, S("12345678901234567890"), 20, 1, S(""));
667 test(S("abcde"), 0, 5, S("12345678901234567890"), 21, 0, S("can't happen"));
668 test(S("abcde"), 0, 6, S(""), 0, 0, S(""));
669 test(S("abcde"), 0, 6, S(""), 0, 1, S(""));
670 test(S("abcde"), 0, 6, S(""), 1, 0, S("can't happen"));
671 test(S("abcde"), 0, 6, S("12345"), 0, 0, S(""));
672 test(S("abcde"), 0, 6, S("12345"), 0, 1, S("1"));
673 test(S("abcde"), 0, 6, S("12345"), 0, 2, S("12"));
674 test(S("abcde"), 0, 6, S("12345"), 0, 4, S("1234"));
675 test(S("abcde"), 0, 6, S("12345"), 0, 5, S("12345"));
681 test(S("abcde"), 0, 6, S("12345"), 0, 6, S("12345"));
682 test(S("abcde"), 0, 6, S("12345"), 1, 0, S(""));
683 test(S("abcde"), 0, 6, S("12345"), 1, 1, S("2"));
684 test(S("abcde"), 0, 6, S("12345"), 1, 2, S("23"));
685 test(S("abcde"), 0, 6, S("12345"), 1, 3, S("234"));
686 test(S("abcde"), 0, 6, S("12345"), 1, 4, S("2345"));
687 test(S("abcde"), 0, 6, S("12345"), 1, 5, S("2345"));
688 test(S("abcde"), 0, 6, S("12345"), 2, 0, S(""));
689 test(S("abcde"), 0, 6, S("12345"), 2, 1, S("3"));
690 test(S("abcde"), 0, 6, S("12345"), 2, 2, S("34"));
691 test(S("abcde"), 0, 6, S("12345"), 2, 3, S("345"));
692 test(S("abcde"), 0, 6, S("12345"), 2, 4, S("345"));
693 test(S("abcde"), 0, 6, S("12345"), 4, 0, S(""));
694 test(S("abcde"), 0, 6, S("12345"), 4, 1, S("5"));
695 test(S("abcde"), 0, 6, S("12345"), 4, 2, S("5"));
696 test(S("abcde"), 0, 6, S("12345"), 5, 0, S(""));
697 test(S("abcde"), 0, 6, S("12345"), 5, 1, S(""));
698 test(S("abcde"), 0, 6, S("12345"), 6, 0, S("can't happen"));
699 test(S("abcde"), 0, 6, S("1234567890"), 0, 0, S(""));
700 test(S("abcde"), 0, 6, S("1234567890"), 0, 1, S("1"));
701 test(S("abcde"), 0, 6, S("1234567890"), 0, 5, S("12345"));
702 test(S("abcde"), 0, 6, S("1234567890"), 0, 9, S("123456789"));
703 test(S("abcde"), 0, 6, S("1234567890"), 0, 10, S("1234567890"));
704 test(S("abcde"), 0, 6, S("1234567890"), 0, 11, S("1234567890"));
705 test(S("abcde"), 0, 6, S("1234567890"), 1, 0, S(""));
706 test(S("abcde"), 0, 6, S("1234567890"), 1, 1, S("2"));
707 test(S("abcde"), 0, 6, S("1234567890"), 1, 4, S("2345"));
708 test(S("abcde"), 0, 6, S("1234567890"), 1, 8, S("23456789"));
709 test(S("abcde"), 0, 6, S("1234567890"), 1, 9, S("234567890"));
710 test(S("abcde"), 0, 6, S("1234567890"), 1, 10, S("234567890"));
711 test(S("abcde"), 0, 6, S("1234567890"), 5, 0, S(""));
712 test(S("abcde"), 0, 6, S("1234567890"), 5, 1, S("6"));
713 test(S("abcde"), 0, 6, S("1234567890"), 5, 2, S("67"));
714 test(S("abcde"), 0, 6, S("1234567890"), 5, 4, S("6789"));
715 test(S("abcde"), 0, 6, S("1234567890"), 5, 5, S("67890"));
716 test(S("abcde"), 0, 6, S("1234567890"), 5, 6, S("67890"));
717 test(S("abcde"), 0, 6, S("1234567890"), 9, 0, S(""));
718 test(S("abcde"), 0, 6, S("1234567890"), 9, 1, S("0"));
719 test(S("abcde"), 0, 6, S("1234567890"), 9, 2, S("0"));
720 test(S("abcde"), 0, 6, S("1234567890"), 10, 0, S(""));
721 test(S("abcde"), 0, 6, S("1234567890"), 10, 1, S(""));
722 test(S("abcde"), 0, 6, S("1234567890"), 11, 0, S("can't happen"));
723 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 0, S(""));
724 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 1, S("1"));
725 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 10, S("1234567890"));
726 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
727 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
728 test(S("abcde"), 0, 6, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
729 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 0, S(""));
730 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 1, S("2"));
731 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 9, S("234567890"));
732 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 18, S("234567890123456789"));
733 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
734 test(S("abcde"), 0, 6, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
735 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 0, S(""));
736 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 1, S("1"));
737 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 5, S("12345"));
738 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 9, S("123456789"));
739 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 10, S("1234567890"));
740 test(S("abcde"), 0, 6, S("12345678901234567890"), 10, 11, S("1234567890"));
741 test(S("abcde"), 0, 6, S("12345678901234567890"), 19, 0, S(""));
742 test(S("abcde"), 0, 6, S("12345678901234567890"), 19, 1, S("0"));
743 test(S("abcde"), 0, 6, S("12345678901234567890"), 19, 2, S("0"));
744 test(S("abcde"), 0, 6, S("12345678901234567890"), 20, 0, S(""));
745 test(S("abcde"), 0, 6, S("12345678901234567890"), 20, 1, S(""));
746 test(S("abcde"), 0, 6, S("12345678901234567890"), 21, 0, S("can't happen"));
747 test(S("abcde"), 1, 0, S(""), 0, 0, S("abcde"));
748 test(S("abcde"), 1, 0, S(""), 0, 1, S("abcde"));
749 test(S("abcde"), 1, 0, S(""), 1, 0, S("can't happen"));
750 test(S("abcde"), 1, 0, S("12345"), 0, 0, S("abcde"));
751 test(S("abcde"), 1, 0, S("12345"), 0, 1, S("a1bcde"));
752 test(S("abcde"), 1, 0, S("12345"), 0, 2, S("a12bcde"));
753 test(S("abcde"), 1, 0, S("12345"), 0, 4, S("a1234bcde"));
754 test(S("abcde"), 1, 0, S("12345"), 0, 5, S("a12345bcde"));
755 test(S("abcde"), 1, 0, S("12345"), 0, 6, S("a12345bcde"));
756 test(S("abcde"), 1, 0, S("12345"), 1, 0, S("abcde"));
757 test(S("abcde"), 1, 0, S("12345"), 1, 1, S("a2bcde"));
758 test(S("abcde"), 1, 0, S("12345"), 1, 2, S("a23bcde"));
759 test(S("abcde"), 1, 0, S("12345"), 1, 3, S("a234bcde"));
760 test(S("abcde"), 1, 0, S("12345"), 1, 4, S("a2345bcde"));
761 test(S("abcde"), 1, 0, S("12345"), 1, 5, S("a2345bcde"));
762 test(S("abcde"), 1, 0, S("12345"), 2, 0, S("abcde"));
763 test(S("abcde"), 1, 0, S("12345"), 2, 1, S("a3bcde"));
764 test(S("abcde"), 1, 0, S("12345"), 2, 2, S("a34bcde"));
765 test(S("abcde"), 1, 0, S("12345"), 2, 3, S("a345bcde"));
766 test(S("abcde"), 1, 0, S("12345"), 2, 4, S("a345bcde"));
767 test(S("abcde"), 1, 0, S("12345"), 4, 0, S("abcde"));
768 test(S("abcde"), 1, 0, S("12345"), 4, 1, S("a5bcde"));
769 test(S("abcde"), 1, 0, S("12345"), 4, 2, S("a5bcde"));
770 test(S("abcde"), 1, 0, S("12345"), 5, 0, S("abcde"));
771 test(S("abcde"), 1, 0, S("12345"), 5, 1, S("abcde"));
772 test(S("abcde"), 1, 0, S("12345"), 6, 0, S("can't happen"));
773 test(S("abcde"), 1, 0, S("1234567890"), 0, 0, S("abcde"));
774 test(S("abcde"), 1, 0, S("1234567890"), 0, 1, S("a1bcde"));
775 test(S("abcde"), 1, 0, S("1234567890"), 0, 5, S("a12345bcde"));
776 test(S("abcde"), 1, 0, S("1234567890"), 0, 9, S("a123456789bcde"));
777 test(S("abcde"), 1, 0, S("1234567890"), 0, 10, S("a1234567890bcde"));
778 test(S("abcde"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcde"));
779 test(S("abcde"), 1, 0, S("1234567890"), 1, 0, S("abcde"));
780 test(S("abcde"), 1, 0, S("1234567890"), 1, 1, S("a2bcde"));
786 test(S("abcde"), 1, 0, S("1234567890"), 1, 4, S("a2345bcde"));
787 test(S("abcde"), 1, 0, S("1234567890"), 1, 8, S("a23456789bcde"));
788 test(S("abcde"), 1, 0, S("1234567890"), 1, 9, S("a234567890bcde"));
789 test(S("abcde"), 1, 0, S("1234567890"), 1, 10, S("a234567890bcde"));
790 test(S("abcde"), 1, 0, S("1234567890"), 5, 0, S("abcde"));
791 test(S("abcde"), 1, 0, S("1234567890"), 5, 1, S("a6bcde"));
792 test(S("abcde"), 1, 0, S("1234567890"), 5, 2, S("a67bcde"));
793 test(S("abcde"), 1, 0, S("1234567890"), 5, 4, S("a6789bcde"));
794 test(S("abcde"), 1, 0, S("1234567890"), 5, 5, S("a67890bcde"));
795 test(S("abcde"), 1, 0, S("1234567890"), 5, 6, S("a67890bcde"));
796 test(S("abcde"), 1, 0, S("1234567890"), 9, 0, S("abcde"));
797 test(S("abcde"), 1, 0, S("1234567890"), 9, 1, S("a0bcde"));
798 test(S("abcde"), 1, 0, S("1234567890"), 9, 2, S("a0bcde"));
799 test(S("abcde"), 1, 0, S("1234567890"), 10, 0, S("abcde"));
800 test(S("abcde"), 1, 0, S("1234567890"), 10, 1, S("abcde"));
801 test(S("abcde"), 1, 0, S("1234567890"), 11, 0, S("can't happen"));
802 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 0, S("abcde"));
803 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 1, S("a1bcde"));
804 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 10, S("a1234567890bcde"));
805 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 19, S("a1234567890123456789bcde"));
806 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 20, S("a12345678901234567890bcde"));
807 test(S("abcde"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcde"));
808 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 0, S("abcde"));
809 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 1, S("a2bcde"));
810 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 9, S("a234567890bcde"));
811 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 18, S("a234567890123456789bcde"));
812 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 19, S("a2345678901234567890bcde"));
813 test(S("abcde"), 1, 0, S("12345678901234567890"), 1, 20, S("a2345678901234567890bcde"));
814 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 0, S("abcde"));
815 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 1, S("a1bcde"));
816 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 5, S("a12345bcde"));
817 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 9, S("a123456789bcde"));
818 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 10, S("a1234567890bcde"));
819 test(S("abcde"), 1, 0, S("12345678901234567890"), 10, 11, S("a1234567890bcde"));
820 test(S("abcde"), 1, 0, S("12345678901234567890"), 19, 0, S("abcde"));
821 test(S("abcde"), 1, 0, S("12345678901234567890"), 19, 1, S("a0bcde"));
822 test(S("abcde"), 1, 0, S("12345678901234567890"), 19, 2, S("a0bcde"));
823 test(S("abcde"), 1, 0, S("12345678901234567890"), 20, 0, S("abcde"));
824 test(S("abcde"), 1, 0, S("12345678901234567890"), 20, 1, S("abcde"));
825 test(S("abcde"), 1, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
826 test(S("abcde"), 1, 1, S(""), 0, 0, S("acde"));
827 test(S("abcde"), 1, 1, S(""), 0, 1, S("acde"));
828 test(S("abcde"), 1, 1, S(""), 1, 0, S("can't happen"));
829 test(S("abcde"), 1, 1, S("12345"), 0, 0, S("acde"));
830 test(S("abcde"), 1, 1, S("12345"), 0, 1, S("a1cde"));
831 test(S("abcde"), 1, 1, S("12345"), 0, 2, S("a12cde"));
832 test(S("abcde"), 1, 1, S("12345"), 0, 4, S("a1234cde"));
833 test(S("abcde"), 1, 1, S("12345"), 0, 5, S("a12345cde"));
834 test(S("abcde"), 1, 1, S("12345"), 0, 6, S("a12345cde"));
835 test(S("abcde"), 1, 1, S("12345"), 1, 0, S("acde"));
836 test(S("abcde"), 1, 1, S("12345"), 1, 1, S("a2cde"));
837 test(S("abcde"), 1, 1, S("12345"), 1, 2, S("a23cde"));
838 test(S("abcde"), 1, 1, S("12345"), 1, 3, S("a234cde"));
839 test(S("abcde"), 1, 1, S("12345"), 1, 4, S("a2345cde"));
840 test(S("abcde"), 1, 1, S("12345"), 1, 5, S("a2345cde"));
841 test(S("abcde"), 1, 1, S("12345"), 2, 0, S("acde"));
842 test(S("abcde"), 1, 1, S("12345"), 2, 1, S("a3cde"));
843 test(S("abcde"), 1, 1, S("12345"), 2, 2, S("a34cde"));
844 test(S("abcde"), 1, 1, S("12345"), 2, 3, S("a345cde"));
845 test(S("abcde"), 1, 1, S("12345"), 2, 4, S("a345cde"));
846 test(S("abcde"), 1, 1, S("12345"), 4, 0, S("acde"));
847 test(S("abcde"), 1, 1, S("12345"), 4, 1, S("a5cde"));
848 test(S("abcde"), 1, 1, S("12345"), 4, 2, S("a5cde"));
849 test(S("abcde"), 1, 1, S("12345"), 5, 0, S("acde"));
850 test(S("abcde"), 1, 1, S("12345"), 5, 1, S("acde"));
851 test(S("abcde"), 1, 1, S("12345"), 6, 0, S("can't happen"));
852 test(S("abcde"), 1, 1, S("1234567890"), 0, 0, S("acde"));
853 test(S("abcde"), 1, 1, S("1234567890"), 0, 1, S("a1cde"));
854 test(S("abcde"), 1, 1, S("1234567890"), 0, 5, S("a12345cde"));
855 test(S("abcde"), 1, 1, S("1234567890"), 0, 9, S("a123456789cde"));
856 test(S("abcde"), 1, 1, S("1234567890"), 0, 10, S("a1234567890cde"));
857 test(S("abcde"), 1, 1, S("1234567890"), 0, 11, S("a1234567890cde"));
858 test(S("abcde"), 1, 1, S("1234567890"), 1, 0, S("acde"));
859 test(S("abcde"), 1, 1, S("1234567890"), 1, 1, S("a2cde"));
860 test(S("abcde"), 1, 1, S("1234567890"), 1, 4, S("a2345cde"));
861 test(S("abcde"), 1, 1, S("1234567890"), 1, 8, S("a23456789cde"));
862 test(S("abcde"), 1, 1, S("1234567890"), 1, 9, S("a234567890cde"));
863 test(S("abcde"), 1, 1, S("1234567890"), 1, 10, S("a234567890cde"));
864 test(S("abcde"), 1, 1, S("1234567890"), 5, 0, S("acde"));
865 test(S("abcde"), 1, 1, S("1234567890"), 5, 1, S("a6cde"));
866 test(S("abcde"), 1, 1, S("1234567890"), 5, 2, S("a67cde"));
867 test(S("abcde"), 1, 1, S("1234567890"), 5, 4, S("a6789cde"));
868 test(S("abcde"), 1, 1, S("1234567890"), 5, 5, S("a67890cde"));
869 test(S("abcde"), 1, 1, S("1234567890"), 5, 6, S("a67890cde"));
870 test(S("abcde"), 1, 1, S("1234567890"), 9, 0, S("acde"));
871 test(S("abcde"), 1, 1, S("1234567890"), 9, 1, S("a0cde"));
872 test(S("abcde"), 1, 1, S("1234567890"), 9, 2, S("a0cde"));
873 test(S("abcde"), 1, 1, S("1234567890"), 10, 0, S("acde"));
874 test(S("abcde"), 1, 1, S("1234567890"), 10, 1, S("acde"));
875 test(S("abcde"), 1, 1, S("1234567890"), 11, 0, S("can't happen"));
876 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 0, S("acde"));
877 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 1, S("a1cde"));
878 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 10, S("a1234567890cde"));
879 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 19, S("a1234567890123456789cde"));
880 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 20, S("a12345678901234567890cde"));
881 test(S("abcde"), 1, 1, S("12345678901234567890"), 0, 21, S("a12345678901234567890cde"));
882 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 0, S("acde"));
883 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cde"));
884 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cde"));
885 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cde"));
891 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cde"));
892 test(S("abcde"), 1, 1, S("12345678901234567890"), 1, 20, S("a2345678901234567890cde"));
893 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 0, S("acde"));
894 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 1, S("a1cde"));
895 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 5, S("a12345cde"));
896 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 9, S("a123456789cde"));
897 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 10, S("a1234567890cde"));
898 test(S("abcde"), 1, 1, S("12345678901234567890"), 10, 11, S("a1234567890cde"));
899 test(S("abcde"), 1, 1, S("12345678901234567890"), 19, 0, S("acde"));
900 test(S("abcde"), 1, 1, S("12345678901234567890"), 19, 1, S("a0cde"));
901 test(S("abcde"), 1, 1, S("12345678901234567890"), 19, 2, S("a0cde"));
902 test(S("abcde"), 1, 1, S("12345678901234567890"), 20, 0, S("acde"));
903 test(S("abcde"), 1, 1, S("12345678901234567890"), 20, 1, S("acde"));
904 test(S("abcde"), 1, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
905 test(S("abcde"), 1, 2, S(""), 0, 0, S("ade"));
906 test(S("abcde"), 1, 2, S(""), 0, 1, S("ade"));
907 test(S("abcde"), 1, 2, S(""), 1, 0, S("can't happen"));
908 test(S("abcde"), 1, 2, S("12345"), 0, 0, S("ade"));
909 test(S("abcde"), 1, 2, S("12345"), 0, 1, S("a1de"));
910 test(S("abcde"), 1, 2, S("12345"), 0, 2, S("a12de"));
911 test(S("abcde"), 1, 2, S("12345"), 0, 4, S("a1234de"));
912 test(S("abcde"), 1, 2, S("12345"), 0, 5, S("a12345de"));
913 test(S("abcde"), 1, 2, S("12345"), 0, 6, S("a12345de"));
914 test(S("abcde"), 1, 2, S("12345"), 1, 0, S("ade"));
915 test(S("abcde"), 1, 2, S("12345"), 1, 1, S("a2de"));
916 test(S("abcde"), 1, 2, S("12345"), 1, 2, S("a23de"));
917 test(S("abcde"), 1, 2, S("12345"), 1, 3, S("a234de"));
918 test(S("abcde"), 1, 2, S("12345"), 1, 4, S("a2345de"));
919 test(S("abcde"), 1, 2, S("12345"), 1, 5, S("a2345de"));
920 test(S("abcde"), 1, 2, S("12345"), 2, 0, S("ade"));
921 test(S("abcde"), 1, 2, S("12345"), 2, 1, S("a3de"));
922 test(S("abcde"), 1, 2, S("12345"), 2, 2, S("a34de"));
923 test(S("abcde"), 1, 2, S("12345"), 2, 3, S("a345de"));
924 test(S("abcde"), 1, 2, S("12345"), 2, 4, S("a345de"));
925 test(S("abcde"), 1, 2, S("12345"), 4, 0, S("ade"));
926 test(S("abcde"), 1, 2, S("12345"), 4, 1, S("a5de"));
927 test(S("abcde"), 1, 2, S("12345"), 4, 2, S("a5de"));
928 test(S("abcde"), 1, 2, S("12345"), 5, 0, S("ade"));
929 test(S("abcde"), 1, 2, S("12345"), 5, 1, S("ade"));
930 test(S("abcde"), 1, 2, S("12345"), 6, 0, S("can't happen"));
931 test(S("abcde"), 1, 2, S("1234567890"), 0, 0, S("ade"));
932 test(S("abcde"), 1, 2, S("1234567890"), 0, 1, S("a1de"));
933 test(S("abcde"), 1, 2, S("1234567890"), 0, 5, S("a12345de"));
934 test(S("abcde"), 1, 2, S("1234567890"), 0, 9, S("a123456789de"));
935 test(S("abcde"), 1, 2, S("1234567890"), 0, 10, S("a1234567890de"));
936 test(S("abcde"), 1, 2, S("1234567890"), 0, 11, S("a1234567890de"));
937 test(S("abcde"), 1, 2, S("1234567890"), 1, 0, S("ade"));
938 test(S("abcde"), 1, 2, S("1234567890"), 1, 1, S("a2de"));
939 test(S("abcde"), 1, 2, S("1234567890"), 1, 4, S("a2345de"));
940 test(S("abcde"), 1, 2, S("1234567890"), 1, 8, S("a23456789de"));
941 test(S("abcde"), 1, 2, S("1234567890"), 1, 9, S("a234567890de"));
942 test(S("abcde"), 1, 2, S("1234567890"), 1, 10, S("a234567890de"));
943 test(S("abcde"), 1, 2, S("1234567890"), 5, 0, S("ade"));
944 test(S("abcde"), 1, 2, S("1234567890"), 5, 1, S("a6de"));
945 test(S("abcde"), 1, 2, S("1234567890"), 5, 2, S("a67de"));
946 test(S("abcde"), 1, 2, S("1234567890"), 5, 4, S("a6789de"));
947 test(S("abcde"), 1, 2, S("1234567890"), 5, 5, S("a67890de"));
948 test(S("abcde"), 1, 2, S("1234567890"), 5, 6, S("a67890de"));
949 test(S("abcde"), 1, 2, S("1234567890"), 9, 0, S("ade"));
950 test(S("abcde"), 1, 2, S("1234567890"), 9, 1, S("a0de"));
951 test(S("abcde"), 1, 2, S("1234567890"), 9, 2, S("a0de"));
952 test(S("abcde"), 1, 2, S("1234567890"), 10, 0, S("ade"));
953 test(S("abcde"), 1, 2, S("1234567890"), 10, 1, S("ade"));
954 test(S("abcde"), 1, 2, S("1234567890"), 11, 0, S("can't happen"));
955 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 0, S("ade"));
956 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 1, S("a1de"));
957 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 10, S("a1234567890de"));
958 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 19, S("a1234567890123456789de"));
959 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 20, S("a12345678901234567890de"));
960 test(S("abcde"), 1, 2, S("12345678901234567890"), 0, 21, S("a12345678901234567890de"));
961 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 0, S("ade"));
962 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 1, S("a2de"));
963 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 9, S("a234567890de"));
964 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 18, S("a234567890123456789de"));
965 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 19, S("a2345678901234567890de"));
966 test(S("abcde"), 1, 2, S("12345678901234567890"), 1, 20, S("a2345678901234567890de"));
967 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 0, S("ade"));
968 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 1, S("a1de"));
969 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 5, S("a12345de"));
970 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 9, S("a123456789de"));
971 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 10, S("a1234567890de"));
972 test(S("abcde"), 1, 2, S("12345678901234567890"), 10, 11, S("a1234567890de"));
973 test(S("abcde"), 1, 2, S("12345678901234567890"), 19, 0, S("ade"));
974 test(S("abcde"), 1, 2, S("12345678901234567890"), 19, 1, S("a0de"));
975 test(S("abcde"), 1, 2, S("12345678901234567890"), 19, 2, S("a0de"));
976 test(S("abcde"), 1, 2, S("12345678901234567890"), 20, 0, S("ade"));
977 test(S("abcde"), 1, 2, S("12345678901234567890"), 20, 1, S("ade"));
978 test(S("abcde"), 1, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
979 test(S("abcde"), 1, 3, S(""), 0, 0, S("ae"));
980 test(S("abcde"), 1, 3, S(""), 0, 1, S("ae"));
981 test(S("abcde"), 1, 3, S(""), 1, 0, S("can't happen"));
982 test(S("abcde"), 1, 3, S("12345"), 0, 0, S("ae"));
983 test(S("abcde"), 1, 3, S("12345"), 0, 1, S("a1e"));
984 test(S("abcde"), 1, 3, S("12345"), 0, 2, S("a12e"));
985 test(S("abcde"), 1, 3, S("12345"), 0, 4, S("a1234e"));
986 test(S("abcde"), 1, 3, S("12345"), 0, 5, S("a12345e"));
987 test(S("abcde"), 1, 3, S("12345"), 0, 6, S("a12345e"));
988 test(S("abcde"), 1, 3, S("12345"), 1, 0, S("ae"));
989 test(S("abcde"), 1, 3, S("12345"), 1, 1, S("a2e"));
990 test(S("abcde"), 1, 3, S("12345"), 1, 2, S("a23e"));
996 test(S("abcde"), 1, 3, S("12345"), 1, 3, S("a234e"));
997 test(S("abcde"), 1, 3, S("12345"), 1, 4, S("a2345e"));
998 test(S("abcde"), 1, 3, S("12345"), 1, 5, S("a2345e"));
999 test(S("abcde"), 1, 3, S("12345"), 2, 0, S("ae"));
1000 test(S("abcde"), 1, 3, S("12345"), 2, 1, S("a3e"));
1001 test(S("abcde"), 1, 3, S("12345"), 2, 2, S("a34e"));
1002 test(S("abcde"), 1, 3, S("12345"), 2, 3, S("a345e"));
1003 test(S("abcde"), 1, 3, S("12345"), 2, 4, S("a345e"));
1004 test(S("abcde"), 1, 3, S("12345"), 4, 0, S("ae"));
1005 test(S("abcde"), 1, 3, S("12345"), 4, 1, S("a5e"));
1006 test(S("abcde"), 1, 3, S("12345"), 4, 2, S("a5e"));
1007 test(S("abcde"), 1, 3, S("12345"), 5, 0, S("ae"));
1008 test(S("abcde"), 1, 3, S("12345"), 5, 1, S("ae"));
1009 test(S("abcde"), 1, 3, S("12345"), 6, 0, S("can't happen"));
1010 test(S("abcde"), 1, 3, S("1234567890"), 0, 0, S("ae"));
1011 test(S("abcde"), 1, 3, S("1234567890"), 0, 1, S("a1e"));
1012 test(S("abcde"), 1, 3, S("1234567890"), 0, 5, S("a12345e"));
1013 test(S("abcde"), 1, 3, S("1234567890"), 0, 9, S("a123456789e"));
1014 test(S("abcde"), 1, 3, S("1234567890"), 0, 10, S("a1234567890e"));
1015 test(S("abcde"), 1, 3, S("1234567890"), 0, 11, S("a1234567890e"));
1016 test(S("abcde"), 1, 3, S("1234567890"), 1, 0, S("ae"));
1017 test(S("abcde"), 1, 3, S("1234567890"), 1, 1, S("a2e"));
1018 test(S("abcde"), 1, 3, S("1234567890"), 1, 4, S("a2345e"));
1019 test(S("abcde"), 1, 3, S("1234567890"), 1, 8, S("a23456789e"));
1020 test(S("abcde"), 1, 3, S("1234567890"), 1, 9, S("a234567890e"));
1021 test(S("abcde"), 1, 3, S("1234567890"), 1, 10, S("a234567890e"));
1022 test(S("abcde"), 1, 3, S("1234567890"), 5, 0, S("ae"));
1023 test(S("abcde"), 1, 3, S("1234567890"), 5, 1, S("a6e"));
1024 test(S("abcde"), 1, 3, S("1234567890"), 5, 2, S("a67e"));
1025 test(S("abcde"), 1, 3, S("1234567890"), 5, 4, S("a6789e"));
1026 test(S("abcde"), 1, 3, S("1234567890"), 5, 5, S("a67890e"));
1027 test(S("abcde"), 1, 3, S("1234567890"), 5, 6, S("a67890e"));
1028 test(S("abcde"), 1, 3, S("1234567890"), 9, 0, S("ae"));
1029 test(S("abcde"), 1, 3, S("1234567890"), 9, 1, S("a0e"));
1030 test(S("abcde"), 1, 3, S("1234567890"), 9, 2, S("a0e"));
1031 test(S("abcde"), 1, 3, S("1234567890"), 10, 0, S("ae"));
1032 test(S("abcde"), 1, 3, S("1234567890"), 10, 1, S("ae"));
1033 test(S("abcde"), 1, 3, S("1234567890"), 11, 0, S("can't happen"));
1034 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 0, S("ae"));
1035 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 1, S("a1e"));
1036 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 10, S("a1234567890e"));
1037 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 19, S("a1234567890123456789e"));
1038 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 20, S("a12345678901234567890e"));
1039 test(S("abcde"), 1, 3, S("12345678901234567890"), 0, 21, S("a12345678901234567890e"));
1040 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 0, S("ae"));
1041 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 1, S("a2e"));
1042 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 9, S("a234567890e"));
1043 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 18, S("a234567890123456789e"));
1044 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 19, S("a2345678901234567890e"));
1045 test(S("abcde"), 1, 3, S("12345678901234567890"), 1, 20, S("a2345678901234567890e"));
1046 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 0, S("ae"));
1047 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 1, S("a1e"));
1048 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 5, S("a12345e"));
1049 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 9, S("a123456789e"));
1050 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 10, S("a1234567890e"));
1051 test(S("abcde"), 1, 3, S("12345678901234567890"), 10, 11, S("a1234567890e"));
1052 test(S("abcde"), 1, 3, S("12345678901234567890"), 19, 0, S("ae"));
1053 test(S("abcde"), 1, 3, S("12345678901234567890"), 19, 1, S("a0e"));
1054 test(S("abcde"), 1, 3, S("12345678901234567890"), 19, 2, S("a0e"));
1055 test(S("abcde"), 1, 3, S("12345678901234567890"), 20, 0, S("ae"));
1056 test(S("abcde"), 1, 3, S("12345678901234567890"), 20, 1, S("ae"));
1057 test(S("abcde"), 1, 3, S("12345678901234567890"), 21, 0, S("can't happen"));
1058 test(S("abcde"), 1, 4, S(""), 0, 0, S("a"));
1059 test(S("abcde"), 1, 4, S(""), 0, 1, S("a"));
1060 test(S("abcde"), 1, 4, S(""), 1, 0, S("can't happen"));
1061 test(S("abcde"), 1, 4, S("12345"), 0, 0, S("a"));
1062 test(S("abcde"), 1, 4, S("12345"), 0, 1, S("a1"));
1063 test(S("abcde"), 1, 4, S("12345"), 0, 2, S("a12"));
1064 test(S("abcde"), 1, 4, S("12345"), 0, 4, S("a1234"));
1065 test(S("abcde"), 1, 4, S("12345"), 0, 5, S("a12345"));
1066 test(S("abcde"), 1, 4, S("12345"), 0, 6, S("a12345"));
1067 test(S("abcde"), 1, 4, S("12345"), 1, 0, S("a"));
1068 test(S("abcde"), 1, 4, S("12345"), 1, 1, S("a2"));
1069 test(S("abcde"), 1, 4, S("12345"), 1, 2, S("a23"));
1070 test(S("abcde"), 1, 4, S("12345"), 1, 3, S("a234"));
1071 test(S("abcde"), 1, 4, S("12345"), 1, 4, S("a2345"));
1072 test(S("abcde"), 1, 4, S("12345"), 1, 5, S("a2345"));
1073 test(S("abcde"), 1, 4, S("12345"), 2, 0, S("a"));
1074 test(S("abcde"), 1, 4, S("12345"), 2, 1, S("a3"));
1075 test(S("abcde"), 1, 4, S("12345"), 2, 2, S("a34"));
1076 test(S("abcde"), 1, 4, S("12345"), 2, 3, S("a345"));
1077 test(S("abcde"), 1, 4, S("12345"), 2, 4, S("a345"));
1078 test(S("abcde"), 1, 4, S("12345"), 4, 0, S("a"));
1079 test(S("abcde"), 1, 4, S("12345"), 4, 1, S("a5"));
1080 test(S("abcde"), 1, 4, S("12345"), 4, 2, S("a5"));
1081 test(S("abcde"), 1, 4, S("12345"), 5, 0, S("a"));
1082 test(S("abcde"), 1, 4, S("12345"), 5, 1, S("a"));
1083 test(S("abcde"), 1, 4, S("12345"), 6, 0, S("can't happen"));
1084 test(S("abcde"), 1, 4, S("1234567890"), 0, 0, S("a"));
1085 test(S("abcde"), 1, 4, S("1234567890"), 0, 1, S("a1"));
1086 test(S("abcde"), 1, 4, S("1234567890"), 0, 5, S("a12345"));
1087 test(S("abcde"), 1, 4, S("1234567890"), 0, 9, S("a123456789"));
1088 test(S("abcde"), 1, 4, S("1234567890"), 0, 10, S("a1234567890"));
1089 test(S("abcde"), 1, 4, S("1234567890"), 0, 11, S("a1234567890"));
1090 test(S("abcde"), 1, 4, S("1234567890"), 1, 0, S("a"));
1091 test(S("abcde"), 1, 4, S("1234567890"), 1, 1, S("a2"));
1092 test(S("abcde"), 1, 4, S("1234567890"), 1, 4, S("a2345"));
1093 test(S("abcde"), 1, 4, S("1234567890"), 1, 8, S("a23456789"));
1094 test(S("abcde"), 1, 4, S("1234567890"), 1, 9, S("a234567890"));
1095 test(S("abcde"), 1, 4, S("1234567890"), 1, 10, S("a234567890"));
1101 test(S("abcde"), 1, 4, S("1234567890"), 5, 0, S("a"));
1102 test(S("abcde"), 1, 4, S("1234567890"), 5, 1, S("a6"));
1103 test(S("abcde"), 1, 4, S("1234567890"), 5, 2, S("a67"));
1104 test(S("abcde"), 1, 4, S("1234567890"), 5, 4, S("a6789"));
1105 test(S("abcde"), 1, 4, S("1234567890"), 5, 5, S("a67890"));
1106 test(S("abcde"), 1, 4, S("1234567890"), 5, 6, S("a67890"));
1107 test(S("abcde"), 1, 4, S("1234567890"), 9, 0, S("a"));
1108 test(S("abcde"), 1, 4, S("1234567890"), 9, 1, S("a0"));
1109 test(S("abcde"), 1, 4, S("1234567890"), 9, 2, S("a0"));
1110 test(S("abcde"), 1, 4, S("1234567890"), 10, 0, S("a"));
1111 test(S("abcde"), 1, 4, S("1234567890"), 10, 1, S("a"));
1112 test(S("abcde"), 1, 4, S("1234567890"), 11, 0, S("can't happen"));
1113 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 0, S("a"));
1114 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 1, S("a1"));
1115 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 10, S("a1234567890"));
1116 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
1117 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
1118 test(S("abcde"), 1, 4, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
1119 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 0, S("a"));
1120 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 1, S("a2"));
1121 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 9, S("a234567890"));
1122 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
1123 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
1124 test(S("abcde"), 1, 4, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
1125 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 0, S("a"));
1126 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 1, S("a1"));
1127 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 5, S("a12345"));
1128 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 9, S("a123456789"));
1129 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 10, S("a1234567890"));
1130 test(S("abcde"), 1, 4, S("12345678901234567890"), 10, 11, S("a1234567890"));
1131 test(S("abcde"), 1, 4, S("12345678901234567890"), 19, 0, S("a"));
1132 test(S("abcde"), 1, 4, S("12345678901234567890"), 19, 1, S("a0"));
1133 test(S("abcde"), 1, 4, S("12345678901234567890"), 19, 2, S("a0"));
1134 test(S("abcde"), 1, 4, S("12345678901234567890"), 20, 0, S("a"));
1135 test(S("abcde"), 1, 4, S("12345678901234567890"), 20, 1, S("a"));
1136 test(S("abcde"), 1, 4, S("12345678901234567890"), 21, 0, S("can't happen"));
1137 test(S("abcde"), 1, 5, S(""), 0, 0, S("a"));
1138 test(S("abcde"), 1, 5, S(""), 0, 1, S("a"));
1139 test(S("abcde"), 1, 5, S(""), 1, 0, S("can't happen"));
1140 test(S("abcde"), 1, 5, S("12345"), 0, 0, S("a"));
1141 test(S("abcde"), 1, 5, S("12345"), 0, 1, S("a1"));
1142 test(S("abcde"), 1, 5, S("12345"), 0, 2, S("a12"));
1143 test(S("abcde"), 1, 5, S("12345"), 0, 4, S("a1234"));
1144 test(S("abcde"), 1, 5, S("12345"), 0, 5, S("a12345"));
1145 test(S("abcde"), 1, 5, S("12345"), 0, 6, S("a12345"));
1146 test(S("abcde"), 1, 5, S("12345"), 1, 0, S("a"));
1147 test(S("abcde"), 1, 5, S("12345"), 1, 1, S("a2"));
1148 test(S("abcde"), 1, 5, S("12345"), 1, 2, S("a23"));
1149 test(S("abcde"), 1, 5, S("12345"), 1, 3, S("a234"));
1150 test(S("abcde"), 1, 5, S("12345"), 1, 4, S("a2345"));
1151 test(S("abcde"), 1, 5, S("12345"), 1, 5, S("a2345"));
1152 test(S("abcde"), 1, 5, S("12345"), 2, 0, S("a"));
1153 test(S("abcde"), 1, 5, S("12345"), 2, 1, S("a3"));
1154 test(S("abcde"), 1, 5, S("12345"), 2, 2, S("a34"));
1155 test(S("abcde"), 1, 5, S("12345"), 2, 3, S("a345"));
1156 test(S("abcde"), 1, 5, S("12345"), 2, 4, S("a345"));
1157 test(S("abcde"), 1, 5, S("12345"), 4, 0, S("a"));
1158 test(S("abcde"), 1, 5, S("12345"), 4, 1, S("a5"));
1159 test(S("abcde"), 1, 5, S("12345"), 4, 2, S("a5"));
1160 test(S("abcde"), 1, 5, S("12345"), 5, 0, S("a"));
1161 test(S("abcde"), 1, 5, S("12345"), 5, 1, S("a"));
1162 test(S("abcde"), 1, 5, S("12345"), 6, 0, S("can't happen"));
1163 test(S("abcde"), 1, 5, S("1234567890"), 0, 0, S("a"));
1164 test(S("abcde"), 1, 5, S("1234567890"), 0, 1, S("a1"));
1165 test(S("abcde"), 1, 5, S("1234567890"), 0, 5, S("a12345"));
1166 test(S("abcde"), 1, 5, S("1234567890"), 0, 9, S("a123456789"));
1167 test(S("abcde"), 1, 5, S("1234567890"), 0, 10, S("a1234567890"));
1168 test(S("abcde"), 1, 5, S("1234567890"), 0, 11, S("a1234567890"));
1169 test(S("abcde"), 1, 5, S("1234567890"), 1, 0, S("a"));
1170 test(S("abcde"), 1, 5, S("1234567890"), 1, 1, S("a2"));
1171 test(S("abcde"), 1, 5, S("1234567890"), 1, 4, S("a2345"));
1172 test(S("abcde"), 1, 5, S("1234567890"), 1, 8, S("a23456789"));
1173 test(S("abcde"), 1, 5, S("1234567890"), 1, 9, S("a234567890"));
1174 test(S("abcde"), 1, 5, S("1234567890"), 1, 10, S("a234567890"));
1175 test(S("abcde"), 1, 5, S("1234567890"), 5, 0, S("a"));
1176 test(S("abcde"), 1, 5, S("1234567890"), 5, 1, S("a6"));
1177 test(S("abcde"), 1, 5, S("1234567890"), 5, 2, S("a67"));
1178 test(S("abcde"), 1, 5, S("1234567890"), 5, 4, S("a6789"));
1179 test(S("abcde"), 1, 5, S("1234567890"), 5, 5, S("a67890"));
1180 test(S("abcde"), 1, 5, S("1234567890"), 5, 6, S("a67890"));
1181 test(S("abcde"), 1, 5, S("1234567890"), 9, 0, S("a"));
1182 test(S("abcde"), 1, 5, S("1234567890"), 9, 1, S("a0"));
1183 test(S("abcde"), 1, 5, S("1234567890"), 9, 2, S("a0"));
1184 test(S("abcde"), 1, 5, S("1234567890"), 10, 0, S("a"));
1185 test(S("abcde"), 1, 5, S("1234567890"), 10, 1, S("a"));
1186 test(S("abcde"), 1, 5, S("1234567890"), 11, 0, S("can't happen"));
1187 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 0, S("a"));
1188 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 1, S("a1"));
1189 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 10, S("a1234567890"));
1190 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
1191 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
1192 test(S("abcde"), 1, 5, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
1193 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 0, S("a"));
1194 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 1, S("a2"));
1195 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 9, S("a234567890"));
1196 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
1197 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
1198 test(S("abcde"), 1, 5, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
1199 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 0, S("a"));
1200 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 1, S("a1"));
1206 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 5, S("a12345"));
1207 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 9, S("a123456789"));
1208 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 10, S("a1234567890"));
1209 test(S("abcde"), 1, 5, S("12345678901234567890"), 10, 11, S("a1234567890"));
1210 test(S("abcde"), 1, 5, S("12345678901234567890"), 19, 0, S("a"));
1211 test(S("abcde"), 1, 5, S("12345678901234567890"), 19, 1, S("a0"));
1212 test(S("abcde"), 1, 5, S("12345678901234567890"), 19, 2, S("a0"));
1213 test(S("abcde"), 1, 5, S("12345678901234567890"), 20, 0, S("a"));
1214 test(S("abcde"), 1, 5, S("12345678901234567890"), 20, 1, S("a"));
1215 test(S("abcde"), 1, 5, S("12345678901234567890"), 21, 0, S("can't happen"));
1216 test(S("abcde"), 2, 0, S(""), 0, 0, S("abcde"));
1217 test(S("abcde"), 2, 0, S(""), 0, 1, S("abcde"));
1218 test(S("abcde"), 2, 0, S(""), 1, 0, S("can't happen"));
1219 test(S("abcde"), 2, 0, S("12345"), 0, 0, S("abcde"));
1220 test(S("abcde"), 2, 0, S("12345"), 0, 1, S("ab1cde"));
1221 test(S("abcde"), 2, 0, S("12345"), 0, 2, S("ab12cde"));
1222 test(S("abcde"), 2, 0, S("12345"), 0, 4, S("ab1234cde"));
1223 test(S("abcde"), 2, 0, S("12345"), 0, 5, S("ab12345cde"));
1224 test(S("abcde"), 2, 0, S("12345"), 0, 6, S("ab12345cde"));
1225 test(S("abcde"), 2, 0, S("12345"), 1, 0, S("abcde"));
1226 test(S("abcde"), 2, 0, S("12345"), 1, 1, S("ab2cde"));
1227 test(S("abcde"), 2, 0, S("12345"), 1, 2, S("ab23cde"));
1228 test(S("abcde"), 2, 0, S("12345"), 1, 3, S("ab234cde"));
1229 test(S("abcde"), 2, 0, S("12345"), 1, 4, S("ab2345cde"));
1230 test(S("abcde"), 2, 0, S("12345"), 1, 5, S("ab2345cde"));
1231 test(S("abcde"), 2, 0, S("12345"), 2, 0, S("abcde"));
1232 test(S("abcde"), 2, 0, S("12345"), 2, 1, S("ab3cde"));
1233 test(S("abcde"), 2, 0, S("12345"), 2, 2, S("ab34cde"));
1234 test(S("abcde"), 2, 0, S("12345"), 2, 3, S("ab345cde"));
1235 test(S("abcde"), 2, 0, S("12345"), 2, 4, S("ab345cde"));
1236 test(S("abcde"), 2, 0, S("12345"), 4, 0, S("abcde"));
1237 test(S("abcde"), 2, 0, S("12345"), 4, 1, S("ab5cde"));
1238 test(S("abcde"), 2, 0, S("12345"), 4, 2, S("ab5cde"));
1239 test(S("abcde"), 2, 0, S("12345"), 5, 0, S("abcde"));
1240 test(S("abcde"), 2, 0, S("12345"), 5, 1, S("abcde"));
1241 test(S("abcde"), 2, 0, S("12345"), 6, 0, S("can't happen"));
1242 test(S("abcde"), 2, 0, S("1234567890"), 0, 0, S("abcde"));
1243 test(S("abcde"), 2, 0, S("1234567890"), 0, 1, S("ab1cde"));
1244 test(S("abcde"), 2, 0, S("1234567890"), 0, 5, S("ab12345cde"));
1245 test(S("abcde"), 2, 0, S("1234567890"), 0, 9, S("ab123456789cde"));
1246 test(S("abcde"), 2, 0, S("1234567890"), 0, 10, S("ab1234567890cde"));
1247 test(S("abcde"), 2, 0, S("1234567890"), 0, 11, S("ab1234567890cde"));
1248 test(S("abcde"), 2, 0, S("1234567890"), 1, 0, S("abcde"));
1249 test(S("abcde"), 2, 0, S("1234567890"), 1, 1, S("ab2cde"));
1250 test(S("abcde"), 2, 0, S("1234567890"), 1, 4, S("ab2345cde"));
1251 test(S("abcde"), 2, 0, S("1234567890"), 1, 8, S("ab23456789cde"));
1252 test(S("abcde"), 2, 0, S("1234567890"), 1, 9, S("ab234567890cde"));
1253 test(S("abcde"), 2, 0, S("1234567890"), 1, 10, S("ab234567890cde"));
1254 test(S("abcde"), 2, 0, S("1234567890"), 5, 0, S("abcde"));
1255 test(S("abcde"), 2, 0, S("1234567890"), 5, 1, S("ab6cde"));
1256 test(S("abcde"), 2, 0, S("1234567890"), 5, 2, S("ab67cde"));
1257 test(S("abcde"), 2, 0, S("1234567890"), 5, 4, S("ab6789cde"));
1258 test(S("abcde"), 2, 0, S("1234567890"), 5, 5, S("ab67890cde"));
1259 test(S("abcde"), 2, 0, S("1234567890"), 5, 6, S("ab67890cde"));
1260 test(S("abcde"), 2, 0, S("1234567890"), 9, 0, S("abcde"));
1261 test(S("abcde"), 2, 0, S("1234567890"), 9, 1, S("ab0cde"));
1262 test(S("abcde"), 2, 0, S("1234567890"), 9, 2, S("ab0cde"));
1263 test(S("abcde"), 2, 0, S("1234567890"), 10, 0, S("abcde"));
1264 test(S("abcde"), 2, 0, S("1234567890"), 10, 1, S("abcde"));
1265 test(S("abcde"), 2, 0, S("1234567890"), 11, 0, S("can't happen"));
1266 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 0, S("abcde"));
1267 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 1, S("ab1cde"));
1268 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 10, S("ab1234567890cde"));
1269 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
1270 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
1271 test(S("abcde"), 2, 0, S("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
1272 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 0, S("abcde"));
1273 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 1, S("ab2cde"));
1274 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 9, S("ab234567890cde"));
1275 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 18, S("ab234567890123456789cde"));
1276 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 19, S("ab2345678901234567890cde"));
1277 test(S("abcde"), 2, 0, S("12345678901234567890"), 1, 20, S("ab2345678901234567890cde"));
1278 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 0, S("abcde"));
1279 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 1, S("ab1cde"));
1280 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 5, S("ab12345cde"));
1281 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 9, S("ab123456789cde"));
1282 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 10, S("ab1234567890cde"));
1283 test(S("abcde"), 2, 0, S("12345678901234567890"), 10, 11, S("ab1234567890cde"));
1284 test(S("abcde"), 2, 0, S("12345678901234567890"), 19, 0, S("abcde"));
1285 test(S("abcde"), 2, 0, S("12345678901234567890"), 19, 1, S("ab0cde"));
1286 test(S("abcde"), 2, 0, S("12345678901234567890"), 19, 2, S("ab0cde"));
1287 test(S("abcde"), 2, 0, S("12345678901234567890"), 20, 0, S("abcde"));
1288 test(S("abcde"), 2, 0, S("12345678901234567890"), 20, 1, S("abcde"));
1289 test(S("abcde"), 2, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
1290 test(S("abcde"), 2, 1, S(""), 0, 0, S("abde"));
1291 test(S("abcde"), 2, 1, S(""), 0, 1, S("abde"));
1292 test(S("abcde"), 2, 1, S(""), 1, 0, S("can't happen"));
1293 test(S("abcde"), 2, 1, S("12345"), 0, 0, S("abde"));
1294 test(S("abcde"), 2, 1, S("12345"), 0, 1, S("ab1de"));
1295 test(S("abcde"), 2, 1, S("12345"), 0, 2, S("ab12de"));
1296 test(S("abcde"), 2, 1, S("12345"), 0, 4, S("ab1234de"));
1297 test(S("abcde"), 2, 1, S("12345"), 0, 5, S("ab12345de"));
1298 test(S("abcde"), 2, 1, S("12345"), 0, 6, S("ab12345de"));
1299 test(S("abcde"), 2, 1, S("12345"), 1, 0, S("abde"));
1300 test(S("abcde"), 2, 1, S("12345"), 1, 1, S("ab2de"));
1301 test(S("abcde"), 2, 1, S("12345"), 1, 2, S("ab23de"));
1302 test(S("abcde"), 2, 1, S("12345"), 1, 3, S("ab234de"));
1303 test(S("abcde"), 2, 1, S("12345"), 1, 4, S("ab2345de"));
1304 test(S("abcde"), 2, 1, S("12345"), 1, 5, S("ab2345de"));
1305 test(S("abcde"), 2, 1, S("12345"), 2, 0, S("abde"));
1311 test(S("abcde"), 2, 1, S("12345"), 2, 1, S("ab3de"));
1312 test(S("abcde"), 2, 1, S("12345"), 2, 2, S("ab34de"));
1313 test(S("abcde"), 2, 1, S("12345"), 2, 3, S("ab345de"));
1314 test(S("abcde"), 2, 1, S("12345"), 2, 4, S("ab345de"));
1315 test(S("abcde"), 2, 1, S("12345"), 4, 0, S("abde"));
1316 test(S("abcde"), 2, 1, S("12345"), 4, 1, S("ab5de"));
1317 test(S("abcde"), 2, 1, S("12345"), 4, 2, S("ab5de"));
1318 test(S("abcde"), 2, 1, S("12345"), 5, 0, S("abde"));
1319 test(S("abcde"), 2, 1, S("12345"), 5, 1, S("abde"));
1320 test(S("abcde"), 2, 1, S("12345"), 6, 0, S("can't happen"));
1321 test(S("abcde"), 2, 1, S("1234567890"), 0, 0, S("abde"));
1322 test(S("abcde"), 2, 1, S("1234567890"), 0, 1, S("ab1de"));
1323 test(S("abcde"), 2, 1, S("1234567890"), 0, 5, S("ab12345de"));
1324 test(S("abcde"), 2, 1, S("1234567890"), 0, 9, S("ab123456789de"));
1325 test(S("abcde"), 2, 1, S("1234567890"), 0, 10, S("ab1234567890de"));
1326 test(S("abcde"), 2, 1, S("1234567890"), 0, 11, S("ab1234567890de"));
1327 test(S("abcde"), 2, 1, S("1234567890"), 1, 0, S("abde"));
1328 test(S("abcde"), 2, 1, S("1234567890"), 1, 1, S("ab2de"));
1329 test(S("abcde"), 2, 1, S("1234567890"), 1, 4, S("ab2345de"));
1330 test(S("abcde"), 2, 1, S("1234567890"), 1, 8, S("ab23456789de"));
1331 test(S("abcde"), 2, 1, S("1234567890"), 1, 9, S("ab234567890de"));
1332 test(S("abcde"), 2, 1, S("1234567890"), 1, 10, S("ab234567890de"));
1333 test(S("abcde"), 2, 1, S("1234567890"), 5, 0, S("abde"));
1334 test(S("abcde"), 2, 1, S("1234567890"), 5, 1, S("ab6de"));
1335 test(S("abcde"), 2, 1, S("1234567890"), 5, 2, S("ab67de"));
1336 test(S("abcde"), 2, 1, S("1234567890"), 5, 4, S("ab6789de"));
1337 test(S("abcde"), 2, 1, S("1234567890"), 5, 5, S("ab67890de"));
1338 test(S("abcde"), 2, 1, S("1234567890"), 5, 6, S("ab67890de"));
1339 test(S("abcde"), 2, 1, S("1234567890"), 9, 0, S("abde"));
1340 test(S("abcde"), 2, 1, S("1234567890"), 9, 1, S("ab0de"));
1341 test(S("abcde"), 2, 1, S("1234567890"), 9, 2, S("ab0de"));
1342 test(S("abcde"), 2, 1, S("1234567890"), 10, 0, S("abde"));
1343 test(S("abcde"), 2, 1, S("1234567890"), 10, 1, S("abde"));
1344 test(S("abcde"), 2, 1, S("1234567890"), 11, 0, S("can't happen"));
1345 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 0, S("abde"));
1346 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 1, S("ab1de"));
1347 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 10, S("ab1234567890de"));
1348 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 19, S("ab1234567890123456789de"));
1349 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 20, S("ab12345678901234567890de"));
1350 test(S("abcde"), 2, 1, S("12345678901234567890"), 0, 21, S("ab12345678901234567890de"));
1351 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 0, S("abde"));
1352 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 1, S("ab2de"));
1353 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 9, S("ab234567890de"));
1354 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 18, S("ab234567890123456789de"));
1355 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 19, S("ab2345678901234567890de"));
1356 test(S("abcde"), 2, 1, S("12345678901234567890"), 1, 20, S("ab2345678901234567890de"));
1357 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 0, S("abde"));
1358 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 1, S("ab1de"));
1359 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 5, S("ab12345de"));
1360 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 9, S("ab123456789de"));
1361 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 10, S("ab1234567890de"));
1362 test(S("abcde"), 2, 1, S("12345678901234567890"), 10, 11, S("ab1234567890de"));
1363 test(S("abcde"), 2, 1, S("12345678901234567890"), 19, 0, S("abde"));
1364 test(S("abcde"), 2, 1, S("12345678901234567890"), 19, 1, S("ab0de"));
1365 test(S("abcde"), 2, 1, S("12345678901234567890"), 19, 2, S("ab0de"));
1366 test(S("abcde"), 2, 1, S("12345678901234567890"), 20, 0, S("abde"));
1367 test(S("abcde"), 2, 1, S("12345678901234567890"), 20, 1, S("abde"));
1368 test(S("abcde"), 2, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
1369 test(S("abcde"), 2, 2, S(""), 0, 0, S("abe"));
1370 test(S("abcde"), 2, 2, S(""), 0, 1, S("abe"));
1371 test(S("abcde"), 2, 2, S(""), 1, 0, S("can't happen"));
1372 test(S("abcde"), 2, 2, S("12345"), 0, 0, S("abe"));
1373 test(S("abcde"), 2, 2, S("12345"), 0, 1, S("ab1e"));
1374 test(S("abcde"), 2, 2, S("12345"), 0, 2, S("ab12e"));
1375 test(S("abcde"), 2, 2, S("12345"), 0, 4, S("ab1234e"));
1376 test(S("abcde"), 2, 2, S("12345"), 0, 5, S("ab12345e"));
1377 test(S("abcde"), 2, 2, S("12345"), 0, 6, S("ab12345e"));
1378 test(S("abcde"), 2, 2, S("12345"), 1, 0, S("abe"));
1379 test(S("abcde"), 2, 2, S("12345"), 1, 1, S("ab2e"));
1380 test(S("abcde"), 2, 2, S("12345"), 1, 2, S("ab23e"));
1381 test(S("abcde"), 2, 2, S("12345"), 1, 3, S("ab234e"));
1382 test(S("abcde"), 2, 2, S("12345"), 1, 4, S("ab2345e"));
1383 test(S("abcde"), 2, 2, S("12345"), 1, 5, S("ab2345e"));
1384 test(S("abcde"), 2, 2, S("12345"), 2, 0, S("abe"));
1385 test(S("abcde"), 2, 2, S("12345"), 2, 1, S("ab3e"));
1386 test(S("abcde"), 2, 2, S("12345"), 2, 2, S("ab34e"));
1387 test(S("abcde"), 2, 2, S("12345"), 2, 3, S("ab345e"));
1388 test(S("abcde"), 2, 2, S("12345"), 2, 4, S("ab345e"));
1389 test(S("abcde"), 2, 2, S("12345"), 4, 0, S("abe"));
1390 test(S("abcde"), 2, 2, S("12345"), 4, 1, S("ab5e"));
1391 test(S("abcde"), 2, 2, S("12345"), 4, 2, S("ab5e"));
1392 test(S("abcde"), 2, 2, S("12345"), 5, 0, S("abe"));
1393 test(S("abcde"), 2, 2, S("12345"), 5, 1, S("abe"));
1394 test(S("abcde"), 2, 2, S("12345"), 6, 0, S("can't happen"));
1395 test(S("abcde"), 2, 2, S("1234567890"), 0, 0, S("abe"));
1396 test(S("abcde"), 2, 2, S("1234567890"), 0, 1, S("ab1e"));
1397 test(S("abcde"), 2, 2, S("1234567890"), 0, 5, S("ab12345e"));
1398 test(S("abcde"), 2, 2, S("1234567890"), 0, 9, S("ab123456789e"));
1399 test(S("abcde"), 2, 2, S("1234567890"), 0, 10, S("ab1234567890e"));
1400 test(S("abcde"), 2, 2, S("1234567890"), 0, 11, S("ab1234567890e"));
1401 test(S("abcde"), 2, 2, S("1234567890"), 1, 0, S("abe"));
1402 test(S("abcde"), 2, 2, S("1234567890"), 1, 1, S("ab2e"));
1403 test(S("abcde"), 2, 2, S("1234567890"), 1, 4, S("ab2345e"));
1404 test(S("abcde"), 2, 2, S("1234567890"), 1, 8, S("ab23456789e"));
1405 test(S("abcde"), 2, 2, S("1234567890"), 1, 9, S("ab234567890e"));
1406 test(S("abcde"), 2, 2, S("1234567890"), 1, 10, S("ab234567890e"));
1407 test(S("abcde"), 2, 2, S("1234567890"), 5, 0, S("abe"));
1408 test(S("abcde"), 2, 2, S("1234567890"), 5, 1, S("ab6e"));
1409 test(S("abcde"), 2, 2, S("1234567890"), 5, 2, S("ab67e"));
1410 test(S("abcde"), 2, 2, S("1234567890"), 5, 4, S("ab6789e"));
1416 test(S("abcde"), 2, 2, S("1234567890"), 5, 5, S("ab67890e"));
1417 test(S("abcde"), 2, 2, S("1234567890"), 5, 6, S("ab67890e"));
1418 test(S("abcde"), 2, 2, S("1234567890"), 9, 0, S("abe"));
1419 test(S("abcde"), 2, 2, S("1234567890"), 9, 1, S("ab0e"));
1420 test(S("abcde"), 2, 2, S("1234567890"), 9, 2, S("ab0e"));
1421 test(S("abcde"), 2, 2, S("1234567890"), 10, 0, S("abe"));
1422 test(S("abcde"), 2, 2, S("1234567890"), 10, 1, S("abe"));
1423 test(S("abcde"), 2, 2, S("1234567890"), 11, 0, S("can't happen"));
1424 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 0, S("abe"));
1425 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 1, S("ab1e"));
1426 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 10, S("ab1234567890e"));
1427 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 19, S("ab1234567890123456789e"));
1428 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 20, S("ab12345678901234567890e"));
1429 test(S("abcde"), 2, 2, S("12345678901234567890"), 0, 21, S("ab12345678901234567890e"));
1430 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 0, S("abe"));
1431 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 1, S("ab2e"));
1432 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 9, S("ab234567890e"));
1433 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 18, S("ab234567890123456789e"));
1434 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 19, S("ab2345678901234567890e"));
1435 test(S("abcde"), 2, 2, S("12345678901234567890"), 1, 20, S("ab2345678901234567890e"));
1436 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 0, S("abe"));
1437 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 1, S("ab1e"));
1438 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 5, S("ab12345e"));
1439 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 9, S("ab123456789e"));
1440 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 10, S("ab1234567890e"));
1441 test(S("abcde"), 2, 2, S("12345678901234567890"), 10, 11, S("ab1234567890e"));
1442 test(S("abcde"), 2, 2, S("12345678901234567890"), 19, 0, S("abe"));
1443 test(S("abcde"), 2, 2, S("12345678901234567890"), 19, 1, S("ab0e"));
1444 test(S("abcde"), 2, 2, S("12345678901234567890"), 19, 2, S("ab0e"));
1445 test(S("abcde"), 2, 2, S("12345678901234567890"), 20, 0, S("abe"));
1446 test(S("abcde"), 2, 2, S("12345678901234567890"), 20, 1, S("abe"));
1447 test(S("abcde"), 2, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
1448 test(S("abcde"), 2, 3, S(""), 0, 0, S("ab"));
1449 test(S("abcde"), 2, 3, S(""), 0, 1, S("ab"));
1450 test(S("abcde"), 2, 3, S(""), 1, 0, S("can't happen"));
1451 test(S("abcde"), 2, 3, S("12345"), 0, 0, S("ab"));
1452 test(S("abcde"), 2, 3, S("12345"), 0, 1, S("ab1"));
1453 test(S("abcde"), 2, 3, S("12345"), 0, 2, S("ab12"));
1454 test(S("abcde"), 2, 3, S("12345"), 0, 4, S("ab1234"));
1455 test(S("abcde"), 2, 3, S("12345"), 0, 5, S("ab12345"));
1456 test(S("abcde"), 2, 3, S("12345"), 0, 6, S("ab12345"));
1457 test(S("abcde"), 2, 3, S("12345"), 1, 0, S("ab"));
1458 test(S("abcde"), 2, 3, S("12345"), 1, 1, S("ab2"));
1459 test(S("abcde"), 2, 3, S("12345"), 1, 2, S("ab23"));
1460 test(S("abcde"), 2, 3, S("12345"), 1, 3, S("ab234"));
1461 test(S("abcde"), 2, 3, S("12345"), 1, 4, S("ab2345"));
1462 test(S("abcde"), 2, 3, S("12345"), 1, 5, S("ab2345"));
1463 test(S("abcde"), 2, 3, S("12345"), 2, 0, S("ab"));
1464 test(S("abcde"), 2, 3, S("12345"), 2, 1, S("ab3"));
1465 test(S("abcde"), 2, 3, S("12345"), 2, 2, S("ab34"));
1466 test(S("abcde"), 2, 3, S("12345"), 2, 3, S("ab345"));
1467 test(S("abcde"), 2, 3, S("12345"), 2, 4, S("ab345"));
1468 test(S("abcde"), 2, 3, S("12345"), 4, 0, S("ab"));
1469 test(S("abcde"), 2, 3, S("12345"), 4, 1, S("ab5"));
1470 test(S("abcde"), 2, 3, S("12345"), 4, 2, S("ab5"));
1471 test(S("abcde"), 2, 3, S("12345"), 5, 0, S("ab"));
1472 test(S("abcde"), 2, 3, S("12345"), 5, 1, S("ab"));
1473 test(S("abcde"), 2, 3, S("12345"), 6, 0, S("can't happen"));
1474 test(S("abcde"), 2, 3, S("1234567890"), 0, 0, S("ab"));
1475 test(S("abcde"), 2, 3, S("1234567890"), 0, 1, S("ab1"));
1476 test(S("abcde"), 2, 3, S("1234567890"), 0, 5, S("ab12345"));
1477 test(S("abcde"), 2, 3, S("1234567890"), 0, 9, S("ab123456789"));
1478 test(S("abcde"), 2, 3, S("1234567890"), 0, 10, S("ab1234567890"));
1479 test(S("abcde"), 2, 3, S("1234567890"), 0, 11, S("ab1234567890"));
1480 test(S("abcde"), 2, 3, S("1234567890"), 1, 0, S("ab"));
1481 test(S("abcde"), 2, 3, S("1234567890"), 1, 1, S("ab2"));
1482 test(S("abcde"), 2, 3, S("1234567890"), 1, 4, S("ab2345"));
1483 test(S("abcde"), 2, 3, S("1234567890"), 1, 8, S("ab23456789"));
1484 test(S("abcde"), 2, 3, S("1234567890"), 1, 9, S("ab234567890"));
1485 test(S("abcde"), 2, 3, S("1234567890"), 1, 10, S("ab234567890"));
1486 test(S("abcde"), 2, 3, S("1234567890"), 5, 0, S("ab"));
1487 test(S("abcde"), 2, 3, S("1234567890"), 5, 1, S("ab6"));
1488 test(S("abcde"), 2, 3, S("1234567890"), 5, 2, S("ab67"));
1489 test(S("abcde"), 2, 3, S("1234567890"), 5, 4, S("ab6789"));
1490 test(S("abcde"), 2, 3, S("1234567890"), 5, 5, S("ab67890"));
1491 test(S("abcde"), 2, 3, S("1234567890"), 5, 6, S("ab67890"));
1492 test(S("abcde"), 2, 3, S("1234567890"), 9, 0, S("ab"));
1493 test(S("abcde"), 2, 3, S("1234567890"), 9, 1, S("ab0"));
1494 test(S("abcde"), 2, 3, S("1234567890"), 9, 2, S("ab0"));
1495 test(S("abcde"), 2, 3, S("1234567890"), 10, 0, S("ab"));
1496 test(S("abcde"), 2, 3, S("1234567890"), 10, 1, S("ab"));
1497 test(S("abcde"), 2, 3, S("1234567890"), 11, 0, S("can't happen"));
1498 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 0, S("ab"));
1499 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 1, S("ab1"));
1500 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 10, S("ab1234567890"));
1501 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
1502 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
1503 test(S("abcde"), 2, 3, S("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
1504 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 0, S("ab"));
1505 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 1, S("ab2"));
1506 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 9, S("ab234567890"));
1507 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 18, S("ab234567890123456789"));
1508 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
1509 test(S("abcde"), 2, 3, S("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
1510 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 0, S("ab"));
1511 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 1, S("ab1"));
1512 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 5, S("ab12345"));
1513 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 9, S("ab123456789"));
1514 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 10, S("ab1234567890"));
1515 test(S("abcde"), 2, 3, S("12345678901234567890"), 10, 11, S("ab1234567890"));
1521 test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 0, S("ab"));
1522 test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 1, S("ab0"));
1523 test(S("abcde"), 2, 3, S("12345678901234567890"), 19, 2, S("ab0"));
1524 test(S("abcde"), 2, 3, S("12345678901234567890"), 20, 0, S("ab"));
1525 test(S("abcde"), 2, 3, S("12345678901234567890"), 20, 1, S("ab"));
1526 test(S("abcde"), 2, 3, S("12345678901234567890"), 21, 0, S("can't happen"));
1527 test(S("abcde"), 2, 4, S(""), 0, 0, S("ab"));
1528 test(S("abcde"), 2, 4, S(""), 0, 1, S("ab"));
1529 test(S("abcde"), 2, 4, S(""), 1, 0, S("can't happen"));
1530 test(S("abcde"), 2, 4, S("12345"), 0, 0, S("ab"));
1531 test(S("abcde"), 2, 4, S("12345"), 0, 1, S("ab1"));
1532 test(S("abcde"), 2, 4, S("12345"), 0, 2, S("ab12"));
1533 test(S("abcde"), 2, 4, S("12345"), 0, 4, S("ab1234"));
1534 test(S("abcde"), 2, 4, S("12345"), 0, 5, S("ab12345"));
1535 test(S("abcde"), 2, 4, S("12345"), 0, 6, S("ab12345"));
1536 test(S("abcde"), 2, 4, S("12345"), 1, 0, S("ab"));
1537 test(S("abcde"), 2, 4, S("12345"), 1, 1, S("ab2"));
1538 test(S("abcde"), 2, 4, S("12345"), 1, 2, S("ab23"));
1539 test(S("abcde"), 2, 4, S("12345"), 1, 3, S("ab234"));
1540 test(S("abcde"), 2, 4, S("12345"), 1, 4, S("ab2345"));
1541 test(S("abcde"), 2, 4, S("12345"), 1, 5, S("ab2345"));
1542 test(S("abcde"), 2, 4, S("12345"), 2, 0, S("ab"));
1543 test(S("abcde"), 2, 4, S("12345"), 2, 1, S("ab3"));
1544 test(S("abcde"), 2, 4, S("12345"), 2, 2, S("ab34"));
1545 test(S("abcde"), 2, 4, S("12345"), 2, 3, S("ab345"));
1546 test(S("abcde"), 2, 4, S("12345"), 2, 4, S("ab345"));
1547 test(S("abcde"), 2, 4, S("12345"), 4, 0, S("ab"));
1548 test(S("abcde"), 2, 4, S("12345"), 4, 1, S("ab5"));
1549 test(S("abcde"), 2, 4, S("12345"), 4, 2, S("ab5"));
1550 test(S("abcde"), 2, 4, S("12345"), 5, 0, S("ab"));
1551 test(S("abcde"), 2, 4, S("12345"), 5, 1, S("ab"));
1552 test(S("abcde"), 2, 4, S("12345"), 6, 0, S("can't happen"));
1553 test(S("abcde"), 2, 4, S("1234567890"), 0, 0, S("ab"));
1554 test(S("abcde"), 2, 4, S("1234567890"), 0, 1, S("ab1"));
1555 test(S("abcde"), 2, 4, S("1234567890"), 0, 5, S("ab12345"));
1556 test(S("abcde"), 2, 4, S("1234567890"), 0, 9, S("ab123456789"));
1557 test(S("abcde"), 2, 4, S("1234567890"), 0, 10, S("ab1234567890"));
1558 test(S("abcde"), 2, 4, S("1234567890"), 0, 11, S("ab1234567890"));
1559 test(S("abcde"), 2, 4, S("1234567890"), 1, 0, S("ab"));
1560 test(S("abcde"), 2, 4, S("1234567890"), 1, 1, S("ab2"));
1561 test(S("abcde"), 2, 4, S("1234567890"), 1, 4, S("ab2345"));
1562 test(S("abcde"), 2, 4, S("1234567890"), 1, 8, S("ab23456789"));
1563 test(S("abcde"), 2, 4, S("1234567890"), 1, 9, S("ab234567890"));
1564 test(S("abcde"), 2, 4, S("1234567890"), 1, 10, S("ab234567890"));
1565 test(S("abcde"), 2, 4, S("1234567890"), 5, 0, S("ab"));
1566 test(S("abcde"), 2, 4, S("1234567890"), 5, 1, S("ab6"));
1567 test(S("abcde"), 2, 4, S("1234567890"), 5, 2, S("ab67"));
1568 test(S("abcde"), 2, 4, S("1234567890"), 5, 4, S("ab6789"));
1569 test(S("abcde"), 2, 4, S("1234567890"), 5, 5, S("ab67890"));
1570 test(S("abcde"), 2, 4, S("1234567890"), 5, 6, S("ab67890"));
1571 test(S("abcde"), 2, 4, S("1234567890"), 9, 0, S("ab"));
1572 test(S("abcde"), 2, 4, S("1234567890"), 9, 1, S("ab0"));
1573 test(S("abcde"), 2, 4, S("1234567890"), 9, 2, S("ab0"));
1574 test(S("abcde"), 2, 4, S("1234567890"), 10, 0, S("ab"));
1575 test(S("abcde"), 2, 4, S("1234567890"), 10, 1, S("ab"));
1576 test(S("abcde"), 2, 4, S("1234567890"), 11, 0, S("can't happen"));
1577 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 0, S("ab"));
1578 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 1, S("ab1"));
1579 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 10, S("ab1234567890"));
1580 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
1581 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
1582 test(S("abcde"), 2, 4, S("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
1583 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 0, S("ab"));
1584 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 1, S("ab2"));
1585 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 9, S("ab234567890"));
1586 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 18, S("ab234567890123456789"));
1587 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
1588 test(S("abcde"), 2, 4, S("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
1589 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 0, S("ab"));
1590 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 1, S("ab1"));
1591 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 5, S("ab12345"));
1592 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 9, S("ab123456789"));
1593 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 10, S("ab1234567890"));
1594 test(S("abcde"), 2, 4, S("12345678901234567890"), 10, 11, S("ab1234567890"));
1595 test(S("abcde"), 2, 4, S("12345678901234567890"), 19, 0, S("ab"));
1596 test(S("abcde"), 2, 4, S("12345678901234567890"), 19, 1, S("ab0"));
1597 test(S("abcde"), 2, 4, S("12345678901234567890"), 19, 2, S("ab0"));
1598 test(S("abcde"), 2, 4, S("12345678901234567890"), 20, 0, S("ab"));
1599 test(S("abcde"), 2, 4, S("12345678901234567890"), 20, 1, S("ab"));
1600 test(S("abcde"), 2, 4, S("12345678901234567890"), 21, 0, S("can't happen"));
1601 test(S("abcde"), 4, 0, S(""), 0, 0, S("abcde"));
1602 test(S("abcde"), 4, 0, S(""), 0, 1, S("abcde"));
1603 test(S("abcde"), 4, 0, S(""), 1, 0, S("can't happen"));
1604 test(S("abcde"), 4, 0, S("12345"), 0, 0, S("abcde"));
1605 test(S("abcde"), 4, 0, S("12345"), 0, 1, S("abcd1e"));
1606 test(S("abcde"), 4, 0, S("12345"), 0, 2, S("abcd12e"));
1607 test(S("abcde"), 4, 0, S("12345"), 0, 4, S("abcd1234e"));
1608 test(S("abcde"), 4, 0, S("12345"), 0, 5, S("abcd12345e"));
1609 test(S("abcde"), 4, 0, S("12345"), 0, 6, S("abcd12345e"));
1610 test(S("abcde"), 4, 0, S("12345"), 1, 0, S("abcde"));
1611 test(S("abcde"), 4, 0, S("12345"), 1, 1, S("abcd2e"));
1612 test(S("abcde"), 4, 0, S("12345"), 1, 2, S("abcd23e"));
1613 test(S("abcde"), 4, 0, S("12345"), 1, 3, S("abcd234e"));
1614 test(S("abcde"), 4, 0, S("12345"), 1, 4, S("abcd2345e"));
1615 test(S("abcde"), 4, 0, S("12345"), 1, 5, S("abcd2345e"));
1616 test(S("abcde"), 4, 0, S("12345"), 2, 0, S("abcde"));
1617 test(S("abcde"), 4, 0, S("12345"), 2, 1, S("abcd3e"));
1618 test(S("abcde"), 4, 0, S("12345"), 2, 2, S("abcd34e"));
1619 test(S("abcde"), 4, 0, S("12345"), 2, 3, S("abcd345e"));
1620 test(S("abcde"), 4, 0, S("12345"), 2, 4, S("abcd345e"));
1626 test(S("abcde"), 4, 0, S("12345"), 4, 0, S("abcde"));
1627 test(S("abcde"), 4, 0, S("12345"), 4, 1, S("abcd5e"));
1628 test(S("abcde"), 4, 0, S("12345"), 4, 2, S("abcd5e"));
1629 test(S("abcde"), 4, 0, S("12345"), 5, 0, S("abcde"));
1630 test(S("abcde"), 4, 0, S("12345"), 5, 1, S("abcde"));
1631 test(S("abcde"), 4, 0, S("12345"), 6, 0, S("can't happen"));
1632 test(S("abcde"), 4, 0, S("1234567890"), 0, 0, S("abcde"));
1633 test(S("abcde"), 4, 0, S("1234567890"), 0, 1, S("abcd1e"));
1634 test(S("abcde"), 4, 0, S("1234567890"), 0, 5, S("abcd12345e"));
1635 test(S("abcde"), 4, 0, S("1234567890"), 0, 9, S("abcd123456789e"));
1636 test(S("abcde"), 4, 0, S("1234567890"), 0, 10, S("abcd1234567890e"));
1637 test(S("abcde"), 4, 0, S("1234567890"), 0, 11, S("abcd1234567890e"));
1638 test(S("abcde"), 4, 0, S("1234567890"), 1, 0, S("abcde"));
1639 test(S("abcde"), 4, 0, S("1234567890"), 1, 1, S("abcd2e"));
1640 test(S("abcde"), 4, 0, S("1234567890"), 1, 4, S("abcd2345e"));
1641 test(S("abcde"), 4, 0, S("1234567890"), 1, 8, S("abcd23456789e"));
1642 test(S("abcde"), 4, 0, S("1234567890"), 1, 9, S("abcd234567890e"));
1643 test(S("abcde"), 4, 0, S("1234567890"), 1, 10, S("abcd234567890e"));
1644 test(S("abcde"), 4, 0, S("1234567890"), 5, 0, S("abcde"));
1645 test(S("abcde"), 4, 0, S("1234567890"), 5, 1, S("abcd6e"));
1646 test(S("abcde"), 4, 0, S("1234567890"), 5, 2, S("abcd67e"));
1647 test(S("abcde"), 4, 0, S("1234567890"), 5, 4, S("abcd6789e"));
1648 test(S("abcde"), 4, 0, S("1234567890"), 5, 5, S("abcd67890e"));
1649 test(S("abcde"), 4, 0, S("1234567890"), 5, 6, S("abcd67890e"));
1650 test(S("abcde"), 4, 0, S("1234567890"), 9, 0, S("abcde"));
1651 test(S("abcde"), 4, 0, S("1234567890"), 9, 1, S("abcd0e"));
1652 test(S("abcde"), 4, 0, S("1234567890"), 9, 2, S("abcd0e"));
1653 test(S("abcde"), 4, 0, S("1234567890"), 10, 0, S("abcde"));
1654 test(S("abcde"), 4, 0, S("1234567890"), 10, 1, S("abcde"));
1655 test(S("abcde"), 4, 0, S("1234567890"), 11, 0, S("can't happen"));
1656 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 0, S("abcde"));
1657 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 1, S("abcd1e"));
1658 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 10, S("abcd1234567890e"));
1659 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 19, S("abcd1234567890123456789e"));
1660 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 20, S("abcd12345678901234567890e"));
1661 test(S("abcde"), 4, 0, S("12345678901234567890"), 0, 21, S("abcd12345678901234567890e"));
1662 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 0, S("abcde"));
1663 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 1, S("abcd2e"));
1664 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 9, S("abcd234567890e"));
1665 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 18, S("abcd234567890123456789e"));
1666 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 19, S("abcd2345678901234567890e"));
1667 test(S("abcde"), 4, 0, S("12345678901234567890"), 1, 20, S("abcd2345678901234567890e"));
1668 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 0, S("abcde"));
1669 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 1, S("abcd1e"));
1670 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 5, S("abcd12345e"));
1671 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 9, S("abcd123456789e"));
1672 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 10, S("abcd1234567890e"));
1673 test(S("abcde"), 4, 0, S("12345678901234567890"), 10, 11, S("abcd1234567890e"));
1674 test(S("abcde"), 4, 0, S("12345678901234567890"), 19, 0, S("abcde"));
1675 test(S("abcde"), 4, 0, S("12345678901234567890"), 19, 1, S("abcd0e"));
1676 test(S("abcde"), 4, 0, S("12345678901234567890"), 19, 2, S("abcd0e"));
1677 test(S("abcde"), 4, 0, S("12345678901234567890"), 20, 0, S("abcde"));
1678 test(S("abcde"), 4, 0, S("12345678901234567890"), 20, 1, S("abcde"));
1679 test(S("abcde"), 4, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
1680 test(S("abcde"), 4, 1, S(""), 0, 0, S("abcd"));
1681 test(S("abcde"), 4, 1, S(""), 0, 1, S("abcd"));
1682 test(S("abcde"), 4, 1, S(""), 1, 0, S("can't happen"));
1683 test(S("abcde"), 4, 1, S("12345"), 0, 0, S("abcd"));
1684 test(S("abcde"), 4, 1, S("12345"), 0, 1, S("abcd1"));
1685 test(S("abcde"), 4, 1, S("12345"), 0, 2, S("abcd12"));
1686 test(S("abcde"), 4, 1, S("12345"), 0, 4, S("abcd1234"));
1687 test(S("abcde"), 4, 1, S("12345"), 0, 5, S("abcd12345"));
1688 test(S("abcde"), 4, 1, S("12345"), 0, 6, S("abcd12345"));
1689 test(S("abcde"), 4, 1, S("12345"), 1, 0, S("abcd"));
1690 test(S("abcde"), 4, 1, S("12345"), 1, 1, S("abcd2"));
1691 test(S("abcde"), 4, 1, S("12345"), 1, 2, S("abcd23"));
1692 test(S("abcde"), 4, 1, S("12345"), 1, 3, S("abcd234"));
1693 test(S("abcde"), 4, 1, S("12345"), 1, 4, S("abcd2345"));
1694 test(S("abcde"), 4, 1, S("12345"), 1, 5, S("abcd2345"));
1695 test(S("abcde"), 4, 1, S("12345"), 2, 0, S("abcd"));
1696 test(S("abcde"), 4, 1, S("12345"), 2, 1, S("abcd3"));
1697 test(S("abcde"), 4, 1, S("12345"), 2, 2, S("abcd34"));
1698 test(S("abcde"), 4, 1, S("12345"), 2, 3, S("abcd345"));
1699 test(S("abcde"), 4, 1, S("12345"), 2, 4, S("abcd345"));
1700 test(S("abcde"), 4, 1, S("12345"), 4, 0, S("abcd"));
1701 test(S("abcde"), 4, 1, S("12345"), 4, 1, S("abcd5"));
1702 test(S("abcde"), 4, 1, S("12345"), 4, 2, S("abcd5"));
1703 test(S("abcde"), 4, 1, S("12345"), 5, 0, S("abcd"));
1704 test(S("abcde"), 4, 1, S("12345"), 5, 1, S("abcd"));
1705 test(S("abcde"), 4, 1, S("12345"), 6, 0, S("can't happen"));
1706 test(S("abcde"), 4, 1, S("1234567890"), 0, 0, S("abcd"));
1707 test(S("abcde"), 4, 1, S("1234567890"), 0, 1, S("abcd1"));
1708 test(S("abcde"), 4, 1, S("1234567890"), 0, 5, S("abcd12345"));
1709 test(S("abcde"), 4, 1, S("1234567890"), 0, 9, S("abcd123456789"));
1710 test(S("abcde"), 4, 1, S("1234567890"), 0, 10, S("abcd1234567890"));
1711 test(S("abcde"), 4, 1, S("1234567890"), 0, 11, S("abcd1234567890"));
1712 test(S("abcde"), 4, 1, S("1234567890"), 1, 0, S("abcd"));
1713 test(S("abcde"), 4, 1, S("1234567890"), 1, 1, S("abcd2"));
1714 test(S("abcde"), 4, 1, S("1234567890"), 1, 4, S("abcd2345"));
1715 test(S("abcde"), 4, 1, S("1234567890"), 1, 8, S("abcd23456789"));
1716 test(S("abcde"), 4, 1, S("1234567890"), 1, 9, S("abcd234567890"));
1717 test(S("abcde"), 4, 1, S("1234567890"), 1, 10, S("abcd234567890"));
1718 test(S("abcde"), 4, 1, S("1234567890"), 5, 0, S("abcd"));
1719 test(S("abcde"), 4, 1, S("1234567890"), 5, 1, S("abcd6"));
1720 test(S("abcde"), 4, 1, S("1234567890"), 5, 2, S("abcd67"));
1721 test(S("abcde"), 4, 1, S("1234567890"), 5, 4, S("abcd6789"));
1722 test(S("abcde"), 4, 1, S("1234567890"), 5, 5, S("abcd67890"));
1723 test(S("abcde"), 4, 1, S("1234567890"), 5, 6, S("abcd67890"));
1724 test(S("abcde"), 4, 1, S("1234567890"), 9, 0, S("abcd"));
1725 test(S("abcde"), 4, 1, S("1234567890"), 9, 1, S("abcd0"));
1731 test(S("abcde"), 4, 1, S("1234567890"), 9, 2, S("abcd0"));
1732 test(S("abcde"), 4, 1, S("1234567890"), 10, 0, S("abcd"));
1733 test(S("abcde"), 4, 1, S("1234567890"), 10, 1, S("abcd"));
1734 test(S("abcde"), 4, 1, S("1234567890"), 11, 0, S("can't happen"));
1735 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 0, S("abcd"));
1736 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 1, S("abcd1"));
1737 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 10, S("abcd1234567890"));
1738 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
1739 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
1740 test(S("abcde"), 4, 1, S("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
1741 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 0, S("abcd"));
1742 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 1, S("abcd2"));
1743 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 9, S("abcd234567890"));
1744 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
1745 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
1746 test(S("abcde"), 4, 1, S("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
1747 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 0, S("abcd"));
1748 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 1, S("abcd1"));
1749 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 5, S("abcd12345"));
1750 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 9, S("abcd123456789"));
1751 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 10, S("abcd1234567890"));
1752 test(S("abcde"), 4, 1, S("12345678901234567890"), 10, 11, S("abcd1234567890"));
1753 test(S("abcde"), 4, 1, S("12345678901234567890"), 19, 0, S("abcd"));
1754 test(S("abcde"), 4, 1, S("12345678901234567890"), 19, 1, S("abcd0"));
1755 test(S("abcde"), 4, 1, S("12345678901234567890"), 19, 2, S("abcd0"));
1756 test(S("abcde"), 4, 1, S("12345678901234567890"), 20, 0, S("abcd"));
1757 test(S("abcde"), 4, 1, S("12345678901234567890"), 20, 1, S("abcd"));
1758 test(S("abcde"), 4, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
1759 test(S("abcde"), 4, 2, S(""), 0, 0, S("abcd"));
1760 test(S("abcde"), 4, 2, S(""), 0, 1, S("abcd"));
1761 test(S("abcde"), 4, 2, S(""), 1, 0, S("can't happen"));
1762 test(S("abcde"), 4, 2, S("12345"), 0, 0, S("abcd"));
1763 test(S("abcde"), 4, 2, S("12345"), 0, 1, S("abcd1"));
1764 test(S("abcde"), 4, 2, S("12345"), 0, 2, S("abcd12"));
1765 test(S("abcde"), 4, 2, S("12345"), 0, 4, S("abcd1234"));
1766 test(S("abcde"), 4, 2, S("12345"), 0, 5, S("abcd12345"));
1767 test(S("abcde"), 4, 2, S("12345"), 0, 6, S("abcd12345"));
1768 test(S("abcde"), 4, 2, S("12345"), 1, 0, S("abcd"));
1769 test(S("abcde"), 4, 2, S("12345"), 1, 1, S("abcd2"));
1770 test(S("abcde"), 4, 2, S("12345"), 1, 2, S("abcd23"));
1771 test(S("abcde"), 4, 2, S("12345"), 1, 3, S("abcd234"));
1772 test(S("abcde"), 4, 2, S("12345"), 1, 4, S("abcd2345"));
1773 test(S("abcde"), 4, 2, S("12345"), 1, 5, S("abcd2345"));
1774 test(S("abcde"), 4, 2, S("12345"), 2, 0, S("abcd"));
1775 test(S("abcde"), 4, 2, S("12345"), 2, 1, S("abcd3"));
1776 test(S("abcde"), 4, 2, S("12345"), 2, 2, S("abcd34"));
1777 test(S("abcde"), 4, 2, S("12345"), 2, 3, S("abcd345"));
1778 test(S("abcde"), 4, 2, S("12345"), 2, 4, S("abcd345"));
1779 test(S("abcde"), 4, 2, S("12345"), 4, 0, S("abcd"));
1780 test(S("abcde"), 4, 2, S("12345"), 4, 1, S("abcd5"));
1781 test(S("abcde"), 4, 2, S("12345"), 4, 2, S("abcd5"));
1782 test(S("abcde"), 4, 2, S("12345"), 5, 0, S("abcd"));
1783 test(S("abcde"), 4, 2, S("12345"), 5, 1, S("abcd"));
1784 test(S("abcde"), 4, 2, S("12345"), 6, 0, S("can't happen"));
1785 test(S("abcde"), 4, 2, S("1234567890"), 0, 0, S("abcd"));
1786 test(S("abcde"), 4, 2, S("1234567890"), 0, 1, S("abcd1"));
1787 test(S("abcde"), 4, 2, S("1234567890"), 0, 5, S("abcd12345"));
1788 test(S("abcde"), 4, 2, S("1234567890"), 0, 9, S("abcd123456789"));
1789 test(S("abcde"), 4, 2, S("1234567890"), 0, 10, S("abcd1234567890"));
1790 test(S("abcde"), 4, 2, S("1234567890"), 0, 11, S("abcd1234567890"));
1791 test(S("abcde"), 4, 2, S("1234567890"), 1, 0, S("abcd"));
1792 test(S("abcde"), 4, 2, S("1234567890"), 1, 1, S("abcd2"));
1793 test(S("abcde"), 4, 2, S("1234567890"), 1, 4, S("abcd2345"));
1794 test(S("abcde"), 4, 2, S("1234567890"), 1, 8, S("abcd23456789"));
1795 test(S("abcde"), 4, 2, S("1234567890"), 1, 9, S("abcd234567890"));
1796 test(S("abcde"), 4, 2, S("1234567890"), 1, 10, S("abcd234567890"));
1797 test(S("abcde"), 4, 2, S("1234567890"), 5, 0, S("abcd"));
1798 test(S("abcde"), 4, 2, S("1234567890"), 5, 1, S("abcd6"));
1799 test(S("abcde"), 4, 2, S("1234567890"), 5, 2, S("abcd67"));
1800 test(S("abcde"), 4, 2, S("1234567890"), 5, 4, S("abcd6789"));
1801 test(S("abcde"), 4, 2, S("1234567890"), 5, 5, S("abcd67890"));
1802 test(S("abcde"), 4, 2, S("1234567890"), 5, 6, S("abcd67890"));
1803 test(S("abcde"), 4, 2, S("1234567890"), 9, 0, S("abcd"));
1804 test(S("abcde"), 4, 2, S("1234567890"), 9, 1, S("abcd0"));
1805 test(S("abcde"), 4, 2, S("1234567890"), 9, 2, S("abcd0"));
1806 test(S("abcde"), 4, 2, S("1234567890"), 10, 0, S("abcd"));
1807 test(S("abcde"), 4, 2, S("1234567890"), 10, 1, S("abcd"));
1808 test(S("abcde"), 4, 2, S("1234567890"), 11, 0, S("can't happen"));
1809 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 0, S("abcd"));
1810 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 1, S("abcd1"));
1811 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 10, S("abcd1234567890"));
1812 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
1813 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
1814 test(S("abcde"), 4, 2, S("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
1815 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 0, S("abcd"));
1816 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 1, S("abcd2"));
1817 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 9, S("abcd234567890"));
1818 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
1819 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
1820 test(S("abcde"), 4, 2, S("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
1821 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 0, S("abcd"));
1822 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 1, S("abcd1"));
1823 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 5, S("abcd12345"));
1824 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 9, S("abcd123456789"));
1825 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 10, S("abcd1234567890"));
1826 test(S("abcde"), 4, 2, S("12345678901234567890"), 10, 11, S("abcd1234567890"));
1827 test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 0, S("abcd"));
1828 test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 1, S("abcd0"));
1829 test(S("abcde"), 4, 2, S("12345678901234567890"), 19, 2, S("abcd0"));
1830 test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 0, S("abcd"));
1836 test(S("abcde"), 4, 2, S("12345678901234567890"), 20, 1, S("abcd"));
1837 test(S("abcde"), 4, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
1838 test(S("abcde"), 5, 0, S(""), 0, 0, S("abcde"));
1839 test(S("abcde"), 5, 0, S(""), 0, 1, S("abcde"));
1840 test(S("abcde"), 5, 0, S(""), 1, 0, S("can't happen"));
1841 test(S("abcde"), 5, 0, S("12345"), 0, 0, S("abcde"));
1842 test(S("abcde"), 5, 0, S("12345"), 0, 1, S("abcde1"));
1843 test(S("abcde"), 5, 0, S("12345"), 0, 2, S("abcde12"));
1844 test(S("abcde"), 5, 0, S("12345"), 0, 4, S("abcde1234"));
1845 test(S("abcde"), 5, 0, S("12345"), 0, 5, S("abcde12345"));
1846 test(S("abcde"), 5, 0, S("12345"), 0, 6, S("abcde12345"));
1847 test(S("abcde"), 5, 0, S("12345"), 1, 0, S("abcde"));
1848 test(S("abcde"), 5, 0, S("12345"), 1, 1, S("abcde2"));
1849 test(S("abcde"), 5, 0, S("12345"), 1, 2, S("abcde23"));
1850 test(S("abcde"), 5, 0, S("12345"), 1, 3, S("abcde234"));
1851 test(S("abcde"), 5, 0, S("12345"), 1, 4, S("abcde2345"));
1852 test(S("abcde"), 5, 0, S("12345"), 1, 5, S("abcde2345"));
1853 test(S("abcde"), 5, 0, S("12345"), 2, 0, S("abcde"));
1854 test(S("abcde"), 5, 0, S("12345"), 2, 1, S("abcde3"));
1855 test(S("abcde"), 5, 0, S("12345"), 2, 2, S("abcde34"));
1856 test(S("abcde"), 5, 0, S("12345"), 2, 3, S("abcde345"));
1857 test(S("abcde"), 5, 0, S("12345"), 2, 4, S("abcde345"));
1858 test(S("abcde"), 5, 0, S("12345"), 4, 0, S("abcde"));
1859 test(S("abcde"), 5, 0, S("12345"), 4, 1, S("abcde5"));
1860 test(S("abcde"), 5, 0, S("12345"), 4, 2, S("abcde5"));
1861 test(S("abcde"), 5, 0, S("12345"), 5, 0, S("abcde"));
1862 test(S("abcde"), 5, 0, S("12345"), 5, 1, S("abcde"));
1863 test(S("abcde"), 5, 0, S("12345"), 6, 0, S("can't happen"));
1864 test(S("abcde"), 5, 0, S("1234567890"), 0, 0, S("abcde"));
1865 test(S("abcde"), 5, 0, S("1234567890"), 0, 1, S("abcde1"));
1866 test(S("abcde"), 5, 0, S("1234567890"), 0, 5, S("abcde12345"));
1867 test(S("abcde"), 5, 0, S("1234567890"), 0, 9, S("abcde123456789"));
1868 test(S("abcde"), 5, 0, S("1234567890"), 0, 10, S("abcde1234567890"));
1869 test(S("abcde"), 5, 0, S("1234567890"), 0, 11, S("abcde1234567890"));
1870 test(S("abcde"), 5, 0, S("1234567890"), 1, 0, S("abcde"));
1871 test(S("abcde"), 5, 0, S("1234567890"), 1, 1, S("abcde2"));
1872 test(S("abcde"), 5, 0, S("1234567890"), 1, 4, S("abcde2345"));
1873 test(S("abcde"), 5, 0, S("1234567890"), 1, 8, S("abcde23456789"));
1874 test(S("abcde"), 5, 0, S("1234567890"), 1, 9, S("abcde234567890"));
1875 test(S("abcde"), 5, 0, S("1234567890"), 1, 10, S("abcde234567890"));
1876 test(S("abcde"), 5, 0, S("1234567890"), 5, 0, S("abcde"));
1877 test(S("abcde"), 5, 0, S("1234567890"), 5, 1, S("abcde6"));
1878 test(S("abcde"), 5, 0, S("1234567890"), 5, 2, S("abcde67"));
1879 test(S("abcde"), 5, 0, S("1234567890"), 5, 4, S("abcde6789"));
1880 test(S("abcde"), 5, 0, S("1234567890"), 5, 5, S("abcde67890"));
1881 test(S("abcde"), 5, 0, S("1234567890"), 5, 6, S("abcde67890"));
1882 test(S("abcde"), 5, 0, S("1234567890"), 9, 0, S("abcde"));
1883 test(S("abcde"), 5, 0, S("1234567890"), 9, 1, S("abcde0"));
1884 test(S("abcde"), 5, 0, S("1234567890"), 9, 2, S("abcde0"));
1885 test(S("abcde"), 5, 0, S("1234567890"), 10, 0, S("abcde"));
1886 test(S("abcde"), 5, 0, S("1234567890"), 10, 1, S("abcde"));
1887 test(S("abcde"), 5, 0, S("1234567890"), 11, 0, S("can't happen"));
1888 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 0, S("abcde"));
1889 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 1, S("abcde1"));
1890 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 10, S("abcde1234567890"));
1891 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
1892 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
1893 test(S("abcde"), 5, 0, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
1894 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 0, S("abcde"));
1895 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 1, S("abcde2"));
1896 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 9, S("abcde234567890"));
1897 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
1898 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
1899 test(S("abcde"), 5, 0, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
1900 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 0, S("abcde"));
1901 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 1, S("abcde1"));
1902 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 5, S("abcde12345"));
1903 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 9, S("abcde123456789"));
1904 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 10, S("abcde1234567890"));
1905 test(S("abcde"), 5, 0, S("12345678901234567890"), 10, 11, S("abcde1234567890"));
1906 test(S("abcde"), 5, 0, S("12345678901234567890"), 19, 0, S("abcde"));
1907 test(S("abcde"), 5, 0, S("12345678901234567890"), 19, 1, S("abcde0"));
1908 test(S("abcde"), 5, 0, S("12345678901234567890"), 19, 2, S("abcde0"));
1909 test(S("abcde"), 5, 0, S("12345678901234567890"), 20, 0, S("abcde"));
1910 test(S("abcde"), 5, 0, S("12345678901234567890"), 20, 1, S("abcde"));
1911 test(S("abcde"), 5, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
1912 test(S("abcde"), 5, 1, S(""), 0, 0, S("abcde"));
1913 test(S("abcde"), 5, 1, S(""), 0, 1, S("abcde"));
1914 test(S("abcde"), 5, 1, S(""), 1, 0, S("can't happen"));
1915 test(S("abcde"), 5, 1, S("12345"), 0, 0, S("abcde"));
1916 test(S("abcde"), 5, 1, S("12345"), 0, 1, S("abcde1"));
1917 test(S("abcde"), 5, 1, S("12345"), 0, 2, S("abcde12"));
1918 test(S("abcde"), 5, 1, S("12345"), 0, 4, S("abcde1234"));
1919 test(S("abcde"), 5, 1, S("12345"), 0, 5, S("abcde12345"));
1920 test(S("abcde"), 5, 1, S("12345"), 0, 6, S("abcde12345"));
1921 test(S("abcde"), 5, 1, S("12345"), 1, 0, S("abcde"));
1922 test(S("abcde"), 5, 1, S("12345"), 1, 1, S("abcde2"));
1923 test(S("abcde"), 5, 1, S("12345"), 1, 2, S("abcde23"));
1924 test(S("abcde"), 5, 1, S("12345"), 1, 3, S("abcde234"));
1925 test(S("abcde"), 5, 1, S("12345"), 1, 4, S("abcde2345"));
1926 test(S("abcde"), 5, 1, S("12345"), 1, 5, S("abcde2345"));
1927 test(S("abcde"), 5, 1, S("12345"), 2, 0, S("abcde"));
1928 test(S("abcde"), 5, 1, S("12345"), 2, 1, S("abcde3"));
1929 test(S("abcde"), 5, 1, S("12345"), 2, 2, S("abcde34"));
1930 test(S("abcde"), 5, 1, S("12345"), 2, 3, S("abcde345"));
1931 test(S("abcde"), 5, 1, S("12345"), 2, 4, S("abcde345"));
1932 test(S("abcde"), 5, 1, S("12345"), 4, 0, S("abcde"));
1933 test(S("abcde"), 5, 1, S("12345"), 4, 1, S("abcde5"));
1934 test(S("abcde"), 5, 1, S("12345"), 4, 2, S("abcde5"));
1935 test(S("abcde"), 5, 1, S("12345"), 5, 0, S("abcde"));
1941 test(S("abcde"), 5, 1, S("12345"), 5, 1, S("abcde"));
1942 test(S("abcde"), 5, 1, S("12345"), 6, 0, S("can't happen"));
1943 test(S("abcde"), 5, 1, S("1234567890"), 0, 0, S("abcde"));
1944 test(S("abcde"), 5, 1, S("1234567890"), 0, 1, S("abcde1"));
1945 test(S("abcde"), 5, 1, S("1234567890"), 0, 5, S("abcde12345"));
1946 test(S("abcde"), 5, 1, S("1234567890"), 0, 9, S("abcde123456789"));
1947 test(S("abcde"), 5, 1, S("1234567890"), 0, 10, S("abcde1234567890"));
1948 test(S("abcde"), 5, 1, S("1234567890"), 0, 11, S("abcde1234567890"));
1949 test(S("abcde"), 5, 1, S("1234567890"), 1, 0, S("abcde"));
1950 test(S("abcde"), 5, 1, S("1234567890"), 1, 1, S("abcde2"));
1951 test(S("abcde"), 5, 1, S("1234567890"), 1, 4, S("abcde2345"));
1952 test(S("abcde"), 5, 1, S("1234567890"), 1, 8, S("abcde23456789"));
1953 test(S("abcde"), 5, 1, S("1234567890"), 1, 9, S("abcde234567890"));
1954 test(S("abcde"), 5, 1, S("1234567890"), 1, 10, S("abcde234567890"));
1955 test(S("abcde"), 5, 1, S("1234567890"), 5, 0, S("abcde"));
1956 test(S("abcde"), 5, 1, S("1234567890"), 5, 1, S("abcde6"));
1957 test(S("abcde"), 5, 1, S("1234567890"), 5, 2, S("abcde67"));
1958 test(S("abcde"), 5, 1, S("1234567890"), 5, 4, S("abcde6789"));
1959 test(S("abcde"), 5, 1, S("1234567890"), 5, 5, S("abcde67890"));
1960 test(S("abcde"), 5, 1, S("1234567890"), 5, 6, S("abcde67890"));
1961 test(S("abcde"), 5, 1, S("1234567890"), 9, 0, S("abcde"));
1962 test(S("abcde"), 5, 1, S("1234567890"), 9, 1, S("abcde0"));
1963 test(S("abcde"), 5, 1, S("1234567890"), 9, 2, S("abcde0"));
1964 test(S("abcde"), 5, 1, S("1234567890"), 10, 0, S("abcde"));
1965 test(S("abcde"), 5, 1, S("1234567890"), 10, 1, S("abcde"));
1966 test(S("abcde"), 5, 1, S("1234567890"), 11, 0, S("can't happen"));
1967 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 0, S("abcde"));
1968 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 1, S("abcde1"));
1969 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 10, S("abcde1234567890"));
1970 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
1971 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
1972 test(S("abcde"), 5, 1, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
1973 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 0, S("abcde"));
1974 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 1, S("abcde2"));
1975 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 9, S("abcde234567890"));
1976 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
1977 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
1978 test(S("abcde"), 5, 1, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
1979 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 0, S("abcde"));
1980 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 1, S("abcde1"));
1981 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 5, S("abcde12345"));
1982 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 9, S("abcde123456789"));
1983 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 10, S("abcde1234567890"));
1984 test(S("abcde"), 5, 1, S("12345678901234567890"), 10, 11, S("abcde1234567890"));
1985 test(S("abcde"), 5, 1, S("12345678901234567890"), 19, 0, S("abcde"));
1986 test(S("abcde"), 5, 1, S("12345678901234567890"), 19, 1, S("abcde0"));
1987 test(S("abcde"), 5, 1, S("12345678901234567890"), 19, 2, S("abcde0"));
1988 test(S("abcde"), 5, 1, S("12345678901234567890"), 20, 0, S("abcde"));
1989 test(S("abcde"), 5, 1, S("12345678901234567890"), 20, 1, S("abcde"));
1990 test(S("abcde"), 5, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
1991 test(S("abcde"), 6, 0, S(""), 0, 0, S("can't happen"));
1992 test(S("abcde"), 6, 0, S(""), 0, 1, S("can't happen"));
1993 test(S("abcde"), 6, 0, S(""), 1, 0, S("can't happen"));
1994 test(S("abcde"), 6, 0, S("12345"), 0, 0, S("can't happen"));
1995 test(S("abcde"), 6, 0, S("12345"), 0, 1, S("can't happen"));
1996 test(S("abcde"), 6, 0, S("12345"), 0, 2, S("can't happen"));
1997 test(S("abcde"), 6, 0, S("12345"), 0, 4, S("can't happen"));
1998 test(S("abcde"), 6, 0, S("12345"), 0, 5, S("can't happen"));
1999 test(S("abcde"), 6, 0, S("12345"), 0, 6, S("can't happen"));
2000 test(S("abcde"), 6, 0, S("12345"), 1, 0, S("can't happen"));
2001 test(S("abcde"), 6, 0, S("12345"), 1, 1, S("can't happen"));
2002 test(S("abcde"), 6, 0, S("12345"), 1, 2, S("can't happen"));
2003 test(S("abcde"), 6, 0, S("12345"), 1, 3, S("can't happen"));
2004 test(S("abcde"), 6, 0, S("12345"), 1, 4, S("can't happen"));
2005 test(S("abcde"), 6, 0, S("12345"), 1, 5, S("can't happen"));
2006 test(S("abcde"), 6, 0, S("12345"), 2, 0, S("can't happen"));
2007 test(S("abcde"), 6, 0, S("12345"), 2, 1, S("can't happen"));
2008 test(S("abcde"), 6, 0, S("12345"), 2, 2, S("can't happen"));
2009 test(S("abcde"), 6, 0, S("12345"), 2, 3, S("can't happen"));
2010 test(S("abcde"), 6, 0, S("12345"), 2, 4, S("can't happen"));
2011 test(S("abcde"), 6, 0, S("12345"), 4, 0, S("can't happen"));
2012 test(S("abcde"), 6, 0, S("12345"), 4, 1, S("can't happen"));
2013 test(S("abcde"), 6, 0, S("12345"), 4, 2, S("can't happen"));
2014 test(S("abcde"), 6, 0, S("12345"), 5, 0, S("can't happen"));
2015 test(S("abcde"), 6, 0, S("12345"), 5, 1, S("can't happen"));
2016 test(S("abcde"), 6, 0, S("12345"), 6, 0, S("can't happen"));
2017 test(S("abcde"), 6, 0, S("1234567890"), 0, 0, S("can't happen"));
2018 test(S("abcde"), 6, 0, S("1234567890"), 0, 1, S("can't happen"));
2019 test(S("abcde"), 6, 0, S("1234567890"), 0, 5, S("can't happen"));
2020 test(S("abcde"), 6, 0, S("1234567890"), 0, 9, S("can't happen"));
2021 test(S("abcde"), 6, 0, S("1234567890"), 0, 10, S("can't happen"));
2022 test(S("abcde"), 6, 0, S("1234567890"), 0, 11, S("can't happen"));
2023 test(S("abcde"), 6, 0, S("1234567890"), 1, 0, S("can't happen"));
2024 test(S("abcde"), 6, 0, S("1234567890"), 1, 1, S("can't happen"));
2025 test(S("abcde"), 6, 0, S("1234567890"), 1, 4, S("can't happen"));
2026 test(S("abcde"), 6, 0, S("1234567890"), 1, 8, S("can't happen"));
2027 test(S("abcde"), 6, 0, S("1234567890"), 1, 9, S("can't happen"));
2028 test(S("abcde"), 6, 0, S("1234567890"), 1, 10, S("can't happen"));
2029 test(S("abcde"), 6, 0, S("1234567890"), 5, 0, S("can't happen"));
2030 test(S("abcde"), 6, 0, S("1234567890"), 5, 1, S("can't happen"));
2031 test(S("abcde"), 6, 0, S("1234567890"), 5, 2, S("can't happen"));
2032 test(S("abcde"), 6, 0, S("1234567890"), 5, 4, S("can't happen"));
2033 test(S("abcde"), 6, 0, S("1234567890"), 5, 5, S("can't happen"));
2034 test(S("abcde"), 6, 0, S("1234567890"), 5, 6, S("can't happen"));
2035 test(S("abcde"), 6, 0, S("1234567890"), 9, 0, S("can't happen"));
2036 test(S("abcde"), 6, 0, S("1234567890"), 9, 1, S("can't happen"));
2037 test(S("abcde"), 6, 0, S("1234567890"), 9, 2, S("can't happen"));
2038 test(S("abcde"), 6, 0, S("1234567890"), 10, 0, S("can't happen"));
2039 test(S("abcde"), 6, 0, S("1234567890"), 10, 1, S("can't happen"));
2040 test(S("abcde"), 6, 0, S("1234567890"), 11, 0, S("can't happen"));
2046 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
2047 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
2048 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
2049 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 19, S("can't happen"));
2050 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 20, S("can't happen"));
2051 test(S("abcde"), 6, 0, S("12345678901234567890"), 0, 21, S("can't happen"));
2052 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 0, S("can't happen"));
2053 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 1, S("can't happen"));
2054 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 9, S("can't happen"));
2055 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 18, S("can't happen"));
2056 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 19, S("can't happen"));
2057 test(S("abcde"), 6, 0, S("12345678901234567890"), 1, 20, S("can't happen"));
2058 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 0, S("can't happen"));
2059 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 1, S("can't happen"));
2060 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 5, S("can't happen"));
2061 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 9, S("can't happen"));
2062 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 10, S("can't happen"));
2063 test(S("abcde"), 6, 0, S("12345678901234567890"), 10, 11, S("can't happen"));
2064 test(S("abcde"), 6, 0, S("12345678901234567890"), 19, 0, S("can't happen"));
2065 test(S("abcde"), 6, 0, S("12345678901234567890"), 19, 1, S("can't happen"));
2066 test(S("abcde"), 6, 0, S("12345678901234567890"), 19, 2, S("can't happen"));
2067 test(S("abcde"), 6, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
2068 test(S("abcde"), 6, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
2069 test(S("abcde"), 6, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
2070 test(S("abcdefghij"), 0, 0, S(""), 0, 0, S("abcdefghij"));
2071 test(S("abcdefghij"), 0, 0, S(""), 0, 1, S("abcdefghij"));
2072 test(S("abcdefghij"), 0, 0, S(""), 1, 0, S("can't happen"));
2073 test(S("abcdefghij"), 0, 0, S("12345"), 0, 0, S("abcdefghij"));
2074 test(S("abcdefghij"), 0, 0, S("12345"), 0, 1, S("1abcdefghij"));
2075 test(S("abcdefghij"), 0, 0, S("12345"), 0, 2, S("12abcdefghij"));
2076 test(S("abcdefghij"), 0, 0, S("12345"), 0, 4, S("1234abcdefghij"));
2077 test(S("abcdefghij"), 0, 0, S("12345"), 0, 5, S("12345abcdefghij"));
2078 test(S("abcdefghij"), 0, 0, S("12345"), 0, 6, S("12345abcdefghij"));
2079 test(S("abcdefghij"), 0, 0, S("12345"), 1, 0, S("abcdefghij"));
2080 test(S("abcdefghij"), 0, 0, S("12345"), 1, 1, S("2abcdefghij"));
2081 test(S("abcdefghij"), 0, 0, S("12345"), 1, 2, S("23abcdefghij"));
2082 test(S("abcdefghij"), 0, 0, S("12345"), 1, 3, S("234abcdefghij"));
2083 test(S("abcdefghij"), 0, 0, S("12345"), 1, 4, S("2345abcdefghij"));
2084 test(S("abcdefghij"), 0, 0, S("12345"), 1, 5, S("2345abcdefghij"));
2085 test(S("abcdefghij"), 0, 0, S("12345"), 2, 0, S("abcdefghij"));
2086 test(S("abcdefghij"), 0, 0, S("12345"), 2, 1, S("3abcdefghij"));
2087 test(S("abcdefghij"), 0, 0, S("12345"), 2, 2, S("34abcdefghij"));
2088 test(S("abcdefghij"), 0, 0, S("12345"), 2, 3, S("345abcdefghij"));
2089 test(S("abcdefghij"), 0, 0, S("12345"), 2, 4, S("345abcdefghij"));
2090 test(S("abcdefghij"), 0, 0, S("12345"), 4, 0, S("abcdefghij"));
2091 test(S("abcdefghij"), 0, 0, S("12345"), 4, 1, S("5abcdefghij"));
2092 test(S("abcdefghij"), 0, 0, S("12345"), 4, 2, S("5abcdefghij"));
2093 test(S("abcdefghij"), 0, 0, S("12345"), 5, 0, S("abcdefghij"));
2094 test(S("abcdefghij"), 0, 0, S("12345"), 5, 1, S("abcdefghij"));
2095 test(S("abcdefghij"), 0, 0, S("12345"), 6, 0, S("can't happen"));
2096 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 0, S("abcdefghij"));
2097 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 1, S("1abcdefghij"));
2098 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 5, S("12345abcdefghij"));
2099 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 9, S("123456789abcdefghij"));
2100 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 10, S("1234567890abcdefghij"));
2101 test(S("abcdefghij"), 0, 0, S("1234567890"), 0, 11, S("1234567890abcdefghij"));
2102 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 0, S("abcdefghij"));
2103 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 1, S("2abcdefghij"));
2104 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 4, S("2345abcdefghij"));
2105 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 8, S("23456789abcdefghij"));
2106 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 9, S("234567890abcdefghij"));
2107 test(S("abcdefghij"), 0, 0, S("1234567890"), 1, 10, S("234567890abcdefghij"));
2108 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 0, S("abcdefghij"));
2109 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 1, S("6abcdefghij"));
2110 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 2, S("67abcdefghij"));
2111 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 4, S("6789abcdefghij"));
2112 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 5, S("67890abcdefghij"));
2113 test(S("abcdefghij"), 0, 0, S("1234567890"), 5, 6, S("67890abcdefghij"));
2114 test(S("abcdefghij"), 0, 0, S("1234567890"), 9, 0, S("abcdefghij"));
2115 test(S("abcdefghij"), 0, 0, S("1234567890"), 9, 1, S("0abcdefghij"));
2116 test(S("abcdefghij"), 0, 0, S("1234567890"), 9, 2, S("0abcdefghij"));
2117 test(S("abcdefghij"), 0, 0, S("1234567890"), 10, 0, S("abcdefghij"));
2118 test(S("abcdefghij"), 0, 0, S("1234567890"), 10, 1, S("abcdefghij"));
2119 test(S("abcdefghij"), 0, 0, S("1234567890"), 11, 0, S("can't happen"));
2120 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 0, S("abcdefghij"));
2121 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 1, S("1abcdefghij"));
2122 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 10, S("1234567890abcdefghij"));
2123 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghij"));
2124 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghij"));
2125 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
2126 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
2127 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 1, S("2abcdefghij"));
2128 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
2129 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
2130 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghij"));
2131 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghij"));
2132 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 0, S("abcdefghij"));
2133 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 1, S("1abcdefghij"));
2134 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 5, S("12345abcdefghij"));
2135 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 9, S("123456789abcdefghij"));
2136 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 10, S("1234567890abcdefghij"));
2137 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 10, 11, S("1234567890abcdefghij"));
2138 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 19, 0, S("abcdefghij"));
2139 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 19, 1, S("0abcdefghij"));
2140 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 19, 2, S("0abcdefghij"));
2141 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 20, 0, S("abcdefghij"));
2142 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 20, 1, S("abcdefghij"));
2143 test(S("abcdefghij"), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
2144 test(S("abcdefghij"), 0, 1, S(""), 0, 0, S("bcdefghij"));
2145 test(S("abcdefghij"), 0, 1, S(""), 0, 1, S("bcdefghij"));
2151 test(S("abcdefghij"), 0, 1, S(""), 1, 0, S("can't happen"));
2152 test(S("abcdefghij"), 0, 1, S("12345"), 0, 0, S("bcdefghij"));
2153 test(S("abcdefghij"), 0, 1, S("12345"), 0, 1, S("1bcdefghij"));
2154 test(S("abcdefghij"), 0, 1, S("12345"), 0, 2, S("12bcdefghij"));
2155 test(S("abcdefghij"), 0, 1, S("12345"), 0, 4, S("1234bcdefghij"));
2156 test(S("abcdefghij"), 0, 1, S("12345"), 0, 5, S("12345bcdefghij"));
2157 test(S("abcdefghij"), 0, 1, S("12345"), 0, 6, S("12345bcdefghij"));
2158 test(S("abcdefghij"), 0, 1, S("12345"), 1, 0, S("bcdefghij"));
2159 test(S("abcdefghij"), 0, 1, S("12345"), 1, 1, S("2bcdefghij"));
2160 test(S("abcdefghij"), 0, 1, S("12345"), 1, 2, S("23bcdefghij"));
2161 test(S("abcdefghij"), 0, 1, S("12345"), 1, 3, S("234bcdefghij"));
2162 test(S("abcdefghij"), 0, 1, S("12345"), 1, 4, S("2345bcdefghij"));
2163 test(S("abcdefghij"), 0, 1, S("12345"), 1, 5, S("2345bcdefghij"));
2164 test(S("abcdefghij"), 0, 1, S("12345"), 2, 0, S("bcdefghij"));
2165 test(S("abcdefghij"), 0, 1, S("12345"), 2, 1, S("3bcdefghij"));
2166 test(S("abcdefghij"), 0, 1, S("12345"), 2, 2, S("34bcdefghij"));
2167 test(S("abcdefghij"), 0, 1, S("12345"), 2, 3, S("345bcdefghij"));
2168 test(S("abcdefghij"), 0, 1, S("12345"), 2, 4, S("345bcdefghij"));
2169 test(S("abcdefghij"), 0, 1, S("12345"), 4, 0, S("bcdefghij"));
2170 test(S("abcdefghij"), 0, 1, S("12345"), 4, 1, S("5bcdefghij"));
2171 test(S("abcdefghij"), 0, 1, S("12345"), 4, 2, S("5bcdefghij"));
2172 test(S("abcdefghij"), 0, 1, S("12345"), 5, 0, S("bcdefghij"));
2173 test(S("abcdefghij"), 0, 1, S("12345"), 5, 1, S("bcdefghij"));
2174 test(S("abcdefghij"), 0, 1, S("12345"), 6, 0, S("can't happen"));
2175 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 0, S("bcdefghij"));
2176 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 1, S("1bcdefghij"));
2177 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 5, S("12345bcdefghij"));
2178 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 9, S("123456789bcdefghij"));
2179 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 10, S("1234567890bcdefghij"));
2180 test(S("abcdefghij"), 0, 1, S("1234567890"), 0, 11, S("1234567890bcdefghij"));
2181 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 0, S("bcdefghij"));
2182 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 1, S("2bcdefghij"));
2183 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 4, S("2345bcdefghij"));
2184 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 8, S("23456789bcdefghij"));
2185 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 9, S("234567890bcdefghij"));
2186 test(S("abcdefghij"), 0, 1, S("1234567890"), 1, 10, S("234567890bcdefghij"));
2187 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 0, S("bcdefghij"));
2188 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 1, S("6bcdefghij"));
2189 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 2, S("67bcdefghij"));
2190 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 4, S("6789bcdefghij"));
2191 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 5, S("67890bcdefghij"));
2192 test(S("abcdefghij"), 0, 1, S("1234567890"), 5, 6, S("67890bcdefghij"));
2193 test(S("abcdefghij"), 0, 1, S("1234567890"), 9, 0, S("bcdefghij"));
2194 test(S("abcdefghij"), 0, 1, S("1234567890"), 9, 1, S("0bcdefghij"));
2195 test(S("abcdefghij"), 0, 1, S("1234567890"), 9, 2, S("0bcdefghij"));
2196 test(S("abcdefghij"), 0, 1, S("1234567890"), 10, 0, S("bcdefghij"));
2197 test(S("abcdefghij"), 0, 1, S("1234567890"), 10, 1, S("bcdefghij"));
2198 test(S("abcdefghij"), 0, 1, S("1234567890"), 11, 0, S("can't happen"));
2199 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 0, S("bcdefghij"));
2200 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 1, S("1bcdefghij"));
2201 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 10, S("1234567890bcdefghij"));
2202 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghij"));
2203 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghij"));
2204 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghij"));
2205 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 0, S("bcdefghij"));
2206 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 1, S("2bcdefghij"));
2207 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 9, S("234567890bcdefghij"));
2208 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 18, S("234567890123456789bcdefghij"));
2209 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghij"));
2210 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghij"));
2211 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 0, S("bcdefghij"));
2212 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 1, S("1bcdefghij"));
2213 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 5, S("12345bcdefghij"));
2214 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 9, S("123456789bcdefghij"));
2215 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 10, S("1234567890bcdefghij"));
2216 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 10, 11, S("1234567890bcdefghij"));
2217 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 19, 0, S("bcdefghij"));
2218 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 19, 1, S("0bcdefghij"));
2219 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 19, 2, S("0bcdefghij"));
2220 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 20, 0, S("bcdefghij"));
2221 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 20, 1, S("bcdefghij"));
2222 test(S("abcdefghij"), 0, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
2223 test(S("abcdefghij"), 0, 5, S(""), 0, 0, S("fghij"));
2224 test(S("abcdefghij"), 0, 5, S(""), 0, 1, S("fghij"));
2225 test(S("abcdefghij"), 0, 5, S(""), 1, 0, S("can't happen"));
2226 test(S("abcdefghij"), 0, 5, S("12345"), 0, 0, S("fghij"));
2227 test(S("abcdefghij"), 0, 5, S("12345"), 0, 1, S("1fghij"));
2228 test(S("abcdefghij"), 0, 5, S("12345"), 0, 2, S("12fghij"));
2229 test(S("abcdefghij"), 0, 5, S("12345"), 0, 4, S("1234fghij"));
2230 test(S("abcdefghij"), 0, 5, S("12345"), 0, 5, S("12345fghij"));
2231 test(S("abcdefghij"), 0, 5, S("12345"), 0, 6, S("12345fghij"));
2232 test(S("abcdefghij"), 0, 5, S("12345"), 1, 0, S("fghij"));
2233 test(S("abcdefghij"), 0, 5, S("12345"), 1, 1, S("2fghij"));
2234 test(S("abcdefghij"), 0, 5, S("12345"), 1, 2, S("23fghij"));
2235 test(S("abcdefghij"), 0, 5, S("12345"), 1, 3, S("234fghij"));
2236 test(S("abcdefghij"), 0, 5, S("12345"), 1, 4, S("2345fghij"));
2237 test(S("abcdefghij"), 0, 5, S("12345"), 1, 5, S("2345fghij"));
2238 test(S("abcdefghij"), 0, 5, S("12345"), 2, 0, S("fghij"));
2239 test(S("abcdefghij"), 0, 5, S("12345"), 2, 1, S("3fghij"));
2240 test(S("abcdefghij"), 0, 5, S("12345"), 2, 2, S("34fghij"));
2241 test(S("abcdefghij"), 0, 5, S("12345"), 2, 3, S("345fghij"));
2242 test(S("abcdefghij"), 0, 5, S("12345"), 2, 4, S("345fghij"));
2243 test(S("abcdefghij"), 0, 5, S("12345"), 4, 0, S("fghij"));
2244 test(S("abcdefghij"), 0, 5, S("12345"), 4, 1, S("5fghij"));
2245 test(S("abcdefghij"), 0, 5, S("12345"), 4, 2, S("5fghij"));
2246 test(S("abcdefghij"), 0, 5, S("12345"), 5, 0, S("fghij"));
2247 test(S("abcdefghij"), 0, 5, S("12345"), 5, 1, S("fghij"));
2248 test(S("abcdefghij"), 0, 5, S("12345"), 6, 0, S("can't happen"));
2249 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 0, S("fghij"));
2250 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 1, S("1fghij"));
2256 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 5, S("12345fghij"));
2257 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 9, S("123456789fghij"));
2258 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 10, S("1234567890fghij"));
2259 test(S("abcdefghij"), 0, 5, S("1234567890"), 0, 11, S("1234567890fghij"));
2260 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 0, S("fghij"));
2261 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 1, S("2fghij"));
2262 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 4, S("2345fghij"));
2263 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 8, S("23456789fghij"));
2264 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 9, S("234567890fghij"));
2265 test(S("abcdefghij"), 0, 5, S("1234567890"), 1, 10, S("234567890fghij"));
2266 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 0, S("fghij"));
2267 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 1, S("6fghij"));
2268 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 2, S("67fghij"));
2269 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 4, S("6789fghij"));
2270 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 5, S("67890fghij"));
2271 test(S("abcdefghij"), 0, 5, S("1234567890"), 5, 6, S("67890fghij"));
2272 test(S("abcdefghij"), 0, 5, S("1234567890"), 9, 0, S("fghij"));
2273 test(S("abcdefghij"), 0, 5, S("1234567890"), 9, 1, S("0fghij"));
2274 test(S("abcdefghij"), 0, 5, S("1234567890"), 9, 2, S("0fghij"));
2275 test(S("abcdefghij"), 0, 5, S("1234567890"), 10, 0, S("fghij"));
2276 test(S("abcdefghij"), 0, 5, S("1234567890"), 10, 1, S("fghij"));
2277 test(S("abcdefghij"), 0, 5, S("1234567890"), 11, 0, S("can't happen"));
2278 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 0, S("fghij"));
2279 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 1, S("1fghij"));
2280 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 10, S("1234567890fghij"));
2281 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 19, S("1234567890123456789fghij"));
2282 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 20, S("12345678901234567890fghij"));
2283 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 0, 21, S("12345678901234567890fghij"));
2284 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 0, S("fghij"));
2285 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 1, S("2fghij"));
2286 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 9, S("234567890fghij"));
2287 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 18, S("234567890123456789fghij"));
2288 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 19, S("2345678901234567890fghij"));
2289 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 1, 20, S("2345678901234567890fghij"));
2290 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 0, S("fghij"));
2291 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 1, S("1fghij"));
2292 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 5, S("12345fghij"));
2293 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 9, S("123456789fghij"));
2294 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 10, S("1234567890fghij"));
2295 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 10, 11, S("1234567890fghij"));
2296 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 19, 0, S("fghij"));
2297 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 19, 1, S("0fghij"));
2298 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 19, 2, S("0fghij"));
2299 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 20, 0, S("fghij"));
2300 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 20, 1, S("fghij"));
2301 test(S("abcdefghij"), 0, 5, S("12345678901234567890"), 21, 0, S("can't happen"));
2302 test(S("abcdefghij"), 0, 9, S(""), 0, 0, S("j"));
2303 test(S("abcdefghij"), 0, 9, S(""), 0, 1, S("j"));
2304 test(S("abcdefghij"), 0, 9, S(""), 1, 0, S("can't happen"));
2305 test(S("abcdefghij"), 0, 9, S("12345"), 0, 0, S("j"));
2306 test(S("abcdefghij"), 0, 9, S("12345"), 0, 1, S("1j"));
2307 test(S("abcdefghij"), 0, 9, S("12345"), 0, 2, S("12j"));
2308 test(S("abcdefghij"), 0, 9, S("12345"), 0, 4, S("1234j"));
2309 test(S("abcdefghij"), 0, 9, S("12345"), 0, 5, S("12345j"));
2310 test(S("abcdefghij"), 0, 9, S("12345"), 0, 6, S("12345j"));
2311 test(S("abcdefghij"), 0, 9, S("12345"), 1, 0, S("j"));
2312 test(S("abcdefghij"), 0, 9, S("12345"), 1, 1, S("2j"));
2313 test(S("abcdefghij"), 0, 9, S("12345"), 1, 2, S("23j"));
2314 test(S("abcdefghij"), 0, 9, S("12345"), 1, 3, S("234j"));
2315 test(S("abcdefghij"), 0, 9, S("12345"), 1, 4, S("2345j"));
2316 test(S("abcdefghij"), 0, 9, S("12345"), 1, 5, S("2345j"));
2317 test(S("abcdefghij"), 0, 9, S("12345"), 2, 0, S("j"));
2318 test(S("abcdefghij"), 0, 9, S("12345"), 2, 1, S("3j"));
2319 test(S("abcdefghij"), 0, 9, S("12345"), 2, 2, S("34j"));
2320 test(S("abcdefghij"), 0, 9, S("12345"), 2, 3, S("345j"));
2321 test(S("abcdefghij"), 0, 9, S("12345"), 2, 4, S("345j"));
2322 test(S("abcdefghij"), 0, 9, S("12345"), 4, 0, S("j"));
2323 test(S("abcdefghij"), 0, 9, S("12345"), 4, 1, S("5j"));
2324 test(S("abcdefghij"), 0, 9, S("12345"), 4, 2, S("5j"));
2325 test(S("abcdefghij"), 0, 9, S("12345"), 5, 0, S("j"));
2326 test(S("abcdefghij"), 0, 9, S("12345"), 5, 1, S("j"));
2327 test(S("abcdefghij"), 0, 9, S("12345"), 6, 0, S("can't happen"));
2328 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 0, S("j"));
2329 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 1, S("1j"));
2330 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 5, S("12345j"));
2331 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 9, S("123456789j"));
2332 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 10, S("1234567890j"));
2333 test(S("abcdefghij"), 0, 9, S("1234567890"), 0, 11, S("1234567890j"));
2334 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 0, S("j"));
2335 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 1, S("2j"));
2336 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 4, S("2345j"));
2337 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 8, S("23456789j"));
2338 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 9, S("234567890j"));
2339 test(S("abcdefghij"), 0, 9, S("1234567890"), 1, 10, S("234567890j"));
2340 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 0, S("j"));
2341 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 1, S("6j"));
2342 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 2, S("67j"));
2343 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 4, S("6789j"));
2344 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 5, S("67890j"));
2345 test(S("abcdefghij"), 0, 9, S("1234567890"), 5, 6, S("67890j"));
2346 test(S("abcdefghij"), 0, 9, S("1234567890"), 9, 0, S("j"));
2347 test(S("abcdefghij"), 0, 9, S("1234567890"), 9, 1, S("0j"));
2348 test(S("abcdefghij"), 0, 9, S("1234567890"), 9, 2, S("0j"));
2349 test(S("abcdefghij"), 0, 9, S("1234567890"), 10, 0, S("j"));
2350 test(S("abcdefghij"), 0, 9, S("1234567890"), 10, 1, S("j"));
2351 test(S("abcdefghij"), 0, 9, S("1234567890"), 11, 0, S("can't happen"));
2352 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 0, S("j"));
2353 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 1, S("1j"));
2354 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 10, S("1234567890j"));
2355 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 19, S("1234567890123456789j"));
2361 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 20, S("12345678901234567890j"));
2362 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 0, 21, S("12345678901234567890j"));
2363 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 0, S("j"));
2364 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 1, S("2j"));
2365 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 9, S("234567890j"));
2366 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 18, S("234567890123456789j"));
2367 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 19, S("2345678901234567890j"));
2368 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 1, 20, S("2345678901234567890j"));
2369 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 0, S("j"));
2370 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 1, S("1j"));
2371 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 5, S("12345j"));
2372 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 9, S("123456789j"));
2373 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 10, S("1234567890j"));
2374 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 10, 11, S("1234567890j"));
2375 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 19, 0, S("j"));
2376 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 19, 1, S("0j"));
2377 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 19, 2, S("0j"));
2378 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 20, 0, S("j"));
2379 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 20, 1, S("j"));
2380 test(S("abcdefghij"), 0, 9, S("12345678901234567890"), 21, 0, S("can't happen"));
2381 test(S("abcdefghij"), 0, 10, S(""), 0, 0, S(""));
2382 test(S("abcdefghij"), 0, 10, S(""), 0, 1, S(""));
2383 test(S("abcdefghij"), 0, 10, S(""), 1, 0, S("can't happen"));
2384 test(S("abcdefghij"), 0, 10, S("12345"), 0, 0, S(""));
2385 test(S("abcdefghij"), 0, 10, S("12345"), 0, 1, S("1"));
2386 test(S("abcdefghij"), 0, 10, S("12345"), 0, 2, S("12"));
2387 test(S("abcdefghij"), 0, 10, S("12345"), 0, 4, S("1234"));
2388 test(S("abcdefghij"), 0, 10, S("12345"), 0, 5, S("12345"));
2389 test(S("abcdefghij"), 0, 10, S("12345"), 0, 6, S("12345"));
2390 test(S("abcdefghij"), 0, 10, S("12345"), 1, 0, S(""));
2391 test(S("abcdefghij"), 0, 10, S("12345"), 1, 1, S("2"));
2392 test(S("abcdefghij"), 0, 10, S("12345"), 1, 2, S("23"));
2393 test(S("abcdefghij"), 0, 10, S("12345"), 1, 3, S("234"));
2394 test(S("abcdefghij"), 0, 10, S("12345"), 1, 4, S("2345"));
2395 test(S("abcdefghij"), 0, 10, S("12345"), 1, 5, S("2345"));
2396 test(S("abcdefghij"), 0, 10, S("12345"), 2, 0, S(""));
2397 test(S("abcdefghij"), 0, 10, S("12345"), 2, 1, S("3"));
2398 test(S("abcdefghij"), 0, 10, S("12345"), 2, 2, S("34"));
2399 test(S("abcdefghij"), 0, 10, S("12345"), 2, 3, S("345"));
2400 test(S("abcdefghij"), 0, 10, S("12345"), 2, 4, S("345"));
2401 test(S("abcdefghij"), 0, 10, S("12345"), 4, 0, S(""));
2402 test(S("abcdefghij"), 0, 10, S("12345"), 4, 1, S("5"));
2403 test(S("abcdefghij"), 0, 10, S("12345"), 4, 2, S("5"));
2404 test(S("abcdefghij"), 0, 10, S("12345"), 5, 0, S(""));
2405 test(S("abcdefghij"), 0, 10, S("12345"), 5, 1, S(""));
2406 test(S("abcdefghij"), 0, 10, S("12345"), 6, 0, S("can't happen"));
2407 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 0, S(""));
2408 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 1, S("1"));
2409 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 5, S("12345"));
2410 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 9, S("123456789"));
2411 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 10, S("1234567890"));
2412 test(S("abcdefghij"), 0, 10, S("1234567890"), 0, 11, S("1234567890"));
2413 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 0, S(""));
2414 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 1, S("2"));
2415 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 4, S("2345"));
2416 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 8, S("23456789"));
2417 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 9, S("234567890"));
2418 test(S("abcdefghij"), 0, 10, S("1234567890"), 1, 10, S("234567890"));
2419 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 0, S(""));
2420 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 1, S("6"));
2421 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 2, S("67"));
2422 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 4, S("6789"));
2423 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 5, S("67890"));
2424 test(S("abcdefghij"), 0, 10, S("1234567890"), 5, 6, S("67890"));
2425 test(S("abcdefghij"), 0, 10, S("1234567890"), 9, 0, S(""));
2426 test(S("abcdefghij"), 0, 10, S("1234567890"), 9, 1, S("0"));
2427 test(S("abcdefghij"), 0, 10, S("1234567890"), 9, 2, S("0"));
2428 test(S("abcdefghij"), 0, 10, S("1234567890"), 10, 0, S(""));
2429 test(S("abcdefghij"), 0, 10, S("1234567890"), 10, 1, S(""));
2430 test(S("abcdefghij"), 0, 10, S("1234567890"), 11, 0, S("can't happen"));
2431 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 0, S(""));
2432 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 1, S("1"));
2433 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890"));
2434 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
2435 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
2436 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
2437 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 0, S(""));
2438 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 1, S("2"));
2439 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 9, S("234567890"));
2440 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 18, S("234567890123456789"));
2441 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
2442 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
2443 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 0, S(""));
2444 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 1, S("1"));
2445 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 5, S("12345"));
2446 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 9, S("123456789"));
2447 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 10, S("1234567890"));
2448 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 10, 11, S("1234567890"));
2449 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 19, 0, S(""));
2450 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 19, 1, S("0"));
2451 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 19, 2, S("0"));
2452 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 20, 0, S(""));
2453 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 20, 1, S(""));
2454 test(S("abcdefghij"), 0, 10, S("12345678901234567890"), 21, 0, S("can't happen"));
2455 test(S("abcdefghij"), 0, 11, S(""), 0, 0, S(""));
2456 test(S("abcdefghij"), 0, 11, S(""), 0, 1, S(""));
2457 test(S("abcdefghij"), 0, 11, S(""), 1, 0, S("can't happen"));
2458 test(S("abcdefghij"), 0, 11, S("12345"), 0, 0, S(""));
2459 test(S("abcdefghij"), 0, 11, S("12345"), 0, 1, S("1"));
2460 test(S("abcdefghij"), 0, 11, S("12345"), 0, 2, S("12"));
2466 test(S("abcdefghij"), 0, 11, S("12345"), 0, 4, S("1234"));
2467 test(S("abcdefghij"), 0, 11, S("12345"), 0, 5, S("12345"));
2468 test(S("abcdefghij"), 0, 11, S("12345"), 0, 6, S("12345"));
2469 test(S("abcdefghij"), 0, 11, S("12345"), 1, 0, S(""));
2470 test(S("abcdefghij"), 0, 11, S("12345"), 1, 1, S("2"));
2471 test(S("abcdefghij"), 0, 11, S("12345"), 1, 2, S("23"));
2472 test(S("abcdefghij"), 0, 11, S("12345"), 1, 3, S("234"));
2473 test(S("abcdefghij"), 0, 11, S("12345"), 1, 4, S("2345"));
2474 test(S("abcdefghij"), 0, 11, S("12345"), 1, 5, S("2345"));
2475 test(S("abcdefghij"), 0, 11, S("12345"), 2, 0, S(""));
2476 test(S("abcdefghij"), 0, 11, S("12345"), 2, 1, S("3"));
2477 test(S("abcdefghij"), 0, 11, S("12345"), 2, 2, S("34"));
2478 test(S("abcdefghij"), 0, 11, S("12345"), 2, 3, S("345"));
2479 test(S("abcdefghij"), 0, 11, S("12345"), 2, 4, S("345"));
2480 test(S("abcdefghij"), 0, 11, S("12345"), 4, 0, S(""));
2481 test(S("abcdefghij"), 0, 11, S("12345"), 4, 1, S("5"));
2482 test(S("abcdefghij"), 0, 11, S("12345"), 4, 2, S("5"));
2483 test(S("abcdefghij"), 0, 11, S("12345"), 5, 0, S(""));
2484 test(S("abcdefghij"), 0, 11, S("12345"), 5, 1, S(""));
2485 test(S("abcdefghij"), 0, 11, S("12345"), 6, 0, S("can't happen"));
2486 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 0, S(""));
2487 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 1, S("1"));
2488 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 5, S("12345"));
2489 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 9, S("123456789"));
2490 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 10, S("1234567890"));
2491 test(S("abcdefghij"), 0, 11, S("1234567890"), 0, 11, S("1234567890"));
2492 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 0, S(""));
2493 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 1, S("2"));
2494 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 4, S("2345"));
2495 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 8, S("23456789"));
2496 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 9, S("234567890"));
2497 test(S("abcdefghij"), 0, 11, S("1234567890"), 1, 10, S("234567890"));
2498 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 0, S(""));
2499 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 1, S("6"));
2500 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 2, S("67"));
2501 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 4, S("6789"));
2502 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 5, S("67890"));
2503 test(S("abcdefghij"), 0, 11, S("1234567890"), 5, 6, S("67890"));
2504 test(S("abcdefghij"), 0, 11, S("1234567890"), 9, 0, S(""));
2505 test(S("abcdefghij"), 0, 11, S("1234567890"), 9, 1, S("0"));
2506 test(S("abcdefghij"), 0, 11, S("1234567890"), 9, 2, S("0"));
2507 test(S("abcdefghij"), 0, 11, S("1234567890"), 10, 0, S(""));
2508 test(S("abcdefghij"), 0, 11, S("1234567890"), 10, 1, S(""));
2509 test(S("abcdefghij"), 0, 11, S("1234567890"), 11, 0, S("can't happen"));
2510 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 0, S(""));
2511 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 1, S("1"));
2512 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 10, S("1234567890"));
2513 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
2514 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
2515 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
2516 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 0, S(""));
2517 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 1, S("2"));
2518 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 9, S("234567890"));
2519 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 18, S("234567890123456789"));
2520 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
2521 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
2522 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 0, S(""));
2523 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 1, S("1"));
2524 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 5, S("12345"));
2525 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 9, S("123456789"));
2526 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 10, S("1234567890"));
2527 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 10, 11, S("1234567890"));
2528 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 19, 0, S(""));
2529 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 19, 1, S("0"));
2530 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 19, 2, S("0"));
2531 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 20, 0, S(""));
2532 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 20, 1, S(""));
2533 test(S("abcdefghij"), 0, 11, S("12345678901234567890"), 21, 0, S("can't happen"));
2534 test(S("abcdefghij"), 1, 0, S(""), 0, 0, S("abcdefghij"));
2535 test(S("abcdefghij"), 1, 0, S(""), 0, 1, S("abcdefghij"));
2536 test(S("abcdefghij"), 1, 0, S(""), 1, 0, S("can't happen"));
2537 test(S("abcdefghij"), 1, 0, S("12345"), 0, 0, S("abcdefghij"));
2538 test(S("abcdefghij"), 1, 0, S("12345"), 0, 1, S("a1bcdefghij"));
2539 test(S("abcdefghij"), 1, 0, S("12345"), 0, 2, S("a12bcdefghij"));
2540 test(S("abcdefghij"), 1, 0, S("12345"), 0, 4, S("a1234bcdefghij"));
2541 test(S("abcdefghij"), 1, 0, S("12345"), 0, 5, S("a12345bcdefghij"));
2542 test(S("abcdefghij"), 1, 0, S("12345"), 0, 6, S("a12345bcdefghij"));
2543 test(S("abcdefghij"), 1, 0, S("12345"), 1, 0, S("abcdefghij"));
2544 test(S("abcdefghij"), 1, 0, S("12345"), 1, 1, S("a2bcdefghij"));
2545 test(S("abcdefghij"), 1, 0, S("12345"), 1, 2, S("a23bcdefghij"));
2546 test(S("abcdefghij"), 1, 0, S("12345"), 1, 3, S("a234bcdefghij"));
2547 test(S("abcdefghij"), 1, 0, S("12345"), 1, 4, S("a2345bcdefghij"));
2548 test(S("abcdefghij"), 1, 0, S("12345"), 1, 5, S("a2345bcdefghij"));
2549 test(S("abcdefghij"), 1, 0, S("12345"), 2, 0, S("abcdefghij"));
2550 test(S("abcdefghij"), 1, 0, S("12345"), 2, 1, S("a3bcdefghij"));
2551 test(S("abcdefghij"), 1, 0, S("12345"), 2, 2, S("a34bcdefghij"));
2552 test(S("abcdefghij"), 1, 0, S("12345"), 2, 3, S("a345bcdefghij"));
2553 test(S("abcdefghij"), 1, 0, S("12345"), 2, 4, S("a345bcdefghij"));
2554 test(S("abcdefghij"), 1, 0, S("12345"), 4, 0, S("abcdefghij"));
2555 test(S("abcdefghij"), 1, 0, S("12345"), 4, 1, S("a5bcdefghij"));
2556 test(S("abcdefghij"), 1, 0, S("12345"), 4, 2, S("a5bcdefghij"));
2557 test(S("abcdefghij"), 1, 0, S("12345"), 5, 0, S("abcdefghij"));
2558 test(S("abcdefghij"), 1, 0, S("12345"), 5, 1, S("abcdefghij"));
2559 test(S("abcdefghij"), 1, 0, S("12345"), 6, 0, S("can't happen"));
2560 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 0, S("abcdefghij"));
2561 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 1, S("a1bcdefghij"));
2562 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 5, S("a12345bcdefghij"));
2563 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 9, S("a123456789bcdefghij"));
2564 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 10, S("a1234567890bcdefghij"));
2565 test(S("abcdefghij"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghij"));
2571 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 0, S("abcdefghij"));
2572 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 1, S("a2bcdefghij"));
2573 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 4, S("a2345bcdefghij"));
2574 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 8, S("a23456789bcdefghij"));
2575 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 9, S("a234567890bcdefghij"));
2576 test(S("abcdefghij"), 1, 0, S("1234567890"), 1, 10, S("a234567890bcdefghij"));
2577 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 0, S("abcdefghij"));
2578 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 1, S("a6bcdefghij"));
2579 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 2, S("a67bcdefghij"));
2580 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 4, S("a6789bcdefghij"));
2581 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 5, S("a67890bcdefghij"));
2582 test(S("abcdefghij"), 1, 0, S("1234567890"), 5, 6, S("a67890bcdefghij"));
2583 test(S("abcdefghij"), 1, 0, S("1234567890"), 9, 0, S("abcdefghij"));
2584 test(S("abcdefghij"), 1, 0, S("1234567890"), 9, 1, S("a0bcdefghij"));
2585 test(S("abcdefghij"), 1, 0, S("1234567890"), 9, 2, S("a0bcdefghij"));
2586 test(S("abcdefghij"), 1, 0, S("1234567890"), 10, 0, S("abcdefghij"));
2587 test(S("abcdefghij"), 1, 0, S("1234567890"), 10, 1, S("abcdefghij"));
2588 test(S("abcdefghij"), 1, 0, S("1234567890"), 11, 0, S("can't happen"));
2589 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 0, S("abcdefghij"));
2590 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 1, S("a1bcdefghij"));
2591 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 10, S("a1234567890bcdefghij"));
2592 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghij"));
2593 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghij"));
2594 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghij"));
2595 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
2596 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 1, S("a2bcdefghij"));
2597 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 9, S("a234567890bcdefghij"));
2598 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghij"));
2599 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghij"));
2600 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghij"));
2601 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 0, S("abcdefghij"));
2602 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 1, S("a1bcdefghij"));
2603 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 5, S("a12345bcdefghij"));
2604 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 9, S("a123456789bcdefghij"));
2605 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 10, S("a1234567890bcdefghij"));
2606 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 10, 11, S("a1234567890bcdefghij"));
2607 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 19, 0, S("abcdefghij"));
2608 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 19, 1, S("a0bcdefghij"));
2609 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 19, 2, S("a0bcdefghij"));
2610 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 20, 0, S("abcdefghij"));
2611 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 20, 1, S("abcdefghij"));
2612 test(S("abcdefghij"), 1, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
2613 test(S("abcdefghij"), 1, 1, S(""), 0, 0, S("acdefghij"));
2614 test(S("abcdefghij"), 1, 1, S(""), 0, 1, S("acdefghij"));
2615 test(S("abcdefghij"), 1, 1, S(""), 1, 0, S("can't happen"));
2616 test(S("abcdefghij"), 1, 1, S("12345"), 0, 0, S("acdefghij"));
2617 test(S("abcdefghij"), 1, 1, S("12345"), 0, 1, S("a1cdefghij"));
2618 test(S("abcdefghij"), 1, 1, S("12345"), 0, 2, S("a12cdefghij"));
2619 test(S("abcdefghij"), 1, 1, S("12345"), 0, 4, S("a1234cdefghij"));
2620 test(S("abcdefghij"), 1, 1, S("12345"), 0, 5, S("a12345cdefghij"));
2621 test(S("abcdefghij"), 1, 1, S("12345"), 0, 6, S("a12345cdefghij"));
2622 test(S("abcdefghij"), 1, 1, S("12345"), 1, 0, S("acdefghij"));
2623 test(S("abcdefghij"), 1, 1, S("12345"), 1, 1, S("a2cdefghij"));
2624 test(S("abcdefghij"), 1, 1, S("12345"), 1, 2, S("a23cdefghij"));
2625 test(S("abcdefghij"), 1, 1, S("12345"), 1, 3, S("a234cdefghij"));
2626 test(S("abcdefghij"), 1, 1, S("12345"), 1, 4, S("a2345cdefghij"));
2627 test(S("abcdefghij"), 1, 1, S("12345"), 1, 5, S("a2345cdefghij"));
2628 test(S("abcdefghij"), 1, 1, S("12345"), 2, 0, S("acdefghij"));
2629 test(S("abcdefghij"), 1, 1, S("12345"), 2, 1, S("a3cdefghij"));
2630 test(S("abcdefghij"), 1, 1, S("12345"), 2, 2, S("a34cdefghij"));
2631 test(S("abcdefghij"), 1, 1, S("12345"), 2, 3, S("a345cdefghij"));
2632 test(S("abcdefghij"), 1, 1, S("12345"), 2, 4, S("a345cdefghij"));
2633 test(S("abcdefghij"), 1, 1, S("12345"), 4, 0, S("acdefghij"));
2634 test(S("abcdefghij"), 1, 1, S("12345"), 4, 1, S("a5cdefghij"));
2635 test(S("abcdefghij"), 1, 1, S("12345"), 4, 2, S("a5cdefghij"));
2636 test(S("abcdefghij"), 1, 1, S("12345"), 5, 0, S("acdefghij"));
2637 test(S("abcdefghij"), 1, 1, S("12345"), 5, 1, S("acdefghij"));
2638 test(S("abcdefghij"), 1, 1, S("12345"), 6, 0, S("can't happen"));
2639 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 0, S("acdefghij"));
2640 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 1, S("a1cdefghij"));
2641 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 5, S("a12345cdefghij"));
2642 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 9, S("a123456789cdefghij"));
2643 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 10, S("a1234567890cdefghij"));
2644 test(S("abcdefghij"), 1, 1, S("1234567890"), 0, 11, S("a1234567890cdefghij"));
2645 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 0, S("acdefghij"));
2646 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 1, S("a2cdefghij"));
2647 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 4, S("a2345cdefghij"));
2648 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 8, S("a23456789cdefghij"));
2649 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 9, S("a234567890cdefghij"));
2650 test(S("abcdefghij"), 1, 1, S("1234567890"), 1, 10, S("a234567890cdefghij"));
2651 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 0, S("acdefghij"));
2652 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 1, S("a6cdefghij"));
2653 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 2, S("a67cdefghij"));
2654 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 4, S("a6789cdefghij"));
2655 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 5, S("a67890cdefghij"));
2656 test(S("abcdefghij"), 1, 1, S("1234567890"), 5, 6, S("a67890cdefghij"));
2657 test(S("abcdefghij"), 1, 1, S("1234567890"), 9, 0, S("acdefghij"));
2658 test(S("abcdefghij"), 1, 1, S("1234567890"), 9, 1, S("a0cdefghij"));
2659 test(S("abcdefghij"), 1, 1, S("1234567890"), 9, 2, S("a0cdefghij"));
2660 test(S("abcdefghij"), 1, 1, S("1234567890"), 10, 0, S("acdefghij"));
2661 test(S("abcdefghij"), 1, 1, S("1234567890"), 10, 1, S("acdefghij"));
2662 test(S("abcdefghij"), 1, 1, S("1234567890"), 11, 0, S("can't happen"));
2663 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 0, S("acdefghij"));
2664 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 1, S("a1cdefghij"));
2665 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 10, S("a1234567890cdefghij"));
2666 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghij"));
2667 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghij"));
2668 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij"));
2669 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 0, S("acdefghij"));
2670 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghij"));
2676 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghij"));
2677 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij"));
2678 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghij"));
2679 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghij"));
2680 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 0, S("acdefghij"));
2681 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 1, S("a1cdefghij"));
2682 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 5, S("a12345cdefghij"));
2683 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 9, S("a123456789cdefghij"));
2684 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 10, S("a1234567890cdefghij"));
2685 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 10, 11, S("a1234567890cdefghij"));
2686 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 19, 0, S("acdefghij"));
2687 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 19, 1, S("a0cdefghij"));
2688 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 19, 2, S("a0cdefghij"));
2689 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 20, 0, S("acdefghij"));
2690 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 20, 1, S("acdefghij"));
2691 test(S("abcdefghij"), 1, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
2692 test(S("abcdefghij"), 1, 4, S(""), 0, 0, S("afghij"));
2693 test(S("abcdefghij"), 1, 4, S(""), 0, 1, S("afghij"));
2694 test(S("abcdefghij"), 1, 4, S(""), 1, 0, S("can't happen"));
2695 test(S("abcdefghij"), 1, 4, S("12345"), 0, 0, S("afghij"));
2696 test(S("abcdefghij"), 1, 4, S("12345"), 0, 1, S("a1fghij"));
2697 test(S("abcdefghij"), 1, 4, S("12345"), 0, 2, S("a12fghij"));
2698 test(S("abcdefghij"), 1, 4, S("12345"), 0, 4, S("a1234fghij"));
2699 test(S("abcdefghij"), 1, 4, S("12345"), 0, 5, S("a12345fghij"));
2700 test(S("abcdefghij"), 1, 4, S("12345"), 0, 6, S("a12345fghij"));
2701 test(S("abcdefghij"), 1, 4, S("12345"), 1, 0, S("afghij"));
2702 test(S("abcdefghij"), 1, 4, S("12345"), 1, 1, S("a2fghij"));
2703 test(S("abcdefghij"), 1, 4, S("12345"), 1, 2, S("a23fghij"));
2704 test(S("abcdefghij"), 1, 4, S("12345"), 1, 3, S("a234fghij"));
2705 test(S("abcdefghij"), 1, 4, S("12345"), 1, 4, S("a2345fghij"));
2706 test(S("abcdefghij"), 1, 4, S("12345"), 1, 5, S("a2345fghij"));
2707 test(S("abcdefghij"), 1, 4, S("12345"), 2, 0, S("afghij"));
2708 test(S("abcdefghij"), 1, 4, S("12345"), 2, 1, S("a3fghij"));
2709 test(S("abcdefghij"), 1, 4, S("12345"), 2, 2, S("a34fghij"));
2710 test(S("abcdefghij"), 1, 4, S("12345"), 2, 3, S("a345fghij"));
2711 test(S("abcdefghij"), 1, 4, S("12345"), 2, 4, S("a345fghij"));
2712 test(S("abcdefghij"), 1, 4, S("12345"), 4, 0, S("afghij"));
2713 test(S("abcdefghij"), 1, 4, S("12345"), 4, 1, S("a5fghij"));
2714 test(S("abcdefghij"), 1, 4, S("12345"), 4, 2, S("a5fghij"));
2715 test(S("abcdefghij"), 1, 4, S("12345"), 5, 0, S("afghij"));
2716 test(S("abcdefghij"), 1, 4, S("12345"), 5, 1, S("afghij"));
2717 test(S("abcdefghij"), 1, 4, S("12345"), 6, 0, S("can't happen"));
2718 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 0, S("afghij"));
2719 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 1, S("a1fghij"));
2720 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 5, S("a12345fghij"));
2721 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 9, S("a123456789fghij"));
2722 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 10, S("a1234567890fghij"));
2723 test(S("abcdefghij"), 1, 4, S("1234567890"), 0, 11, S("a1234567890fghij"));
2724 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 0, S("afghij"));
2725 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 1, S("a2fghij"));
2726 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 4, S("a2345fghij"));
2727 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 8, S("a23456789fghij"));
2728 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 9, S("a234567890fghij"));
2729 test(S("abcdefghij"), 1, 4, S("1234567890"), 1, 10, S("a234567890fghij"));
2730 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 0, S("afghij"));
2731 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 1, S("a6fghij"));
2732 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 2, S("a67fghij"));
2733 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 4, S("a6789fghij"));
2734 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 5, S("a67890fghij"));
2735 test(S("abcdefghij"), 1, 4, S("1234567890"), 5, 6, S("a67890fghij"));
2736 test(S("abcdefghij"), 1, 4, S("1234567890"), 9, 0, S("afghij"));
2737 test(S("abcdefghij"), 1, 4, S("1234567890"), 9, 1, S("a0fghij"));
2738 test(S("abcdefghij"), 1, 4, S("1234567890"), 9, 2, S("a0fghij"));
2739 test(S("abcdefghij"), 1, 4, S("1234567890"), 10, 0, S("afghij"));
2740 test(S("abcdefghij"), 1, 4, S("1234567890"), 10, 1, S("afghij"));
2741 test(S("abcdefghij"), 1, 4, S("1234567890"), 11, 0, S("can't happen"));
2742 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 0, S("afghij"));
2743 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 1, S("a1fghij"));
2744 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 10, S("a1234567890fghij"));
2745 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 19, S("a1234567890123456789fghij"));
2746 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 20, S("a12345678901234567890fghij"));
2747 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 0, 21, S("a12345678901234567890fghij"));
2748 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 0, S("afghij"));
2749 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 1, S("a2fghij"));
2750 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 9, S("a234567890fghij"));
2751 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 18, S("a234567890123456789fghij"));
2752 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 19, S("a2345678901234567890fghij"));
2753 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 1, 20, S("a2345678901234567890fghij"));
2754 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 0, S("afghij"));
2755 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 1, S("a1fghij"));
2756 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 5, S("a12345fghij"));
2757 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 9, S("a123456789fghij"));
2758 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 10, S("a1234567890fghij"));
2759 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 10, 11, S("a1234567890fghij"));
2760 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 19, 0, S("afghij"));
2761 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 19, 1, S("a0fghij"));
2762 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 19, 2, S("a0fghij"));
2763 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 20, 0, S("afghij"));
2764 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 20, 1, S("afghij"));
2765 test(S("abcdefghij"), 1, 4, S("12345678901234567890"), 21, 0, S("can't happen"));
2766 test(S("abcdefghij"), 1, 8, S(""), 0, 0, S("aj"));
2767 test(S("abcdefghij"), 1, 8, S(""), 0, 1, S("aj"));
2768 test(S("abcdefghij"), 1, 8, S(""), 1, 0, S("can't happen"));
2769 test(S("abcdefghij"), 1, 8, S("12345"), 0, 0, S("aj"));
2770 test(S("abcdefghij"), 1, 8, S("12345"), 0, 1, S("a1j"));
2771 test(S("abcdefghij"), 1, 8, S("12345"), 0, 2, S("a12j"));
2772 test(S("abcdefghij"), 1, 8, S("12345"), 0, 4, S("a1234j"));
2773 test(S("abcdefghij"), 1, 8, S("12345"), 0, 5, S("a12345j"));
2774 test(S("abcdefghij"), 1, 8, S("12345"), 0, 6, S("a12345j"));
2775 test(S("abcdefghij"), 1, 8, S("12345"), 1, 0, S("aj"));
2781 test(S("abcdefghij"), 1, 8, S("12345"), 1, 1, S("a2j"));
2782 test(S("abcdefghij"), 1, 8, S("12345"), 1, 2, S("a23j"));
2783 test(S("abcdefghij"), 1, 8, S("12345"), 1, 3, S("a234j"));
2784 test(S("abcdefghij"), 1, 8, S("12345"), 1, 4, S("a2345j"));
2785 test(S("abcdefghij"), 1, 8, S("12345"), 1, 5, S("a2345j"));
2786 test(S("abcdefghij"), 1, 8, S("12345"), 2, 0, S("aj"));
2787 test(S("abcdefghij"), 1, 8, S("12345"), 2, 1, S("a3j"));
2788 test(S("abcdefghij"), 1, 8, S("12345"), 2, 2, S("a34j"));
2789 test(S("abcdefghij"), 1, 8, S("12345"), 2, 3, S("a345j"));
2790 test(S("abcdefghij"), 1, 8, S("12345"), 2, 4, S("a345j"));
2791 test(S("abcdefghij"), 1, 8, S("12345"), 4, 0, S("aj"));
2792 test(S("abcdefghij"), 1, 8, S("12345"), 4, 1, S("a5j"));
2793 test(S("abcdefghij"), 1, 8, S("12345"), 4, 2, S("a5j"));
2794 test(S("abcdefghij"), 1, 8, S("12345"), 5, 0, S("aj"));
2795 test(S("abcdefghij"), 1, 8, S("12345"), 5, 1, S("aj"));
2796 test(S("abcdefghij"), 1, 8, S("12345"), 6, 0, S("can't happen"));
2797 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 0, S("aj"));
2798 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 1, S("a1j"));
2799 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 5, S("a12345j"));
2800 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 9, S("a123456789j"));
2801 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 10, S("a1234567890j"));
2802 test(S("abcdefghij"), 1, 8, S("1234567890"), 0, 11, S("a1234567890j"));
2803 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 0, S("aj"));
2804 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 1, S("a2j"));
2805 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 4, S("a2345j"));
2806 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 8, S("a23456789j"));
2807 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 9, S("a234567890j"));
2808 test(S("abcdefghij"), 1, 8, S("1234567890"), 1, 10, S("a234567890j"));
2809 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 0, S("aj"));
2810 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 1, S("a6j"));
2811 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 2, S("a67j"));
2812 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 4, S("a6789j"));
2813 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 5, S("a67890j"));
2814 test(S("abcdefghij"), 1, 8, S("1234567890"), 5, 6, S("a67890j"));
2815 test(S("abcdefghij"), 1, 8, S("1234567890"), 9, 0, S("aj"));
2816 test(S("abcdefghij"), 1, 8, S("1234567890"), 9, 1, S("a0j"));
2817 test(S("abcdefghij"), 1, 8, S("1234567890"), 9, 2, S("a0j"));
2818 test(S("abcdefghij"), 1, 8, S("1234567890"), 10, 0, S("aj"));
2819 test(S("abcdefghij"), 1, 8, S("1234567890"), 10, 1, S("aj"));
2820 test(S("abcdefghij"), 1, 8, S("1234567890"), 11, 0, S("can't happen"));
2821 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 0, S("aj"));
2822 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 1, S("a1j"));
2823 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 10, S("a1234567890j"));
2824 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 19, S("a1234567890123456789j"));
2825 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 20, S("a12345678901234567890j"));
2826 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 0, 21, S("a12345678901234567890j"));
2827 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 0, S("aj"));
2828 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 1, S("a2j"));
2829 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 9, S("a234567890j"));
2830 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 18, S("a234567890123456789j"));
2831 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 19, S("a2345678901234567890j"));
2832 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 1, 20, S("a2345678901234567890j"));
2833 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 0, S("aj"));
2834 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 1, S("a1j"));
2835 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 5, S("a12345j"));
2836 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 9, S("a123456789j"));
2837 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 10, S("a1234567890j"));
2838 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 10, 11, S("a1234567890j"));
2839 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 19, 0, S("aj"));
2840 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 19, 1, S("a0j"));
2841 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 19, 2, S("a0j"));
2842 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 20, 0, S("aj"));
2843 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 20, 1, S("aj"));
2844 test(S("abcdefghij"), 1, 8, S("12345678901234567890"), 21, 0, S("can't happen"));
2845 test(S("abcdefghij"), 1, 9, S(""), 0, 0, S("a"));
2846 test(S("abcdefghij"), 1, 9, S(""), 0, 1, S("a"));
2847 test(S("abcdefghij"), 1, 9, S(""), 1, 0, S("can't happen"));
2848 test(S("abcdefghij"), 1, 9, S("12345"), 0, 0, S("a"));
2849 test(S("abcdefghij"), 1, 9, S("12345"), 0, 1, S("a1"));
2850 test(S("abcdefghij"), 1, 9, S("12345"), 0, 2, S("a12"));
2851 test(S("abcdefghij"), 1, 9, S("12345"), 0, 4, S("a1234"));
2852 test(S("abcdefghij"), 1, 9, S("12345"), 0, 5, S("a12345"));
2853 test(S("abcdefghij"), 1, 9, S("12345"), 0, 6, S("a12345"));
2854 test(S("abcdefghij"), 1, 9, S("12345"), 1, 0, S("a"));
2855 test(S("abcdefghij"), 1, 9, S("12345"), 1, 1, S("a2"));
2856 test(S("abcdefghij"), 1, 9, S("12345"), 1, 2, S("a23"));
2857 test(S("abcdefghij"), 1, 9, S("12345"), 1, 3, S("a234"));
2858 test(S("abcdefghij"), 1, 9, S("12345"), 1, 4, S("a2345"));
2859 test(S("abcdefghij"), 1, 9, S("12345"), 1, 5, S("a2345"));
2860 test(S("abcdefghij"), 1, 9, S("12345"), 2, 0, S("a"));
2861 test(S("abcdefghij"), 1, 9, S("12345"), 2, 1, S("a3"));
2862 test(S("abcdefghij"), 1, 9, S("12345"), 2, 2, S("a34"));
2863 test(S("abcdefghij"), 1, 9, S("12345"), 2, 3, S("a345"));
2864 test(S("abcdefghij"), 1, 9, S("12345"), 2, 4, S("a345"));
2865 test(S("abcdefghij"), 1, 9, S("12345"), 4, 0, S("a"));
2866 test(S("abcdefghij"), 1, 9, S("12345"), 4, 1, S("a5"));
2867 test(S("abcdefghij"), 1, 9, S("12345"), 4, 2, S("a5"));
2868 test(S("abcdefghij"), 1, 9, S("12345"), 5, 0, S("a"));
2869 test(S("abcdefghij"), 1, 9, S("12345"), 5, 1, S("a"));
2870 test(S("abcdefghij"), 1, 9, S("12345"), 6, 0, S("can't happen"));
2871 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 0, S("a"));
2872 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 1, S("a1"));
2873 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 5, S("a12345"));
2874 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 9, S("a123456789"));
2875 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 10, S("a1234567890"));
2876 test(S("abcdefghij"), 1, 9, S("1234567890"), 0, 11, S("a1234567890"));
2877 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 0, S("a"));
2878 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 1, S("a2"));
2879 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 4, S("a2345"));
2880 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 8, S("a23456789"));
2886 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 9, S("a234567890"));
2887 test(S("abcdefghij"), 1, 9, S("1234567890"), 1, 10, S("a234567890"));
2888 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 0, S("a"));
2889 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 1, S("a6"));
2890 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 2, S("a67"));
2891 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 4, S("a6789"));
2892 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 5, S("a67890"));
2893 test(S("abcdefghij"), 1, 9, S("1234567890"), 5, 6, S("a67890"));
2894 test(S("abcdefghij"), 1, 9, S("1234567890"), 9, 0, S("a"));
2895 test(S("abcdefghij"), 1, 9, S("1234567890"), 9, 1, S("a0"));
2896 test(S("abcdefghij"), 1, 9, S("1234567890"), 9, 2, S("a0"));
2897 test(S("abcdefghij"), 1, 9, S("1234567890"), 10, 0, S("a"));
2898 test(S("abcdefghij"), 1, 9, S("1234567890"), 10, 1, S("a"));
2899 test(S("abcdefghij"), 1, 9, S("1234567890"), 11, 0, S("can't happen"));
2900 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 0, S("a"));
2901 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 1, S("a1"));
2902 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 10, S("a1234567890"));
2903 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
2904 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
2905 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
2906 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 0, S("a"));
2907 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 1, S("a2"));
2908 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 9, S("a234567890"));
2909 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
2910 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
2911 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
2912 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 0, S("a"));
2913 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 1, S("a1"));
2914 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 5, S("a12345"));
2915 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 9, S("a123456789"));
2916 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 10, S("a1234567890"));
2917 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 10, 11, S("a1234567890"));
2918 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 19, 0, S("a"));
2919 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 19, 1, S("a0"));
2920 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 19, 2, S("a0"));
2921 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 20, 0, S("a"));
2922 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 20, 1, S("a"));
2923 test(S("abcdefghij"), 1, 9, S("12345678901234567890"), 21, 0, S("can't happen"));
2924 test(S("abcdefghij"), 1, 10, S(""), 0, 0, S("a"));
2925 test(S("abcdefghij"), 1, 10, S(""), 0, 1, S("a"));
2926 test(S("abcdefghij"), 1, 10, S(""), 1, 0, S("can't happen"));
2927 test(S("abcdefghij"), 1, 10, S("12345"), 0, 0, S("a"));
2928 test(S("abcdefghij"), 1, 10, S("12345"), 0, 1, S("a1"));
2929 test(S("abcdefghij"), 1, 10, S("12345"), 0, 2, S("a12"));
2930 test(S("abcdefghij"), 1, 10, S("12345"), 0, 4, S("a1234"));
2931 test(S("abcdefghij"), 1, 10, S("12345"), 0, 5, S("a12345"));
2932 test(S("abcdefghij"), 1, 10, S("12345"), 0, 6, S("a12345"));
2933 test(S("abcdefghij"), 1, 10, S("12345"), 1, 0, S("a"));
2934 test(S("abcdefghij"), 1, 10, S("12345"), 1, 1, S("a2"));
2935 test(S("abcdefghij"), 1, 10, S("12345"), 1, 2, S("a23"));
2936 test(S("abcdefghij"), 1, 10, S("12345"), 1, 3, S("a234"));
2937 test(S("abcdefghij"), 1, 10, S("12345"), 1, 4, S("a2345"));
2938 test(S("abcdefghij"), 1, 10, S("12345"), 1, 5, S("a2345"));
2939 test(S("abcdefghij"), 1, 10, S("12345"), 2, 0, S("a"));
2940 test(S("abcdefghij"), 1, 10, S("12345"), 2, 1, S("a3"));
2941 test(S("abcdefghij"), 1, 10, S("12345"), 2, 2, S("a34"));
2942 test(S("abcdefghij"), 1, 10, S("12345"), 2, 3, S("a345"));
2943 test(S("abcdefghij"), 1, 10, S("12345"), 2, 4, S("a345"));
2944 test(S("abcdefghij"), 1, 10, S("12345"), 4, 0, S("a"));
2945 test(S("abcdefghij"), 1, 10, S("12345"), 4, 1, S("a5"));
2946 test(S("abcdefghij"), 1, 10, S("12345"), 4, 2, S("a5"));
2947 test(S("abcdefghij"), 1, 10, S("12345"), 5, 0, S("a"));
2948 test(S("abcdefghij"), 1, 10, S("12345"), 5, 1, S("a"));
2949 test(S("abcdefghij"), 1, 10, S("12345"), 6, 0, S("can't happen"));
2950 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 0, S("a"));
2951 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 1, S("a1"));
2952 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 5, S("a12345"));
2953 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 9, S("a123456789"));
2954 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 10, S("a1234567890"));
2955 test(S("abcdefghij"), 1, 10, S("1234567890"), 0, 11, S("a1234567890"));
2956 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 0, S("a"));
2957 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 1, S("a2"));
2958 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 4, S("a2345"));
2959 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 8, S("a23456789"));
2960 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 9, S("a234567890"));
2961 test(S("abcdefghij"), 1, 10, S("1234567890"), 1, 10, S("a234567890"));
2962 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 0, S("a"));
2963 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 1, S("a6"));
2964 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 2, S("a67"));
2965 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 4, S("a6789"));
2966 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 5, S("a67890"));
2967 test(S("abcdefghij"), 1, 10, S("1234567890"), 5, 6, S("a67890"));
2968 test(S("abcdefghij"), 1, 10, S("1234567890"), 9, 0, S("a"));
2969 test(S("abcdefghij"), 1, 10, S("1234567890"), 9, 1, S("a0"));
2970 test(S("abcdefghij"), 1, 10, S("1234567890"), 9, 2, S("a0"));
2971 test(S("abcdefghij"), 1, 10, S("1234567890"), 10, 0, S("a"));
2972 test(S("abcdefghij"), 1, 10, S("1234567890"), 10, 1, S("a"));
2973 test(S("abcdefghij"), 1, 10, S("1234567890"), 11, 0, S("can't happen"));
2974 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 0, S("a"));
2975 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 1, S("a1"));
2976 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 10, S("a1234567890"));
2977 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
2978 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
2979 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
2980 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 0, S("a"));
2981 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 1, S("a2"));
2982 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 9, S("a234567890"));
2983 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
2984 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
2985 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
2991 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 0, S("a"));
2992 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 1, S("a1"));
2993 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 5, S("a12345"));
2994 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 9, S("a123456789"));
2995 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 10, S("a1234567890"));
2996 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 10, 11, S("a1234567890"));
2997 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 19, 0, S("a"));
2998 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 19, 1, S("a0"));
2999 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 19, 2, S("a0"));
3000 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 20, 0, S("a"));
3001 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 20, 1, S("a"));
3002 test(S("abcdefghij"), 1, 10, S("12345678901234567890"), 21, 0, S("can't happen"));
3003 test(S("abcdefghij"), 5, 0, S(""), 0, 0, S("abcdefghij"));
3004 test(S("abcdefghij"), 5, 0, S(""), 0, 1, S("abcdefghij"));
3005 test(S("abcdefghij"), 5, 0, S(""), 1, 0, S("can't happen"));
3006 test(S("abcdefghij"), 5, 0, S("12345"), 0, 0, S("abcdefghij"));
3007 test(S("abcdefghij"), 5, 0, S("12345"), 0, 1, S("abcde1fghij"));
3008 test(S("abcdefghij"), 5, 0, S("12345"), 0, 2, S("abcde12fghij"));
3009 test(S("abcdefghij"), 5, 0, S("12345"), 0, 4, S("abcde1234fghij"));
3010 test(S("abcdefghij"), 5, 0, S("12345"), 0, 5, S("abcde12345fghij"));
3011 test(S("abcdefghij"), 5, 0, S("12345"), 0, 6, S("abcde12345fghij"));
3012 test(S("abcdefghij"), 5, 0, S("12345"), 1, 0, S("abcdefghij"));
3013 test(S("abcdefghij"), 5, 0, S("12345"), 1, 1, S("abcde2fghij"));
3014 test(S("abcdefghij"), 5, 0, S("12345"), 1, 2, S("abcde23fghij"));
3015 test(S("abcdefghij"), 5, 0, S("12345"), 1, 3, S("abcde234fghij"));
3016 test(S("abcdefghij"), 5, 0, S("12345"), 1, 4, S("abcde2345fghij"));
3017 test(S("abcdefghij"), 5, 0, S("12345"), 1, 5, S("abcde2345fghij"));
3018 test(S("abcdefghij"), 5, 0, S("12345"), 2, 0, S("abcdefghij"));
3019 test(S("abcdefghij"), 5, 0, S("12345"), 2, 1, S("abcde3fghij"));
3020 test(S("abcdefghij"), 5, 0, S("12345"), 2, 2, S("abcde34fghij"));
3021 test(S("abcdefghij"), 5, 0, S("12345"), 2, 3, S("abcde345fghij"));
3022 test(S("abcdefghij"), 5, 0, S("12345"), 2, 4, S("abcde345fghij"));
3023 test(S("abcdefghij"), 5, 0, S("12345"), 4, 0, S("abcdefghij"));
3024 test(S("abcdefghij"), 5, 0, S("12345"), 4, 1, S("abcde5fghij"));
3025 test(S("abcdefghij"), 5, 0, S("12345"), 4, 2, S("abcde5fghij"));
3026 test(S("abcdefghij"), 5, 0, S("12345"), 5, 0, S("abcdefghij"));
3027 test(S("abcdefghij"), 5, 0, S("12345"), 5, 1, S("abcdefghij"));
3028 test(S("abcdefghij"), 5, 0, S("12345"), 6, 0, S("can't happen"));
3029 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 0, S("abcdefghij"));
3030 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 1, S("abcde1fghij"));
3031 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 5, S("abcde12345fghij"));
3032 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 9, S("abcde123456789fghij"));
3033 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 10, S("abcde1234567890fghij"));
3034 test(S("abcdefghij"), 5, 0, S("1234567890"), 0, 11, S("abcde1234567890fghij"));
3035 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 0, S("abcdefghij"));
3036 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 1, S("abcde2fghij"));
3037 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 4, S("abcde2345fghij"));
3038 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 8, S("abcde23456789fghij"));
3039 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 9, S("abcde234567890fghij"));
3040 test(S("abcdefghij"), 5, 0, S("1234567890"), 1, 10, S("abcde234567890fghij"));
3041 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 0, S("abcdefghij"));
3042 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 1, S("abcde6fghij"));
3043 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 2, S("abcde67fghij"));
3044 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 4, S("abcde6789fghij"));
3045 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 5, S("abcde67890fghij"));
3046 test(S("abcdefghij"), 5, 0, S("1234567890"), 5, 6, S("abcde67890fghij"));
3047 test(S("abcdefghij"), 5, 0, S("1234567890"), 9, 0, S("abcdefghij"));
3048 test(S("abcdefghij"), 5, 0, S("1234567890"), 9, 1, S("abcde0fghij"));
3049 test(S("abcdefghij"), 5, 0, S("1234567890"), 9, 2, S("abcde0fghij"));
3050 test(S("abcdefghij"), 5, 0, S("1234567890"), 10, 0, S("abcdefghij"));
3051 test(S("abcdefghij"), 5, 0, S("1234567890"), 10, 1, S("abcdefghij"));
3052 test(S("abcdefghij"), 5, 0, S("1234567890"), 11, 0, S("can't happen"));
3053 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 0, S("abcdefghij"));
3054 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 1, S("abcde1fghij"));
3055 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 10, S("abcde1234567890fghij"));
3056 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789fghij"));
3057 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890fghij"));
3058 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890fghij"));
3059 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
3060 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 1, S("abcde2fghij"));
3061 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
3062 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
3063 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
3064 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
3065 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 0, S("abcdefghij"));
3066 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 1, S("abcde1fghij"));
3067 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 5, S("abcde12345fghij"));
3068 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 9, S("abcde123456789fghij"));
3069 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 10, S("abcde1234567890fghij"));
3070 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 10, 11, S("abcde1234567890fghij"));
3071 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 19, 0, S("abcdefghij"));
3072 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 19, 1, S("abcde0fghij"));
3073 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 19, 2, S("abcde0fghij"));
3074 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 20, 0, S("abcdefghij"));
3075 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 20, 1, S("abcdefghij"));
3076 test(S("abcdefghij"), 5, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
3077 test(S("abcdefghij"), 5, 1, S(""), 0, 0, S("abcdeghij"));
3078 test(S("abcdefghij"), 5, 1, S(""), 0, 1, S("abcdeghij"));
3079 test(S("abcdefghij"), 5, 1, S(""), 1, 0, S("can't happen"));
3080 test(S("abcdefghij"), 5, 1, S("12345"), 0, 0, S("abcdeghij"));
3081 test(S("abcdefghij"), 5, 1, S("12345"), 0, 1, S("abcde1ghij"));
3082 test(S("abcdefghij"), 5, 1, S("12345"), 0, 2, S("abcde12ghij"));
3083 test(S("abcdefghij"), 5, 1, S("12345"), 0, 4, S("abcde1234ghij"));
3084 test(S("abcdefghij"), 5, 1, S("12345"), 0, 5, S("abcde12345ghij"));
3085 test(S("abcdefghij"), 5, 1, S("12345"), 0, 6, S("abcde12345ghij"));
3086 test(S("abcdefghij"), 5, 1, S("12345"), 1, 0, S("abcdeghij"));
3087 test(S("abcdefghij"), 5, 1, S("12345"), 1, 1, S("abcde2ghij"));
3088 test(S("abcdefghij"), 5, 1, S("12345"), 1, 2, S("abcde23ghij"));
3089 test(S("abcdefghij"), 5, 1, S("12345"), 1, 3, S("abcde234ghij"));
3090 test(S("abcdefghij"), 5, 1, S("12345"), 1, 4, S("abcde2345ghij"));
3096 test(S("abcdefghij"), 5, 1, S("12345"), 1, 5, S("abcde2345ghij"));
3097 test(S("abcdefghij"), 5, 1, S("12345"), 2, 0, S("abcdeghij"));
3098 test(S("abcdefghij"), 5, 1, S("12345"), 2, 1, S("abcde3ghij"));
3099 test(S("abcdefghij"), 5, 1, S("12345"), 2, 2, S("abcde34ghij"));
3100 test(S("abcdefghij"), 5, 1, S("12345"), 2, 3, S("abcde345ghij"));
3101 test(S("abcdefghij"), 5, 1, S("12345"), 2, 4, S("abcde345ghij"));
3102 test(S("abcdefghij"), 5, 1, S("12345"), 4, 0, S("abcdeghij"));
3103 test(S("abcdefghij"), 5, 1, S("12345"), 4, 1, S("abcde5ghij"));
3104 test(S("abcdefghij"), 5, 1, S("12345"), 4, 2, S("abcde5ghij"));
3105 test(S("abcdefghij"), 5, 1, S("12345"), 5, 0, S("abcdeghij"));
3106 test(S("abcdefghij"), 5, 1, S("12345"), 5, 1, S("abcdeghij"));
3107 test(S("abcdefghij"), 5, 1, S("12345"), 6, 0, S("can't happen"));
3108 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 0, S("abcdeghij"));
3109 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 1, S("abcde1ghij"));
3110 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 5, S("abcde12345ghij"));
3111 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 9, S("abcde123456789ghij"));
3112 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 10, S("abcde1234567890ghij"));
3113 test(S("abcdefghij"), 5, 1, S("1234567890"), 0, 11, S("abcde1234567890ghij"));
3114 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 0, S("abcdeghij"));
3115 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 1, S("abcde2ghij"));
3116 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 4, S("abcde2345ghij"));
3117 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 8, S("abcde23456789ghij"));
3118 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 9, S("abcde234567890ghij"));
3119 test(S("abcdefghij"), 5, 1, S("1234567890"), 1, 10, S("abcde234567890ghij"));
3120 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 0, S("abcdeghij"));
3121 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 1, S("abcde6ghij"));
3122 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 2, S("abcde67ghij"));
3123 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 4, S("abcde6789ghij"));
3124 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 5, S("abcde67890ghij"));
3125 test(S("abcdefghij"), 5, 1, S("1234567890"), 5, 6, S("abcde67890ghij"));
3126 test(S("abcdefghij"), 5, 1, S("1234567890"), 9, 0, S("abcdeghij"));
3127 test(S("abcdefghij"), 5, 1, S("1234567890"), 9, 1, S("abcde0ghij"));
3128 test(S("abcdefghij"), 5, 1, S("1234567890"), 9, 2, S("abcde0ghij"));
3129 test(S("abcdefghij"), 5, 1, S("1234567890"), 10, 0, S("abcdeghij"));
3130 test(S("abcdefghij"), 5, 1, S("1234567890"), 10, 1, S("abcdeghij"));
3131 test(S("abcdefghij"), 5, 1, S("1234567890"), 11, 0, S("can't happen"));
3132 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 0, S("abcdeghij"));
3133 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 1, S("abcde1ghij"));
3134 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 10, S("abcde1234567890ghij"));
3135 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789ghij"));
3136 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890ghij"));
3137 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890ghij"));
3138 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 0, S("abcdeghij"));
3139 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 1, S("abcde2ghij"));
3140 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 9, S("abcde234567890ghij"));
3141 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 18, S("abcde234567890123456789ghij"));
3142 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890ghij"));
3143 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890ghij"));
3144 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 0, S("abcdeghij"));
3145 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 1, S("abcde1ghij"));
3146 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 5, S("abcde12345ghij"));
3147 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 9, S("abcde123456789ghij"));
3148 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 10, S("abcde1234567890ghij"));
3149 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 10, 11, S("abcde1234567890ghij"));
3150 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 19, 0, S("abcdeghij"));
3151 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 19, 1, S("abcde0ghij"));
3152 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 19, 2, S("abcde0ghij"));
3153 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 20, 0, S("abcdeghij"));
3154 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 20, 1, S("abcdeghij"));
3155 test(S("abcdefghij"), 5, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
3156 test(S("abcdefghij"), 5, 2, S(""), 0, 0, S("abcdehij"));
3157 test(S("abcdefghij"), 5, 2, S(""), 0, 1, S("abcdehij"));
3158 test(S("abcdefghij"), 5, 2, S(""), 1, 0, S("can't happen"));
3159 test(S("abcdefghij"), 5, 2, S("12345"), 0, 0, S("abcdehij"));
3160 test(S("abcdefghij"), 5, 2, S("12345"), 0, 1, S("abcde1hij"));
3161 test(S("abcdefghij"), 5, 2, S("12345"), 0, 2, S("abcde12hij"));
3162 test(S("abcdefghij"), 5, 2, S("12345"), 0, 4, S("abcde1234hij"));
3163 test(S("abcdefghij"), 5, 2, S("12345"), 0, 5, S("abcde12345hij"));
3164 test(S("abcdefghij"), 5, 2, S("12345"), 0, 6, S("abcde12345hij"));
3165 test(S("abcdefghij"), 5, 2, S("12345"), 1, 0, S("abcdehij"));
3166 test(S("abcdefghij"), 5, 2, S("12345"), 1, 1, S("abcde2hij"));
3167 test(S("abcdefghij"), 5, 2, S("12345"), 1, 2, S("abcde23hij"));
3168 test(S("abcdefghij"), 5, 2, S("12345"), 1, 3, S("abcde234hij"));
3169 test(S("abcdefghij"), 5, 2, S("12345"), 1, 4, S("abcde2345hij"));
3170 test(S("abcdefghij"), 5, 2, S("12345"), 1, 5, S("abcde2345hij"));
3171 test(S("abcdefghij"), 5, 2, S("12345"), 2, 0, S("abcdehij"));
3172 test(S("abcdefghij"), 5, 2, S("12345"), 2, 1, S("abcde3hij"));
3173 test(S("abcdefghij"), 5, 2, S("12345"), 2, 2, S("abcde34hij"));
3174 test(S("abcdefghij"), 5, 2, S("12345"), 2, 3, S("abcde345hij"));
3175 test(S("abcdefghij"), 5, 2, S("12345"), 2, 4, S("abcde345hij"));
3176 test(S("abcdefghij"), 5, 2, S("12345"), 4, 0, S("abcdehij"));
3177 test(S("abcdefghij"), 5, 2, S("12345"), 4, 1, S("abcde5hij"));
3178 test(S("abcdefghij"), 5, 2, S("12345"), 4, 2, S("abcde5hij"));
3179 test(S("abcdefghij"), 5, 2, S("12345"), 5, 0, S("abcdehij"));
3180 test(S("abcdefghij"), 5, 2, S("12345"), 5, 1, S("abcdehij"));
3181 test(S("abcdefghij"), 5, 2, S("12345"), 6, 0, S("can't happen"));
3182 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 0, S("abcdehij"));
3183 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 1, S("abcde1hij"));
3184 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 5, S("abcde12345hij"));
3185 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 9, S("abcde123456789hij"));
3186 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 10, S("abcde1234567890hij"));
3187 test(S("abcdefghij"), 5, 2, S("1234567890"), 0, 11, S("abcde1234567890hij"));
3188 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 0, S("abcdehij"));
3189 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 1, S("abcde2hij"));
3190 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 4, S("abcde2345hij"));
3191 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 8, S("abcde23456789hij"));
3192 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 9, S("abcde234567890hij"));
3193 test(S("abcdefghij"), 5, 2, S("1234567890"), 1, 10, S("abcde234567890hij"));
3194 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 0, S("abcdehij"));
3195 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 1, S("abcde6hij"));
3201 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 2, S("abcde67hij"));
3202 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 4, S("abcde6789hij"));
3203 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 5, S("abcde67890hij"));
3204 test(S("abcdefghij"), 5, 2, S("1234567890"), 5, 6, S("abcde67890hij"));
3205 test(S("abcdefghij"), 5, 2, S("1234567890"), 9, 0, S("abcdehij"));
3206 test(S("abcdefghij"), 5, 2, S("1234567890"), 9, 1, S("abcde0hij"));
3207 test(S("abcdefghij"), 5, 2, S("1234567890"), 9, 2, S("abcde0hij"));
3208 test(S("abcdefghij"), 5, 2, S("1234567890"), 10, 0, S("abcdehij"));
3209 test(S("abcdefghij"), 5, 2, S("1234567890"), 10, 1, S("abcdehij"));
3210 test(S("abcdefghij"), 5, 2, S("1234567890"), 11, 0, S("can't happen"));
3211 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 0, S("abcdehij"));
3212 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 1, S("abcde1hij"));
3213 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 10, S("abcde1234567890hij"));
3214 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789hij"));
3215 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890hij"));
3216 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890hij"));
3217 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 0, S("abcdehij"));
3218 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 1, S("abcde2hij"));
3219 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 9, S("abcde234567890hij"));
3220 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 18, S("abcde234567890123456789hij"));
3221 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890hij"));
3222 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890hij"));
3223 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 0, S("abcdehij"));
3224 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 1, S("abcde1hij"));
3225 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 5, S("abcde12345hij"));
3226 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 9, S("abcde123456789hij"));
3227 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 10, S("abcde1234567890hij"));
3228 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 10, 11, S("abcde1234567890hij"));
3229 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 19, 0, S("abcdehij"));
3230 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 19, 1, S("abcde0hij"));
3231 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 19, 2, S("abcde0hij"));
3232 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 20, 0, S("abcdehij"));
3233 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 20, 1, S("abcdehij"));
3234 test(S("abcdefghij"), 5, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
3235 test(S("abcdefghij"), 5, 4, S(""), 0, 0, S("abcdej"));
3236 test(S("abcdefghij"), 5, 4, S(""), 0, 1, S("abcdej"));
3237 test(S("abcdefghij"), 5, 4, S(""), 1, 0, S("can't happen"));
3238 test(S("abcdefghij"), 5, 4, S("12345"), 0, 0, S("abcdej"));
3239 test(S("abcdefghij"), 5, 4, S("12345"), 0, 1, S("abcde1j"));
3240 test(S("abcdefghij"), 5, 4, S("12345"), 0, 2, S("abcde12j"));
3241 test(S("abcdefghij"), 5, 4, S("12345"), 0, 4, S("abcde1234j"));
3242 test(S("abcdefghij"), 5, 4, S("12345"), 0, 5, S("abcde12345j"));
3243 test(S("abcdefghij"), 5, 4, S("12345"), 0, 6, S("abcde12345j"));
3244 test(S("abcdefghij"), 5, 4, S("12345"), 1, 0, S("abcdej"));
3245 test(S("abcdefghij"), 5, 4, S("12345"), 1, 1, S("abcde2j"));
3246 test(S("abcdefghij"), 5, 4, S("12345"), 1, 2, S("abcde23j"));
3247 test(S("abcdefghij"), 5, 4, S("12345"), 1, 3, S("abcde234j"));
3248 test(S("abcdefghij"), 5, 4, S("12345"), 1, 4, S("abcde2345j"));
3249 test(S("abcdefghij"), 5, 4, S("12345"), 1, 5, S("abcde2345j"));
3250 test(S("abcdefghij"), 5, 4, S("12345"), 2, 0, S("abcdej"));
3251 test(S("abcdefghij"), 5, 4, S("12345"), 2, 1, S("abcde3j"));
3252 test(S("abcdefghij"), 5, 4, S("12345"), 2, 2, S("abcde34j"));
3253 test(S("abcdefghij"), 5, 4, S("12345"), 2, 3, S("abcde345j"));
3254 test(S("abcdefghij"), 5, 4, S("12345"), 2, 4, S("abcde345j"));
3255 test(S("abcdefghij"), 5, 4, S("12345"), 4, 0, S("abcdej"));
3256 test(S("abcdefghij"), 5, 4, S("12345"), 4, 1, S("abcde5j"));
3257 test(S("abcdefghij"), 5, 4, S("12345"), 4, 2, S("abcde5j"));
3258 test(S("abcdefghij"), 5, 4, S("12345"), 5, 0, S("abcdej"));
3259 test(S("abcdefghij"), 5, 4, S("12345"), 5, 1, S("abcdej"));
3260 test(S("abcdefghij"), 5, 4, S("12345"), 6, 0, S("can't happen"));
3261 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 0, S("abcdej"));
3262 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 1, S("abcde1j"));
3263 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 5, S("abcde12345j"));
3264 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 9, S("abcde123456789j"));
3265 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 10, S("abcde1234567890j"));
3266 test(S("abcdefghij"), 5, 4, S("1234567890"), 0, 11, S("abcde1234567890j"));
3267 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 0, S("abcdej"));
3268 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 1, S("abcde2j"));
3269 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 4, S("abcde2345j"));
3270 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 8, S("abcde23456789j"));
3271 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 9, S("abcde234567890j"));
3272 test(S("abcdefghij"), 5, 4, S("1234567890"), 1, 10, S("abcde234567890j"));
3273 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 0, S("abcdej"));
3274 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 1, S("abcde6j"));
3275 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 2, S("abcde67j"));
3276 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 4, S("abcde6789j"));
3277 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 5, S("abcde67890j"));
3278 test(S("abcdefghij"), 5, 4, S("1234567890"), 5, 6, S("abcde67890j"));
3279 test(S("abcdefghij"), 5, 4, S("1234567890"), 9, 0, S("abcdej"));
3280 test(S("abcdefghij"), 5, 4, S("1234567890"), 9, 1, S("abcde0j"));
3281 test(S("abcdefghij"), 5, 4, S("1234567890"), 9, 2, S("abcde0j"));
3282 test(S("abcdefghij"), 5, 4, S("1234567890"), 10, 0, S("abcdej"));
3283 test(S("abcdefghij"), 5, 4, S("1234567890"), 10, 1, S("abcdej"));
3284 test(S("abcdefghij"), 5, 4, S("1234567890"), 11, 0, S("can't happen"));
3285 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 0, S("abcdej"));
3286 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 1, S("abcde1j"));
3287 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 10, S("abcde1234567890j"));
3288 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789j"));
3289 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890j"));
3290 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890j"));
3291 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 0, S("abcdej"));
3292 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 1, S("abcde2j"));
3293 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 9, S("abcde234567890j"));
3294 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 18, S("abcde234567890123456789j"));
3295 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890j"));
3296 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890j"));
3297 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 0, S("abcdej"));
3298 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 1, S("abcde1j"));
3299 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 5, S("abcde12345j"));
3300 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 9, S("abcde123456789j"));
3306 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 10, S("abcde1234567890j"));
3307 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 10, 11, S("abcde1234567890j"));
3308 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 19, 0, S("abcdej"));
3309 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 19, 1, S("abcde0j"));
3310 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 19, 2, S("abcde0j"));
3311 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 20, 0, S("abcdej"));
3312 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 20, 1, S("abcdej"));
3313 test(S("abcdefghij"), 5, 4, S("12345678901234567890"), 21, 0, S("can't happen"));
3314 test(S("abcdefghij"), 5, 5, S(""), 0, 0, S("abcde"));
3315 test(S("abcdefghij"), 5, 5, S(""), 0, 1, S("abcde"));
3316 test(S("abcdefghij"), 5, 5, S(""), 1, 0, S("can't happen"));
3317 test(S("abcdefghij"), 5, 5, S("12345"), 0, 0, S("abcde"));
3318 test(S("abcdefghij"), 5, 5, S("12345"), 0, 1, S("abcde1"));
3319 test(S("abcdefghij"), 5, 5, S("12345"), 0, 2, S("abcde12"));
3320 test(S("abcdefghij"), 5, 5, S("12345"), 0, 4, S("abcde1234"));
3321 test(S("abcdefghij"), 5, 5, S("12345"), 0, 5, S("abcde12345"));
3322 test(S("abcdefghij"), 5, 5, S("12345"), 0, 6, S("abcde12345"));
3323 test(S("abcdefghij"), 5, 5, S("12345"), 1, 0, S("abcde"));
3324 test(S("abcdefghij"), 5, 5, S("12345"), 1, 1, S("abcde2"));
3325 test(S("abcdefghij"), 5, 5, S("12345"), 1, 2, S("abcde23"));
3326 test(S("abcdefghij"), 5, 5, S("12345"), 1, 3, S("abcde234"));
3327 test(S("abcdefghij"), 5, 5, S("12345"), 1, 4, S("abcde2345"));
3328 test(S("abcdefghij"), 5, 5, S("12345"), 1, 5, S("abcde2345"));
3329 test(S("abcdefghij"), 5, 5, S("12345"), 2, 0, S("abcde"));
3330 test(S("abcdefghij"), 5, 5, S("12345"), 2, 1, S("abcde3"));
3331 test(S("abcdefghij"), 5, 5, S("12345"), 2, 2, S("abcde34"));
3332 test(S("abcdefghij"), 5, 5, S("12345"), 2, 3, S("abcde345"));
3333 test(S("abcdefghij"), 5, 5, S("12345"), 2, 4, S("abcde345"));
3334 test(S("abcdefghij"), 5, 5, S("12345"), 4, 0, S("abcde"));
3335 test(S("abcdefghij"), 5, 5, S("12345"), 4, 1, S("abcde5"));
3336 test(S("abcdefghij"), 5, 5, S("12345"), 4, 2, S("abcde5"));
3337 test(S("abcdefghij"), 5, 5, S("12345"), 5, 0, S("abcde"));
3338 test(S("abcdefghij"), 5, 5, S("12345"), 5, 1, S("abcde"));
3339 test(S("abcdefghij"), 5, 5, S("12345"), 6, 0, S("can't happen"));
3340 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 0, S("abcde"));
3341 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 1, S("abcde1"));
3342 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 5, S("abcde12345"));
3343 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 9, S("abcde123456789"));
3344 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 10, S("abcde1234567890"));
3345 test(S("abcdefghij"), 5, 5, S("1234567890"), 0, 11, S("abcde1234567890"));
3346 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 0, S("abcde"));
3347 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 1, S("abcde2"));
3348 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 4, S("abcde2345"));
3349 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 8, S("abcde23456789"));
3350 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 9, S("abcde234567890"));
3351 test(S("abcdefghij"), 5, 5, S("1234567890"), 1, 10, S("abcde234567890"));
3352 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 0, S("abcde"));
3353 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 1, S("abcde6"));
3354 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 2, S("abcde67"));
3355 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 4, S("abcde6789"));
3356 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 5, S("abcde67890"));
3357 test(S("abcdefghij"), 5, 5, S("1234567890"), 5, 6, S("abcde67890"));
3358 test(S("abcdefghij"), 5, 5, S("1234567890"), 9, 0, S("abcde"));
3359 test(S("abcdefghij"), 5, 5, S("1234567890"), 9, 1, S("abcde0"));
3360 test(S("abcdefghij"), 5, 5, S("1234567890"), 9, 2, S("abcde0"));
3361 test(S("abcdefghij"), 5, 5, S("1234567890"), 10, 0, S("abcde"));
3362 test(S("abcdefghij"), 5, 5, S("1234567890"), 10, 1, S("abcde"));
3363 test(S("abcdefghij"), 5, 5, S("1234567890"), 11, 0, S("can't happen"));
3364 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 0, S("abcde"));
3365 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 1, S("abcde1"));
3366 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 10, S("abcde1234567890"));
3367 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
3368 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
3369 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
3370 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 0, S("abcde"));
3371 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 1, S("abcde2"));
3372 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 9, S("abcde234567890"));
3373 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
3374 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
3375 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
3376 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 0, S("abcde"));
3377 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 1, S("abcde1"));
3378 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 5, S("abcde12345"));
3379 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 9, S("abcde123456789"));
3380 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 10, S("abcde1234567890"));
3381 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 10, 11, S("abcde1234567890"));
3382 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 19, 0, S("abcde"));
3383 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 19, 1, S("abcde0"));
3384 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 19, 2, S("abcde0"));
3385 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 20, 0, S("abcde"));
3386 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 20, 1, S("abcde"));
3387 test(S("abcdefghij"), 5, 5, S("12345678901234567890"), 21, 0, S("can't happen"));
3388 test(S("abcdefghij"), 5, 6, S(""), 0, 0, S("abcde"));
3389 test(S("abcdefghij"), 5, 6, S(""), 0, 1, S("abcde"));
3390 test(S("abcdefghij"), 5, 6, S(""), 1, 0, S("can't happen"));
3391 test(S("abcdefghij"), 5, 6, S("12345"), 0, 0, S("abcde"));
3392 test(S("abcdefghij"), 5, 6, S("12345"), 0, 1, S("abcde1"));
3393 test(S("abcdefghij"), 5, 6, S("12345"), 0, 2, S("abcde12"));
3394 test(S("abcdefghij"), 5, 6, S("12345"), 0, 4, S("abcde1234"));
3395 test(S("abcdefghij"), 5, 6, S("12345"), 0, 5, S("abcde12345"));
3396 test(S("abcdefghij"), 5, 6, S("12345"), 0, 6, S("abcde12345"));
3397 test(S("abcdefghij"), 5, 6, S("12345"), 1, 0, S("abcde"));
3398 test(S("abcdefghij"), 5, 6, S("12345"), 1, 1, S("abcde2"));
3399 test(S("abcdefghij"), 5, 6, S("12345"), 1, 2, S("abcde23"));
3400 test(S("abcdefghij"), 5, 6, S("12345"), 1, 3, S("abcde234"));
3401 test(S("abcdefghij"), 5, 6, S("12345"), 1, 4, S("abcde2345"));
3402 test(S("abcdefghij"), 5, 6, S("12345"), 1, 5, S("abcde2345"));
3403 test(S("abcdefghij"), 5, 6, S("12345"), 2, 0, S("abcde"));
3404 test(S("abcdefghij"), 5, 6, S("12345"), 2, 1, S("abcde3"));
3405 test(S("abcdefghij"), 5, 6, S("12345"), 2, 2, S("abcde34"));
3411 test(S("abcdefghij"), 5, 6, S("12345"), 2, 3, S("abcde345"));
3412 test(S("abcdefghij"), 5, 6, S("12345"), 2, 4, S("abcde345"));
3413 test(S("abcdefghij"), 5, 6, S("12345"), 4, 0, S("abcde"));
3414 test(S("abcdefghij"), 5, 6, S("12345"), 4, 1, S("abcde5"));
3415 test(S("abcdefghij"), 5, 6, S("12345"), 4, 2, S("abcde5"));
3416 test(S("abcdefghij"), 5, 6, S("12345"), 5, 0, S("abcde"));
3417 test(S("abcdefghij"), 5, 6, S("12345"), 5, 1, S("abcde"));
3418 test(S("abcdefghij"), 5, 6, S("12345"), 6, 0, S("can't happen"));
3419 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 0, S("abcde"));
3420 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 1, S("abcde1"));
3421 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 5, S("abcde12345"));
3422 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 9, S("abcde123456789"));
3423 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 10, S("abcde1234567890"));
3424 test(S("abcdefghij"), 5, 6, S("1234567890"), 0, 11, S("abcde1234567890"));
3425 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 0, S("abcde"));
3426 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 1, S("abcde2"));
3427 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 4, S("abcde2345"));
3428 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 8, S("abcde23456789"));
3429 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 9, S("abcde234567890"));
3430 test(S("abcdefghij"), 5, 6, S("1234567890"), 1, 10, S("abcde234567890"));
3431 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 0, S("abcde"));
3432 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 1, S("abcde6"));
3433 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 2, S("abcde67"));
3434 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 4, S("abcde6789"));
3435 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 5, S("abcde67890"));
3436 test(S("abcdefghij"), 5, 6, S("1234567890"), 5, 6, S("abcde67890"));
3437 test(S("abcdefghij"), 5, 6, S("1234567890"), 9, 0, S("abcde"));
3438 test(S("abcdefghij"), 5, 6, S("1234567890"), 9, 1, S("abcde0"));
3439 test(S("abcdefghij"), 5, 6, S("1234567890"), 9, 2, S("abcde0"));
3440 test(S("abcdefghij"), 5, 6, S("1234567890"), 10, 0, S("abcde"));
3441 test(S("abcdefghij"), 5, 6, S("1234567890"), 10, 1, S("abcde"));
3442 test(S("abcdefghij"), 5, 6, S("1234567890"), 11, 0, S("can't happen"));
3443 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 0, S("abcde"));
3444 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 1, S("abcde1"));
3445 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 10, S("abcde1234567890"));
3446 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
3447 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
3448 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
3449 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 0, S("abcde"));
3450 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 1, S("abcde2"));
3451 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 9, S("abcde234567890"));
3452 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
3453 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
3454 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
3455 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 0, S("abcde"));
3456 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 1, S("abcde1"));
3457 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 5, S("abcde12345"));
3458 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 9, S("abcde123456789"));
3459 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 10, S("abcde1234567890"));
3460 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 10, 11, S("abcde1234567890"));
3461 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 19, 0, S("abcde"));
3462 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 19, 1, S("abcde0"));
3463 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 19, 2, S("abcde0"));
3464 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 20, 0, S("abcde"));
3465 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 20, 1, S("abcde"));
3466 test(S("abcdefghij"), 5, 6, S("12345678901234567890"), 21, 0, S("can't happen"));
3467 test(S("abcdefghij"), 9, 0, S(""), 0, 0, S("abcdefghij"));
3468 test(S("abcdefghij"), 9, 0, S(""), 0, 1, S("abcdefghij"));
3469 test(S("abcdefghij"), 9, 0, S(""), 1, 0, S("can't happen"));
3470 test(S("abcdefghij"), 9, 0, S("12345"), 0, 0, S("abcdefghij"));
3471 test(S("abcdefghij"), 9, 0, S("12345"), 0, 1, S("abcdefghi1j"));
3472 test(S("abcdefghij"), 9, 0, S("12345"), 0, 2, S("abcdefghi12j"));
3473 test(S("abcdefghij"), 9, 0, S("12345"), 0, 4, S("abcdefghi1234j"));
3474 test(S("abcdefghij"), 9, 0, S("12345"), 0, 5, S("abcdefghi12345j"));
3475 test(S("abcdefghij"), 9, 0, S("12345"), 0, 6, S("abcdefghi12345j"));
3476 test(S("abcdefghij"), 9, 0, S("12345"), 1, 0, S("abcdefghij"));
3477 test(S("abcdefghij"), 9, 0, S("12345"), 1, 1, S("abcdefghi2j"));
3478 test(S("abcdefghij"), 9, 0, S("12345"), 1, 2, S("abcdefghi23j"));
3479 test(S("abcdefghij"), 9, 0, S("12345"), 1, 3, S("abcdefghi234j"));
3480 test(S("abcdefghij"), 9, 0, S("12345"), 1, 4, S("abcdefghi2345j"));
3481 test(S("abcdefghij"), 9, 0, S("12345"), 1, 5, S("abcdefghi2345j"));
3482 test(S("abcdefghij"), 9, 0, S("12345"), 2, 0, S("abcdefghij"));
3483 test(S("abcdefghij"), 9, 0, S("12345"), 2, 1, S("abcdefghi3j"));
3484 test(S("abcdefghij"), 9, 0, S("12345"), 2, 2, S("abcdefghi34j"));
3485 test(S("abcdefghij"), 9, 0, S("12345"), 2, 3, S("abcdefghi345j"));
3486 test(S("abcdefghij"), 9, 0, S("12345"), 2, 4, S("abcdefghi345j"));
3487 test(S("abcdefghij"), 9, 0, S("12345"), 4, 0, S("abcdefghij"));
3488 test(S("abcdefghij"), 9, 0, S("12345"), 4, 1, S("abcdefghi5j"));
3489 test(S("abcdefghij"), 9, 0, S("12345"), 4, 2, S("abcdefghi5j"));
3490 test(S("abcdefghij"), 9, 0, S("12345"), 5, 0, S("abcdefghij"));
3491 test(S("abcdefghij"), 9, 0, S("12345"), 5, 1, S("abcdefghij"));
3492 test(S("abcdefghij"), 9, 0, S("12345"), 6, 0, S("can't happen"));
3493 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 0, S("abcdefghij"));
3494 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 1, S("abcdefghi1j"));
3495 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 5, S("abcdefghi12345j"));
3496 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 9, S("abcdefghi123456789j"));
3497 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 10, S("abcdefghi1234567890j"));
3498 test(S("abcdefghij"), 9, 0, S("1234567890"), 0, 11, S("abcdefghi1234567890j"));
3499 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 0, S("abcdefghij"));
3500 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 1, S("abcdefghi2j"));
3501 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 4, S("abcdefghi2345j"));
3502 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 8, S("abcdefghi23456789j"));
3503 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 9, S("abcdefghi234567890j"));
3504 test(S("abcdefghij"), 9, 0, S("1234567890"), 1, 10, S("abcdefghi234567890j"));
3505 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 0, S("abcdefghij"));
3506 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 1, S("abcdefghi6j"));
3507 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 2, S("abcdefghi67j"));
3508 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 4, S("abcdefghi6789j"));
3509 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 5, S("abcdefghi67890j"));
3510 test(S("abcdefghij"), 9, 0, S("1234567890"), 5, 6, S("abcdefghi67890j"));
3516 test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 0, S("abcdefghij"));
3517 test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 1, S("abcdefghi0j"));
3518 test(S("abcdefghij"), 9, 0, S("1234567890"), 9, 2, S("abcdefghi0j"));
3519 test(S("abcdefghij"), 9, 0, S("1234567890"), 10, 0, S("abcdefghij"));
3520 test(S("abcdefghij"), 9, 0, S("1234567890"), 10, 1, S("abcdefghij"));
3521 test(S("abcdefghij"), 9, 0, S("1234567890"), 11, 0, S("can't happen"));
3522 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 0, S("abcdefghij"));
3523 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 1, S("abcdefghi1j"));
3524 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 10, S("abcdefghi1234567890j"));
3525 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789j"));
3526 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890j"));
3527 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890j"));
3528 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
3529 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 1, S("abcdefghi2j"));
3530 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 9, S("abcdefghi234567890j"));
3531 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789j"));
3532 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890j"));
3533 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890j"));
3534 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 0, S("abcdefghij"));
3535 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 1, S("abcdefghi1j"));
3536 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 5, S("abcdefghi12345j"));
3537 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 9, S("abcdefghi123456789j"));
3538 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 10, S("abcdefghi1234567890j"));
3539 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 10, 11, S("abcdefghi1234567890j"));
3540 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 19, 0, S("abcdefghij"));
3541 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 19, 1, S("abcdefghi0j"));
3542 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 19, 2, S("abcdefghi0j"));
3543 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 20, 0, S("abcdefghij"));
3544 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 20, 1, S("abcdefghij"));
3545 test(S("abcdefghij"), 9, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
3546 test(S("abcdefghij"), 9, 1, S(""), 0, 0, S("abcdefghi"));
3547 test(S("abcdefghij"), 9, 1, S(""), 0, 1, S("abcdefghi"));
3548 test(S("abcdefghij"), 9, 1, S(""), 1, 0, S("can't happen"));
3549 test(S("abcdefghij"), 9, 1, S("12345"), 0, 0, S("abcdefghi"));
3550 test(S("abcdefghij"), 9, 1, S("12345"), 0, 1, S("abcdefghi1"));
3551 test(S("abcdefghij"), 9, 1, S("12345"), 0, 2, S("abcdefghi12"));
3552 test(S("abcdefghij"), 9, 1, S("12345"), 0, 4, S("abcdefghi1234"));
3553 test(S("abcdefghij"), 9, 1, S("12345"), 0, 5, S("abcdefghi12345"));
3554 test(S("abcdefghij"), 9, 1, S("12345"), 0, 6, S("abcdefghi12345"));
3555 test(S("abcdefghij"), 9, 1, S("12345"), 1, 0, S("abcdefghi"));
3556 test(S("abcdefghij"), 9, 1, S("12345"), 1, 1, S("abcdefghi2"));
3557 test(S("abcdefghij"), 9, 1, S("12345"), 1, 2, S("abcdefghi23"));
3558 test(S("abcdefghij"), 9, 1, S("12345"), 1, 3, S("abcdefghi234"));
3559 test(S("abcdefghij"), 9, 1, S("12345"), 1, 4, S("abcdefghi2345"));
3560 test(S("abcdefghij"), 9, 1, S("12345"), 1, 5, S("abcdefghi2345"));
3561 test(S("abcdefghij"), 9, 1, S("12345"), 2, 0, S("abcdefghi"));
3562 test(S("abcdefghij"), 9, 1, S("12345"), 2, 1, S("abcdefghi3"));
3563 test(S("abcdefghij"), 9, 1, S("12345"), 2, 2, S("abcdefghi34"));
3564 test(S("abcdefghij"), 9, 1, S("12345"), 2, 3, S("abcdefghi345"));
3565 test(S("abcdefghij"), 9, 1, S("12345"), 2, 4, S("abcdefghi345"));
3566 test(S("abcdefghij"), 9, 1, S("12345"), 4, 0, S("abcdefghi"));
3567 test(S("abcdefghij"), 9, 1, S("12345"), 4, 1, S("abcdefghi5"));
3568 test(S("abcdefghij"), 9, 1, S("12345"), 4, 2, S("abcdefghi5"));
3569 test(S("abcdefghij"), 9, 1, S("12345"), 5, 0, S("abcdefghi"));
3570 test(S("abcdefghij"), 9, 1, S("12345"), 5, 1, S("abcdefghi"));
3571 test(S("abcdefghij"), 9, 1, S("12345"), 6, 0, S("can't happen"));
3572 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 0, S("abcdefghi"));
3573 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 1, S("abcdefghi1"));
3574 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 5, S("abcdefghi12345"));
3575 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 9, S("abcdefghi123456789"));
3576 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 10, S("abcdefghi1234567890"));
3577 test(S("abcdefghij"), 9, 1, S("1234567890"), 0, 11, S("abcdefghi1234567890"));
3578 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 0, S("abcdefghi"));
3579 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 1, S("abcdefghi2"));
3580 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 4, S("abcdefghi2345"));
3581 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 8, S("abcdefghi23456789"));
3582 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 9, S("abcdefghi234567890"));
3583 test(S("abcdefghij"), 9, 1, S("1234567890"), 1, 10, S("abcdefghi234567890"));
3584 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 0, S("abcdefghi"));
3585 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 1, S("abcdefghi6"));
3586 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 2, S("abcdefghi67"));
3587 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 4, S("abcdefghi6789"));
3588 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 5, S("abcdefghi67890"));
3589 test(S("abcdefghij"), 9, 1, S("1234567890"), 5, 6, S("abcdefghi67890"));
3590 test(S("abcdefghij"), 9, 1, S("1234567890"), 9, 0, S("abcdefghi"));
3591 test(S("abcdefghij"), 9, 1, S("1234567890"), 9, 1, S("abcdefghi0"));
3592 test(S("abcdefghij"), 9, 1, S("1234567890"), 9, 2, S("abcdefghi0"));
3593 test(S("abcdefghij"), 9, 1, S("1234567890"), 10, 0, S("abcdefghi"));
3594 test(S("abcdefghij"), 9, 1, S("1234567890"), 10, 1, S("abcdefghi"));
3595 test(S("abcdefghij"), 9, 1, S("1234567890"), 11, 0, S("can't happen"));
3596 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 0, S("abcdefghi"));
3597 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 1, S("abcdefghi1"));
3598 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
3599 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
3600 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
3601 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
3602 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 0, S("abcdefghi"));
3603 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 1, S("abcdefghi2"));
3604 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
3605 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
3606 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
3607 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
3608 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 0, S("abcdefghi"));
3609 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 1, S("abcdefghi1"));
3610 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 5, S("abcdefghi12345"));
3611 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
3612 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
3613 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
3614 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 0, S("abcdefghi"));
3615 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 1, S("abcdefghi0"));
3621 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 19, 2, S("abcdefghi0"));
3622 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 20, 0, S("abcdefghi"));
3623 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 20, 1, S("abcdefghi"));
3624 test(S("abcdefghij"), 9, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
3625 test(S("abcdefghij"), 9, 2, S(""), 0, 0, S("abcdefghi"));
3626 test(S("abcdefghij"), 9, 2, S(""), 0, 1, S("abcdefghi"));
3627 test(S("abcdefghij"), 9, 2, S(""), 1, 0, S("can't happen"));
3628 test(S("abcdefghij"), 9, 2, S("12345"), 0, 0, S("abcdefghi"));
3629 test(S("abcdefghij"), 9, 2, S("12345"), 0, 1, S("abcdefghi1"));
3630 test(S("abcdefghij"), 9, 2, S("12345"), 0, 2, S("abcdefghi12"));
3631 test(S("abcdefghij"), 9, 2, S("12345"), 0, 4, S("abcdefghi1234"));
3632 test(S("abcdefghij"), 9, 2, S("12345"), 0, 5, S("abcdefghi12345"));
3633 test(S("abcdefghij"), 9, 2, S("12345"), 0, 6, S("abcdefghi12345"));
3634 test(S("abcdefghij"), 9, 2, S("12345"), 1, 0, S("abcdefghi"));
3635 test(S("abcdefghij"), 9, 2, S("12345"), 1, 1, S("abcdefghi2"));
3636 test(S("abcdefghij"), 9, 2, S("12345"), 1, 2, S("abcdefghi23"));
3637 test(S("abcdefghij"), 9, 2, S("12345"), 1, 3, S("abcdefghi234"));
3638 test(S("abcdefghij"), 9, 2, S("12345"), 1, 4, S("abcdefghi2345"));
3639 test(S("abcdefghij"), 9, 2, S("12345"), 1, 5, S("abcdefghi2345"));
3640 test(S("abcdefghij"), 9, 2, S("12345"), 2, 0, S("abcdefghi"));
3641 test(S("abcdefghij"), 9, 2, S("12345"), 2, 1, S("abcdefghi3"));
3642 test(S("abcdefghij"), 9, 2, S("12345"), 2, 2, S("abcdefghi34"));
3643 test(S("abcdefghij"), 9, 2, S("12345"), 2, 3, S("abcdefghi345"));
3644 test(S("abcdefghij"), 9, 2, S("12345"), 2, 4, S("abcdefghi345"));
3645 test(S("abcdefghij"), 9, 2, S("12345"), 4, 0, S("abcdefghi"));
3646 test(S("abcdefghij"), 9, 2, S("12345"), 4, 1, S("abcdefghi5"));
3647 test(S("abcdefghij"), 9, 2, S("12345"), 4, 2, S("abcdefghi5"));
3648 test(S("abcdefghij"), 9, 2, S("12345"), 5, 0, S("abcdefghi"));
3649 test(S("abcdefghij"), 9, 2, S("12345"), 5, 1, S("abcdefghi"));
3650 test(S("abcdefghij"), 9, 2, S("12345"), 6, 0, S("can't happen"));
3651 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 0, S("abcdefghi"));
3652 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 1, S("abcdefghi1"));
3653 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 5, S("abcdefghi12345"));
3654 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 9, S("abcdefghi123456789"));
3655 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 10, S("abcdefghi1234567890"));
3656 test(S("abcdefghij"), 9, 2, S("1234567890"), 0, 11, S("abcdefghi1234567890"));
3657 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 0, S("abcdefghi"));
3658 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 1, S("abcdefghi2"));
3659 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 4, S("abcdefghi2345"));
3660 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 8, S("abcdefghi23456789"));
3661 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 9, S("abcdefghi234567890"));
3662 test(S("abcdefghij"), 9, 2, S("1234567890"), 1, 10, S("abcdefghi234567890"));
3663 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 0, S("abcdefghi"));
3664 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 1, S("abcdefghi6"));
3665 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 2, S("abcdefghi67"));
3666 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 4, S("abcdefghi6789"));
3667 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 5, S("abcdefghi67890"));
3668 test(S("abcdefghij"), 9, 2, S("1234567890"), 5, 6, S("abcdefghi67890"));
3669 test(S("abcdefghij"), 9, 2, S("1234567890"), 9, 0, S("abcdefghi"));
3670 test(S("abcdefghij"), 9, 2, S("1234567890"), 9, 1, S("abcdefghi0"));
3671 test(S("abcdefghij"), 9, 2, S("1234567890"), 9, 2, S("abcdefghi0"));
3672 test(S("abcdefghij"), 9, 2, S("1234567890"), 10, 0, S("abcdefghi"));
3673 test(S("abcdefghij"), 9, 2, S("1234567890"), 10, 1, S("abcdefghi"));
3674 test(S("abcdefghij"), 9, 2, S("1234567890"), 11, 0, S("can't happen"));
3675 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 0, S("abcdefghi"));
3676 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 1, S("abcdefghi1"));
3677 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
3678 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
3679 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
3680 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
3681 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 0, S("abcdefghi"));
3682 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 1, S("abcdefghi2"));
3683 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
3684 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
3685 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
3686 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
3687 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 0, S("abcdefghi"));
3688 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 1, S("abcdefghi1"));
3689 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 5, S("abcdefghi12345"));
3690 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
3691 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
3692 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
3693 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 19, 0, S("abcdefghi"));
3694 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 19, 1, S("abcdefghi0"));
3695 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 19, 2, S("abcdefghi0"));
3696 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 20, 0, S("abcdefghi"));
3697 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 20, 1, S("abcdefghi"));
3698 test(S("abcdefghij"), 9, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
3699 test(S("abcdefghij"), 10, 0, S(""), 0, 0, S("abcdefghij"));
3700 test(S("abcdefghij"), 10, 0, S(""), 0, 1, S("abcdefghij"));
3701 test(S("abcdefghij"), 10, 0, S(""), 1, 0, S("can't happen"));
3702 test(S("abcdefghij"), 10, 0, S("12345"), 0, 0, S("abcdefghij"));
3703 test(S("abcdefghij"), 10, 0, S("12345"), 0, 1, S("abcdefghij1"));
3704 test(S("abcdefghij"), 10, 0, S("12345"), 0, 2, S("abcdefghij12"));
3705 test(S("abcdefghij"), 10, 0, S("12345"), 0, 4, S("abcdefghij1234"));
3706 test(S("abcdefghij"), 10, 0, S("12345"), 0, 5, S("abcdefghij12345"));
3707 test(S("abcdefghij"), 10, 0, S("12345"), 0, 6, S("abcdefghij12345"));
3708 test(S("abcdefghij"), 10, 0, S("12345"), 1, 0, S("abcdefghij"));
3709 test(S("abcdefghij"), 10, 0, S("12345"), 1, 1, S("abcdefghij2"));
3710 test(S("abcdefghij"), 10, 0, S("12345"), 1, 2, S("abcdefghij23"));
3711 test(S("abcdefghij"), 10, 0, S("12345"), 1, 3, S("abcdefghij234"));
3712 test(S("abcdefghij"), 10, 0, S("12345"), 1, 4, S("abcdefghij2345"));
3713 test(S("abcdefghij"), 10, 0, S("12345"), 1, 5, S("abcdefghij2345"));
3714 test(S("abcdefghij"), 10, 0, S("12345"), 2, 0, S("abcdefghij"));
3715 test(S("abcdefghij"), 10, 0, S("12345"), 2, 1, S("abcdefghij3"));
3716 test(S("abcdefghij"), 10, 0, S("12345"), 2, 2, S("abcdefghij34"));
3717 test(S("abcdefghij"), 10, 0, S("12345"), 2, 3, S("abcdefghij345"));
3718 test(S("abcdefghij"), 10, 0, S("12345"), 2, 4, S("abcdefghij345"));
3719 test(S("abcdefghij"), 10, 0, S("12345"), 4, 0, S("abcdefghij"));
3720 test(S("abcdefghij"), 10, 0, S("12345"), 4, 1, S("abcdefghij5"));
3726 test(S("abcdefghij"), 10, 0, S("12345"), 4, 2, S("abcdefghij5"));
3727 test(S("abcdefghij"), 10, 0, S("12345"), 5, 0, S("abcdefghij"));
3728 test(S("abcdefghij"), 10, 0, S("12345"), 5, 1, S("abcdefghij"));
3729 test(S("abcdefghij"), 10, 0, S("12345"), 6, 0, S("can't happen"));
3730 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 0, S("abcdefghij"));
3731 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 1, S("abcdefghij1"));
3732 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 5, S("abcdefghij12345"));
3733 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 9, S("abcdefghij123456789"));
3734 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 10, S("abcdefghij1234567890"));
3735 test(S("abcdefghij"), 10, 0, S("1234567890"), 0, 11, S("abcdefghij1234567890"));
3736 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 0, S("abcdefghij"));
3737 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 1, S("abcdefghij2"));
3738 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 4, S("abcdefghij2345"));
3739 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 8, S("abcdefghij23456789"));
3740 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 9, S("abcdefghij234567890"));
3741 test(S("abcdefghij"), 10, 0, S("1234567890"), 1, 10, S("abcdefghij234567890"));
3742 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 0, S("abcdefghij"));
3743 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 1, S("abcdefghij6"));
3744 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 2, S("abcdefghij67"));
3745 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 4, S("abcdefghij6789"));
3746 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 5, S("abcdefghij67890"));
3747 test(S("abcdefghij"), 10, 0, S("1234567890"), 5, 6, S("abcdefghij67890"));
3748 test(S("abcdefghij"), 10, 0, S("1234567890"), 9, 0, S("abcdefghij"));
3749 test(S("abcdefghij"), 10, 0, S("1234567890"), 9, 1, S("abcdefghij0"));
3750 test(S("abcdefghij"), 10, 0, S("1234567890"), 9, 2, S("abcdefghij0"));
3751 test(S("abcdefghij"), 10, 0, S("1234567890"), 10, 0, S("abcdefghij"));
3752 test(S("abcdefghij"), 10, 0, S("1234567890"), 10, 1, S("abcdefghij"));
3753 test(S("abcdefghij"), 10, 0, S("1234567890"), 11, 0, S("can't happen"));
3754 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 0, S("abcdefghij"));
3755 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 1, S("abcdefghij1"));
3756 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
3757 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
3758 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
3759 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
3760 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 0, S("abcdefghij"));
3761 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 1, S("abcdefghij2"));
3762 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
3763 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
3764 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
3765 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
3766 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 0, S("abcdefghij"));
3767 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 1, S("abcdefghij1"));
3768 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 5, S("abcdefghij12345"));
3769 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
3770 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
3771 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
3772 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 19, 0, S("abcdefghij"));
3773 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 19, 1, S("abcdefghij0"));
3774 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 19, 2, S("abcdefghij0"));
3775 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 20, 0, S("abcdefghij"));
3776 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 20, 1, S("abcdefghij"));
3777 test(S("abcdefghij"), 10, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
3778 test(S("abcdefghij"), 10, 1, S(""), 0, 0, S("abcdefghij"));
3779 test(S("abcdefghij"), 10, 1, S(""), 0, 1, S("abcdefghij"));
3780 test(S("abcdefghij"), 10, 1, S(""), 1, 0, S("can't happen"));
3781 test(S("abcdefghij"), 10, 1, S("12345"), 0, 0, S("abcdefghij"));
3782 test(S("abcdefghij"), 10, 1, S("12345"), 0, 1, S("abcdefghij1"));
3783 test(S("abcdefghij"), 10, 1, S("12345"), 0, 2, S("abcdefghij12"));
3784 test(S("abcdefghij"), 10, 1, S("12345"), 0, 4, S("abcdefghij1234"));
3785 test(S("abcdefghij"), 10, 1, S("12345"), 0, 5, S("abcdefghij12345"));
3786 test(S("abcdefghij"), 10, 1, S("12345"), 0, 6, S("abcdefghij12345"));
3787 test(S("abcdefghij"), 10, 1, S("12345"), 1, 0, S("abcdefghij"));
3788 test(S("abcdefghij"), 10, 1, S("12345"), 1, 1, S("abcdefghij2"));
3789 test(S("abcdefghij"), 10, 1, S("12345"), 1, 2, S("abcdefghij23"));
3790 test(S("abcdefghij"), 10, 1, S("12345"), 1, 3, S("abcdefghij234"));
3791 test(S("abcdefghij"), 10, 1, S("12345"), 1, 4, S("abcdefghij2345"));
3792 test(S("abcdefghij"), 10, 1, S("12345"), 1, 5, S("abcdefghij2345"));
3793 test(S("abcdefghij"), 10, 1, S("12345"), 2, 0, S("abcdefghij"));
3794 test(S("abcdefghij"), 10, 1, S("12345"), 2, 1, S("abcdefghij3"));
3795 test(S("abcdefghij"), 10, 1, S("12345"), 2, 2, S("abcdefghij34"));
3796 test(S("abcdefghij"), 10, 1, S("12345"), 2, 3, S("abcdefghij345"));
3797 test(S("abcdefghij"), 10, 1, S("12345"), 2, 4, S("abcdefghij345"));
3798 test(S("abcdefghij"), 10, 1, S("12345"), 4, 0, S("abcdefghij"));
3799 test(S("abcdefghij"), 10, 1, S("12345"), 4, 1, S("abcdefghij5"));
3800 test(S("abcdefghij"), 10, 1, S("12345"), 4, 2, S("abcdefghij5"));
3801 test(S("abcdefghij"), 10, 1, S("12345"), 5, 0, S("abcdefghij"));
3802 test(S("abcdefghij"), 10, 1, S("12345"), 5, 1, S("abcdefghij"));
3803 test(S("abcdefghij"), 10, 1, S("12345"), 6, 0, S("can't happen"));
3804 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 0, S("abcdefghij"));
3805 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 1, S("abcdefghij1"));
3806 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 5, S("abcdefghij12345"));
3807 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 9, S("abcdefghij123456789"));
3808 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 10, S("abcdefghij1234567890"));
3809 test(S("abcdefghij"), 10, 1, S("1234567890"), 0, 11, S("abcdefghij1234567890"));
3810 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 0, S("abcdefghij"));
3811 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 1, S("abcdefghij2"));
3812 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 4, S("abcdefghij2345"));
3813 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 8, S("abcdefghij23456789"));
3814 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 9, S("abcdefghij234567890"));
3815 test(S("abcdefghij"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890"));
3816 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 0, S("abcdefghij"));
3817 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 1, S("abcdefghij6"));
3818 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 2, S("abcdefghij67"));
3819 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 4, S("abcdefghij6789"));
3820 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 5, S("abcdefghij67890"));
3821 test(S("abcdefghij"), 10, 1, S("1234567890"), 5, 6, S("abcdefghij67890"));
3822 test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 0, S("abcdefghij"));
3823 test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 1, S("abcdefghij0"));
3824 test(S("abcdefghij"), 10, 1, S("1234567890"), 9, 2, S("abcdefghij0"));
3825 test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 0, S("abcdefghij"));
3831 test(S("abcdefghij"), 10, 1, S("1234567890"), 10, 1, S("abcdefghij"));
3832 test(S("abcdefghij"), 10, 1, S("1234567890"), 11, 0, S("can't happen"));
3833 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 0, S("abcdefghij"));
3834 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 1, S("abcdefghij1"));
3835 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
3836 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
3837 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
3838 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
3839 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 0, S("abcdefghij"));
3840 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 1, S("abcdefghij2"));
3841 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
3842 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
3843 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
3844 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
3845 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 0, S("abcdefghij"));
3846 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 1, S("abcdefghij1"));
3847 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 5, S("abcdefghij12345"));
3848 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
3849 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
3850 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
3851 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 19, 0, S("abcdefghij"));
3852 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 19, 1, S("abcdefghij0"));
3853 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 19, 2, S("abcdefghij0"));
3854 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 20, 0, S("abcdefghij"));
3855 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 20, 1, S("abcdefghij"));
3856 test(S("abcdefghij"), 10, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
3857 test(S("abcdefghij"), 11, 0, S(""), 0, 0, S("can't happen"));
3858 test(S("abcdefghij"), 11, 0, S(""), 0, 1, S("can't happen"));
3859 test(S("abcdefghij"), 11, 0, S(""), 1, 0, S("can't happen"));
3860 test(S("abcdefghij"), 11, 0, S("12345"), 0, 0, S("can't happen"));
3861 test(S("abcdefghij"), 11, 0, S("12345"), 0, 1, S("can't happen"));
3862 test(S("abcdefghij"), 11, 0, S("12345"), 0, 2, S("can't happen"));
3863 test(S("abcdefghij"), 11, 0, S("12345"), 0, 4, S("can't happen"));
3864 test(S("abcdefghij"), 11, 0, S("12345"), 0, 5, S("can't happen"));
3865 test(S("abcdefghij"), 11, 0, S("12345"), 0, 6, S("can't happen"));
3866 test(S("abcdefghij"), 11, 0, S("12345"), 1, 0, S("can't happen"));
3867 test(S("abcdefghij"), 11, 0, S("12345"), 1, 1, S("can't happen"));
3868 test(S("abcdefghij"), 11, 0, S("12345"), 1, 2, S("can't happen"));
3869 test(S("abcdefghij"), 11, 0, S("12345"), 1, 3, S("can't happen"));
3870 test(S("abcdefghij"), 11, 0, S("12345"), 1, 4, S("can't happen"));
3871 test(S("abcdefghij"), 11, 0, S("12345"), 1, 5, S("can't happen"));
3872 test(S("abcdefghij"), 11, 0, S("12345"), 2, 0, S("can't happen"));
3873 test(S("abcdefghij"), 11, 0, S("12345"), 2, 1, S("can't happen"));
3874 test(S("abcdefghij"), 11, 0, S("12345"), 2, 2, S("can't happen"));
3875 test(S("abcdefghij"), 11, 0, S("12345"), 2, 3, S("can't happen"));
3876 test(S("abcdefghij"), 11, 0, S("12345"), 2, 4, S("can't happen"));
3877 test(S("abcdefghij"), 11, 0, S("12345"), 4, 0, S("can't happen"));
3878 test(S("abcdefghij"), 11, 0, S("12345"), 4, 1, S("can't happen"));
3879 test(S("abcdefghij"), 11, 0, S("12345"), 4, 2, S("can't happen"));
3880 test(S("abcdefghij"), 11, 0, S("12345"), 5, 0, S("can't happen"));
3881 test(S("abcdefghij"), 11, 0, S("12345"), 5, 1, S("can't happen"));
3882 test(S("abcdefghij"), 11, 0, S("12345"), 6, 0, S("can't happen"));
3883 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 0, S("can't happen"));
3884 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 1, S("can't happen"));
3885 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 5, S("can't happen"));
3886 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 9, S("can't happen"));
3887 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 10, S("can't happen"));
3888 test(S("abcdefghij"), 11, 0, S("1234567890"), 0, 11, S("can't happen"));
3889 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 0, S("can't happen"));
3890 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 1, S("can't happen"));
3891 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 4, S("can't happen"));
3892 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 8, S("can't happen"));
3893 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 9, S("can't happen"));
3894 test(S("abcdefghij"), 11, 0, S("1234567890"), 1, 10, S("can't happen"));
3895 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 0, S("can't happen"));
3896 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 1, S("can't happen"));
3897 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 2, S("can't happen"));
3898 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 4, S("can't happen"));
3899 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 5, S("can't happen"));
3900 test(S("abcdefghij"), 11, 0, S("1234567890"), 5, 6, S("can't happen"));
3901 test(S("abcdefghij"), 11, 0, S("1234567890"), 9, 0, S("can't happen"));
3902 test(S("abcdefghij"), 11, 0, S("1234567890"), 9, 1, S("can't happen"));
3903 test(S("abcdefghij"), 11, 0, S("1234567890"), 9, 2, S("can't happen"));
3904 test(S("abcdefghij"), 11, 0, S("1234567890"), 10, 0, S("can't happen"));
3905 test(S("abcdefghij"), 11, 0, S("1234567890"), 10, 1, S("can't happen"));
3906 test(S("abcdefghij"), 11, 0, S("1234567890"), 11, 0, S("can't happen"));
3907 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
3908 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
3909 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
3910 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 19, S("can't happen"));
3911 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 20, S("can't happen"));
3912 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 0, 21, S("can't happen"));
3913 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 0, S("can't happen"));
3914 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 1, S("can't happen"));
3915 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 9, S("can't happen"));
3916 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 18, S("can't happen"));
3917 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 19, S("can't happen"));
3918 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 1, 20, S("can't happen"));
3919 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 0, S("can't happen"));
3920 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 1, S("can't happen"));
3921 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 5, S("can't happen"));
3922 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 9, S("can't happen"));
3923 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 10, S("can't happen"));
3924 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 10, 11, S("can't happen"));
3925 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 19, 0, S("can't happen"));
3926 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 19, 1, S("can't happen"));
3927 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 19, 2, S("can't happen"));
3928 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
3929 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
3930 test(S("abcdefghij"), 11, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
3936 test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
3937 test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
3938 test(S("abcdefghijklmnopqrst"), 0, 0, S(""), 1, 0, S("can't happen"));
3939 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
3940 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 1, S("1abcdefghijklmnopqrst"));
3941 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 2, S("12abcdefghijklmnopqrst"));
3942 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 4, S("1234abcdefghijklmnopqrst"));
3943 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 5, S("12345abcdefghijklmnopqrst"));
3944 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 0, 6, S("12345abcdefghijklmnopqrst"));
3945 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
3946 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 1, S("2abcdefghijklmnopqrst"));
3947 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
3948 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
3949 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
3950 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
3951 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
3952 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 2, 1, S("3abcdefghijklmnopqrst"));
3953 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 2, 2, S("34abcdefghijklmnopqrst"));
3954 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 2, 3, S("345abcdefghijklmnopqrst"));
3955 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 2, 4, S("345abcdefghijklmnopqrst"));
3956 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
3957 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 4, 1, S("5abcdefghijklmnopqrst"));
3958 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 4, 2, S("5abcdefghijklmnopqrst"));
3959 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
3960 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
3961 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345"), 6, 0, S("can't happen"));
3962 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
3963 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
3964 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 5, S("12345abcdefghijklmnopqrst"));
3965 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 9, S("123456789abcdefghijklmnopqrst"));
3966 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
3967 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 0, 11, S("1234567890abcdefghijklmnopqrst"));
3968 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
3969 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
3970 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 4, S("2345abcdefghijklmnopqrst"));
3971 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 8, S("23456789abcdefghijklmnopqrst"));
3972 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
3973 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 1, 10, S("234567890abcdefghijklmnopqrst"));
3974 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
3975 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 1, S("6abcdefghijklmnopqrst"));
3976 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 2, S("67abcdefghijklmnopqrst"));
3977 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 4, S("6789abcdefghijklmnopqrst"));
3978 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 5, S("67890abcdefghijklmnopqrst"));
3979 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 5, 6, S("67890abcdefghijklmnopqrst"));
3980 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
3981 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 9, 1, S("0abcdefghijklmnopqrst"));
3982 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 9, 2, S("0abcdefghijklmnopqrst"));
3983 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
3984 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
3985 test(S("abcdefghijklmnopqrst"), 0, 0, S("1234567890"), 11, 0, S("can't happen"));
3986 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
3987 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
3988 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
3989 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghijklmnopqrst"));
3990 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghijklmnopqrst"));
3991 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghijklmnopqrst"));
3992 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
3993 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
3994 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
3995 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 18, S("234567890123456789abcdefghijklmnopqrst"));
3996 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghijklmnopqrst"));
3997 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
3998 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
3999 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
4000 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
4001 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
4002 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 10, S("1234567890abcdefghijklmnopqrst"));
4003 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 10, 11, S("1234567890abcdefghijklmnopqrst"));
4004 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
4005 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 19, 1, S("0abcdefghijklmnopqrst"));
4006 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 19, 2, S("0abcdefghijklmnopqrst"));
4007 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
4008 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
4009 test(S("abcdefghijklmnopqrst"), 0, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
4010 test(S("abcdefghijklmnopqrst"), 0, 1, S(""), 0, 0, S("bcdefghijklmnopqrst"));
4011 test(S("abcdefghijklmnopqrst"), 0, 1, S(""), 0, 1, S("bcdefghijklmnopqrst"));
4012 test(S("abcdefghijklmnopqrst"), 0, 1, S(""), 1, 0, S("can't happen"));
4013 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 0, S("bcdefghijklmnopqrst"));
4014 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 1, S("1bcdefghijklmnopqrst"));
4015 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 2, S("12bcdefghijklmnopqrst"));
4016 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 4, S("1234bcdefghijklmnopqrst"));
4017 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 5, S("12345bcdefghijklmnopqrst"));
4018 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 0, 6, S("12345bcdefghijklmnopqrst"));
4019 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 0, S("bcdefghijklmnopqrst"));
4020 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 1, S("2bcdefghijklmnopqrst"));
4021 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 2, S("23bcdefghijklmnopqrst"));
4022 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 3, S("234bcdefghijklmnopqrst"));
4023 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 4, S("2345bcdefghijklmnopqrst"));
4024 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 1, 5, S("2345bcdefghijklmnopqrst"));
4025 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 2, 0, S("bcdefghijklmnopqrst"));
4026 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 2, 1, S("3bcdefghijklmnopqrst"));
4027 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 2, 2, S("34bcdefghijklmnopqrst"));
4028 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 2, 3, S("345bcdefghijklmnopqrst"));
4029 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 2, 4, S("345bcdefghijklmnopqrst"));
4030 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 4, 0, S("bcdefghijklmnopqrst"));
4031 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 4, 1, S("5bcdefghijklmnopqrst"));
4032 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 4, 2, S("5bcdefghijklmnopqrst"));
4033 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 0, S("bcdefghijklmnopqrst"));
4034 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 5, 1, S("bcdefghijklmnopqrst"));
4035 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345"), 6, 0, S("can't happen"));
4041 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 0, S("bcdefghijklmnopqrst"));
4042 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
4043 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 5, S("12345bcdefghijklmnopqrst"));
4044 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 9, S("123456789bcdefghijklmnopqrst"));
4045 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
4046 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 0, 11, S("1234567890bcdefghijklmnopqrst"));
4047 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 0, S("bcdefghijklmnopqrst"));
4048 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
4049 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 4, S("2345bcdefghijklmnopqrst"));
4050 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 8, S("23456789bcdefghijklmnopqrst"));
4051 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
4052 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 1, 10, S("234567890bcdefghijklmnopqrst"));
4053 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 0, S("bcdefghijklmnopqrst"));
4054 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 1, S("6bcdefghijklmnopqrst"));
4055 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 2, S("67bcdefghijklmnopqrst"));
4056 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 4, S("6789bcdefghijklmnopqrst"));
4057 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 5, S("67890bcdefghijklmnopqrst"));
4058 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 5, 6, S("67890bcdefghijklmnopqrst"));
4059 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 9, 0, S("bcdefghijklmnopqrst"));
4060 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 9, 1, S("0bcdefghijklmnopqrst"));
4061 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 9, 2, S("0bcdefghijklmnopqrst"));
4062 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 10, 0, S("bcdefghijklmnopqrst"));
4063 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 10, 1, S("bcdefghijklmnopqrst"));
4064 test(S("abcdefghijklmnopqrst"), 0, 1, S("1234567890"), 11, 0, S("can't happen"));
4065 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 0, S("bcdefghijklmnopqrst"));
4066 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
4067 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
4068 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghijklmnopqrst"));
4069 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghijklmnopqrst"));
4070 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghijklmnopqrst"));
4071 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 0, S("bcdefghijklmnopqrst"));
4072 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
4073 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
4074 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 18, S("234567890123456789bcdefghijklmnopqrst"));
4075 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghijklmnopqrst"));
4076 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghijklmnopqrst"));
4077 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 0, S("bcdefghijklmnopqrst"));
4078 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 1, S("1bcdefghijklmnopqrst"));
4079 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 5, S("12345bcdefghijklmnopqrst"));
4080 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 9, S("123456789bcdefghijklmnopqrst"));
4081 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 10, S("1234567890bcdefghijklmnopqrst"));
4082 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 10, 11, S("1234567890bcdefghijklmnopqrst"));
4083 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 19, 0, S("bcdefghijklmnopqrst"));
4084 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 19, 1, S("0bcdefghijklmnopqrst"));
4085 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 19, 2, S("0bcdefghijklmnopqrst"));
4086 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 20, 0, S("bcdefghijklmnopqrst"));
4087 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 20, 1, S("bcdefghijklmnopqrst"));
4088 test(S("abcdefghijklmnopqrst"), 0, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
4089 test(S("abcdefghijklmnopqrst"), 0, 10, S(""), 0, 0, S("klmnopqrst"));
4090 test(S("abcdefghijklmnopqrst"), 0, 10, S(""), 0, 1, S("klmnopqrst"));
4091 test(S("abcdefghijklmnopqrst"), 0, 10, S(""), 1, 0, S("can't happen"));
4092 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 0, S("klmnopqrst"));
4093 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 1, S("1klmnopqrst"));
4094 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 2, S("12klmnopqrst"));
4095 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 4, S("1234klmnopqrst"));
4096 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 5, S("12345klmnopqrst"));
4097 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 0, 6, S("12345klmnopqrst"));
4098 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 0, S("klmnopqrst"));
4099 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 1, S("2klmnopqrst"));
4100 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 2, S("23klmnopqrst"));
4101 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 3, S("234klmnopqrst"));
4102 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 4, S("2345klmnopqrst"));
4103 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 1, 5, S("2345klmnopqrst"));
4104 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 2, 0, S("klmnopqrst"));
4105 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 2, 1, S("3klmnopqrst"));
4106 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 2, 2, S("34klmnopqrst"));
4107 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 2, 3, S("345klmnopqrst"));
4108 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 2, 4, S("345klmnopqrst"));
4109 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 4, 0, S("klmnopqrst"));
4110 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 4, 1, S("5klmnopqrst"));
4111 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 4, 2, S("5klmnopqrst"));
4112 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 5, 0, S("klmnopqrst"));
4113 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 5, 1, S("klmnopqrst"));
4114 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345"), 6, 0, S("can't happen"));
4115 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 0, S("klmnopqrst"));
4116 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 1, S("1klmnopqrst"));
4117 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 5, S("12345klmnopqrst"));
4118 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 9, S("123456789klmnopqrst"));
4119 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 10, S("1234567890klmnopqrst"));
4120 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 0, 11, S("1234567890klmnopqrst"));
4121 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 0, S("klmnopqrst"));
4122 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 1, S("2klmnopqrst"));
4123 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 4, S("2345klmnopqrst"));
4124 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 8, S("23456789klmnopqrst"));
4125 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 9, S("234567890klmnopqrst"));
4126 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 1, 10, S("234567890klmnopqrst"));
4127 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 0, S("klmnopqrst"));
4128 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 1, S("6klmnopqrst"));
4129 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 2, S("67klmnopqrst"));
4130 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 4, S("6789klmnopqrst"));
4131 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 5, S("67890klmnopqrst"));
4132 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 5, 6, S("67890klmnopqrst"));
4133 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 9, 0, S("klmnopqrst"));
4134 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 9, 1, S("0klmnopqrst"));
4135 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 9, 2, S("0klmnopqrst"));
4136 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 10, 0, S("klmnopqrst"));
4137 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 10, 1, S("klmnopqrst"));
4138 test(S("abcdefghijklmnopqrst"), 0, 10, S("1234567890"), 11, 0, S("can't happen"));
4139 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 0, S("klmnopqrst"));
4140 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 1, S("1klmnopqrst"));
4146 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 10, S("1234567890klmnopqrst"));
4147 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst"));
4148 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 20, S("12345678901234567890klmnopqrst"));
4149 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 0, 21, S("12345678901234567890klmnopqrst"));
4150 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 0, S("klmnopqrst"));
4151 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 1, S("2klmnopqrst"));
4152 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 9, S("234567890klmnopqrst"));
4153 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 18, S("234567890123456789klmnopqrst"));
4154 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 19, S("2345678901234567890klmnopqrst"));
4155 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 1, 20, S("2345678901234567890klmnopqrst"));
4156 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 0, S("klmnopqrst"));
4157 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 1, S("1klmnopqrst"));
4158 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 5, S("12345klmnopqrst"));
4159 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 9, S("123456789klmnopqrst"));
4160 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 10, S("1234567890klmnopqrst"));
4161 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 10, 11, S("1234567890klmnopqrst"));
4162 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 19, 0, S("klmnopqrst"));
4163 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 19, 1, S("0klmnopqrst"));
4164 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 19, 2, S("0klmnopqrst"));
4165 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 20, 0, S("klmnopqrst"));
4166 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 20, 1, S("klmnopqrst"));
4167 test(S("abcdefghijklmnopqrst"), 0, 10, S("12345678901234567890"), 21, 0, S("can't happen"));
4168 test(S("abcdefghijklmnopqrst"), 0, 19, S(""), 0, 0, S("t"));
4169 test(S("abcdefghijklmnopqrst"), 0, 19, S(""), 0, 1, S("t"));
4170 test(S("abcdefghijklmnopqrst"), 0, 19, S(""), 1, 0, S("can't happen"));
4171 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 0, S("t"));
4172 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 1, S("1t"));
4173 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 2, S("12t"));
4174 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 4, S("1234t"));
4175 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 5, S("12345t"));
4176 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 0, 6, S("12345t"));
4177 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 0, S("t"));
4178 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 1, S("2t"));
4179 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 2, S("23t"));
4180 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 3, S("234t"));
4181 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 4, S("2345t"));
4182 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 1, 5, S("2345t"));
4183 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 2, 0, S("t"));
4184 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 2, 1, S("3t"));
4185 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 2, 2, S("34t"));
4186 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 2, 3, S("345t"));
4187 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 2, 4, S("345t"));
4188 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 4, 0, S("t"));
4189 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 4, 1, S("5t"));
4190 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 4, 2, S("5t"));
4191 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 5, 0, S("t"));
4192 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 5, 1, S("t"));
4193 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345"), 6, 0, S("can't happen"));
4194 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 0, S("t"));
4195 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 1, S("1t"));
4196 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 5, S("12345t"));
4197 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 9, S("123456789t"));
4198 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 10, S("1234567890t"));
4199 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 0, 11, S("1234567890t"));
4200 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 0, S("t"));
4201 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 1, S("2t"));
4202 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 4, S("2345t"));
4203 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 8, S("23456789t"));
4204 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 9, S("234567890t"));
4205 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 1, 10, S("234567890t"));
4206 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 0, S("t"));
4207 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 1, S("6t"));
4208 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 2, S("67t"));
4209 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 4, S("6789t"));
4210 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 5, S("67890t"));
4211 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 5, 6, S("67890t"));
4212 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 9, 0, S("t"));
4213 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 9, 1, S("0t"));
4214 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 9, 2, S("0t"));
4215 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 10, 0, S("t"));
4216 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 10, 1, S("t"));
4217 test(S("abcdefghijklmnopqrst"), 0, 19, S("1234567890"), 11, 0, S("can't happen"));
4218 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 0, S("t"));
4219 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 1, S("1t"));
4220 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 10, S("1234567890t"));
4221 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 19, S("1234567890123456789t"));
4222 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 20, S("12345678901234567890t"));
4223 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 0, 21, S("12345678901234567890t"));
4224 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 0, S("t"));
4225 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 1, S("2t"));
4226 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 9, S("234567890t"));
4227 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 18, S("234567890123456789t"));
4228 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 19, S("2345678901234567890t"));
4229 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 1, 20, S("2345678901234567890t"));
4230 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 0, S("t"));
4231 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 1, S("1t"));
4232 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 5, S("12345t"));
4233 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 9, S("123456789t"));
4234 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 10, S("1234567890t"));
4235 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 10, 11, S("1234567890t"));
4236 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 19, 0, S("t"));
4237 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 19, 1, S("0t"));
4238 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 19, 2, S("0t"));
4239 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 20, 0, S("t"));
4240 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 20, 1, S("t"));
4241 test(S("abcdefghijklmnopqrst"), 0, 19, S("12345678901234567890"), 21, 0, S("can't happen"));
4242 test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 0, 0, S(""));
4243 test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 0, 1, S(""));
4244 test(S("abcdefghijklmnopqrst"), 0, 20, S(""), 1, 0, S("can't happen"));
4245 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 0, S(""));
4251 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 1, S("1"));
4252 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 2, S("12"));
4253 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 4, S("1234"));
4254 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 5, S("12345"));
4255 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 0, 6, S("12345"));
4256 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 0, S(""));
4257 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 1, S("2"));
4258 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 2, S("23"));
4259 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 3, S("234"));
4260 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 4, S("2345"));
4261 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 1, 5, S("2345"));
4262 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 2, 0, S(""));
4263 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 2, 1, S("3"));
4264 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 2, 2, S("34"));
4265 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 2, 3, S("345"));
4266 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 2, 4, S("345"));
4267 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 4, 0, S(""));
4268 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 4, 1, S("5"));
4269 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 4, 2, S("5"));
4270 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 5, 0, S(""));
4271 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 5, 1, S(""));
4272 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345"), 6, 0, S("can't happen"));
4273 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 0, S(""));
4274 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 1, S("1"));
4275 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 5, S("12345"));
4276 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 9, S("123456789"));
4277 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 10, S("1234567890"));
4278 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 0, 11, S("1234567890"));
4279 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 0, S(""));
4280 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 1, S("2"));
4281 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 4, S("2345"));
4282 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 8, S("23456789"));
4283 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 9, S("234567890"));
4284 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 1, 10, S("234567890"));
4285 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 0, S(""));
4286 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 1, S("6"));
4287 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 2, S("67"));
4288 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 4, S("6789"));
4289 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 5, S("67890"));
4290 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 5, 6, S("67890"));
4291 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 9, 0, S(""));
4292 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 9, 1, S("0"));
4293 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 9, 2, S("0"));
4294 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 10, 0, S(""));
4295 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 10, 1, S(""));
4296 test(S("abcdefghijklmnopqrst"), 0, 20, S("1234567890"), 11, 0, S("can't happen"));
4297 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 0, S(""));
4298 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 1, S("1"));
4299 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 10, S("1234567890"));
4300 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
4301 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
4302 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
4303 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 0, S(""));
4304 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 1, S("2"));
4305 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 9, S("234567890"));
4306 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 18, S("234567890123456789"));
4307 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
4308 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
4309 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 0, S(""));
4310 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 1, S("1"));
4311 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 5, S("12345"));
4312 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 9, S("123456789"));
4313 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 10, S("1234567890"));
4314 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 10, 11, S("1234567890"));
4315 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 19, 0, S(""));
4316 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 19, 1, S("0"));
4317 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 19, 2, S("0"));
4318 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 20, 0, S(""));
4319 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 20, 1, S(""));
4320 test(S("abcdefghijklmnopqrst"), 0, 20, S("12345678901234567890"), 21, 0, S("can't happen"));
4321 test(S("abcdefghijklmnopqrst"), 0, 21, S(""), 0, 0, S(""));
4322 test(S("abcdefghijklmnopqrst"), 0, 21, S(""), 0, 1, S(""));
4323 test(S("abcdefghijklmnopqrst"), 0, 21, S(""), 1, 0, S("can't happen"));
4324 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 0, S(""));
4325 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 1, S("1"));
4326 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 2, S("12"));
4327 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 4, S("1234"));
4328 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 5, S("12345"));
4329 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 0, 6, S("12345"));
4330 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 0, S(""));
4331 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 1, S("2"));
4332 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 2, S("23"));
4333 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 3, S("234"));
4334 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 4, S("2345"));
4335 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 1, 5, S("2345"));
4336 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 2, 0, S(""));
4337 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 2, 1, S("3"));
4338 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 2, 2, S("34"));
4339 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 2, 3, S("345"));
4340 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 2, 4, S("345"));
4341 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 4, 0, S(""));
4342 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 4, 1, S("5"));
4343 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 4, 2, S("5"));
4344 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 5, 0, S(""));
4345 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 5, 1, S(""));
4346 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345"), 6, 0, S("can't happen"));
4347 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 0, S(""));
4348 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 1, S("1"));
4349 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 5, S("12345"));
4350 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 9, S("123456789"));
4356 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 10, S("1234567890"));
4357 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 0, 11, S("1234567890"));
4358 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 0, S(""));
4359 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 1, S("2"));
4360 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 4, S("2345"));
4361 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 8, S("23456789"));
4362 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 9, S("234567890"));
4363 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 1, 10, S("234567890"));
4364 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 0, S(""));
4365 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 1, S("6"));
4366 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 2, S("67"));
4367 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 4, S("6789"));
4368 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 5, S("67890"));
4369 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 5, 6, S("67890"));
4370 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 9, 0, S(""));
4371 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 9, 1, S("0"));
4372 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 9, 2, S("0"));
4373 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 10, 0, S(""));
4374 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 10, 1, S(""));
4375 test(S("abcdefghijklmnopqrst"), 0, 21, S("1234567890"), 11, 0, S("can't happen"));
4376 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 0, S(""));
4377 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 1, S("1"));
4378 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 10, S("1234567890"));
4379 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 19, S("1234567890123456789"));
4380 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 20, S("12345678901234567890"));
4381 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 0, 21, S("12345678901234567890"));
4382 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 0, S(""));
4383 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 1, S("2"));
4384 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 9, S("234567890"));
4385 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 18, S("234567890123456789"));
4386 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 19, S("2345678901234567890"));
4387 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 1, 20, S("2345678901234567890"));
4388 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 0, S(""));
4389 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 1, S("1"));
4390 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 5, S("12345"));
4391 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 9, S("123456789"));
4392 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 10, S("1234567890"));
4393 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 10, 11, S("1234567890"));
4394 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 19, 0, S(""));
4395 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 19, 1, S("0"));
4396 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 19, 2, S("0"));
4397 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 20, 0, S(""));
4398 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 20, 1, S(""));
4399 test(S("abcdefghijklmnopqrst"), 0, 21, S("12345678901234567890"), 21, 0, S("can't happen"));
4400 test(S("abcdefghijklmnopqrst"), 1, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
4401 test(S("abcdefghijklmnopqrst"), 1, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
4402 test(S("abcdefghijklmnopqrst"), 1, 0, S(""), 1, 0, S("can't happen"));
4403 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
4404 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 1, S("a1bcdefghijklmnopqrst"));
4405 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 2, S("a12bcdefghijklmnopqrst"));
4406 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 4, S("a1234bcdefghijklmnopqrst"));
4407 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 5, S("a12345bcdefghijklmnopqrst"));
4408 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 0, 6, S("a12345bcdefghijklmnopqrst"));
4409 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
4410 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 1, S("a2bcdefghijklmnopqrst"));
4411 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 2, S("a23bcdefghijklmnopqrst"));
4412 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 3, S("a234bcdefghijklmnopqrst"));
4413 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 4, S("a2345bcdefghijklmnopqrst"));
4414 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 1, 5, S("a2345bcdefghijklmnopqrst"));
4415 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
4416 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 2, 1, S("a3bcdefghijklmnopqrst"));
4417 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 2, 2, S("a34bcdefghijklmnopqrst"));
4418 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 2, 3, S("a345bcdefghijklmnopqrst"));
4419 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 2, 4, S("a345bcdefghijklmnopqrst"));
4420 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
4421 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 4, 1, S("a5bcdefghijklmnopqrst"));
4422 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 4, 2, S("a5bcdefghijklmnopqrst"));
4423 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
4424 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
4425 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345"), 6, 0, S("can't happen"));
4426 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
4427 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
4428 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 5, S("a12345bcdefghijklmnopqrst"));
4429 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 9, S("a123456789bcdefghijklmnopqrst"));
4430 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
4431 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 0, 11, S("a1234567890bcdefghijklmnopqrst"));
4432 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
4433 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
4434 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 4, S("a2345bcdefghijklmnopqrst"));
4435 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 8, S("a23456789bcdefghijklmnopqrst"));
4436 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
4437 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
4438 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
4439 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
4440 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
4441 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
4442 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 5, S("a67890bcdefghijklmnopqrst"));
4443 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 5, 6, S("a67890bcdefghijklmnopqrst"));
4444 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
4445 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 9, 1, S("a0bcdefghijklmnopqrst"));
4446 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 9, 2, S("a0bcdefghijklmnopqrst"));
4447 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
4448 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
4449 test(S("abcdefghijklmnopqrst"), 1, 0, S("1234567890"), 11, 0, S("can't happen"));
4450 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
4451 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
4452 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
4453 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst"));
4454 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst"));
4455 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
4461 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
4462 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
4463 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
4464 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghijklmnopqrst"));
4465 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghijklmnopqrst"));
4466 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghijklmnopqrst"));
4467 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
4468 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 1, S("a1bcdefghijklmnopqrst"));
4469 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 5, S("a12345bcdefghijklmnopqrst"));
4470 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 9, S("a123456789bcdefghijklmnopqrst"));
4471 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 10, S("a1234567890bcdefghijklmnopqrst"));
4472 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 10, 11, S("a1234567890bcdefghijklmnopqrst"));
4473 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
4474 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 19, 1, S("a0bcdefghijklmnopqrst"));
4475 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 19, 2, S("a0bcdefghijklmnopqrst"));
4476 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
4477 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
4478 test(S("abcdefghijklmnopqrst"), 1, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
4479 test(S("abcdefghijklmnopqrst"), 1, 1, S(""), 0, 0, S("acdefghijklmnopqrst"));
4480 test(S("abcdefghijklmnopqrst"), 1, 1, S(""), 0, 1, S("acdefghijklmnopqrst"));
4481 test(S("abcdefghijklmnopqrst"), 1, 1, S(""), 1, 0, S("can't happen"));
4482 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 0, S("acdefghijklmnopqrst"));
4483 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 1, S("a1cdefghijklmnopqrst"));
4484 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 2, S("a12cdefghijklmnopqrst"));
4485 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 4, S("a1234cdefghijklmnopqrst"));
4486 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 5, S("a12345cdefghijklmnopqrst"));
4487 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 0, 6, S("a12345cdefghijklmnopqrst"));
4488 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 0, S("acdefghijklmnopqrst"));
4489 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 1, S("a2cdefghijklmnopqrst"));
4490 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 2, S("a23cdefghijklmnopqrst"));
4491 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 3, S("a234cdefghijklmnopqrst"));
4492 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 4, S("a2345cdefghijklmnopqrst"));
4493 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 1, 5, S("a2345cdefghijklmnopqrst"));
4494 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 2, 0, S("acdefghijklmnopqrst"));
4495 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 2, 1, S("a3cdefghijklmnopqrst"));
4496 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 2, 2, S("a34cdefghijklmnopqrst"));
4497 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 2, 3, S("a345cdefghijklmnopqrst"));
4498 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 2, 4, S("a345cdefghijklmnopqrst"));
4499 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 4, 0, S("acdefghijklmnopqrst"));
4500 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 4, 1, S("a5cdefghijklmnopqrst"));
4501 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 4, 2, S("a5cdefghijklmnopqrst"));
4502 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 5, 0, S("acdefghijklmnopqrst"));
4503 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 5, 1, S("acdefghijklmnopqrst"));
4504 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345"), 6, 0, S("can't happen"));
4505 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 0, S("acdefghijklmnopqrst"));
4506 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
4507 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 5, S("a12345cdefghijklmnopqrst"));
4508 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 9, S("a123456789cdefghijklmnopqrst"));
4509 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
4510 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 0, 11, S("a1234567890cdefghijklmnopqrst"));
4511 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 0, S("acdefghijklmnopqrst"));
4512 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
4513 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 4, S("a2345cdefghijklmnopqrst"));
4514 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 8, S("a23456789cdefghijklmnopqrst"));
4515 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
4516 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 1, 10, S("a234567890cdefghijklmnopqrst"));
4517 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 0, S("acdefghijklmnopqrst"));
4518 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 1, S("a6cdefghijklmnopqrst"));
4519 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 2, S("a67cdefghijklmnopqrst"));
4520 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 4, S("a6789cdefghijklmnopqrst"));
4521 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 5, S("a67890cdefghijklmnopqrst"));
4522 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 5, 6, S("a67890cdefghijklmnopqrst"));
4523 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 9, 0, S("acdefghijklmnopqrst"));
4524 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 9, 1, S("a0cdefghijklmnopqrst"));
4525 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 9, 2, S("a0cdefghijklmnopqrst"));
4526 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 10, 0, S("acdefghijklmnopqrst"));
4527 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 10, 1, S("acdefghijklmnopqrst"));
4528 test(S("abcdefghijklmnopqrst"), 1, 1, S("1234567890"), 11, 0, S("can't happen"));
4529 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 0, S("acdefghijklmnopqrst"));
4530 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
4531 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
4532 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghijklmnopqrst"));
4533 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghijklmnopqrst"));
4534 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghijklmnopqrst"));
4535 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 0, S("acdefghijklmnopqrst"));
4536 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
4537 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
4538 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 18, S("a234567890123456789cdefghijklmnopqrst"));
4539 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghijklmnopqrst"));
4540 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghijklmnopqrst"));
4541 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 0, S("acdefghijklmnopqrst"));
4542 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 1, S("a1cdefghijklmnopqrst"));
4543 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 5, S("a12345cdefghijklmnopqrst"));
4544 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 9, S("a123456789cdefghijklmnopqrst"));
4545 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 10, S("a1234567890cdefghijklmnopqrst"));
4546 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 10, 11, S("a1234567890cdefghijklmnopqrst"));
4547 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 19, 0, S("acdefghijklmnopqrst"));
4548 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 19, 1, S("a0cdefghijklmnopqrst"));
4549 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 19, 2, S("a0cdefghijklmnopqrst"));
4550 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 20, 0, S("acdefghijklmnopqrst"));
4551 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 20, 1, S("acdefghijklmnopqrst"));
4552 test(S("abcdefghijklmnopqrst"), 1, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
4553 test(S("abcdefghijklmnopqrst"), 1, 9, S(""), 0, 0, S("aklmnopqrst"));
4554 test(S("abcdefghijklmnopqrst"), 1, 9, S(""), 0, 1, S("aklmnopqrst"));
4555 test(S("abcdefghijklmnopqrst"), 1, 9, S(""), 1, 0, S("can't happen"));
4556 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 0, S("aklmnopqrst"));
4557 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 1, S("a1klmnopqrst"));
4558 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 2, S("a12klmnopqrst"));
4559 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 4, S("a1234klmnopqrst"));
4560 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 5, S("a12345klmnopqrst"));
4566 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 0, 6, S("a12345klmnopqrst"));
4567 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 0, S("aklmnopqrst"));
4568 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 1, S("a2klmnopqrst"));
4569 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 2, S("a23klmnopqrst"));
4570 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 3, S("a234klmnopqrst"));
4571 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 4, S("a2345klmnopqrst"));
4572 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 1, 5, S("a2345klmnopqrst"));
4573 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 2, 0, S("aklmnopqrst"));
4574 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 2, 1, S("a3klmnopqrst"));
4575 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 2, 2, S("a34klmnopqrst"));
4576 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 2, 3, S("a345klmnopqrst"));
4577 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 2, 4, S("a345klmnopqrst"));
4578 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 4, 0, S("aklmnopqrst"));
4579 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 4, 1, S("a5klmnopqrst"));
4580 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 4, 2, S("a5klmnopqrst"));
4581 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 5, 0, S("aklmnopqrst"));
4582 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 5, 1, S("aklmnopqrst"));
4583 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345"), 6, 0, S("can't happen"));
4584 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 0, S("aklmnopqrst"));
4585 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 1, S("a1klmnopqrst"));
4586 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 5, S("a12345klmnopqrst"));
4587 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 9, S("a123456789klmnopqrst"));
4588 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 10, S("a1234567890klmnopqrst"));
4589 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 0, 11, S("a1234567890klmnopqrst"));
4590 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 0, S("aklmnopqrst"));
4591 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 1, S("a2klmnopqrst"));
4592 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 4, S("a2345klmnopqrst"));
4593 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 8, S("a23456789klmnopqrst"));
4594 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 9, S("a234567890klmnopqrst"));
4595 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 1, 10, S("a234567890klmnopqrst"));
4596 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 0, S("aklmnopqrst"));
4597 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 1, S("a6klmnopqrst"));
4598 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 2, S("a67klmnopqrst"));
4599 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 4, S("a6789klmnopqrst"));
4600 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 5, S("a67890klmnopqrst"));
4601 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 5, 6, S("a67890klmnopqrst"));
4602 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 9, 0, S("aklmnopqrst"));
4603 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 9, 1, S("a0klmnopqrst"));
4604 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 9, 2, S("a0klmnopqrst"));
4605 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 10, 0, S("aklmnopqrst"));
4606 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 10, 1, S("aklmnopqrst"));
4607 test(S("abcdefghijklmnopqrst"), 1, 9, S("1234567890"), 11, 0, S("can't happen"));
4608 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 0, S("aklmnopqrst"));
4609 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 1, S("a1klmnopqrst"));
4610 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 10, S("a1234567890klmnopqrst"));
4611 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 19, S("a1234567890123456789klmnopqrst"));
4612 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 20, S("a12345678901234567890klmnopqrst"));
4613 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 0, 21, S("a12345678901234567890klmnopqrst"));
4614 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 0, S("aklmnopqrst"));
4615 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 1, S("a2klmnopqrst"));
4616 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 9, S("a234567890klmnopqrst"));
4617 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 18, S("a234567890123456789klmnopqrst"));
4618 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 19, S("a2345678901234567890klmnopqrst"));
4619 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 1, 20, S("a2345678901234567890klmnopqrst"));
4620 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 0, S("aklmnopqrst"));
4621 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 1, S("a1klmnopqrst"));
4622 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 5, S("a12345klmnopqrst"));
4623 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 9, S("a123456789klmnopqrst"));
4624 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 10, S("a1234567890klmnopqrst"));
4625 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 10, 11, S("a1234567890klmnopqrst"));
4626 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 19, 0, S("aklmnopqrst"));
4627 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 19, 1, S("a0klmnopqrst"));
4628 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 19, 2, S("a0klmnopqrst"));
4629 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 20, 0, S("aklmnopqrst"));
4630 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 20, 1, S("aklmnopqrst"));
4631 test(S("abcdefghijklmnopqrst"), 1, 9, S("12345678901234567890"), 21, 0, S("can't happen"));
4632 test(S("abcdefghijklmnopqrst"), 1, 18, S(""), 0, 0, S("at"));
4633 test(S("abcdefghijklmnopqrst"), 1, 18, S(""), 0, 1, S("at"));
4634 test(S("abcdefghijklmnopqrst"), 1, 18, S(""), 1, 0, S("can't happen"));
4635 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 0, S("at"));
4636 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 1, S("a1t"));
4637 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 2, S("a12t"));
4638 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 4, S("a1234t"));
4639 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 5, S("a12345t"));
4640 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 0, 6, S("a12345t"));
4641 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 0, S("at"));
4642 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 1, S("a2t"));
4643 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 2, S("a23t"));
4644 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 3, S("a234t"));
4645 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 4, S("a2345t"));
4646 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 1, 5, S("a2345t"));
4647 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 2, 0, S("at"));
4648 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 2, 1, S("a3t"));
4649 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 2, 2, S("a34t"));
4650 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 2, 3, S("a345t"));
4651 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 2, 4, S("a345t"));
4652 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 4, 0, S("at"));
4653 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 4, 1, S("a5t"));
4654 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 4, 2, S("a5t"));
4655 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 5, 0, S("at"));
4656 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 5, 1, S("at"));
4657 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345"), 6, 0, S("can't happen"));
4658 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 0, S("at"));
4659 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 1, S("a1t"));
4660 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 5, S("a12345t"));
4661 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 9, S("a123456789t"));
4662 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 10, S("a1234567890t"));
4663 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 0, 11, S("a1234567890t"));
4664 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 0, S("at"));
4665 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 1, S("a2t"));
4671 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 4, S("a2345t"));
4672 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 8, S("a23456789t"));
4673 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 9, S("a234567890t"));
4674 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 1, 10, S("a234567890t"));
4675 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 0, S("at"));
4676 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 1, S("a6t"));
4677 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 2, S("a67t"));
4678 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 4, S("a6789t"));
4679 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 5, S("a67890t"));
4680 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 5, 6, S("a67890t"));
4681 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 9, 0, S("at"));
4682 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 9, 1, S("a0t"));
4683 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 9, 2, S("a0t"));
4684 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 10, 0, S("at"));
4685 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 10, 1, S("at"));
4686 test(S("abcdefghijklmnopqrst"), 1, 18, S("1234567890"), 11, 0, S("can't happen"));
4687 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 0, S("at"));
4688 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 1, S("a1t"));
4689 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 10, S("a1234567890t"));
4690 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 19, S("a1234567890123456789t"));
4691 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 20, S("a12345678901234567890t"));
4692 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 0, 21, S("a12345678901234567890t"));
4693 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 0, S("at"));
4694 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 1, S("a2t"));
4695 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 9, S("a234567890t"));
4696 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 18, S("a234567890123456789t"));
4697 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 19, S("a2345678901234567890t"));
4698 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 1, 20, S("a2345678901234567890t"));
4699 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 0, S("at"));
4700 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 1, S("a1t"));
4701 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 5, S("a12345t"));
4702 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 9, S("a123456789t"));
4703 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 10, S("a1234567890t"));
4704 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 10, 11, S("a1234567890t"));
4705 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 19, 0, S("at"));
4706 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 19, 1, S("a0t"));
4707 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 19, 2, S("a0t"));
4708 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 20, 0, S("at"));
4709 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 20, 1, S("at"));
4710 test(S("abcdefghijklmnopqrst"), 1, 18, S("12345678901234567890"), 21, 0, S("can't happen"));
4711 test(S("abcdefghijklmnopqrst"), 1, 19, S(""), 0, 0, S("a"));
4712 test(S("abcdefghijklmnopqrst"), 1, 19, S(""), 0, 1, S("a"));
4713 test(S("abcdefghijklmnopqrst"), 1, 19, S(""), 1, 0, S("can't happen"));
4714 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 0, S("a"));
4715 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 1, S("a1"));
4716 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 2, S("a12"));
4717 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 4, S("a1234"));
4718 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 5, S("a12345"));
4719 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 0, 6, S("a12345"));
4720 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 0, S("a"));
4721 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 1, S("a2"));
4722 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 2, S("a23"));
4723 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 3, S("a234"));
4724 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 4, S("a2345"));
4725 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 1, 5, S("a2345"));
4726 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 2, 0, S("a"));
4727 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 2, 1, S("a3"));
4728 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 2, 2, S("a34"));
4729 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 2, 3, S("a345"));
4730 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 2, 4, S("a345"));
4731 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 4, 0, S("a"));
4732 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 4, 1, S("a5"));
4733 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 4, 2, S("a5"));
4734 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 5, 0, S("a"));
4735 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 5, 1, S("a"));
4736 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345"), 6, 0, S("can't happen"));
4737 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 0, S("a"));
4738 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 1, S("a1"));
4739 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 5, S("a12345"));
4740 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 9, S("a123456789"));
4741 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 10, S("a1234567890"));
4742 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 0, 11, S("a1234567890"));
4743 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 0, S("a"));
4744 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 1, S("a2"));
4745 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 4, S("a2345"));
4746 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 8, S("a23456789"));
4747 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 9, S("a234567890"));
4748 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 1, 10, S("a234567890"));
4749 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 0, S("a"));
4750 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 1, S("a6"));
4751 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 2, S("a67"));
4752 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 4, S("a6789"));
4753 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 5, S("a67890"));
4754 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 5, 6, S("a67890"));
4755 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 9, 0, S("a"));
4756 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 9, 1, S("a0"));
4757 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 9, 2, S("a0"));
4758 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 10, 0, S("a"));
4759 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 10, 1, S("a"));
4760 test(S("abcdefghijklmnopqrst"), 1, 19, S("1234567890"), 11, 0, S("can't happen"));
4761 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 0, S("a"));
4762 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 1, S("a1"));
4763 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 10, S("a1234567890"));
4764 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
4765 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
4766 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
4767 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 0, S("a"));
4768 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 1, S("a2"));
4769 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 9, S("a234567890"));
4770 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
4776 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
4777 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
4778 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 0, S("a"));
4779 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 1, S("a1"));
4780 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 5, S("a12345"));
4781 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 9, S("a123456789"));
4782 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 10, S("a1234567890"));
4783 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 10, 11, S("a1234567890"));
4784 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 19, 0, S("a"));
4785 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 19, 1, S("a0"));
4786 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 19, 2, S("a0"));
4787 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 20, 0, S("a"));
4788 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 20, 1, S("a"));
4789 test(S("abcdefghijklmnopqrst"), 1, 19, S("12345678901234567890"), 21, 0, S("can't happen"));
4790 test(S("abcdefghijklmnopqrst"), 1, 20, S(""), 0, 0, S("a"));
4791 test(S("abcdefghijklmnopqrst"), 1, 20, S(""), 0, 1, S("a"));
4792 test(S("abcdefghijklmnopqrst"), 1, 20, S(""), 1, 0, S("can't happen"));
4793 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 0, S("a"));
4794 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 1, S("a1"));
4795 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 2, S("a12"));
4796 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 4, S("a1234"));
4797 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 5, S("a12345"));
4798 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 0, 6, S("a12345"));
4799 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 0, S("a"));
4800 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 1, S("a2"));
4801 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 2, S("a23"));
4802 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 3, S("a234"));
4803 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 4, S("a2345"));
4804 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 1, 5, S("a2345"));
4805 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 2, 0, S("a"));
4806 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 2, 1, S("a3"));
4807 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 2, 2, S("a34"));
4808 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 2, 3, S("a345"));
4809 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 2, 4, S("a345"));
4810 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 4, 0, S("a"));
4811 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 4, 1, S("a5"));
4812 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 4, 2, S("a5"));
4813 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 5, 0, S("a"));
4814 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 5, 1, S("a"));
4815 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345"), 6, 0, S("can't happen"));
4816 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 0, S("a"));
4817 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 1, S("a1"));
4818 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 5, S("a12345"));
4819 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 9, S("a123456789"));
4820 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 10, S("a1234567890"));
4821 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 0, 11, S("a1234567890"));
4822 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 0, S("a"));
4823 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 1, S("a2"));
4824 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 4, S("a2345"));
4825 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 8, S("a23456789"));
4826 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 9, S("a234567890"));
4827 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 1, 10, S("a234567890"));
4828 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 0, S("a"));
4829 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 1, S("a6"));
4830 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 2, S("a67"));
4831 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 4, S("a6789"));
4832 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 5, S("a67890"));
4833 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 5, 6, S("a67890"));
4834 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 9, 0, S("a"));
4835 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 9, 1, S("a0"));
4836 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 9, 2, S("a0"));
4837 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 10, 0, S("a"));
4838 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 10, 1, S("a"));
4839 test(S("abcdefghijklmnopqrst"), 1, 20, S("1234567890"), 11, 0, S("can't happen"));
4840 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 0, S("a"));
4841 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 1, S("a1"));
4842 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 10, S("a1234567890"));
4843 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 19, S("a1234567890123456789"));
4844 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 20, S("a12345678901234567890"));
4845 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 0, 21, S("a12345678901234567890"));
4846 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 0, S("a"));
4847 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 1, S("a2"));
4848 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 9, S("a234567890"));
4849 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 18, S("a234567890123456789"));
4850 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 19, S("a2345678901234567890"));
4851 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 1, 20, S("a2345678901234567890"));
4852 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 0, S("a"));
4853 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 1, S("a1"));
4854 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 5, S("a12345"));
4855 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 9, S("a123456789"));
4856 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 10, S("a1234567890"));
4857 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 10, 11, S("a1234567890"));
4858 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 19, 0, S("a"));
4859 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 19, 1, S("a0"));
4860 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 19, 2, S("a0"));
4861 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 20, 0, S("a"));
4862 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 20, 1, S("a"));
4863 test(S("abcdefghijklmnopqrst"), 1, 20, S("12345678901234567890"), 21, 0, S("can't happen"));
4864 test(S("abcdefghijklmnopqrst"), 10, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
4865 test(S("abcdefghijklmnopqrst"), 10, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
4866 test(S("abcdefghijklmnopqrst"), 10, 0, S(""), 1, 0, S("can't happen"));
4867 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
4868 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 1, S("abcdefghij1klmnopqrst"));
4869 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 2, S("abcdefghij12klmnopqrst"));
4870 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 4, S("abcdefghij1234klmnopqrst"));
4871 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 5, S("abcdefghij12345klmnopqrst"));
4872 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 0, 6, S("abcdefghij12345klmnopqrst"));
4873 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
4874 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 1, S("abcdefghij2klmnopqrst"));
4875 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
4881 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
4882 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
4883 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
4884 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
4885 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
4886 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
4887 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 2, 3, S("abcdefghij345klmnopqrst"));
4888 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 2, 4, S("abcdefghij345klmnopqrst"));
4889 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
4890 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 4, 1, S("abcdefghij5klmnopqrst"));
4891 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 4, 2, S("abcdefghij5klmnopqrst"));
4892 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
4893 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
4894 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345"), 6, 0, S("can't happen"));
4895 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
4896 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
4897 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 5, S("abcdefghij12345klmnopqrst"));
4898 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 9, S("abcdefghij123456789klmnopqrst"));
4899 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
4900 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 0, 11, S("abcdefghij1234567890klmnopqrst"));
4901 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
4902 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
4903 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 4, S("abcdefghij2345klmnopqrst"));
4904 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 8, S("abcdefghij23456789klmnopqrst"));
4905 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
4906 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 1, 10, S("abcdefghij234567890klmnopqrst"));
4907 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
4908 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 1, S("abcdefghij6klmnopqrst"));
4909 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 2, S("abcdefghij67klmnopqrst"));
4910 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 4, S("abcdefghij6789klmnopqrst"));
4911 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 5, S("abcdefghij67890klmnopqrst"));
4912 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 5, 6, S("abcdefghij67890klmnopqrst"));
4913 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
4914 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 9, 1, S("abcdefghij0klmnopqrst"));
4915 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 9, 2, S("abcdefghij0klmnopqrst"));
4916 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
4917 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
4918 test(S("abcdefghijklmnopqrst"), 10, 0, S("1234567890"), 11, 0, S("can't happen"));
4919 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
4920 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
4921 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
4922 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789klmnopqrst"));
4923 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890klmnopqrst"));
4924 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890klmnopqrst"));
4925 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
4926 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
4927 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
4928 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789klmnopqrst"));
4929 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890klmnopqrst"));
4930 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890klmnopqrst"));
4931 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
4932 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
4933 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
4934 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
4935 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
4936 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
4937 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
4938 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 19, 1, S("abcdefghij0klmnopqrst"));
4939 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 19, 2, S("abcdefghij0klmnopqrst"));
4940 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
4941 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
4942 test(S("abcdefghijklmnopqrst"), 10, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
4943 test(S("abcdefghijklmnopqrst"), 10, 1, S(""), 0, 0, S("abcdefghijlmnopqrst"));
4944 test(S("abcdefghijklmnopqrst"), 10, 1, S(""), 0, 1, S("abcdefghijlmnopqrst"));
4945 test(S("abcdefghijklmnopqrst"), 10, 1, S(""), 1, 0, S("can't happen"));
4946 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 0, S("abcdefghijlmnopqrst"));
4947 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 1, S("abcdefghij1lmnopqrst"));
4948 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 2, S("abcdefghij12lmnopqrst"));
4949 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 4, S("abcdefghij1234lmnopqrst"));
4950 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 5, S("abcdefghij12345lmnopqrst"));
4951 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 0, 6, S("abcdefghij12345lmnopqrst"));
4952 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 0, S("abcdefghijlmnopqrst"));
4953 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 1, S("abcdefghij2lmnopqrst"));
4954 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 2, S("abcdefghij23lmnopqrst"));
4955 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 3, S("abcdefghij234lmnopqrst"));
4956 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 4, S("abcdefghij2345lmnopqrst"));
4957 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 1, 5, S("abcdefghij2345lmnopqrst"));
4958 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 2, 0, S("abcdefghijlmnopqrst"));
4959 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 2, 1, S("abcdefghij3lmnopqrst"));
4960 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 2, 2, S("abcdefghij34lmnopqrst"));
4961 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 2, 3, S("abcdefghij345lmnopqrst"));
4962 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 2, 4, S("abcdefghij345lmnopqrst"));
4963 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 4, 0, S("abcdefghijlmnopqrst"));
4964 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 4, 1, S("abcdefghij5lmnopqrst"));
4965 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 4, 2, S("abcdefghij5lmnopqrst"));
4966 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 5, 0, S("abcdefghijlmnopqrst"));
4967 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 5, 1, S("abcdefghijlmnopqrst"));
4968 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345"), 6, 0, S("can't happen"));
4969 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 0, S("abcdefghijlmnopqrst"));
4970 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
4971 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 5, S("abcdefghij12345lmnopqrst"));
4972 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 9, S("abcdefghij123456789lmnopqrst"));
4973 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
4974 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 0, 11, S("abcdefghij1234567890lmnopqrst"));
4975 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 0, S("abcdefghijlmnopqrst"));
4976 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
4977 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 4, S("abcdefghij2345lmnopqrst"));
4978 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst"));
4979 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
4980 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst"));
4986 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 0, S("abcdefghijlmnopqrst"));
4987 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 1, S("abcdefghij6lmnopqrst"));
4988 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 2, S("abcdefghij67lmnopqrst"));
4989 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 4, S("abcdefghij6789lmnopqrst"));
4990 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 5, S("abcdefghij67890lmnopqrst"));
4991 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 5, 6, S("abcdefghij67890lmnopqrst"));
4992 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 9, 0, S("abcdefghijlmnopqrst"));
4993 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 9, 1, S("abcdefghij0lmnopqrst"));
4994 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 9, 2, S("abcdefghij0lmnopqrst"));
4995 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 10, 0, S("abcdefghijlmnopqrst"));
4996 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 10, 1, S("abcdefghijlmnopqrst"));
4997 test(S("abcdefghijklmnopqrst"), 10, 1, S("1234567890"), 11, 0, S("can't happen"));
4998 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 0, S("abcdefghijlmnopqrst"));
4999 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
5000 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
5001 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789lmnopqrst"));
5002 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890lmnopqrst"));
5003 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890lmnopqrst"));
5004 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 0, S("abcdefghijlmnopqrst"));
5005 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
5006 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
5007 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789lmnopqrst"));
5008 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890lmnopqrst"));
5009 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890lmnopqrst"));
5010 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 0, S("abcdefghijlmnopqrst"));
5011 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 1, S("abcdefghij1lmnopqrst"));
5012 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 5, S("abcdefghij12345lmnopqrst"));
5013 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 9, S("abcdefghij123456789lmnopqrst"));
5014 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890lmnopqrst"));
5015 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890lmnopqrst"));
5016 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 19, 0, S("abcdefghijlmnopqrst"));
5017 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 19, 1, S("abcdefghij0lmnopqrst"));
5018 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 19, 2, S("abcdefghij0lmnopqrst"));
5019 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 20, 0, S("abcdefghijlmnopqrst"));
5020 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 20, 1, S("abcdefghijlmnopqrst"));
5021 test(S("abcdefghijklmnopqrst"), 10, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
5022 test(S("abcdefghijklmnopqrst"), 10, 5, S(""), 0, 0, S("abcdefghijpqrst"));
5023 test(S("abcdefghijklmnopqrst"), 10, 5, S(""), 0, 1, S("abcdefghijpqrst"));
5024 test(S("abcdefghijklmnopqrst"), 10, 5, S(""), 1, 0, S("can't happen"));
5025 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 0, S("abcdefghijpqrst"));
5026 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 1, S("abcdefghij1pqrst"));
5027 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 2, S("abcdefghij12pqrst"));
5028 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 4, S("abcdefghij1234pqrst"));
5029 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 5, S("abcdefghij12345pqrst"));
5030 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 0, 6, S("abcdefghij12345pqrst"));
5031 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 0, S("abcdefghijpqrst"));
5032 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 1, S("abcdefghij2pqrst"));
5033 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 2, S("abcdefghij23pqrst"));
5034 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 3, S("abcdefghij234pqrst"));
5035 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 4, S("abcdefghij2345pqrst"));
5036 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 1, 5, S("abcdefghij2345pqrst"));
5037 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 2, 0, S("abcdefghijpqrst"));
5038 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 2, 1, S("abcdefghij3pqrst"));
5039 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 2, 2, S("abcdefghij34pqrst"));
5040 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 2, 3, S("abcdefghij345pqrst"));
5041 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 2, 4, S("abcdefghij345pqrst"));
5042 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 4, 0, S("abcdefghijpqrst"));
5043 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 4, 1, S("abcdefghij5pqrst"));
5044 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 4, 2, S("abcdefghij5pqrst"));
5045 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 5, 0, S("abcdefghijpqrst"));
5046 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 5, 1, S("abcdefghijpqrst"));
5047 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345"), 6, 0, S("can't happen"));
5048 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 0, S("abcdefghijpqrst"));
5049 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 1, S("abcdefghij1pqrst"));
5050 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 5, S("abcdefghij12345pqrst"));
5051 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 9, S("abcdefghij123456789pqrst"));
5052 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
5053 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 0, 11, S("abcdefghij1234567890pqrst"));
5054 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 0, S("abcdefghijpqrst"));
5055 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 1, S("abcdefghij2pqrst"));
5056 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 4, S("abcdefghij2345pqrst"));
5057 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 8, S("abcdefghij23456789pqrst"));
5058 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 9, S("abcdefghij234567890pqrst"));
5059 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 1, 10, S("abcdefghij234567890pqrst"));
5060 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 0, S("abcdefghijpqrst"));
5061 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 1, S("abcdefghij6pqrst"));
5062 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 2, S("abcdefghij67pqrst"));
5063 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 4, S("abcdefghij6789pqrst"));
5064 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 5, S("abcdefghij67890pqrst"));
5065 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 5, 6, S("abcdefghij67890pqrst"));
5066 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 9, 0, S("abcdefghijpqrst"));
5067 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 9, 1, S("abcdefghij0pqrst"));
5068 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 9, 2, S("abcdefghij0pqrst"));
5069 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 10, 0, S("abcdefghijpqrst"));
5070 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 10, 1, S("abcdefghijpqrst"));
5071 test(S("abcdefghijklmnopqrst"), 10, 5, S("1234567890"), 11, 0, S("can't happen"));
5072 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 0, S("abcdefghijpqrst"));
5073 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 1, S("abcdefghij1pqrst"));
5074 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
5075 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789pqrst"));
5076 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890pqrst"));
5077 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890pqrst"));
5078 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 0, S("abcdefghijpqrst"));
5079 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 1, S("abcdefghij2pqrst"));
5080 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 9, S("abcdefghij234567890pqrst"));
5081 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789pqrst"));
5082 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890pqrst"));
5083 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst"));
5084 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 0, S("abcdefghijpqrst"));
5085 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 1, S("abcdefghij1pqrst"));
5091 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst"));
5092 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst"));
5093 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890pqrst"));
5094 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890pqrst"));
5095 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 19, 0, S("abcdefghijpqrst"));
5096 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 19, 1, S("abcdefghij0pqrst"));
5097 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 19, 2, S("abcdefghij0pqrst"));
5098 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 20, 0, S("abcdefghijpqrst"));
5099 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 20, 1, S("abcdefghijpqrst"));
5100 test(S("abcdefghijklmnopqrst"), 10, 5, S("12345678901234567890"), 21, 0, S("can't happen"));
5101 test(S("abcdefghijklmnopqrst"), 10, 9, S(""), 0, 0, S("abcdefghijt"));
5102 test(S("abcdefghijklmnopqrst"), 10, 9, S(""), 0, 1, S("abcdefghijt"));
5103 test(S("abcdefghijklmnopqrst"), 10, 9, S(""), 1, 0, S("can't happen"));
5104 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 0, S("abcdefghijt"));
5105 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 1, S("abcdefghij1t"));
5106 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 2, S("abcdefghij12t"));
5107 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 4, S("abcdefghij1234t"));
5108 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 5, S("abcdefghij12345t"));
5109 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 0, 6, S("abcdefghij12345t"));
5110 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 0, S("abcdefghijt"));
5111 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 1, S("abcdefghij2t"));
5112 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 2, S("abcdefghij23t"));
5113 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 3, S("abcdefghij234t"));
5114 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 4, S("abcdefghij2345t"));
5115 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 1, 5, S("abcdefghij2345t"));
5116 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 2, 0, S("abcdefghijt"));
5117 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 2, 1, S("abcdefghij3t"));
5118 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 2, 2, S("abcdefghij34t"));
5119 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 2, 3, S("abcdefghij345t"));
5120 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 2, 4, S("abcdefghij345t"));
5121 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 4, 0, S("abcdefghijt"));
5122 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 4, 1, S("abcdefghij5t"));
5123 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 4, 2, S("abcdefghij5t"));
5124 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 5, 0, S("abcdefghijt"));
5125 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 5, 1, S("abcdefghijt"));
5126 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345"), 6, 0, S("can't happen"));
5127 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 0, S("abcdefghijt"));
5128 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 1, S("abcdefghij1t"));
5129 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 5, S("abcdefghij12345t"));
5130 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 9, S("abcdefghij123456789t"));
5131 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 10, S("abcdefghij1234567890t"));
5132 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 0, 11, S("abcdefghij1234567890t"));
5133 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 0, S("abcdefghijt"));
5134 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 1, S("abcdefghij2t"));
5135 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 4, S("abcdefghij2345t"));
5136 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 8, S("abcdefghij23456789t"));
5137 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 9, S("abcdefghij234567890t"));
5138 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 1, 10, S("abcdefghij234567890t"));
5139 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 0, S("abcdefghijt"));
5140 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 1, S("abcdefghij6t"));
5141 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 2, S("abcdefghij67t"));
5142 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 4, S("abcdefghij6789t"));
5143 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 5, S("abcdefghij67890t"));
5144 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 5, 6, S("abcdefghij67890t"));
5145 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 9, 0, S("abcdefghijt"));
5146 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 9, 1, S("abcdefghij0t"));
5147 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 9, 2, S("abcdefghij0t"));
5148 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 10, 0, S("abcdefghijt"));
5149 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 10, 1, S("abcdefghijt"));
5150 test(S("abcdefghijklmnopqrst"), 10, 9, S("1234567890"), 11, 0, S("can't happen"));
5151 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 0, S("abcdefghijt"));
5152 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 1, S("abcdefghij1t"));
5153 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890t"));
5154 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789t"));
5155 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890t"));
5156 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890t"));
5157 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 0, S("abcdefghijt"));
5158 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 1, S("abcdefghij2t"));
5159 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 9, S("abcdefghij234567890t"));
5160 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789t"));
5161 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890t"));
5162 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890t"));
5163 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 0, S("abcdefghijt"));
5164 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 1, S("abcdefghij1t"));
5165 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 5, S("abcdefghij12345t"));
5166 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 9, S("abcdefghij123456789t"));
5167 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890t"));
5168 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890t"));
5169 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 19, 0, S("abcdefghijt"));
5170 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 19, 1, S("abcdefghij0t"));
5171 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 19, 2, S("abcdefghij0t"));
5172 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 20, 0, S("abcdefghijt"));
5173 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 20, 1, S("abcdefghijt"));
5174 test(S("abcdefghijklmnopqrst"), 10, 9, S("12345678901234567890"), 21, 0, S("can't happen"));
5175 test(S("abcdefghijklmnopqrst"), 10, 10, S(""), 0, 0, S("abcdefghij"));
5176 test(S("abcdefghijklmnopqrst"), 10, 10, S(""), 0, 1, S("abcdefghij"));
5177 test(S("abcdefghijklmnopqrst"), 10, 10, S(""), 1, 0, S("can't happen"));
5178 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 0, S("abcdefghij"));
5179 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 1, S("abcdefghij1"));
5180 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 2, S("abcdefghij12"));
5181 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 4, S("abcdefghij1234"));
5182 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 5, S("abcdefghij12345"));
5183 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 0, 6, S("abcdefghij12345"));
5184 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 0, S("abcdefghij"));
5185 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 1, S("abcdefghij2"));
5186 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 2, S("abcdefghij23"));
5187 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 3, S("abcdefghij234"));
5188 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 4, S("abcdefghij2345"));
5189 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 1, 5, S("abcdefghij2345"));
5190 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 0, S("abcdefghij"));
5196 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 1, S("abcdefghij3"));
5197 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 2, S("abcdefghij34"));
5198 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 3, S("abcdefghij345"));
5199 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 2, 4, S("abcdefghij345"));
5200 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 4, 0, S("abcdefghij"));
5201 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 4, 1, S("abcdefghij5"));
5202 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 4, 2, S("abcdefghij5"));
5203 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 5, 0, S("abcdefghij"));
5204 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 5, 1, S("abcdefghij"));
5205 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345"), 6, 0, S("can't happen"));
5206 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 0, S("abcdefghij"));
5207 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 1, S("abcdefghij1"));
5208 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 5, S("abcdefghij12345"));
5209 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 9, S("abcdefghij123456789"));
5210 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 10, S("abcdefghij1234567890"));
5211 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 0, 11, S("abcdefghij1234567890"));
5212 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 0, S("abcdefghij"));
5213 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 1, S("abcdefghij2"));
5214 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 4, S("abcdefghij2345"));
5215 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 8, S("abcdefghij23456789"));
5216 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 9, S("abcdefghij234567890"));
5217 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 1, 10, S("abcdefghij234567890"));
5218 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 0, S("abcdefghij"));
5219 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 1, S("abcdefghij6"));
5220 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 2, S("abcdefghij67"));
5221 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 4, S("abcdefghij6789"));
5222 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 5, S("abcdefghij67890"));
5223 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 5, 6, S("abcdefghij67890"));
5224 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 9, 0, S("abcdefghij"));
5225 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 9, 1, S("abcdefghij0"));
5226 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 9, 2, S("abcdefghij0"));
5227 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 10, 0, S("abcdefghij"));
5228 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 10, 1, S("abcdefghij"));
5229 test(S("abcdefghijklmnopqrst"), 10, 10, S("1234567890"), 11, 0, S("can't happen"));
5230 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 0, S("abcdefghij"));
5231 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 1, S("abcdefghij1"));
5232 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
5233 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
5234 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
5235 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
5236 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 0, S("abcdefghij"));
5237 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 1, S("abcdefghij2"));
5238 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
5239 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
5240 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
5241 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
5242 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 0, S("abcdefghij"));
5243 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 1, S("abcdefghij1"));
5244 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 5, S("abcdefghij12345"));
5245 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
5246 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
5247 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
5248 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 19, 0, S("abcdefghij"));
5249 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 19, 1, S("abcdefghij0"));
5250 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 19, 2, S("abcdefghij0"));
5251 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 20, 0, S("abcdefghij"));
5252 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 20, 1, S("abcdefghij"));
5253 test(S("abcdefghijklmnopqrst"), 10, 10, S("12345678901234567890"), 21, 0, S("can't happen"));
5254 test(S("abcdefghijklmnopqrst"), 10, 11, S(""), 0, 0, S("abcdefghij"));
5255 test(S("abcdefghijklmnopqrst"), 10, 11, S(""), 0, 1, S("abcdefghij"));
5256 test(S("abcdefghijklmnopqrst"), 10, 11, S(""), 1, 0, S("can't happen"));
5257 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 0, S("abcdefghij"));
5258 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 1, S("abcdefghij1"));
5259 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 2, S("abcdefghij12"));
5260 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 4, S("abcdefghij1234"));
5261 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 5, S("abcdefghij12345"));
5262 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 0, 6, S("abcdefghij12345"));
5263 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 0, S("abcdefghij"));
5264 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 1, S("abcdefghij2"));
5265 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 2, S("abcdefghij23"));
5266 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 3, S("abcdefghij234"));
5267 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 4, S("abcdefghij2345"));
5268 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 1, 5, S("abcdefghij2345"));
5269 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 2, 0, S("abcdefghij"));
5270 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 2, 1, S("abcdefghij3"));
5271 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 2, 2, S("abcdefghij34"));
5272 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 2, 3, S("abcdefghij345"));
5273 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 2, 4, S("abcdefghij345"));
5274 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 4, 0, S("abcdefghij"));
5275 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 4, 1, S("abcdefghij5"));
5276 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 4, 2, S("abcdefghij5"));
5277 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 5, 0, S("abcdefghij"));
5278 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 5, 1, S("abcdefghij"));
5279 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345"), 6, 0, S("can't happen"));
5280 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 0, S("abcdefghij"));
5281 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 1, S("abcdefghij1"));
5282 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 5, S("abcdefghij12345"));
5283 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 9, S("abcdefghij123456789"));
5284 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 10, S("abcdefghij1234567890"));
5285 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 0, 11, S("abcdefghij1234567890"));
5286 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 0, S("abcdefghij"));
5287 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 1, S("abcdefghij2"));
5288 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 4, S("abcdefghij2345"));
5289 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 8, S("abcdefghij23456789"));
5290 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 9, S("abcdefghij234567890"));
5291 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 1, 10, S("abcdefghij234567890"));
5292 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 0, S("abcdefghij"));
5293 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 1, S("abcdefghij6"));
5294 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 2, S("abcdefghij67"));
5295 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 4, S("abcdefghij6789"));
5301 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 5, S("abcdefghij67890"));
5302 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 5, 6, S("abcdefghij67890"));
5303 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 9, 0, S("abcdefghij"));
5304 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 9, 1, S("abcdefghij0"));
5305 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 9, 2, S("abcdefghij0"));
5306 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 10, 0, S("abcdefghij"));
5307 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 10, 1, S("abcdefghij"));
5308 test(S("abcdefghijklmnopqrst"), 10, 11, S("1234567890"), 11, 0, S("can't happen"));
5309 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 0, S("abcdefghij"));
5310 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 1, S("abcdefghij1"));
5311 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
5312 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
5313 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
5314 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
5315 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 0, S("abcdefghij"));
5316 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 1, S("abcdefghij2"));
5317 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
5318 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
5319 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
5320 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
5321 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 0, S("abcdefghij"));
5322 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 1, S("abcdefghij1"));
5323 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 5, S("abcdefghij12345"));
5324 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
5325 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
5326 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
5327 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 19, 0, S("abcdefghij"));
5328 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 19, 1, S("abcdefghij0"));
5329 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 19, 2, S("abcdefghij0"));
5330 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 20, 0, S("abcdefghij"));
5331 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 20, 1, S("abcdefghij"));
5332 test(S("abcdefghijklmnopqrst"), 10, 11, S("12345678901234567890"), 21, 0, S("can't happen"));
5333 test(S("abcdefghijklmnopqrst"), 19, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
5334 test(S("abcdefghijklmnopqrst"), 19, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
5335 test(S("abcdefghijklmnopqrst"), 19, 0, S(""), 1, 0, S("can't happen"));
5336 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
5337 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 1, S("abcdefghijklmnopqrs1t"));
5338 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 2, S("abcdefghijklmnopqrs12t"));
5339 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 4, S("abcdefghijklmnopqrs1234t"));
5340 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 5, S("abcdefghijklmnopqrs12345t"));
5341 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 0, 6, S("abcdefghijklmnopqrs12345t"));
5342 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
5343 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 1, S("abcdefghijklmnopqrs2t"));
5344 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 2, S("abcdefghijklmnopqrs23t"));
5345 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 3, S("abcdefghijklmnopqrs234t"));
5346 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 4, S("abcdefghijklmnopqrs2345t"));
5347 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 1, 5, S("abcdefghijklmnopqrs2345t"));
5348 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
5349 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 2, 1, S("abcdefghijklmnopqrs3t"));
5350 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 2, 2, S("abcdefghijklmnopqrs34t"));
5351 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 2, 3, S("abcdefghijklmnopqrs345t"));
5352 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 2, 4, S("abcdefghijklmnopqrs345t"));
5353 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
5354 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 4, 1, S("abcdefghijklmnopqrs5t"));
5355 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 4, 2, S("abcdefghijklmnopqrs5t"));
5356 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
5357 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
5358 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345"), 6, 0, S("can't happen"));
5359 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5360 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
5361 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345t"));
5362 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789t"));
5363 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
5364 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890t"));
5365 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5366 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
5367 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345t"));
5368 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789t"));
5369 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
5370 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890t"));
5371 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
5372 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
5373 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
5374 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
5375 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
5376 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
5377 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
5378 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrs0t"));
5379 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrs0t"));
5380 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5381 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
5382 test(S("abcdefghijklmnopqrst"), 19, 0, S("1234567890"), 11, 0, S("can't happen"));
5383 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5384 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
5385 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
5386 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789t"));
5387 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890t"));
5388 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890t"));
5389 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5390 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
5391 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
5392 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789t"));
5393 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890t"));
5394 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890t"));
5395 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5396 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1t"));
5397 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345t"));
5398 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t"));
5399 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t"));
5400 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
5406 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
5407 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t"));
5408 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0t"));
5409 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
5410 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
5411 test(S("abcdefghijklmnopqrst"), 19, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
5412 test(S("abcdefghijklmnopqrst"), 19, 1, S(""), 0, 0, S("abcdefghijklmnopqrs"));
5413 test(S("abcdefghijklmnopqrst"), 19, 1, S(""), 0, 1, S("abcdefghijklmnopqrs"));
5414 test(S("abcdefghijklmnopqrst"), 19, 1, S(""), 1, 0, S("can't happen"));
5415 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 0, S("abcdefghijklmnopqrs"));
5416 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
5417 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
5418 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
5419 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
5420 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
5421 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 0, S("abcdefghijklmnopqrs"));
5422 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
5423 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
5424 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
5425 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
5426 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
5427 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 2, 0, S("abcdefghijklmnopqrs"));
5428 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
5429 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
5430 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
5431 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
5432 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 4, 0, S("abcdefghijklmnopqrs"));
5433 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
5434 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
5435 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 5, 0, S("abcdefghijklmnopqrs"));
5436 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 5, 1, S("abcdefghijklmnopqrs"));
5437 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345"), 6, 0, S("can't happen"));
5438 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
5439 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
5440 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
5441 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
5442 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
5443 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
5444 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
5445 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
5446 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
5447 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
5448 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
5449 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
5450 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
5451 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
5452 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
5453 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
5454 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
5455 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
5456 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
5457 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
5458 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
5459 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
5460 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
5461 test(S("abcdefghijklmnopqrst"), 19, 1, S("1234567890"), 11, 0, S("can't happen"));
5462 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
5463 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
5464 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
5465 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
5466 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
5467 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
5468 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
5469 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
5470 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
5471 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
5472 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
5473 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
5474 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
5475 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
5476 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
5477 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
5478 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
5479 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
5480 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
5481 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
5482 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
5483 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
5484 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
5485 test(S("abcdefghijklmnopqrst"), 19, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
5486 test(S("abcdefghijklmnopqrst"), 19, 2, S(""), 0, 0, S("abcdefghijklmnopqrs"));
5487 test(S("abcdefghijklmnopqrst"), 19, 2, S(""), 0, 1, S("abcdefghijklmnopqrs"));
5488 test(S("abcdefghijklmnopqrst"), 19, 2, S(""), 1, 0, S("can't happen"));
5489 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 0, S("abcdefghijklmnopqrs"));
5490 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
5491 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
5492 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
5493 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
5494 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
5495 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 0, S("abcdefghijklmnopqrs"));
5496 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
5497 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
5498 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
5499 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
5500 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
5501 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 0, S("abcdefghijklmnopqrs"));
5502 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
5503 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
5504 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
5505 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
5511 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 0, S("abcdefghijklmnopqrs"));
5512 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
5513 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
5514 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 5, 0, S("abcdefghijklmnopqrs"));
5515 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 5, 1, S("abcdefghijklmnopqrs"));
5516 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345"), 6, 0, S("can't happen"));
5517 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
5518 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
5519 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
5520 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
5521 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
5522 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
5523 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
5524 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
5525 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
5526 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
5527 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
5528 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
5529 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
5530 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
5531 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
5532 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
5533 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
5534 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
5535 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
5536 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
5537 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
5538 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
5539 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
5540 test(S("abcdefghijklmnopqrst"), 19, 2, S("1234567890"), 11, 0, S("can't happen"));
5541 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
5542 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
5543 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
5544 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
5545 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
5546 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
5547 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
5548 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
5549 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
5550 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
5551 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
5552 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
5553 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
5554 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
5555 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
5556 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
5557 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
5558 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
5559 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
5560 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
5561 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
5562 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
5563 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
5564 test(S("abcdefghijklmnopqrst"), 19, 2, S("12345678901234567890"), 21, 0, S("can't happen"));
5565 test(S("abcdefghijklmnopqrst"), 20, 0, S(""), 0, 0, S("abcdefghijklmnopqrst"));
5566 test(S("abcdefghijklmnopqrst"), 20, 0, S(""), 0, 1, S("abcdefghijklmnopqrst"));
5567 test(S("abcdefghijklmnopqrst"), 20, 0, S(""), 1, 0, S("can't happen"));
5568 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
5569 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
5570 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
5571 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
5572 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
5573 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
5574 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
5575 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
5576 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
5577 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
5578 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
5579 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
5580 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
5581 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
5582 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
5583 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
5584 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
5585 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
5586 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
5587 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
5588 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
5589 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
5590 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345"), 6, 0, S("can't happen"));
5591 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5592 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
5593 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
5594 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
5595 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
5596 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
5597 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5598 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
5599 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
5600 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
5601 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
5602 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
5603 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
5604 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
5605 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
5606 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
5607 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
5608 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
5609 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
5610 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
5616 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
5617 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5618 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
5619 test(S("abcdefghijklmnopqrst"), 20, 0, S("1234567890"), 11, 0, S("can't happen"));
5620 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5621 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
5622 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
5623 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
5624 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
5625 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
5626 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5627 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
5628 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
5629 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
5630 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
5631 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
5632 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5633 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
5634 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
5635 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
5636 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
5637 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
5638 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
5639 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
5640 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
5641 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
5642 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
5643 test(S("abcdefghijklmnopqrst"), 20, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
5644 test(S("abcdefghijklmnopqrst"), 20, 1, S(""), 0, 0, S("abcdefghijklmnopqrst"));
5645 test(S("abcdefghijklmnopqrst"), 20, 1, S(""), 0, 1, S("abcdefghijklmnopqrst"));
5646 test(S("abcdefghijklmnopqrst"), 20, 1, S(""), 1, 0, S("can't happen"));
5647 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 0, S("abcdefghijklmnopqrst"));
5648 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
5649 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
5650 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
5651 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
5652 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
5653 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 0, S("abcdefghijklmnopqrst"));
5654 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
5655 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
5656 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
5657 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
5658 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
5659 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 2, 0, S("abcdefghijklmnopqrst"));
5660 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
5661 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
5662 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
5663 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
5664 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 4, 0, S("abcdefghijklmnopqrst"));
5665 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
5666 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
5667 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 5, 0, S("abcdefghijklmnopqrst"));
5668 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 5, 1, S("abcdefghijklmnopqrst"));
5669 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345"), 6, 0, S("can't happen"));
5670 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5671 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
5672 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
5673 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
5674 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
5675 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
5676 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5677 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
5678 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
5679 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
5680 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
5681 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
5682 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
5683 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
5684 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
5685 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
5686 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
5687 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
5688 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
5689 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
5690 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
5691 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5692 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
5693 test(S("abcdefghijklmnopqrst"), 20, 1, S("1234567890"), 11, 0, S("can't happen"));
5694 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
5695 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
5696 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
5697 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
5698 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
5699 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
5700 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
5701 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
5702 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
5703 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
5704 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
5705 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
5706 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
5707 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
5708 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
5709 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
5710 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
5711 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
5712 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
5713 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
5714 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
5715 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
5721 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
5722 test(S("abcdefghijklmnopqrst"), 20, 1, S("12345678901234567890"), 21, 0, S("can't happen"));
5723 test(S("abcdefghijklmnopqrst"), 21, 0, S(""), 0, 0, S("can't happen"));
5724 test(S("abcdefghijklmnopqrst"), 21, 0, S(""), 0, 1, S("can't happen"));
5725 test(S("abcdefghijklmnopqrst"), 21, 0, S(""), 1, 0, S("can't happen"));
5726 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 0, S("can't happen"));
5727 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 1, S("can't happen"));
5728 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 2, S("can't happen"));
5729 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 4, S("can't happen"));
5730 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 5, S("can't happen"));
5731 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 0, 6, S("can't happen"));
5732 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 0, S("can't happen"));
5733 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 1, S("can't happen"));
5734 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 2, S("can't happen"));
5735 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 3, S("can't happen"));
5736 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 4, S("can't happen"));
5737 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 1, 5, S("can't happen"));
5738 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 2, 0, S("can't happen"));
5739 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 2, 1, S("can't happen"));
5740 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 2, 2, S("can't happen"));
5741 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 2, 3, S("can't happen"));
5742 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 2, 4, S("can't happen"));
5743 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 4, 0, S("can't happen"));
5744 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 4, 1, S("can't happen"));
5745 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 4, 2, S("can't happen"));
5746 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 5, 0, S("can't happen"));
5747 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 5, 1, S("can't happen"));
5748 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345"), 6, 0, S("can't happen"));
5749 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 0, S("can't happen"));
5750 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 1, S("can't happen"));
5751 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 5, S("can't happen"));
5752 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 9, S("can't happen"));
5753 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 10, S("can't happen"));
5754 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 0, 11, S("can't happen"));
5755 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 0, S("can't happen"));
5756 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 1, S("can't happen"));
5757 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 4, S("can't happen"));
5758 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 8, S("can't happen"));
5759 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 9, S("can't happen"));
5760 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 1, 10, S("can't happen"));
5761 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 0, S("can't happen"));
5762 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 1, S("can't happen"));
5763 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 2, S("can't happen"));
5764 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 4, S("can't happen"));
5765 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 5, S("can't happen"));
5766 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 5, 6, S("can't happen"));
5767 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 9, 0, S("can't happen"));
5768 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 9, 1, S("can't happen"));
5769 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 9, 2, S("can't happen"));
5770 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 10, 0, S("can't happen"));
5771 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 10, 1, S("can't happen"));
5772 test(S("abcdefghijklmnopqrst"), 21, 0, S("1234567890"), 11, 0, S("can't happen"));
5773 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 0, S("can't happen"));
5774 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 1, S("can't happen"));
5775 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 10, S("can't happen"));
5776 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 19, S("can't happen"));
5777 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 20, S("can't happen"));
5778 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 0, 21, S("can't happen"));
5779 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 0, S("can't happen"));
5780 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 1, S("can't happen"));
5781 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 9, S("can't happen"));
5782 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 18, S("can't happen"));
5783 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 19, S("can't happen"));
5784 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 1, 20, S("can't happen"));
5785 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 0, S("can't happen"));
5786 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 1, S("can't happen"));
5787 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 5, S("can't happen"));
5788 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 9, S("can't happen"));
5789 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 10, S("can't happen"));
5790 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 10, 11, S("can't happen"));
5791 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 19, 0, S("can't happen"));
5792 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 19, 1, S("can't happen"));
5793 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 19, 2, S("can't happen"));
5794 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 0, S("can't happen"));
5795 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 20, 1, S("can't happen"));
5796 test(S("abcdefghijklmnopqrst"), 21, 0, S("12345678901234567890"), 21, 0, S("can't happen"));
5802 typedef std::string S;
5859 #if __cplusplus >= 201103L
5861 typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;