Home | History | Annotate | Download | only in string_replace
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <string>
     11 
     12 // template <class T>
     13 //    basic_string& replace(size_type pos1, size_type n1, const T& t,
     14 //                          size_type pos2, size_type n=npos);
     15 //
     16 //  Mostly we're testing string_view here
     17 
     18 #include <string>
     19 #include <stdexcept>
     20 #include <algorithm>
     21 #include <cassert>
     22 
     23 #include "test_macros.h"
     24 #include "min_allocator.h"
     25 
     26 template <class S, class SV>
     27 void
     28 test(S s, typename S::size_type pos1, typename S::size_type n1,
     29      SV sv, typename S::size_type pos2, typename S::size_type n2,
     30      S expected)
     31 {
     32     typedef typename S::size_type SizeT;
     33     static_assert((!std::is_same<S, SV>::value), "");
     34 
     35     // String and string_view may not always share the same size type,
     36     // but both types should have the same size (ex. int vs long)
     37     static_assert(sizeof(SizeT) == sizeof(typename SV::size_type), "");
     38 
     39     const SizeT old_size = s.size();
     40     S s0 = s;
     41     if (pos1 <= old_size && pos2 <= sv.size())
     42     {
     43         s.replace(pos1, n1, sv, pos2, n2);
     44         LIBCPP_ASSERT(s.__invariants());
     45         assert(s == expected);
     46         SizeT xlen = std::min<SizeT>(n1, old_size - pos1);
     47         SizeT rlen = std::min<SizeT>(n2, sv.size() - pos2);
     48         assert(s.size() == old_size - xlen + rlen);
     49     }
     50 #ifndef TEST_HAS_NO_EXCEPTIONS
     51     else
     52     {
     53         try
     54         {
     55             s.replace(pos1, n1, sv, pos2, n2);
     56             assert(false);
     57         }
     58         catch (std::out_of_range&)
     59         {
     60             assert(pos1 > old_size || pos2 > sv.size());
     61             assert(s == s0);
     62         }
     63     }
     64 #endif
     65 }
     66 
     67 template <class S, class SV>
     68 void
     69 test_npos(S s, typename S::size_type pos1, typename S::size_type n1,
     70           SV sv, typename S::size_type pos2,
     71           S expected)
     72 {
     73     typedef typename S::size_type SizeT;
     74     static_assert((!std::is_same<S, SV>::value), "");
     75     const SizeT old_size = s.size();
     76     S s0 = s;
     77     if (pos1 <= old_size && pos2 <= sv.size())
     78     {
     79         s.replace(pos1, n1, sv, pos2);
     80         LIBCPP_ASSERT(s.__invariants());
     81         assert(s == expected);
     82         SizeT xlen = std::min<SizeT>(n1, old_size - pos1);
     83         SizeT rlen = std::min<SizeT>(S::npos, sv.size() - pos2);
     84         assert(s.size() == old_size - xlen + rlen);
     85     }
     86 #ifndef TEST_HAS_NO_EXCEPTIONS
     87     else
     88     {
     89         try
     90         {
     91             s.replace(pos1, n1, sv, pos2);
     92             assert(false);
     93         }
     94         catch (std::out_of_range&)
     95         {
     96             assert(pos1 > old_size || pos2 > sv.size());
     97             assert(s == s0);
     98         }
     99     }
    100 #endif
    101 }
    102 
    103 
    104 template <class S, class SV>
    105 void test0()
    106 {
    107     test(S(""), 0, 0, SV(""), 0, 0, S(""));
    108     test(S(""), 0, 0, SV(""), 0, 1, S(""));
    109     test(S(""), 0, 0, SV(""), 1, 0, S("can't happen"));
    110     test(S(""), 0, 0, SV("12345"), 0, 0, S(""));
    111     test(S(""), 0, 0, SV("12345"), 0, 1, S("1"));
    112     test(S(""), 0, 0, SV("12345"), 0, 2, S("12"));
    113     test(S(""), 0, 0, SV("12345"), 0, 4, S("1234"));
    114     test(S(""), 0, 0, SV("12345"), 0, 5, S("12345"));
    115     test(S(""), 0, 0, SV("12345"), 0, 6, S("12345"));
    116     test(S(""), 0, 0, SV("12345"), 1, 0, S(""));
    117     test(S(""), 0, 0, SV("12345"), 1, 1, S("2"));
    118     test(S(""), 0, 0, SV("12345"), 1, 2, S("23"));
    119     test(S(""), 0, 0, SV("12345"), 1, 3, S("234"));
    120     test(S(""), 0, 0, SV("12345"), 1, 4, S("2345"));
    121     test(S(""), 0, 0, SV("12345"), 1, 5, S("2345"));
    122     test(S(""), 0, 0, SV("12345"), 2, 0, S(""));
    123     test(S(""), 0, 0, SV("12345"), 2, 1, S("3"));
    124     test(S(""), 0, 0, SV("12345"), 2, 2, S("34"));
    125     test(S(""), 0, 0, SV("12345"), 2, 3, S("345"));
    126     test(S(""), 0, 0, SV("12345"), 2, 4, S("345"));
    127     test(S(""), 0, 0, SV("12345"), 4, 0, S(""));
    128     test(S(""), 0, 0, SV("12345"), 4, 1, S("5"));
    129     test(S(""), 0, 0, SV("12345"), 4, 2, S("5"));
    130     test(S(""), 0, 0, SV("12345"), 5, 0, S(""));
    131     test(S(""), 0, 0, SV("12345"), 5, 1, S(""));
    132     test(S(""), 0, 0, SV("12345"), 6, 0, S("can't happen"));
    133     test(S(""), 0, 0, SV("1234567890"), 0, 0, S(""));
    134     test(S(""), 0, 0, SV("1234567890"), 0, 1, S("1"));
    135     test(S(""), 0, 0, SV("1234567890"), 0, 5, S("12345"));
    136     test(S(""), 0, 0, SV("1234567890"), 0, 9, S("123456789"));
    137     test(S(""), 0, 0, SV("1234567890"), 0, 10, S("1234567890"));
    138     test(S(""), 0, 0, SV("1234567890"), 0, 11, S("1234567890"));
    139     test(S(""), 0, 0, SV("1234567890"), 1, 0, S(""));
    140     test(S(""), 0, 0, SV("1234567890"), 1, 1, S("2"));
    141     test(S(""), 0, 0, SV("1234567890"), 1, 4, S("2345"));
    142     test(S(""), 0, 0, SV("1234567890"), 1, 8, S("23456789"));
    143     test(S(""), 0, 0, SV("1234567890"), 1, 9, S("234567890"));
    144     test(S(""), 0, 0, SV("1234567890"), 1, 10, S("234567890"));
    145     test(S(""), 0, 0, SV("1234567890"), 5, 0, S(""));
    146     test(S(""), 0, 0, SV("1234567890"), 5, 1, S("6"));
    147     test(S(""), 0, 0, SV("1234567890"), 5, 2, S("67"));
    148     test(S(""), 0, 0, SV("1234567890"), 5, 4, S("6789"));
    149     test(S(""), 0, 0, SV("1234567890"), 5, 5, S("67890"));
    150     test(S(""), 0, 0, SV("1234567890"), 5, 6, S("67890"));
    151     test(S(""), 0, 0, SV("1234567890"), 9, 0, S(""));
    152     test(S(""), 0, 0, SV("1234567890"), 9, 1, S("0"));
    153     test(S(""), 0, 0, SV("1234567890"), 9, 2, S("0"));
    154     test(S(""), 0, 0, SV("1234567890"), 10, 0, S(""));
    155     test(S(""), 0, 0, SV("1234567890"), 10, 1, S(""));
    156     test(S(""), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
    157     test(S(""), 0, 0, SV("12345678901234567890"), 0, 0, S(""));
    158     test(S(""), 0, 0, SV("12345678901234567890"), 0, 1, S("1"));
    159     test(S(""), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890"));
    160     test(S(""), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
    161     test(S(""), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
    162     test(S(""), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
    163     test(S(""), 0, 0, SV("12345678901234567890"), 1, 0, S(""));
    164     test(S(""), 0, 0, SV("12345678901234567890"), 1, 1, S("2"));
    165     test(S(""), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890"));
    166     test(S(""), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
    167     test(S(""), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
    168     test(S(""), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
    169     test(S(""), 0, 0, SV("12345678901234567890"), 10, 0, S(""));
    170     test(S(""), 0, 0, SV("12345678901234567890"), 10, 1, S("1"));
    171     test(S(""), 0, 0, SV("12345678901234567890"), 10, 5, S("12345"));
    172     test(S(""), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789"));
    173     test(S(""), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890"));
    174     test(S(""), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890"));
    175     test(S(""), 0, 0, SV("12345678901234567890"), 19, 0, S(""));
    176     test(S(""), 0, 0, SV("12345678901234567890"), 19, 1, S("0"));
    177     test(S(""), 0, 0, SV("12345678901234567890"), 19, 2, S("0"));
    178     test(S(""), 0, 0, SV("12345678901234567890"), 20, 0, S(""));
    179     test(S(""), 0, 0, SV("12345678901234567890"), 20, 1, S(""));
    180     test(S(""), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
    181     test(S(""), 0, 1, SV(""), 0, 0, S(""));
    182     test(S(""), 0, 1, SV(""), 0, 1, S(""));
    183     test(S(""), 0, 1, SV(""), 1, 0, S("can't happen"));
    184     test(S(""), 0, 1, SV("12345"), 0, 0, S(""));
    185     test(S(""), 0, 1, SV("12345"), 0, 1, S("1"));
    186     test(S(""), 0, 1, SV("12345"), 0, 2, S("12"));
    187     test(S(""), 0, 1, SV("12345"), 0, 4, S("1234"));
    188     test(S(""), 0, 1, SV("12345"), 0, 5, S("12345"));
    189     test(S(""), 0, 1, SV("12345"), 0, 6, S("12345"));
    190     test(S(""), 0, 1, SV("12345"), 1, 0, S(""));
    191     test(S(""), 0, 1, SV("12345"), 1, 1, S("2"));
    192     test(S(""), 0, 1, SV("12345"), 1, 2, S("23"));
    193     test(S(""), 0, 1, SV("12345"), 1, 3, S("234"));
    194     test(S(""), 0, 1, SV("12345"), 1, 4, S("2345"));
    195     test(S(""), 0, 1, SV("12345"), 1, 5, S("2345"));
    196     test(S(""), 0, 1, SV("12345"), 2, 0, S(""));
    197     test(S(""), 0, 1, SV("12345"), 2, 1, S("3"));
    198     test(S(""), 0, 1, SV("12345"), 2, 2, S("34"));
    199     test(S(""), 0, 1, SV("12345"), 2, 3, S("345"));
    200     test(S(""), 0, 1, SV("12345"), 2, 4, S("345"));
    201     test(S(""), 0, 1, SV("12345"), 4, 0, S(""));
    202     test(S(""), 0, 1, SV("12345"), 4, 1, S("5"));
    203     test(S(""), 0, 1, SV("12345"), 4, 2, S("5"));
    204     test(S(""), 0, 1, SV("12345"), 5, 0, S(""));
    205     test(S(""), 0, 1, SV("12345"), 5, 1, S(""));
    206     test(S(""), 0, 1, SV("12345"), 6, 0, S("can't happen"));
    207 }
    208 
    209 template <class S, class SV>
    210 void test1()
    211 {
    212     test(S(""), 0, 1, SV("1234567890"), 0, 0, S(""));
    213     test(S(""), 0, 1, SV("1234567890"), 0, 1, S("1"));
    214     test(S(""), 0, 1, SV("1234567890"), 0, 5, S("12345"));
    215     test(S(""), 0, 1, SV("1234567890"), 0, 9, S("123456789"));
    216     test(S(""), 0, 1, SV("1234567890"), 0, 10, S("1234567890"));
    217     test(S(""), 0, 1, SV("1234567890"), 0, 11, S("1234567890"));
    218     test(S(""), 0, 1, SV("1234567890"), 1, 0, S(""));
    219     test(S(""), 0, 1, SV("1234567890"), 1, 1, S("2"));
    220     test(S(""), 0, 1, SV("1234567890"), 1, 4, S("2345"));
    221     test(S(""), 0, 1, SV("1234567890"), 1, 8, S("23456789"));
    222     test(S(""), 0, 1, SV("1234567890"), 1, 9, S("234567890"));
    223     test(S(""), 0, 1, SV("1234567890"), 1, 10, S("234567890"));
    224     test(S(""), 0, 1, SV("1234567890"), 5, 0, S(""));
    225     test(S(""), 0, 1, SV("1234567890"), 5, 1, S("6"));
    226     test(S(""), 0, 1, SV("1234567890"), 5, 2, S("67"));
    227     test(S(""), 0, 1, SV("1234567890"), 5, 4, S("6789"));
    228     test(S(""), 0, 1, SV("1234567890"), 5, 5, S("67890"));
    229     test(S(""), 0, 1, SV("1234567890"), 5, 6, S("67890"));
    230     test(S(""), 0, 1, SV("1234567890"), 9, 0, S(""));
    231     test(S(""), 0, 1, SV("1234567890"), 9, 1, S("0"));
    232     test(S(""), 0, 1, SV("1234567890"), 9, 2, S("0"));
    233     test(S(""), 0, 1, SV("1234567890"), 10, 0, S(""));
    234     test(S(""), 0, 1, SV("1234567890"), 10, 1, S(""));
    235     test(S(""), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
    236     test(S(""), 0, 1, SV("12345678901234567890"), 0, 0, S(""));
    237     test(S(""), 0, 1, SV("12345678901234567890"), 0, 1, S("1"));
    238     test(S(""), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890"));
    239     test(S(""), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
    240     test(S(""), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
    241     test(S(""), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
    242     test(S(""), 0, 1, SV("12345678901234567890"), 1, 0, S(""));
    243     test(S(""), 0, 1, SV("12345678901234567890"), 1, 1, S("2"));
    244     test(S(""), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890"));
    245     test(S(""), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
    246     test(S(""), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
    247     test(S(""), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
    248     test(S(""), 0, 1, SV("12345678901234567890"), 10, 0, S(""));
    249     test(S(""), 0, 1, SV("12345678901234567890"), 10, 1, S("1"));
    250     test(S(""), 0, 1, SV("12345678901234567890"), 10, 5, S("12345"));
    251     test(S(""), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789"));
    252     test(S(""), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890"));
    253     test(S(""), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890"));
    254     test(S(""), 0, 1, SV("12345678901234567890"), 19, 0, S(""));
    255     test(S(""), 0, 1, SV("12345678901234567890"), 19, 1, S("0"));
    256     test(S(""), 0, 1, SV("12345678901234567890"), 19, 2, S("0"));
    257     test(S(""), 0, 1, SV("12345678901234567890"), 20, 0, S(""));
    258     test(S(""), 0, 1, SV("12345678901234567890"), 20, 1, S(""));
    259     test(S(""), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
    260     test(S(""), 1, 0, SV(""), 0, 0, S("can't happen"));
    261     test(S(""), 1, 0, SV(""), 0, 1, S("can't happen"));
    262     test(S(""), 1, 0, SV(""), 1, 0, S("can't happen"));
    263     test(S(""), 1, 0, SV("12345"), 0, 0, S("can't happen"));
    264     test(S(""), 1, 0, SV("12345"), 0, 1, S("can't happen"));
    265     test(S(""), 1, 0, SV("12345"), 0, 2, S("can't happen"));
    266     test(S(""), 1, 0, SV("12345"), 0, 4, S("can't happen"));
    267     test(S(""), 1, 0, SV("12345"), 0, 5, S("can't happen"));
    268     test(S(""), 1, 0, SV("12345"), 0, 6, S("can't happen"));
    269     test(S(""), 1, 0, SV("12345"), 1, 0, S("can't happen"));
    270     test(S(""), 1, 0, SV("12345"), 1, 1, S("can't happen"));
    271     test(S(""), 1, 0, SV("12345"), 1, 2, S("can't happen"));
    272     test(S(""), 1, 0, SV("12345"), 1, 3, S("can't happen"));
    273     test(S(""), 1, 0, SV("12345"), 1, 4, S("can't happen"));
    274     test(S(""), 1, 0, SV("12345"), 1, 5, S("can't happen"));
    275     test(S(""), 1, 0, SV("12345"), 2, 0, S("can't happen"));
    276     test(S(""), 1, 0, SV("12345"), 2, 1, S("can't happen"));
    277     test(S(""), 1, 0, SV("12345"), 2, 2, S("can't happen"));
    278     test(S(""), 1, 0, SV("12345"), 2, 3, S("can't happen"));
    279     test(S(""), 1, 0, SV("12345"), 2, 4, S("can't happen"));
    280     test(S(""), 1, 0, SV("12345"), 4, 0, S("can't happen"));
    281     test(S(""), 1, 0, SV("12345"), 4, 1, S("can't happen"));
    282     test(S(""), 1, 0, SV("12345"), 4, 2, S("can't happen"));
    283     test(S(""), 1, 0, SV("12345"), 5, 0, S("can't happen"));
    284     test(S(""), 1, 0, SV("12345"), 5, 1, S("can't happen"));
    285     test(S(""), 1, 0, SV("12345"), 6, 0, S("can't happen"));
    286     test(S(""), 1, 0, SV("1234567890"), 0, 0, S("can't happen"));
    287     test(S(""), 1, 0, SV("1234567890"), 0, 1, S("can't happen"));
    288     test(S(""), 1, 0, SV("1234567890"), 0, 5, S("can't happen"));
    289     test(S(""), 1, 0, SV("1234567890"), 0, 9, S("can't happen"));
    290     test(S(""), 1, 0, SV("1234567890"), 0, 10, S("can't happen"));
    291     test(S(""), 1, 0, SV("1234567890"), 0, 11, S("can't happen"));
    292     test(S(""), 1, 0, SV("1234567890"), 1, 0, S("can't happen"));
    293     test(S(""), 1, 0, SV("1234567890"), 1, 1, S("can't happen"));
    294     test(S(""), 1, 0, SV("1234567890"), 1, 4, S("can't happen"));
    295     test(S(""), 1, 0, SV("1234567890"), 1, 8, S("can't happen"));
    296     test(S(""), 1, 0, SV("1234567890"), 1, 9, S("can't happen"));
    297     test(S(""), 1, 0, SV("1234567890"), 1, 10, S("can't happen"));
    298     test(S(""), 1, 0, SV("1234567890"), 5, 0, S("can't happen"));
    299     test(S(""), 1, 0, SV("1234567890"), 5, 1, S("can't happen"));
    300     test(S(""), 1, 0, SV("1234567890"), 5, 2, S("can't happen"));
    301     test(S(""), 1, 0, SV("1234567890"), 5, 4, S("can't happen"));
    302     test(S(""), 1, 0, SV("1234567890"), 5, 5, S("can't happen"));
    303     test(S(""), 1, 0, SV("1234567890"), 5, 6, S("can't happen"));
    304     test(S(""), 1, 0, SV("1234567890"), 9, 0, S("can't happen"));
    305     test(S(""), 1, 0, SV("1234567890"), 9, 1, S("can't happen"));
    306     test(S(""), 1, 0, SV("1234567890"), 9, 2, S("can't happen"));
    307     test(S(""), 1, 0, SV("1234567890"), 10, 0, S("can't happen"));
    308     test(S(""), 1, 0, SV("1234567890"), 10, 1, S("can't happen"));
    309     test(S(""), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
    310     test(S(""), 1, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
    311     test(S(""), 1, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
    312 }
    313 
    314 template <class S, class SV>
    315 void test2()
    316 {
    317     test(S(""), 1, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
    318     test(S(""), 1, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
    319     test(S(""), 1, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
    320     test(S(""), 1, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
    321     test(S(""), 1, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
    322     test(S(""), 1, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
    323     test(S(""), 1, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
    324     test(S(""), 1, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
    325     test(S(""), 1, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
    326     test(S(""), 1, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
    327     test(S(""), 1, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
    328     test(S(""), 1, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
    329     test(S(""), 1, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
    330     test(S(""), 1, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
    331     test(S(""), 1, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
    332     test(S(""), 1, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
    333     test(S(""), 1, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
    334     test(S(""), 1, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
    335     test(S(""), 1, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
    336     test(S(""), 1, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
    337     test(S(""), 1, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
    338     test(S(""), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
    339     test(S("abcde"), 0, 0, SV(""), 0, 0, S("abcde"));
    340     test(S("abcde"), 0, 0, SV(""), 0, 1, S("abcde"));
    341     test(S("abcde"), 0, 0, SV(""), 1, 0, S("can't happen"));
    342     test(S("abcde"), 0, 0, SV("12345"), 0, 0, S("abcde"));
    343     test(S("abcde"), 0, 0, SV("12345"), 0, 1, S("1abcde"));
    344     test(S("abcde"), 0, 0, SV("12345"), 0, 2, S("12abcde"));
    345     test(S("abcde"), 0, 0, SV("12345"), 0, 4, S("1234abcde"));
    346     test(S("abcde"), 0, 0, SV("12345"), 0, 5, S("12345abcde"));
    347     test(S("abcde"), 0, 0, SV("12345"), 0, 6, S("12345abcde"));
    348     test(S("abcde"), 0, 0, SV("12345"), 1, 0, S("abcde"));
    349     test(S("abcde"), 0, 0, SV("12345"), 1, 1, S("2abcde"));
    350     test(S("abcde"), 0, 0, SV("12345"), 1, 2, S("23abcde"));
    351     test(S("abcde"), 0, 0, SV("12345"), 1, 3, S("234abcde"));
    352     test(S("abcde"), 0, 0, SV("12345"), 1, 4, S("2345abcde"));
    353     test(S("abcde"), 0, 0, SV("12345"), 1, 5, S("2345abcde"));
    354     test(S("abcde"), 0, 0, SV("12345"), 2, 0, S("abcde"));
    355     test(S("abcde"), 0, 0, SV("12345"), 2, 1, S("3abcde"));
    356     test(S("abcde"), 0, 0, SV("12345"), 2, 2, S("34abcde"));
    357     test(S("abcde"), 0, 0, SV("12345"), 2, 3, S("345abcde"));
    358     test(S("abcde"), 0, 0, SV("12345"), 2, 4, S("345abcde"));
    359     test(S("abcde"), 0, 0, SV("12345"), 4, 0, S("abcde"));
    360     test(S("abcde"), 0, 0, SV("12345"), 4, 1, S("5abcde"));
    361     test(S("abcde"), 0, 0, SV("12345"), 4, 2, S("5abcde"));
    362     test(S("abcde"), 0, 0, SV("12345"), 5, 0, S("abcde"));
    363     test(S("abcde"), 0, 0, SV("12345"), 5, 1, S("abcde"));
    364     test(S("abcde"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
    365     test(S("abcde"), 0, 0, SV("1234567890"), 0, 0, S("abcde"));
    366     test(S("abcde"), 0, 0, SV("1234567890"), 0, 1, S("1abcde"));
    367     test(S("abcde"), 0, 0, SV("1234567890"), 0, 5, S("12345abcde"));
    368     test(S("abcde"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcde"));
    369     test(S("abcde"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcde"));
    370     test(S("abcde"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcde"));
    371     test(S("abcde"), 0, 0, SV("1234567890"), 1, 0, S("abcde"));
    372     test(S("abcde"), 0, 0, SV("1234567890"), 1, 1, S("2abcde"));
    373     test(S("abcde"), 0, 0, SV("1234567890"), 1, 4, S("2345abcde"));
    374     test(S("abcde"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcde"));
    375     test(S("abcde"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcde"));
    376     test(S("abcde"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcde"));
    377     test(S("abcde"), 0, 0, SV("1234567890"), 5, 0, S("abcde"));
    378     test(S("abcde"), 0, 0, SV("1234567890"), 5, 1, S("6abcde"));
    379     test(S("abcde"), 0, 0, SV("1234567890"), 5, 2, S("67abcde"));
    380     test(S("abcde"), 0, 0, SV("1234567890"), 5, 4, S("6789abcde"));
    381     test(S("abcde"), 0, 0, SV("1234567890"), 5, 5, S("67890abcde"));
    382     test(S("abcde"), 0, 0, SV("1234567890"), 5, 6, S("67890abcde"));
    383     test(S("abcde"), 0, 0, SV("1234567890"), 9, 0, S("abcde"));
    384     test(S("abcde"), 0, 0, SV("1234567890"), 9, 1, S("0abcde"));
    385     test(S("abcde"), 0, 0, SV("1234567890"), 9, 2, S("0abcde"));
    386     test(S("abcde"), 0, 0, SV("1234567890"), 10, 0, S("abcde"));
    387     test(S("abcde"), 0, 0, SV("1234567890"), 10, 1, S("abcde"));
    388     test(S("abcde"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
    389     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
    390     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcde"));
    391     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcde"));
    392     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcde"));
    393     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcde"));
    394     test(S("abcde"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcde"));
    395     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
    396     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcde"));
    397     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcde"));
    398     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcde"));
    399     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcde"));
    400     test(S("abcde"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcde"));
    401     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
    402     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcde"));
    403     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcde"));
    404     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcde"));
    405     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcde"));
    406     test(S("abcde"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcde"));
    407     test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
    408     test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcde"));
    409     test(S("abcde"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcde"));
    410     test(S("abcde"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
    411     test(S("abcde"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
    412     test(S("abcde"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
    413     test(S("abcde"), 0, 1, SV(""), 0, 0, S("bcde"));
    414     test(S("abcde"), 0, 1, SV(""), 0, 1, S("bcde"));
    415     test(S("abcde"), 0, 1, SV(""), 1, 0, S("can't happen"));
    416     test(S("abcde"), 0, 1, SV("12345"), 0, 0, S("bcde"));
    417 }
    418 
    419 template <class S, class SV>
    420 void test3()
    421 {
    422     test(S("abcde"), 0, 1, SV("12345"), 0, 1, S("1bcde"));
    423     test(S("abcde"), 0, 1, SV("12345"), 0, 2, S("12bcde"));
    424     test(S("abcde"), 0, 1, SV("12345"), 0, 4, S("1234bcde"));
    425     test(S("abcde"), 0, 1, SV("12345"), 0, 5, S("12345bcde"));
    426     test(S("abcde"), 0, 1, SV("12345"), 0, 6, S("12345bcde"));
    427     test(S("abcde"), 0, 1, SV("12345"), 1, 0, S("bcde"));
    428     test(S("abcde"), 0, 1, SV("12345"), 1, 1, S("2bcde"));
    429     test(S("abcde"), 0, 1, SV("12345"), 1, 2, S("23bcde"));
    430     test(S("abcde"), 0, 1, SV("12345"), 1, 3, S("234bcde"));
    431     test(S("abcde"), 0, 1, SV("12345"), 1, 4, S("2345bcde"));
    432     test(S("abcde"), 0, 1, SV("12345"), 1, 5, S("2345bcde"));
    433     test(S("abcde"), 0, 1, SV("12345"), 2, 0, S("bcde"));
    434     test(S("abcde"), 0, 1, SV("12345"), 2, 1, S("3bcde"));
    435     test(S("abcde"), 0, 1, SV("12345"), 2, 2, S("34bcde"));
    436     test(S("abcde"), 0, 1, SV("12345"), 2, 3, S("345bcde"));
    437     test(S("abcde"), 0, 1, SV("12345"), 2, 4, S("345bcde"));
    438     test(S("abcde"), 0, 1, SV("12345"), 4, 0, S("bcde"));
    439     test(S("abcde"), 0, 1, SV("12345"), 4, 1, S("5bcde"));
    440     test(S("abcde"), 0, 1, SV("12345"), 4, 2, S("5bcde"));
    441     test(S("abcde"), 0, 1, SV("12345"), 5, 0, S("bcde"));
    442     test(S("abcde"), 0, 1, SV("12345"), 5, 1, S("bcde"));
    443     test(S("abcde"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
    444     test(S("abcde"), 0, 1, SV("1234567890"), 0, 0, S("bcde"));
    445     test(S("abcde"), 0, 1, SV("1234567890"), 0, 1, S("1bcde"));
    446     test(S("abcde"), 0, 1, SV("1234567890"), 0, 5, S("12345bcde"));
    447     test(S("abcde"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcde"));
    448     test(S("abcde"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcde"));
    449     test(S("abcde"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcde"));
    450     test(S("abcde"), 0, 1, SV("1234567890"), 1, 0, S("bcde"));
    451     test(S("abcde"), 0, 1, SV("1234567890"), 1, 1, S("2bcde"));
    452     test(S("abcde"), 0, 1, SV("1234567890"), 1, 4, S("2345bcde"));
    453     test(S("abcde"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcde"));
    454     test(S("abcde"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcde"));
    455     test(S("abcde"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcde"));
    456     test(S("abcde"), 0, 1, SV("1234567890"), 5, 0, S("bcde"));
    457     test(S("abcde"), 0, 1, SV("1234567890"), 5, 1, S("6bcde"));
    458     test(S("abcde"), 0, 1, SV("1234567890"), 5, 2, S("67bcde"));
    459     test(S("abcde"), 0, 1, SV("1234567890"), 5, 4, S("6789bcde"));
    460     test(S("abcde"), 0, 1, SV("1234567890"), 5, 5, S("67890bcde"));
    461     test(S("abcde"), 0, 1, SV("1234567890"), 5, 6, S("67890bcde"));
    462     test(S("abcde"), 0, 1, SV("1234567890"), 9, 0, S("bcde"));
    463     test(S("abcde"), 0, 1, SV("1234567890"), 9, 1, S("0bcde"));
    464     test(S("abcde"), 0, 1, SV("1234567890"), 9, 2, S("0bcde"));
    465     test(S("abcde"), 0, 1, SV("1234567890"), 10, 0, S("bcde"));
    466     test(S("abcde"), 0, 1, SV("1234567890"), 10, 1, S("bcde"));
    467     test(S("abcde"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
    468     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcde"));
    469     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcde"));
    470     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcde"));
    471     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcde"));
    472     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcde"));
    473     test(S("abcde"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcde"));
    474     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcde"));
    475     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcde"));
    476     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcde"));
    477     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcde"));
    478     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcde"));
    479     test(S("abcde"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcde"));
    480     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcde"));
    481     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcde"));
    482     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcde"));
    483     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcde"));
    484     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcde"));
    485     test(S("abcde"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcde"));
    486     test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcde"));
    487     test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcde"));
    488     test(S("abcde"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcde"));
    489     test(S("abcde"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcde"));
    490     test(S("abcde"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcde"));
    491     test(S("abcde"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
    492     test(S("abcde"), 0, 2, SV(""), 0, 0, S("cde"));
    493     test(S("abcde"), 0, 2, SV(""), 0, 1, S("cde"));
    494     test(S("abcde"), 0, 2, SV(""), 1, 0, S("can't happen"));
    495     test(S("abcde"), 0, 2, SV("12345"), 0, 0, S("cde"));
    496     test(S("abcde"), 0, 2, SV("12345"), 0, 1, S("1cde"));
    497     test(S("abcde"), 0, 2, SV("12345"), 0, 2, S("12cde"));
    498     test(S("abcde"), 0, 2, SV("12345"), 0, 4, S("1234cde"));
    499     test(S("abcde"), 0, 2, SV("12345"), 0, 5, S("12345cde"));
    500     test(S("abcde"), 0, 2, SV("12345"), 0, 6, S("12345cde"));
    501     test(S("abcde"), 0, 2, SV("12345"), 1, 0, S("cde"));
    502     test(S("abcde"), 0, 2, SV("12345"), 1, 1, S("2cde"));
    503     test(S("abcde"), 0, 2, SV("12345"), 1, 2, S("23cde"));
    504     test(S("abcde"), 0, 2, SV("12345"), 1, 3, S("234cde"));
    505     test(S("abcde"), 0, 2, SV("12345"), 1, 4, S("2345cde"));
    506     test(S("abcde"), 0, 2, SV("12345"), 1, 5, S("2345cde"));
    507     test(S("abcde"), 0, 2, SV("12345"), 2, 0, S("cde"));
    508     test(S("abcde"), 0, 2, SV("12345"), 2, 1, S("3cde"));
    509     test(S("abcde"), 0, 2, SV("12345"), 2, 2, S("34cde"));
    510     test(S("abcde"), 0, 2, SV("12345"), 2, 3, S("345cde"));
    511     test(S("abcde"), 0, 2, SV("12345"), 2, 4, S("345cde"));
    512     test(S("abcde"), 0, 2, SV("12345"), 4, 0, S("cde"));
    513     test(S("abcde"), 0, 2, SV("12345"), 4, 1, S("5cde"));
    514     test(S("abcde"), 0, 2, SV("12345"), 4, 2, S("5cde"));
    515     test(S("abcde"), 0, 2, SV("12345"), 5, 0, S("cde"));
    516     test(S("abcde"), 0, 2, SV("12345"), 5, 1, S("cde"));
    517     test(S("abcde"), 0, 2, SV("12345"), 6, 0, S("can't happen"));
    518     test(S("abcde"), 0, 2, SV("1234567890"), 0, 0, S("cde"));
    519     test(S("abcde"), 0, 2, SV("1234567890"), 0, 1, S("1cde"));
    520     test(S("abcde"), 0, 2, SV("1234567890"), 0, 5, S("12345cde"));
    521     test(S("abcde"), 0, 2, SV("1234567890"), 0, 9, S("123456789cde"));
    522 }
    523 
    524 template <class S, class SV>
    525 void test4()
    526 {
    527     test(S("abcde"), 0, 2, SV("1234567890"), 0, 10, S("1234567890cde"));
    528     test(S("abcde"), 0, 2, SV("1234567890"), 0, 11, S("1234567890cde"));
    529     test(S("abcde"), 0, 2, SV("1234567890"), 1, 0, S("cde"));
    530     test(S("abcde"), 0, 2, SV("1234567890"), 1, 1, S("2cde"));
    531     test(S("abcde"), 0, 2, SV("1234567890"), 1, 4, S("2345cde"));
    532     test(S("abcde"), 0, 2, SV("1234567890"), 1, 8, S("23456789cde"));
    533     test(S("abcde"), 0, 2, SV("1234567890"), 1, 9, S("234567890cde"));
    534     test(S("abcde"), 0, 2, SV("1234567890"), 1, 10, S("234567890cde"));
    535     test(S("abcde"), 0, 2, SV("1234567890"), 5, 0, S("cde"));
    536     test(S("abcde"), 0, 2, SV("1234567890"), 5, 1, S("6cde"));
    537     test(S("abcde"), 0, 2, SV("1234567890"), 5, 2, S("67cde"));
    538     test(S("abcde"), 0, 2, SV("1234567890"), 5, 4, S("6789cde"));
    539     test(S("abcde"), 0, 2, SV("1234567890"), 5, 5, S("67890cde"));
    540     test(S("abcde"), 0, 2, SV("1234567890"), 5, 6, S("67890cde"));
    541     test(S("abcde"), 0, 2, SV("1234567890"), 9, 0, S("cde"));
    542     test(S("abcde"), 0, 2, SV("1234567890"), 9, 1, S("0cde"));
    543     test(S("abcde"), 0, 2, SV("1234567890"), 9, 2, S("0cde"));
    544     test(S("abcde"), 0, 2, SV("1234567890"), 10, 0, S("cde"));
    545     test(S("abcde"), 0, 2, SV("1234567890"), 10, 1, S("cde"));
    546     test(S("abcde"), 0, 2, SV("1234567890"), 11, 0, S("can't happen"));
    547     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 0, S("cde"));
    548     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 1, S("1cde"));
    549     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 10, S("1234567890cde"));
    550     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 19, S("1234567890123456789cde"));
    551     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 20, S("12345678901234567890cde"));
    552     test(S("abcde"), 0, 2, SV("12345678901234567890"), 0, 21, S("12345678901234567890cde"));
    553     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 0, S("cde"));
    554     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 1, S("2cde"));
    555     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 9, S("234567890cde"));
    556     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 18, S("234567890123456789cde"));
    557     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 19, S("2345678901234567890cde"));
    558     test(S("abcde"), 0, 2, SV("12345678901234567890"), 1, 20, S("2345678901234567890cde"));
    559     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 0, S("cde"));
    560     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 1, S("1cde"));
    561     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 5, S("12345cde"));
    562     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 9, S("123456789cde"));
    563     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 10, S("1234567890cde"));
    564     test(S("abcde"), 0, 2, SV("12345678901234567890"), 10, 11, S("1234567890cde"));
    565     test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 0, S("cde"));
    566     test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 1, S("0cde"));
    567     test(S("abcde"), 0, 2, SV("12345678901234567890"), 19, 2, S("0cde"));
    568     test(S("abcde"), 0, 2, SV("12345678901234567890"), 20, 0, S("cde"));
    569     test(S("abcde"), 0, 2, SV("12345678901234567890"), 20, 1, S("cde"));
    570     test(S("abcde"), 0, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
    571     test(S("abcde"), 0, 4, SV(""), 0, 0, S("e"));
    572     test(S("abcde"), 0, 4, SV(""), 0, 1, S("e"));
    573     test(S("abcde"), 0, 4, SV(""), 1, 0, S("can't happen"));
    574     test(S("abcde"), 0, 4, SV("12345"), 0, 0, S("e"));
    575     test(S("abcde"), 0, 4, SV("12345"), 0, 1, S("1e"));
    576     test(S("abcde"), 0, 4, SV("12345"), 0, 2, S("12e"));
    577     test(S("abcde"), 0, 4, SV("12345"), 0, 4, S("1234e"));
    578     test(S("abcde"), 0, 4, SV("12345"), 0, 5, S("12345e"));
    579     test(S("abcde"), 0, 4, SV("12345"), 0, 6, S("12345e"));
    580     test(S("abcde"), 0, 4, SV("12345"), 1, 0, S("e"));
    581     test(S("abcde"), 0, 4, SV("12345"), 1, 1, S("2e"));
    582     test(S("abcde"), 0, 4, SV("12345"), 1, 2, S("23e"));
    583     test(S("abcde"), 0, 4, SV("12345"), 1, 3, S("234e"));
    584     test(S("abcde"), 0, 4, SV("12345"), 1, 4, S("2345e"));
    585     test(S("abcde"), 0, 4, SV("12345"), 1, 5, S("2345e"));
    586     test(S("abcde"), 0, 4, SV("12345"), 2, 0, S("e"));
    587     test(S("abcde"), 0, 4, SV("12345"), 2, 1, S("3e"));
    588     test(S("abcde"), 0, 4, SV("12345"), 2, 2, S("34e"));
    589     test(S("abcde"), 0, 4, SV("12345"), 2, 3, S("345e"));
    590     test(S("abcde"), 0, 4, SV("12345"), 2, 4, S("345e"));
    591     test(S("abcde"), 0, 4, SV("12345"), 4, 0, S("e"));
    592     test(S("abcde"), 0, 4, SV("12345"), 4, 1, S("5e"));
    593     test(S("abcde"), 0, 4, SV("12345"), 4, 2, S("5e"));
    594     test(S("abcde"), 0, 4, SV("12345"), 5, 0, S("e"));
    595     test(S("abcde"), 0, 4, SV("12345"), 5, 1, S("e"));
    596     test(S("abcde"), 0, 4, SV("12345"), 6, 0, S("can't happen"));
    597     test(S("abcde"), 0, 4, SV("1234567890"), 0, 0, S("e"));
    598     test(S("abcde"), 0, 4, SV("1234567890"), 0, 1, S("1e"));
    599     test(S("abcde"), 0, 4, SV("1234567890"), 0, 5, S("12345e"));
    600     test(S("abcde"), 0, 4, SV("1234567890"), 0, 9, S("123456789e"));
    601     test(S("abcde"), 0, 4, SV("1234567890"), 0, 10, S("1234567890e"));
    602     test(S("abcde"), 0, 4, SV("1234567890"), 0, 11, S("1234567890e"));
    603     test(S("abcde"), 0, 4, SV("1234567890"), 1, 0, S("e"));
    604     test(S("abcde"), 0, 4, SV("1234567890"), 1, 1, S("2e"));
    605     test(S("abcde"), 0, 4, SV("1234567890"), 1, 4, S("2345e"));
    606     test(S("abcde"), 0, 4, SV("1234567890"), 1, 8, S("23456789e"));
    607     test(S("abcde"), 0, 4, SV("1234567890"), 1, 9, S("234567890e"));
    608     test(S("abcde"), 0, 4, SV("1234567890"), 1, 10, S("234567890e"));
    609     test(S("abcde"), 0, 4, SV("1234567890"), 5, 0, S("e"));
    610     test(S("abcde"), 0, 4, SV("1234567890"), 5, 1, S("6e"));
    611     test(S("abcde"), 0, 4, SV("1234567890"), 5, 2, S("67e"));
    612     test(S("abcde"), 0, 4, SV("1234567890"), 5, 4, S("6789e"));
    613     test(S("abcde"), 0, 4, SV("1234567890"), 5, 5, S("67890e"));
    614     test(S("abcde"), 0, 4, SV("1234567890"), 5, 6, S("67890e"));
    615     test(S("abcde"), 0, 4, SV("1234567890"), 9, 0, S("e"));
    616     test(S("abcde"), 0, 4, SV("1234567890"), 9, 1, S("0e"));
    617     test(S("abcde"), 0, 4, SV("1234567890"), 9, 2, S("0e"));
    618     test(S("abcde"), 0, 4, SV("1234567890"), 10, 0, S("e"));
    619     test(S("abcde"), 0, 4, SV("1234567890"), 10, 1, S("e"));
    620     test(S("abcde"), 0, 4, SV("1234567890"), 11, 0, S("can't happen"));
    621     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 0, S("e"));
    622     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 1, S("1e"));
    623     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 10, S("1234567890e"));
    624     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 19, S("1234567890123456789e"));
    625     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 20, S("12345678901234567890e"));
    626     test(S("abcde"), 0, 4, SV("12345678901234567890"), 0, 21, S("12345678901234567890e"));
    627 }
    628 
    629 template <class S, class SV>
    630 void test5()
    631 {
    632     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 0, S("e"));
    633     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 1, S("2e"));
    634     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 9, S("234567890e"));
    635     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 18, S("234567890123456789e"));
    636     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 19, S("2345678901234567890e"));
    637     test(S("abcde"), 0, 4, SV("12345678901234567890"), 1, 20, S("2345678901234567890e"));
    638     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 0, S("e"));
    639     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 1, S("1e"));
    640     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 5, S("12345e"));
    641     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 9, S("123456789e"));
    642     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 10, S("1234567890e"));
    643     test(S("abcde"), 0, 4, SV("12345678901234567890"), 10, 11, S("1234567890e"));
    644     test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 0, S("e"));
    645     test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 1, S("0e"));
    646     test(S("abcde"), 0, 4, SV("12345678901234567890"), 19, 2, S("0e"));
    647     test(S("abcde"), 0, 4, SV("12345678901234567890"), 20, 0, S("e"));
    648     test(S("abcde"), 0, 4, SV("12345678901234567890"), 20, 1, S("e"));
    649     test(S("abcde"), 0, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
    650     test(S("abcde"), 0, 5, SV(""), 0, 0, S(""));
    651     test(S("abcde"), 0, 5, SV(""), 0, 1, S(""));
    652     test(S("abcde"), 0, 5, SV(""), 1, 0, S("can't happen"));
    653     test(S("abcde"), 0, 5, SV("12345"), 0, 0, S(""));
    654     test(S("abcde"), 0, 5, SV("12345"), 0, 1, S("1"));
    655     test(S("abcde"), 0, 5, SV("12345"), 0, 2, S("12"));
    656     test(S("abcde"), 0, 5, SV("12345"), 0, 4, S("1234"));
    657     test(S("abcde"), 0, 5, SV("12345"), 0, 5, S("12345"));
    658     test(S("abcde"), 0, 5, SV("12345"), 0, 6, S("12345"));
    659     test(S("abcde"), 0, 5, SV("12345"), 1, 0, S(""));
    660     test(S("abcde"), 0, 5, SV("12345"), 1, 1, S("2"));
    661     test(S("abcde"), 0, 5, SV("12345"), 1, 2, S("23"));
    662     test(S("abcde"), 0, 5, SV("12345"), 1, 3, S("234"));
    663     test(S("abcde"), 0, 5, SV("12345"), 1, 4, S("2345"));
    664     test(S("abcde"), 0, 5, SV("12345"), 1, 5, S("2345"));
    665     test(S("abcde"), 0, 5, SV("12345"), 2, 0, S(""));
    666     test(S("abcde"), 0, 5, SV("12345"), 2, 1, S("3"));
    667     test(S("abcde"), 0, 5, SV("12345"), 2, 2, S("34"));
    668     test(S("abcde"), 0, 5, SV("12345"), 2, 3, S("345"));
    669     test(S("abcde"), 0, 5, SV("12345"), 2, 4, S("345"));
    670     test(S("abcde"), 0, 5, SV("12345"), 4, 0, S(""));
    671     test(S("abcde"), 0, 5, SV("12345"), 4, 1, S("5"));
    672     test(S("abcde"), 0, 5, SV("12345"), 4, 2, S("5"));
    673     test(S("abcde"), 0, 5, SV("12345"), 5, 0, S(""));
    674     test(S("abcde"), 0, 5, SV("12345"), 5, 1, S(""));
    675     test(S("abcde"), 0, 5, SV("12345"), 6, 0, S("can't happen"));
    676     test(S("abcde"), 0, 5, SV("1234567890"), 0, 0, S(""));
    677     test(S("abcde"), 0, 5, SV("1234567890"), 0, 1, S("1"));
    678     test(S("abcde"), 0, 5, SV("1234567890"), 0, 5, S("12345"));
    679     test(S("abcde"), 0, 5, SV("1234567890"), 0, 9, S("123456789"));
    680     test(S("abcde"), 0, 5, SV("1234567890"), 0, 10, S("1234567890"));
    681     test(S("abcde"), 0, 5, SV("1234567890"), 0, 11, S("1234567890"));
    682     test(S("abcde"), 0, 5, SV("1234567890"), 1, 0, S(""));
    683     test(S("abcde"), 0, 5, SV("1234567890"), 1, 1, S("2"));
    684     test(S("abcde"), 0, 5, SV("1234567890"), 1, 4, S("2345"));
    685     test(S("abcde"), 0, 5, SV("1234567890"), 1, 8, S("23456789"));
    686     test(S("abcde"), 0, 5, SV("1234567890"), 1, 9, S("234567890"));
    687     test(S("abcde"), 0, 5, SV("1234567890"), 1, 10, S("234567890"));
    688     test(S("abcde"), 0, 5, SV("1234567890"), 5, 0, S(""));
    689     test(S("abcde"), 0, 5, SV("1234567890"), 5, 1, S("6"));
    690     test(S("abcde"), 0, 5, SV("1234567890"), 5, 2, S("67"));
    691     test(S("abcde"), 0, 5, SV("1234567890"), 5, 4, S("6789"));
    692     test(S("abcde"), 0, 5, SV("1234567890"), 5, 5, S("67890"));
    693     test(S("abcde"), 0, 5, SV("1234567890"), 5, 6, S("67890"));
    694     test(S("abcde"), 0, 5, SV("1234567890"), 9, 0, S(""));
    695     test(S("abcde"), 0, 5, SV("1234567890"), 9, 1, S("0"));
    696     test(S("abcde"), 0, 5, SV("1234567890"), 9, 2, S("0"));
    697     test(S("abcde"), 0, 5, SV("1234567890"), 10, 0, S(""));
    698     test(S("abcde"), 0, 5, SV("1234567890"), 10, 1, S(""));
    699     test(S("abcde"), 0, 5, SV("1234567890"), 11, 0, S("can't happen"));
    700     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 0, S(""));
    701     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 1, S("1"));
    702     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 10, S("1234567890"));
    703     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
    704     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
    705     test(S("abcde"), 0, 5, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
    706     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 0, S(""));
    707     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 1, S("2"));
    708     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 9, S("234567890"));
    709     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
    710     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
    711     test(S("abcde"), 0, 5, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
    712     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 0, S(""));
    713     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 1, S("1"));
    714     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 5, S("12345"));
    715     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 9, S("123456789"));
    716     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 10, S("1234567890"));
    717     test(S("abcde"), 0, 5, SV("12345678901234567890"), 10, 11, S("1234567890"));
    718     test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 0, S(""));
    719     test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 1, S("0"));
    720     test(S("abcde"), 0, 5, SV("12345678901234567890"), 19, 2, S("0"));
    721     test(S("abcde"), 0, 5, SV("12345678901234567890"), 20, 0, S(""));
    722     test(S("abcde"), 0, 5, SV("12345678901234567890"), 20, 1, S(""));
    723     test(S("abcde"), 0, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
    724     test(S("abcde"), 0, 6, SV(""), 0, 0, S(""));
    725     test(S("abcde"), 0, 6, SV(""), 0, 1, S(""));
    726     test(S("abcde"), 0, 6, SV(""), 1, 0, S("can't happen"));
    727     test(S("abcde"), 0, 6, SV("12345"), 0, 0, S(""));
    728     test(S("abcde"), 0, 6, SV("12345"), 0, 1, S("1"));
    729     test(S("abcde"), 0, 6, SV("12345"), 0, 2, S("12"));
    730     test(S("abcde"), 0, 6, SV("12345"), 0, 4, S("1234"));
    731     test(S("abcde"), 0, 6, SV("12345"), 0, 5, S("12345"));
    732 }
    733 
    734 template <class S, class SV>
    735 void test6()
    736 {
    737     test(S("abcde"), 0, 6, SV("12345"), 0, 6, S("12345"));
    738     test(S("abcde"), 0, 6, SV("12345"), 1, 0, S(""));
    739     test(S("abcde"), 0, 6, SV("12345"), 1, 1, S("2"));
    740     test(S("abcde"), 0, 6, SV("12345"), 1, 2, S("23"));
    741     test(S("abcde"), 0, 6, SV("12345"), 1, 3, S("234"));
    742     test(S("abcde"), 0, 6, SV("12345"), 1, 4, S("2345"));
    743     test(S("abcde"), 0, 6, SV("12345"), 1, 5, S("2345"));
    744     test(S("abcde"), 0, 6, SV("12345"), 2, 0, S(""));
    745     test(S("abcde"), 0, 6, SV("12345"), 2, 1, S("3"));
    746     test(S("abcde"), 0, 6, SV("12345"), 2, 2, S("34"));
    747     test(S("abcde"), 0, 6, SV("12345"), 2, 3, S("345"));
    748     test(S("abcde"), 0, 6, SV("12345"), 2, 4, S("345"));
    749     test(S("abcde"), 0, 6, SV("12345"), 4, 0, S(""));
    750     test(S("abcde"), 0, 6, SV("12345"), 4, 1, S("5"));
    751     test(S("abcde"), 0, 6, SV("12345"), 4, 2, S("5"));
    752     test(S("abcde"), 0, 6, SV("12345"), 5, 0, S(""));
    753     test(S("abcde"), 0, 6, SV("12345"), 5, 1, S(""));
    754     test(S("abcde"), 0, 6, SV("12345"), 6, 0, S("can't happen"));
    755     test(S("abcde"), 0, 6, SV("1234567890"), 0, 0, S(""));
    756     test(S("abcde"), 0, 6, SV("1234567890"), 0, 1, S("1"));
    757     test(S("abcde"), 0, 6, SV("1234567890"), 0, 5, S("12345"));
    758     test(S("abcde"), 0, 6, SV("1234567890"), 0, 9, S("123456789"));
    759     test(S("abcde"), 0, 6, SV("1234567890"), 0, 10, S("1234567890"));
    760     test(S("abcde"), 0, 6, SV("1234567890"), 0, 11, S("1234567890"));
    761     test(S("abcde"), 0, 6, SV("1234567890"), 1, 0, S(""));
    762     test(S("abcde"), 0, 6, SV("1234567890"), 1, 1, S("2"));
    763     test(S("abcde"), 0, 6, SV("1234567890"), 1, 4, S("2345"));
    764     test(S("abcde"), 0, 6, SV("1234567890"), 1, 8, S("23456789"));
    765     test(S("abcde"), 0, 6, SV("1234567890"), 1, 9, S("234567890"));
    766     test(S("abcde"), 0, 6, SV("1234567890"), 1, 10, S("234567890"));
    767     test(S("abcde"), 0, 6, SV("1234567890"), 5, 0, S(""));
    768     test(S("abcde"), 0, 6, SV("1234567890"), 5, 1, S("6"));
    769     test(S("abcde"), 0, 6, SV("1234567890"), 5, 2, S("67"));
    770     test(S("abcde"), 0, 6, SV("1234567890"), 5, 4, S("6789"));
    771     test(S("abcde"), 0, 6, SV("1234567890"), 5, 5, S("67890"));
    772     test(S("abcde"), 0, 6, SV("1234567890"), 5, 6, S("67890"));
    773     test(S("abcde"), 0, 6, SV("1234567890"), 9, 0, S(""));
    774     test(S("abcde"), 0, 6, SV("1234567890"), 9, 1, S("0"));
    775     test(S("abcde"), 0, 6, SV("1234567890"), 9, 2, S("0"));
    776     test(S("abcde"), 0, 6, SV("1234567890"), 10, 0, S(""));
    777     test(S("abcde"), 0, 6, SV("1234567890"), 10, 1, S(""));
    778     test(S("abcde"), 0, 6, SV("1234567890"), 11, 0, S("can't happen"));
    779     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 0, S(""));
    780     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 1, S("1"));
    781     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 10, S("1234567890"));
    782     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
    783     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
    784     test(S("abcde"), 0, 6, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
    785     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 0, S(""));
    786     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 1, S("2"));
    787     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 9, S("234567890"));
    788     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
    789     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
    790     test(S("abcde"), 0, 6, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
    791     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 0, S(""));
    792     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 1, S("1"));
    793     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 5, S("12345"));
    794     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 9, S("123456789"));
    795     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 10, S("1234567890"));
    796     test(S("abcde"), 0, 6, SV("12345678901234567890"), 10, 11, S("1234567890"));
    797     test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 0, S(""));
    798     test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 1, S("0"));
    799     test(S("abcde"), 0, 6, SV("12345678901234567890"), 19, 2, S("0"));
    800     test(S("abcde"), 0, 6, SV("12345678901234567890"), 20, 0, S(""));
    801     test(S("abcde"), 0, 6, SV("12345678901234567890"), 20, 1, S(""));
    802     test(S("abcde"), 0, 6, SV("12345678901234567890"), 21, 0, S("can't happen"));
    803     test(S("abcde"), 1, 0, SV(""), 0, 0, S("abcde"));
    804     test(S("abcde"), 1, 0, SV(""), 0, 1, S("abcde"));
    805     test(S("abcde"), 1, 0, SV(""), 1, 0, S("can't happen"));
    806     test(S("abcde"), 1, 0, SV("12345"), 0, 0, S("abcde"));
    807     test(S("abcde"), 1, 0, SV("12345"), 0, 1, S("a1bcde"));
    808     test(S("abcde"), 1, 0, SV("12345"), 0, 2, S("a12bcde"));
    809     test(S("abcde"), 1, 0, SV("12345"), 0, 4, S("a1234bcde"));
    810     test(S("abcde"), 1, 0, SV("12345"), 0, 5, S("a12345bcde"));
    811     test(S("abcde"), 1, 0, SV("12345"), 0, 6, S("a12345bcde"));
    812     test(S("abcde"), 1, 0, SV("12345"), 1, 0, S("abcde"));
    813     test(S("abcde"), 1, 0, SV("12345"), 1, 1, S("a2bcde"));
    814     test(S("abcde"), 1, 0, SV("12345"), 1, 2, S("a23bcde"));
    815     test(S("abcde"), 1, 0, SV("12345"), 1, 3, S("a234bcde"));
    816     test(S("abcde"), 1, 0, SV("12345"), 1, 4, S("a2345bcde"));
    817     test(S("abcde"), 1, 0, SV("12345"), 1, 5, S("a2345bcde"));
    818     test(S("abcde"), 1, 0, SV("12345"), 2, 0, S("abcde"));
    819     test(S("abcde"), 1, 0, SV("12345"), 2, 1, S("a3bcde"));
    820     test(S("abcde"), 1, 0, SV("12345"), 2, 2, S("a34bcde"));
    821     test(S("abcde"), 1, 0, SV("12345"), 2, 3, S("a345bcde"));
    822     test(S("abcde"), 1, 0, SV("12345"), 2, 4, S("a345bcde"));
    823     test(S("abcde"), 1, 0, SV("12345"), 4, 0, S("abcde"));
    824     test(S("abcde"), 1, 0, SV("12345"), 4, 1, S("a5bcde"));
    825     test(S("abcde"), 1, 0, SV("12345"), 4, 2, S("a5bcde"));
    826     test(S("abcde"), 1, 0, SV("12345"), 5, 0, S("abcde"));
    827     test(S("abcde"), 1, 0, SV("12345"), 5, 1, S("abcde"));
    828     test(S("abcde"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
    829     test(S("abcde"), 1, 0, SV("1234567890"), 0, 0, S("abcde"));
    830     test(S("abcde"), 1, 0, SV("1234567890"), 0, 1, S("a1bcde"));
    831     test(S("abcde"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcde"));
    832     test(S("abcde"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcde"));
    833     test(S("abcde"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcde"));
    834     test(S("abcde"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcde"));
    835     test(S("abcde"), 1, 0, SV("1234567890"), 1, 0, S("abcde"));
    836     test(S("abcde"), 1, 0, SV("1234567890"), 1, 1, S("a2bcde"));
    837 }
    838 
    839 template <class S, class SV>
    840 void test7()
    841 {
    842     test(S("abcde"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcde"));
    843     test(S("abcde"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcde"));
    844     test(S("abcde"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcde"));
    845     test(S("abcde"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcde"));
    846     test(S("abcde"), 1, 0, SV("1234567890"), 5, 0, S("abcde"));
    847     test(S("abcde"), 1, 0, SV("1234567890"), 5, 1, S("a6bcde"));
    848     test(S("abcde"), 1, 0, SV("1234567890"), 5, 2, S("a67bcde"));
    849     test(S("abcde"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcde"));
    850     test(S("abcde"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcde"));
    851     test(S("abcde"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcde"));
    852     test(S("abcde"), 1, 0, SV("1234567890"), 9, 0, S("abcde"));
    853     test(S("abcde"), 1, 0, SV("1234567890"), 9, 1, S("a0bcde"));
    854     test(S("abcde"), 1, 0, SV("1234567890"), 9, 2, S("a0bcde"));
    855     test(S("abcde"), 1, 0, SV("1234567890"), 10, 0, S("abcde"));
    856     test(S("abcde"), 1, 0, SV("1234567890"), 10, 1, S("abcde"));
    857     test(S("abcde"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
    858     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
    859     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcde"));
    860     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcde"));
    861     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcde"));
    862     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcde"));
    863     test(S("abcde"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcde"));
    864     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
    865     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcde"));
    866     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcde"));
    867     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcde"));
    868     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcde"));
    869     test(S("abcde"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcde"));
    870     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
    871     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcde"));
    872     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcde"));
    873     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcde"));
    874     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcde"));
    875     test(S("abcde"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcde"));
    876     test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
    877     test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcde"));
    878     test(S("abcde"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcde"));
    879     test(S("abcde"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
    880     test(S("abcde"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
    881     test(S("abcde"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
    882     test(S("abcde"), 1, 1, SV(""), 0, 0, S("acde"));
    883     test(S("abcde"), 1, 1, SV(""), 0, 1, S("acde"));
    884     test(S("abcde"), 1, 1, SV(""), 1, 0, S("can't happen"));
    885     test(S("abcde"), 1, 1, SV("12345"), 0, 0, S("acde"));
    886     test(S("abcde"), 1, 1, SV("12345"), 0, 1, S("a1cde"));
    887     test(S("abcde"), 1, 1, SV("12345"), 0, 2, S("a12cde"));
    888     test(S("abcde"), 1, 1, SV("12345"), 0, 4, S("a1234cde"));
    889     test(S("abcde"), 1, 1, SV("12345"), 0, 5, S("a12345cde"));
    890     test(S("abcde"), 1, 1, SV("12345"), 0, 6, S("a12345cde"));
    891     test(S("abcde"), 1, 1, SV("12345"), 1, 0, S("acde"));
    892     test(S("abcde"), 1, 1, SV("12345"), 1, 1, S("a2cde"));
    893     test(S("abcde"), 1, 1, SV("12345"), 1, 2, S("a23cde"));
    894     test(S("abcde"), 1, 1, SV("12345"), 1, 3, S("a234cde"));
    895     test(S("abcde"), 1, 1, SV("12345"), 1, 4, S("a2345cde"));
    896     test(S("abcde"), 1, 1, SV("12345"), 1, 5, S("a2345cde"));
    897     test(S("abcde"), 1, 1, SV("12345"), 2, 0, S("acde"));
    898     test(S("abcde"), 1, 1, SV("12345"), 2, 1, S("a3cde"));
    899     test(S("abcde"), 1, 1, SV("12345"), 2, 2, S("a34cde"));
    900     test(S("abcde"), 1, 1, SV("12345"), 2, 3, S("a345cde"));
    901     test(S("abcde"), 1, 1, SV("12345"), 2, 4, S("a345cde"));
    902     test(S("abcde"), 1, 1, SV("12345"), 4, 0, S("acde"));
    903     test(S("abcde"), 1, 1, SV("12345"), 4, 1, S("a5cde"));
    904     test(S("abcde"), 1, 1, SV("12345"), 4, 2, S("a5cde"));
    905     test(S("abcde"), 1, 1, SV("12345"), 5, 0, S("acde"));
    906     test(S("abcde"), 1, 1, SV("12345"), 5, 1, S("acde"));
    907     test(S("abcde"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
    908     test(S("abcde"), 1, 1, SV("1234567890"), 0, 0, S("acde"));
    909     test(S("abcde"), 1, 1, SV("1234567890"), 0, 1, S("a1cde"));
    910     test(S("abcde"), 1, 1, SV("1234567890"), 0, 5, S("a12345cde"));
    911     test(S("abcde"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cde"));
    912     test(S("abcde"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cde"));
    913     test(S("abcde"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cde"));
    914     test(S("abcde"), 1, 1, SV("1234567890"), 1, 0, S("acde"));
    915     test(S("abcde"), 1, 1, SV("1234567890"), 1, 1, S("a2cde"));
    916     test(S("abcde"), 1, 1, SV("1234567890"), 1, 4, S("a2345cde"));
    917     test(S("abcde"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cde"));
    918     test(S("abcde"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cde"));
    919     test(S("abcde"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cde"));
    920     test(S("abcde"), 1, 1, SV("1234567890"), 5, 0, S("acde"));
    921     test(S("abcde"), 1, 1, SV("1234567890"), 5, 1, S("a6cde"));
    922     test(S("abcde"), 1, 1, SV("1234567890"), 5, 2, S("a67cde"));
    923     test(S("abcde"), 1, 1, SV("1234567890"), 5, 4, S("a6789cde"));
    924     test(S("abcde"), 1, 1, SV("1234567890"), 5, 5, S("a67890cde"));
    925     test(S("abcde"), 1, 1, SV("1234567890"), 5, 6, S("a67890cde"));
    926     test(S("abcde"), 1, 1, SV("1234567890"), 9, 0, S("acde"));
    927     test(S("abcde"), 1, 1, SV("1234567890"), 9, 1, S("a0cde"));
    928     test(S("abcde"), 1, 1, SV("1234567890"), 9, 2, S("a0cde"));
    929     test(S("abcde"), 1, 1, SV("1234567890"), 10, 0, S("acde"));
    930     test(S("abcde"), 1, 1, SV("1234567890"), 10, 1, S("acde"));
    931     test(S("abcde"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
    932     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 0, S("acde"));
    933     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cde"));
    934     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cde"));
    935     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cde"));
    936     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cde"));
    937     test(S("abcde"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cde"));
    938     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 0, S("acde"));
    939     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cde"));
    940     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cde"));
    941     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cde"));
    942 }
    943 
    944 template <class S, class SV>
    945 void test8()
    946 {
    947     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cde"));
    948     test(S("abcde"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cde"));
    949     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 0, S("acde"));
    950     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cde"));
    951     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cde"));
    952     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cde"));
    953     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cde"));
    954     test(S("abcde"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cde"));
    955     test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 0, S("acde"));
    956     test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cde"));
    957     test(S("abcde"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cde"));
    958     test(S("abcde"), 1, 1, SV("12345678901234567890"), 20, 0, S("acde"));
    959     test(S("abcde"), 1, 1, SV("12345678901234567890"), 20, 1, S("acde"));
    960     test(S("abcde"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
    961     test(S("abcde"), 1, 2, SV(""), 0, 0, S("ade"));
    962     test(S("abcde"), 1, 2, SV(""), 0, 1, S("ade"));
    963     test(S("abcde"), 1, 2, SV(""), 1, 0, S("can't happen"));
    964     test(S("abcde"), 1, 2, SV("12345"), 0, 0, S("ade"));
    965     test(S("abcde"), 1, 2, SV("12345"), 0, 1, S("a1de"));
    966     test(S("abcde"), 1, 2, SV("12345"), 0, 2, S("a12de"));
    967     test(S("abcde"), 1, 2, SV("12345"), 0, 4, S("a1234de"));
    968     test(S("abcde"), 1, 2, SV("12345"), 0, 5, S("a12345de"));
    969     test(S("abcde"), 1, 2, SV("12345"), 0, 6, S("a12345de"));
    970     test(S("abcde"), 1, 2, SV("12345"), 1, 0, S("ade"));
    971     test(S("abcde"), 1, 2, SV("12345"), 1, 1, S("a2de"));
    972     test(S("abcde"), 1, 2, SV("12345"), 1, 2, S("a23de"));
    973     test(S("abcde"), 1, 2, SV("12345"), 1, 3, S("a234de"));
    974     test(S("abcde"), 1, 2, SV("12345"), 1, 4, S("a2345de"));
    975     test(S("abcde"), 1, 2, SV("12345"), 1, 5, S("a2345de"));
    976     test(S("abcde"), 1, 2, SV("12345"), 2, 0, S("ade"));
    977     test(S("abcde"), 1, 2, SV("12345"), 2, 1, S("a3de"));
    978     test(S("abcde"), 1, 2, SV("12345"), 2, 2, S("a34de"));
    979     test(S("abcde"), 1, 2, SV("12345"), 2, 3, S("a345de"));
    980     test(S("abcde"), 1, 2, SV("12345"), 2, 4, S("a345de"));
    981     test(S("abcde"), 1, 2, SV("12345"), 4, 0, S("ade"));
    982     test(S("abcde"), 1, 2, SV("12345"), 4, 1, S("a5de"));
    983     test(S("abcde"), 1, 2, SV("12345"), 4, 2, S("a5de"));
    984     test(S("abcde"), 1, 2, SV("12345"), 5, 0, S("ade"));
    985     test(S("abcde"), 1, 2, SV("12345"), 5, 1, S("ade"));
    986     test(S("abcde"), 1, 2, SV("12345"), 6, 0, S("can't happen"));
    987     test(S("abcde"), 1, 2, SV("1234567890"), 0, 0, S("ade"));
    988     test(S("abcde"), 1, 2, SV("1234567890"), 0, 1, S("a1de"));
    989     test(S("abcde"), 1, 2, SV("1234567890"), 0, 5, S("a12345de"));
    990     test(S("abcde"), 1, 2, SV("1234567890"), 0, 9, S("a123456789de"));
    991     test(S("abcde"), 1, 2, SV("1234567890"), 0, 10, S("a1234567890de"));
    992     test(S("abcde"), 1, 2, SV("1234567890"), 0, 11, S("a1234567890de"));
    993     test(S("abcde"), 1, 2, SV("1234567890"), 1, 0, S("ade"));
    994     test(S("abcde"), 1, 2, SV("1234567890"), 1, 1, S("a2de"));
    995     test(S("abcde"), 1, 2, SV("1234567890"), 1, 4, S("a2345de"));
    996     test(S("abcde"), 1, 2, SV("1234567890"), 1, 8, S("a23456789de"));
    997     test(S("abcde"), 1, 2, SV("1234567890"), 1, 9, S("a234567890de"));
    998     test(S("abcde"), 1, 2, SV("1234567890"), 1, 10, S("a234567890de"));
    999     test(S("abcde"), 1, 2, SV("1234567890"), 5, 0, S("ade"));
   1000     test(S("abcde"), 1, 2, SV("1234567890"), 5, 1, S("a6de"));
   1001     test(S("abcde"), 1, 2, SV("1234567890"), 5, 2, S("a67de"));
   1002     test(S("abcde"), 1, 2, SV("1234567890"), 5, 4, S("a6789de"));
   1003     test(S("abcde"), 1, 2, SV("1234567890"), 5, 5, S("a67890de"));
   1004     test(S("abcde"), 1, 2, SV("1234567890"), 5, 6, S("a67890de"));
   1005     test(S("abcde"), 1, 2, SV("1234567890"), 9, 0, S("ade"));
   1006     test(S("abcde"), 1, 2, SV("1234567890"), 9, 1, S("a0de"));
   1007     test(S("abcde"), 1, 2, SV("1234567890"), 9, 2, S("a0de"));
   1008     test(S("abcde"), 1, 2, SV("1234567890"), 10, 0, S("ade"));
   1009     test(S("abcde"), 1, 2, SV("1234567890"), 10, 1, S("ade"));
   1010     test(S("abcde"), 1, 2, SV("1234567890"), 11, 0, S("can't happen"));
   1011     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 0, S("ade"));
   1012     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 1, S("a1de"));
   1013     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 10, S("a1234567890de"));
   1014     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 19, S("a1234567890123456789de"));
   1015     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 20, S("a12345678901234567890de"));
   1016     test(S("abcde"), 1, 2, SV("12345678901234567890"), 0, 21, S("a12345678901234567890de"));
   1017     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 0, S("ade"));
   1018     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 1, S("a2de"));
   1019     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 9, S("a234567890de"));
   1020     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 18, S("a234567890123456789de"));
   1021     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 19, S("a2345678901234567890de"));
   1022     test(S("abcde"), 1, 2, SV("12345678901234567890"), 1, 20, S("a2345678901234567890de"));
   1023     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 0, S("ade"));
   1024     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 1, S("a1de"));
   1025     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 5, S("a12345de"));
   1026     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 9, S("a123456789de"));
   1027     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 10, S("a1234567890de"));
   1028     test(S("abcde"), 1, 2, SV("12345678901234567890"), 10, 11, S("a1234567890de"));
   1029     test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 0, S("ade"));
   1030     test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 1, S("a0de"));
   1031     test(S("abcde"), 1, 2, SV("12345678901234567890"), 19, 2, S("a0de"));
   1032     test(S("abcde"), 1, 2, SV("12345678901234567890"), 20, 0, S("ade"));
   1033     test(S("abcde"), 1, 2, SV("12345678901234567890"), 20, 1, S("ade"));
   1034     test(S("abcde"), 1, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1035     test(S("abcde"), 1, 3, SV(""), 0, 0, S("ae"));
   1036     test(S("abcde"), 1, 3, SV(""), 0, 1, S("ae"));
   1037     test(S("abcde"), 1, 3, SV(""), 1, 0, S("can't happen"));
   1038     test(S("abcde"), 1, 3, SV("12345"), 0, 0, S("ae"));
   1039     test(S("abcde"), 1, 3, SV("12345"), 0, 1, S("a1e"));
   1040     test(S("abcde"), 1, 3, SV("12345"), 0, 2, S("a12e"));
   1041     test(S("abcde"), 1, 3, SV("12345"), 0, 4, S("a1234e"));
   1042     test(S("abcde"), 1, 3, SV("12345"), 0, 5, S("a12345e"));
   1043     test(S("abcde"), 1, 3, SV("12345"), 0, 6, S("a12345e"));
   1044     test(S("abcde"), 1, 3, SV("12345"), 1, 0, S("ae"));
   1045     test(S("abcde"), 1, 3, SV("12345"), 1, 1, S("a2e"));
   1046     test(S("abcde"), 1, 3, SV("12345"), 1, 2, S("a23e"));
   1047 }
   1048 
   1049 template <class S, class SV>
   1050 void test9()
   1051 {
   1052     test(S("abcde"), 1, 3, SV("12345"), 1, 3, S("a234e"));
   1053     test(S("abcde"), 1, 3, SV("12345"), 1, 4, S("a2345e"));
   1054     test(S("abcde"), 1, 3, SV("12345"), 1, 5, S("a2345e"));
   1055     test(S("abcde"), 1, 3, SV("12345"), 2, 0, S("ae"));
   1056     test(S("abcde"), 1, 3, SV("12345"), 2, 1, S("a3e"));
   1057     test(S("abcde"), 1, 3, SV("12345"), 2, 2, S("a34e"));
   1058     test(S("abcde"), 1, 3, SV("12345"), 2, 3, S("a345e"));
   1059     test(S("abcde"), 1, 3, SV("12345"), 2, 4, S("a345e"));
   1060     test(S("abcde"), 1, 3, SV("12345"), 4, 0, S("ae"));
   1061     test(S("abcde"), 1, 3, SV("12345"), 4, 1, S("a5e"));
   1062     test(S("abcde"), 1, 3, SV("12345"), 4, 2, S("a5e"));
   1063     test(S("abcde"), 1, 3, SV("12345"), 5, 0, S("ae"));
   1064     test(S("abcde"), 1, 3, SV("12345"), 5, 1, S("ae"));
   1065     test(S("abcde"), 1, 3, SV("12345"), 6, 0, S("can't happen"));
   1066     test(S("abcde"), 1, 3, SV("1234567890"), 0, 0, S("ae"));
   1067     test(S("abcde"), 1, 3, SV("1234567890"), 0, 1, S("a1e"));
   1068     test(S("abcde"), 1, 3, SV("1234567890"), 0, 5, S("a12345e"));
   1069     test(S("abcde"), 1, 3, SV("1234567890"), 0, 9, S("a123456789e"));
   1070     test(S("abcde"), 1, 3, SV("1234567890"), 0, 10, S("a1234567890e"));
   1071     test(S("abcde"), 1, 3, SV("1234567890"), 0, 11, S("a1234567890e"));
   1072     test(S("abcde"), 1, 3, SV("1234567890"), 1, 0, S("ae"));
   1073     test(S("abcde"), 1, 3, SV("1234567890"), 1, 1, S("a2e"));
   1074     test(S("abcde"), 1, 3, SV("1234567890"), 1, 4, S("a2345e"));
   1075     test(S("abcde"), 1, 3, SV("1234567890"), 1, 8, S("a23456789e"));
   1076     test(S("abcde"), 1, 3, SV("1234567890"), 1, 9, S("a234567890e"));
   1077     test(S("abcde"), 1, 3, SV("1234567890"), 1, 10, S("a234567890e"));
   1078     test(S("abcde"), 1, 3, SV("1234567890"), 5, 0, S("ae"));
   1079     test(S("abcde"), 1, 3, SV("1234567890"), 5, 1, S("a6e"));
   1080     test(S("abcde"), 1, 3, SV("1234567890"), 5, 2, S("a67e"));
   1081     test(S("abcde"), 1, 3, SV("1234567890"), 5, 4, S("a6789e"));
   1082     test(S("abcde"), 1, 3, SV("1234567890"), 5, 5, S("a67890e"));
   1083     test(S("abcde"), 1, 3, SV("1234567890"), 5, 6, S("a67890e"));
   1084     test(S("abcde"), 1, 3, SV("1234567890"), 9, 0, S("ae"));
   1085     test(S("abcde"), 1, 3, SV("1234567890"), 9, 1, S("a0e"));
   1086     test(S("abcde"), 1, 3, SV("1234567890"), 9, 2, S("a0e"));
   1087     test(S("abcde"), 1, 3, SV("1234567890"), 10, 0, S("ae"));
   1088     test(S("abcde"), 1, 3, SV("1234567890"), 10, 1, S("ae"));
   1089     test(S("abcde"), 1, 3, SV("1234567890"), 11, 0, S("can't happen"));
   1090     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 0, S("ae"));
   1091     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 1, S("a1e"));
   1092     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 10, S("a1234567890e"));
   1093     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 19, S("a1234567890123456789e"));
   1094     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 20, S("a12345678901234567890e"));
   1095     test(S("abcde"), 1, 3, SV("12345678901234567890"), 0, 21, S("a12345678901234567890e"));
   1096     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 0, S("ae"));
   1097     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 1, S("a2e"));
   1098     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 9, S("a234567890e"));
   1099     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 18, S("a234567890123456789e"));
   1100     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 19, S("a2345678901234567890e"));
   1101     test(S("abcde"), 1, 3, SV("12345678901234567890"), 1, 20, S("a2345678901234567890e"));
   1102     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 0, S("ae"));
   1103     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 1, S("a1e"));
   1104     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 5, S("a12345e"));
   1105     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 9, S("a123456789e"));
   1106     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 10, S("a1234567890e"));
   1107     test(S("abcde"), 1, 3, SV("12345678901234567890"), 10, 11, S("a1234567890e"));
   1108     test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 0, S("ae"));
   1109     test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 1, S("a0e"));
   1110     test(S("abcde"), 1, 3, SV("12345678901234567890"), 19, 2, S("a0e"));
   1111     test(S("abcde"), 1, 3, SV("12345678901234567890"), 20, 0, S("ae"));
   1112     test(S("abcde"), 1, 3, SV("12345678901234567890"), 20, 1, S("ae"));
   1113     test(S("abcde"), 1, 3, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1114     test(S("abcde"), 1, 4, SV(""), 0, 0, S("a"));
   1115     test(S("abcde"), 1, 4, SV(""), 0, 1, S("a"));
   1116     test(S("abcde"), 1, 4, SV(""), 1, 0, S("can't happen"));
   1117     test(S("abcde"), 1, 4, SV("12345"), 0, 0, S("a"));
   1118     test(S("abcde"), 1, 4, SV("12345"), 0, 1, S("a1"));
   1119     test(S("abcde"), 1, 4, SV("12345"), 0, 2, S("a12"));
   1120     test(S("abcde"), 1, 4, SV("12345"), 0, 4, S("a1234"));
   1121     test(S("abcde"), 1, 4, SV("12345"), 0, 5, S("a12345"));
   1122     test(S("abcde"), 1, 4, SV("12345"), 0, 6, S("a12345"));
   1123     test(S("abcde"), 1, 4, SV("12345"), 1, 0, S("a"));
   1124     test(S("abcde"), 1, 4, SV("12345"), 1, 1, S("a2"));
   1125     test(S("abcde"), 1, 4, SV("12345"), 1, 2, S("a23"));
   1126     test(S("abcde"), 1, 4, SV("12345"), 1, 3, S("a234"));
   1127     test(S("abcde"), 1, 4, SV("12345"), 1, 4, S("a2345"));
   1128     test(S("abcde"), 1, 4, SV("12345"), 1, 5, S("a2345"));
   1129     test(S("abcde"), 1, 4, SV("12345"), 2, 0, S("a"));
   1130     test(S("abcde"), 1, 4, SV("12345"), 2, 1, S("a3"));
   1131     test(S("abcde"), 1, 4, SV("12345"), 2, 2, S("a34"));
   1132     test(S("abcde"), 1, 4, SV("12345"), 2, 3, S("a345"));
   1133     test(S("abcde"), 1, 4, SV("12345"), 2, 4, S("a345"));
   1134     test(S("abcde"), 1, 4, SV("12345"), 4, 0, S("a"));
   1135     test(S("abcde"), 1, 4, SV("12345"), 4, 1, S("a5"));
   1136     test(S("abcde"), 1, 4, SV("12345"), 4, 2, S("a5"));
   1137     test(S("abcde"), 1, 4, SV("12345"), 5, 0, S("a"));
   1138     test(S("abcde"), 1, 4, SV("12345"), 5, 1, S("a"));
   1139     test(S("abcde"), 1, 4, SV("12345"), 6, 0, S("can't happen"));
   1140     test(S("abcde"), 1, 4, SV("1234567890"), 0, 0, S("a"));
   1141     test(S("abcde"), 1, 4, SV("1234567890"), 0, 1, S("a1"));
   1142     test(S("abcde"), 1, 4, SV("1234567890"), 0, 5, S("a12345"));
   1143     test(S("abcde"), 1, 4, SV("1234567890"), 0, 9, S("a123456789"));
   1144     test(S("abcde"), 1, 4, SV("1234567890"), 0, 10, S("a1234567890"));
   1145     test(S("abcde"), 1, 4, SV("1234567890"), 0, 11, S("a1234567890"));
   1146     test(S("abcde"), 1, 4, SV("1234567890"), 1, 0, S("a"));
   1147     test(S("abcde"), 1, 4, SV("1234567890"), 1, 1, S("a2"));
   1148     test(S("abcde"), 1, 4, SV("1234567890"), 1, 4, S("a2345"));
   1149     test(S("abcde"), 1, 4, SV("1234567890"), 1, 8, S("a23456789"));
   1150     test(S("abcde"), 1, 4, SV("1234567890"), 1, 9, S("a234567890"));
   1151     test(S("abcde"), 1, 4, SV("1234567890"), 1, 10, S("a234567890"));
   1152 }
   1153 
   1154 template <class S, class SV>
   1155 void test10()
   1156 {
   1157     test(S("abcde"), 1, 4, SV("1234567890"), 5, 0, S("a"));
   1158     test(S("abcde"), 1, 4, SV("1234567890"), 5, 1, S("a6"));
   1159     test(S("abcde"), 1, 4, SV("1234567890"), 5, 2, S("a67"));
   1160     test(S("abcde"), 1, 4, SV("1234567890"), 5, 4, S("a6789"));
   1161     test(S("abcde"), 1, 4, SV("1234567890"), 5, 5, S("a67890"));
   1162     test(S("abcde"), 1, 4, SV("1234567890"), 5, 6, S("a67890"));
   1163     test(S("abcde"), 1, 4, SV("1234567890"), 9, 0, S("a"));
   1164     test(S("abcde"), 1, 4, SV("1234567890"), 9, 1, S("a0"));
   1165     test(S("abcde"), 1, 4, SV("1234567890"), 9, 2, S("a0"));
   1166     test(S("abcde"), 1, 4, SV("1234567890"), 10, 0, S("a"));
   1167     test(S("abcde"), 1, 4, SV("1234567890"), 10, 1, S("a"));
   1168     test(S("abcde"), 1, 4, SV("1234567890"), 11, 0, S("can't happen"));
   1169     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 0, S("a"));
   1170     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 1, S("a1"));
   1171     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   1172     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   1173     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   1174     test(S("abcde"), 1, 4, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   1175     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 0, S("a"));
   1176     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 1, S("a2"));
   1177     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 9, S("a234567890"));
   1178     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   1179     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   1180     test(S("abcde"), 1, 4, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   1181     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 0, S("a"));
   1182     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 1, S("a1"));
   1183     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 5, S("a12345"));
   1184     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 9, S("a123456789"));
   1185     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   1186     test(S("abcde"), 1, 4, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   1187     test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 0, S("a"));
   1188     test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 1, S("a0"));
   1189     test(S("abcde"), 1, 4, SV("12345678901234567890"), 19, 2, S("a0"));
   1190     test(S("abcde"), 1, 4, SV("12345678901234567890"), 20, 0, S("a"));
   1191     test(S("abcde"), 1, 4, SV("12345678901234567890"), 20, 1, S("a"));
   1192     test(S("abcde"), 1, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1193     test(S("abcde"), 1, 5, SV(""), 0, 0, S("a"));
   1194     test(S("abcde"), 1, 5, SV(""), 0, 1, S("a"));
   1195     test(S("abcde"), 1, 5, SV(""), 1, 0, S("can't happen"));
   1196     test(S("abcde"), 1, 5, SV("12345"), 0, 0, S("a"));
   1197     test(S("abcde"), 1, 5, SV("12345"), 0, 1, S("a1"));
   1198     test(S("abcde"), 1, 5, SV("12345"), 0, 2, S("a12"));
   1199     test(S("abcde"), 1, 5, SV("12345"), 0, 4, S("a1234"));
   1200     test(S("abcde"), 1, 5, SV("12345"), 0, 5, S("a12345"));
   1201     test(S("abcde"), 1, 5, SV("12345"), 0, 6, S("a12345"));
   1202     test(S("abcde"), 1, 5, SV("12345"), 1, 0, S("a"));
   1203     test(S("abcde"), 1, 5, SV("12345"), 1, 1, S("a2"));
   1204     test(S("abcde"), 1, 5, SV("12345"), 1, 2, S("a23"));
   1205     test(S("abcde"), 1, 5, SV("12345"), 1, 3, S("a234"));
   1206     test(S("abcde"), 1, 5, SV("12345"), 1, 4, S("a2345"));
   1207     test(S("abcde"), 1, 5, SV("12345"), 1, 5, S("a2345"));
   1208     test(S("abcde"), 1, 5, SV("12345"), 2, 0, S("a"));
   1209     test(S("abcde"), 1, 5, SV("12345"), 2, 1, S("a3"));
   1210     test(S("abcde"), 1, 5, SV("12345"), 2, 2, S("a34"));
   1211     test(S("abcde"), 1, 5, SV("12345"), 2, 3, S("a345"));
   1212     test(S("abcde"), 1, 5, SV("12345"), 2, 4, S("a345"));
   1213     test(S("abcde"), 1, 5, SV("12345"), 4, 0, S("a"));
   1214     test(S("abcde"), 1, 5, SV("12345"), 4, 1, S("a5"));
   1215     test(S("abcde"), 1, 5, SV("12345"), 4, 2, S("a5"));
   1216     test(S("abcde"), 1, 5, SV("12345"), 5, 0, S("a"));
   1217     test(S("abcde"), 1, 5, SV("12345"), 5, 1, S("a"));
   1218     test(S("abcde"), 1, 5, SV("12345"), 6, 0, S("can't happen"));
   1219     test(S("abcde"), 1, 5, SV("1234567890"), 0, 0, S("a"));
   1220     test(S("abcde"), 1, 5, SV("1234567890"), 0, 1, S("a1"));
   1221     test(S("abcde"), 1, 5, SV("1234567890"), 0, 5, S("a12345"));
   1222     test(S("abcde"), 1, 5, SV("1234567890"), 0, 9, S("a123456789"));
   1223     test(S("abcde"), 1, 5, SV("1234567890"), 0, 10, S("a1234567890"));
   1224     test(S("abcde"), 1, 5, SV("1234567890"), 0, 11, S("a1234567890"));
   1225     test(S("abcde"), 1, 5, SV("1234567890"), 1, 0, S("a"));
   1226     test(S("abcde"), 1, 5, SV("1234567890"), 1, 1, S("a2"));
   1227     test(S("abcde"), 1, 5, SV("1234567890"), 1, 4, S("a2345"));
   1228     test(S("abcde"), 1, 5, SV("1234567890"), 1, 8, S("a23456789"));
   1229     test(S("abcde"), 1, 5, SV("1234567890"), 1, 9, S("a234567890"));
   1230     test(S("abcde"), 1, 5, SV("1234567890"), 1, 10, S("a234567890"));
   1231     test(S("abcde"), 1, 5, SV("1234567890"), 5, 0, S("a"));
   1232     test(S("abcde"), 1, 5, SV("1234567890"), 5, 1, S("a6"));
   1233     test(S("abcde"), 1, 5, SV("1234567890"), 5, 2, S("a67"));
   1234     test(S("abcde"), 1, 5, SV("1234567890"), 5, 4, S("a6789"));
   1235     test(S("abcde"), 1, 5, SV("1234567890"), 5, 5, S("a67890"));
   1236     test(S("abcde"), 1, 5, SV("1234567890"), 5, 6, S("a67890"));
   1237     test(S("abcde"), 1, 5, SV("1234567890"), 9, 0, S("a"));
   1238     test(S("abcde"), 1, 5, SV("1234567890"), 9, 1, S("a0"));
   1239     test(S("abcde"), 1, 5, SV("1234567890"), 9, 2, S("a0"));
   1240     test(S("abcde"), 1, 5, SV("1234567890"), 10, 0, S("a"));
   1241     test(S("abcde"), 1, 5, SV("1234567890"), 10, 1, S("a"));
   1242     test(S("abcde"), 1, 5, SV("1234567890"), 11, 0, S("can't happen"));
   1243     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 0, S("a"));
   1244     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 1, S("a1"));
   1245     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   1246     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   1247     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   1248     test(S("abcde"), 1, 5, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   1249     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 0, S("a"));
   1250     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 1, S("a2"));
   1251     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 9, S("a234567890"));
   1252     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   1253     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   1254     test(S("abcde"), 1, 5, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   1255     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 0, S("a"));
   1256     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 1, S("a1"));
   1257 }
   1258 
   1259 template <class S, class SV>
   1260 void test11()
   1261 {
   1262     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 5, S("a12345"));
   1263     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 9, S("a123456789"));
   1264     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   1265     test(S("abcde"), 1, 5, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   1266     test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 0, S("a"));
   1267     test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 1, S("a0"));
   1268     test(S("abcde"), 1, 5, SV("12345678901234567890"), 19, 2, S("a0"));
   1269     test(S("abcde"), 1, 5, SV("12345678901234567890"), 20, 0, S("a"));
   1270     test(S("abcde"), 1, 5, SV("12345678901234567890"), 20, 1, S("a"));
   1271     test(S("abcde"), 1, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1272     test(S("abcde"), 2, 0, SV(""), 0, 0, S("abcde"));
   1273     test(S("abcde"), 2, 0, SV(""), 0, 1, S("abcde"));
   1274     test(S("abcde"), 2, 0, SV(""), 1, 0, S("can't happen"));
   1275     test(S("abcde"), 2, 0, SV("12345"), 0, 0, S("abcde"));
   1276     test(S("abcde"), 2, 0, SV("12345"), 0, 1, S("ab1cde"));
   1277     test(S("abcde"), 2, 0, SV("12345"), 0, 2, S("ab12cde"));
   1278     test(S("abcde"), 2, 0, SV("12345"), 0, 4, S("ab1234cde"));
   1279     test(S("abcde"), 2, 0, SV("12345"), 0, 5, S("ab12345cde"));
   1280     test(S("abcde"), 2, 0, SV("12345"), 0, 6, S("ab12345cde"));
   1281     test(S("abcde"), 2, 0, SV("12345"), 1, 0, S("abcde"));
   1282     test(S("abcde"), 2, 0, SV("12345"), 1, 1, S("ab2cde"));
   1283     test(S("abcde"), 2, 0, SV("12345"), 1, 2, S("ab23cde"));
   1284     test(S("abcde"), 2, 0, SV("12345"), 1, 3, S("ab234cde"));
   1285     test(S("abcde"), 2, 0, SV("12345"), 1, 4, S("ab2345cde"));
   1286     test(S("abcde"), 2, 0, SV("12345"), 1, 5, S("ab2345cde"));
   1287     test(S("abcde"), 2, 0, SV("12345"), 2, 0, S("abcde"));
   1288     test(S("abcde"), 2, 0, SV("12345"), 2, 1, S("ab3cde"));
   1289     test(S("abcde"), 2, 0, SV("12345"), 2, 2, S("ab34cde"));
   1290     test(S("abcde"), 2, 0, SV("12345"), 2, 3, S("ab345cde"));
   1291     test(S("abcde"), 2, 0, SV("12345"), 2, 4, S("ab345cde"));
   1292     test(S("abcde"), 2, 0, SV("12345"), 4, 0, S("abcde"));
   1293     test(S("abcde"), 2, 0, SV("12345"), 4, 1, S("ab5cde"));
   1294     test(S("abcde"), 2, 0, SV("12345"), 4, 2, S("ab5cde"));
   1295     test(S("abcde"), 2, 0, SV("12345"), 5, 0, S("abcde"));
   1296     test(S("abcde"), 2, 0, SV("12345"), 5, 1, S("abcde"));
   1297     test(S("abcde"), 2, 0, SV("12345"), 6, 0, S("can't happen"));
   1298     test(S("abcde"), 2, 0, SV("1234567890"), 0, 0, S("abcde"));
   1299     test(S("abcde"), 2, 0, SV("1234567890"), 0, 1, S("ab1cde"));
   1300     test(S("abcde"), 2, 0, SV("1234567890"), 0, 5, S("ab12345cde"));
   1301     test(S("abcde"), 2, 0, SV("1234567890"), 0, 9, S("ab123456789cde"));
   1302     test(S("abcde"), 2, 0, SV("1234567890"), 0, 10, S("ab1234567890cde"));
   1303     test(S("abcde"), 2, 0, SV("1234567890"), 0, 11, S("ab1234567890cde"));
   1304     test(S("abcde"), 2, 0, SV("1234567890"), 1, 0, S("abcde"));
   1305     test(S("abcde"), 2, 0, SV("1234567890"), 1, 1, S("ab2cde"));
   1306     test(S("abcde"), 2, 0, SV("1234567890"), 1, 4, S("ab2345cde"));
   1307     test(S("abcde"), 2, 0, SV("1234567890"), 1, 8, S("ab23456789cde"));
   1308     test(S("abcde"), 2, 0, SV("1234567890"), 1, 9, S("ab234567890cde"));
   1309     test(S("abcde"), 2, 0, SV("1234567890"), 1, 10, S("ab234567890cde"));
   1310     test(S("abcde"), 2, 0, SV("1234567890"), 5, 0, S("abcde"));
   1311     test(S("abcde"), 2, 0, SV("1234567890"), 5, 1, S("ab6cde"));
   1312     test(S("abcde"), 2, 0, SV("1234567890"), 5, 2, S("ab67cde"));
   1313     test(S("abcde"), 2, 0, SV("1234567890"), 5, 4, S("ab6789cde"));
   1314     test(S("abcde"), 2, 0, SV("1234567890"), 5, 5, S("ab67890cde"));
   1315     test(S("abcde"), 2, 0, SV("1234567890"), 5, 6, S("ab67890cde"));
   1316     test(S("abcde"), 2, 0, SV("1234567890"), 9, 0, S("abcde"));
   1317     test(S("abcde"), 2, 0, SV("1234567890"), 9, 1, S("ab0cde"));
   1318     test(S("abcde"), 2, 0, SV("1234567890"), 9, 2, S("ab0cde"));
   1319     test(S("abcde"), 2, 0, SV("1234567890"), 10, 0, S("abcde"));
   1320     test(S("abcde"), 2, 0, SV("1234567890"), 10, 1, S("abcde"));
   1321     test(S("abcde"), 2, 0, SV("1234567890"), 11, 0, S("can't happen"));
   1322     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
   1323     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 1, S("ab1cde"));
   1324     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 10, S("ab1234567890cde"));
   1325     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789cde"));
   1326     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890cde"));
   1327     test(S("abcde"), 2, 0, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890cde"));
   1328     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
   1329     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 1, S("ab2cde"));
   1330     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 9, S("ab234567890cde"));
   1331     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 18, S("ab234567890123456789cde"));
   1332     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890cde"));
   1333     test(S("abcde"), 2, 0, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890cde"));
   1334     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
   1335     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 1, S("ab1cde"));
   1336     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 5, S("ab12345cde"));
   1337     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 9, S("ab123456789cde"));
   1338     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 10, S("ab1234567890cde"));
   1339     test(S("abcde"), 2, 0, SV("12345678901234567890"), 10, 11, S("ab1234567890cde"));
   1340     test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
   1341     test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 1, S("ab0cde"));
   1342     test(S("abcde"), 2, 0, SV("12345678901234567890"), 19, 2, S("ab0cde"));
   1343     test(S("abcde"), 2, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
   1344     test(S("abcde"), 2, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
   1345     test(S("abcde"), 2, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1346     test(S("abcde"), 2, 1, SV(""), 0, 0, S("abde"));
   1347     test(S("abcde"), 2, 1, SV(""), 0, 1, S("abde"));
   1348     test(S("abcde"), 2, 1, SV(""), 1, 0, S("can't happen"));
   1349     test(S("abcde"), 2, 1, SV("12345"), 0, 0, S("abde"));
   1350     test(S("abcde"), 2, 1, SV("12345"), 0, 1, S("ab1de"));
   1351     test(S("abcde"), 2, 1, SV("12345"), 0, 2, S("ab12de"));
   1352     test(S("abcde"), 2, 1, SV("12345"), 0, 4, S("ab1234de"));
   1353     test(S("abcde"), 2, 1, SV("12345"), 0, 5, S("ab12345de"));
   1354     test(S("abcde"), 2, 1, SV("12345"), 0, 6, S("ab12345de"));
   1355     test(S("abcde"), 2, 1, SV("12345"), 1, 0, S("abde"));
   1356     test(S("abcde"), 2, 1, SV("12345"), 1, 1, S("ab2de"));
   1357     test(S("abcde"), 2, 1, SV("12345"), 1, 2, S("ab23de"));
   1358     test(S("abcde"), 2, 1, SV("12345"), 1, 3, S("ab234de"));
   1359     test(S("abcde"), 2, 1, SV("12345"), 1, 4, S("ab2345de"));
   1360     test(S("abcde"), 2, 1, SV("12345"), 1, 5, S("ab2345de"));
   1361     test(S("abcde"), 2, 1, SV("12345"), 2, 0, S("abde"));
   1362 }
   1363 
   1364 template <class S, class SV>
   1365 void test12()
   1366 {
   1367     test(S("abcde"), 2, 1, SV("12345"), 2, 1, S("ab3de"));
   1368     test(S("abcde"), 2, 1, SV("12345"), 2, 2, S("ab34de"));
   1369     test(S("abcde"), 2, 1, SV("12345"), 2, 3, S("ab345de"));
   1370     test(S("abcde"), 2, 1, SV("12345"), 2, 4, S("ab345de"));
   1371     test(S("abcde"), 2, 1, SV("12345"), 4, 0, S("abde"));
   1372     test(S("abcde"), 2, 1, SV("12345"), 4, 1, S("ab5de"));
   1373     test(S("abcde"), 2, 1, SV("12345"), 4, 2, S("ab5de"));
   1374     test(S("abcde"), 2, 1, SV("12345"), 5, 0, S("abde"));
   1375     test(S("abcde"), 2, 1, SV("12345"), 5, 1, S("abde"));
   1376     test(S("abcde"), 2, 1, SV("12345"), 6, 0, S("can't happen"));
   1377     test(S("abcde"), 2, 1, SV("1234567890"), 0, 0, S("abde"));
   1378     test(S("abcde"), 2, 1, SV("1234567890"), 0, 1, S("ab1de"));
   1379     test(S("abcde"), 2, 1, SV("1234567890"), 0, 5, S("ab12345de"));
   1380     test(S("abcde"), 2, 1, SV("1234567890"), 0, 9, S("ab123456789de"));
   1381     test(S("abcde"), 2, 1, SV("1234567890"), 0, 10, S("ab1234567890de"));
   1382     test(S("abcde"), 2, 1, SV("1234567890"), 0, 11, S("ab1234567890de"));
   1383     test(S("abcde"), 2, 1, SV("1234567890"), 1, 0, S("abde"));
   1384     test(S("abcde"), 2, 1, SV("1234567890"), 1, 1, S("ab2de"));
   1385     test(S("abcde"), 2, 1, SV("1234567890"), 1, 4, S("ab2345de"));
   1386     test(S("abcde"), 2, 1, SV("1234567890"), 1, 8, S("ab23456789de"));
   1387     test(S("abcde"), 2, 1, SV("1234567890"), 1, 9, S("ab234567890de"));
   1388     test(S("abcde"), 2, 1, SV("1234567890"), 1, 10, S("ab234567890de"));
   1389     test(S("abcde"), 2, 1, SV("1234567890"), 5, 0, S("abde"));
   1390     test(S("abcde"), 2, 1, SV("1234567890"), 5, 1, S("ab6de"));
   1391     test(S("abcde"), 2, 1, SV("1234567890"), 5, 2, S("ab67de"));
   1392     test(S("abcde"), 2, 1, SV("1234567890"), 5, 4, S("ab6789de"));
   1393     test(S("abcde"), 2, 1, SV("1234567890"), 5, 5, S("ab67890de"));
   1394     test(S("abcde"), 2, 1, SV("1234567890"), 5, 6, S("ab67890de"));
   1395     test(S("abcde"), 2, 1, SV("1234567890"), 9, 0, S("abde"));
   1396     test(S("abcde"), 2, 1, SV("1234567890"), 9, 1, S("ab0de"));
   1397     test(S("abcde"), 2, 1, SV("1234567890"), 9, 2, S("ab0de"));
   1398     test(S("abcde"), 2, 1, SV("1234567890"), 10, 0, S("abde"));
   1399     test(S("abcde"), 2, 1, SV("1234567890"), 10, 1, S("abde"));
   1400     test(S("abcde"), 2, 1, SV("1234567890"), 11, 0, S("can't happen"));
   1401     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 0, S("abde"));
   1402     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 1, S("ab1de"));
   1403     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 10, S("ab1234567890de"));
   1404     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789de"));
   1405     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890de"));
   1406     test(S("abcde"), 2, 1, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890de"));
   1407     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 0, S("abde"));
   1408     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 1, S("ab2de"));
   1409     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 9, S("ab234567890de"));
   1410     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 18, S("ab234567890123456789de"));
   1411     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890de"));
   1412     test(S("abcde"), 2, 1, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890de"));
   1413     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 0, S("abde"));
   1414     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 1, S("ab1de"));
   1415     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 5, S("ab12345de"));
   1416     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 9, S("ab123456789de"));
   1417     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 10, S("ab1234567890de"));
   1418     test(S("abcde"), 2, 1, SV("12345678901234567890"), 10, 11, S("ab1234567890de"));
   1419     test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 0, S("abde"));
   1420     test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 1, S("ab0de"));
   1421     test(S("abcde"), 2, 1, SV("12345678901234567890"), 19, 2, S("ab0de"));
   1422     test(S("abcde"), 2, 1, SV("12345678901234567890"), 20, 0, S("abde"));
   1423     test(S("abcde"), 2, 1, SV("12345678901234567890"), 20, 1, S("abde"));
   1424     test(S("abcde"), 2, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1425     test(S("abcde"), 2, 2, SV(""), 0, 0, S("abe"));
   1426     test(S("abcde"), 2, 2, SV(""), 0, 1, S("abe"));
   1427     test(S("abcde"), 2, 2, SV(""), 1, 0, S("can't happen"));
   1428     test(S("abcde"), 2, 2, SV("12345"), 0, 0, S("abe"));
   1429     test(S("abcde"), 2, 2, SV("12345"), 0, 1, S("ab1e"));
   1430     test(S("abcde"), 2, 2, SV("12345"), 0, 2, S("ab12e"));
   1431     test(S("abcde"), 2, 2, SV("12345"), 0, 4, S("ab1234e"));
   1432     test(S("abcde"), 2, 2, SV("12345"), 0, 5, S("ab12345e"));
   1433     test(S("abcde"), 2, 2, SV("12345"), 0, 6, S("ab12345e"));
   1434     test(S("abcde"), 2, 2, SV("12345"), 1, 0, S("abe"));
   1435     test(S("abcde"), 2, 2, SV("12345"), 1, 1, S("ab2e"));
   1436     test(S("abcde"), 2, 2, SV("12345"), 1, 2, S("ab23e"));
   1437     test(S("abcde"), 2, 2, SV("12345"), 1, 3, S("ab234e"));
   1438     test(S("abcde"), 2, 2, SV("12345"), 1, 4, S("ab2345e"));
   1439     test(S("abcde"), 2, 2, SV("12345"), 1, 5, S("ab2345e"));
   1440     test(S("abcde"), 2, 2, SV("12345"), 2, 0, S("abe"));
   1441     test(S("abcde"), 2, 2, SV("12345"), 2, 1, S("ab3e"));
   1442     test(S("abcde"), 2, 2, SV("12345"), 2, 2, S("ab34e"));
   1443     test(S("abcde"), 2, 2, SV("12345"), 2, 3, S("ab345e"));
   1444     test(S("abcde"), 2, 2, SV("12345"), 2, 4, S("ab345e"));
   1445     test(S("abcde"), 2, 2, SV("12345"), 4, 0, S("abe"));
   1446     test(S("abcde"), 2, 2, SV("12345"), 4, 1, S("ab5e"));
   1447     test(S("abcde"), 2, 2, SV("12345"), 4, 2, S("ab5e"));
   1448     test(S("abcde"), 2, 2, SV("12345"), 5, 0, S("abe"));
   1449     test(S("abcde"), 2, 2, SV("12345"), 5, 1, S("abe"));
   1450     test(S("abcde"), 2, 2, SV("12345"), 6, 0, S("can't happen"));
   1451     test(S("abcde"), 2, 2, SV("1234567890"), 0, 0, S("abe"));
   1452     test(S("abcde"), 2, 2, SV("1234567890"), 0, 1, S("ab1e"));
   1453     test(S("abcde"), 2, 2, SV("1234567890"), 0, 5, S("ab12345e"));
   1454     test(S("abcde"), 2, 2, SV("1234567890"), 0, 9, S("ab123456789e"));
   1455     test(S("abcde"), 2, 2, SV("1234567890"), 0, 10, S("ab1234567890e"));
   1456     test(S("abcde"), 2, 2, SV("1234567890"), 0, 11, S("ab1234567890e"));
   1457     test(S("abcde"), 2, 2, SV("1234567890"), 1, 0, S("abe"));
   1458     test(S("abcde"), 2, 2, SV("1234567890"), 1, 1, S("ab2e"));
   1459     test(S("abcde"), 2, 2, SV("1234567890"), 1, 4, S("ab2345e"));
   1460     test(S("abcde"), 2, 2, SV("1234567890"), 1, 8, S("ab23456789e"));
   1461     test(S("abcde"), 2, 2, SV("1234567890"), 1, 9, S("ab234567890e"));
   1462     test(S("abcde"), 2, 2, SV("1234567890"), 1, 10, S("ab234567890e"));
   1463     test(S("abcde"), 2, 2, SV("1234567890"), 5, 0, S("abe"));
   1464     test(S("abcde"), 2, 2, SV("1234567890"), 5, 1, S("ab6e"));
   1465     test(S("abcde"), 2, 2, SV("1234567890"), 5, 2, S("ab67e"));
   1466     test(S("abcde"), 2, 2, SV("1234567890"), 5, 4, S("ab6789e"));
   1467 }
   1468 
   1469 template <class S, class SV>
   1470 void test13()
   1471 {
   1472     test(S("abcde"), 2, 2, SV("1234567890"), 5, 5, S("ab67890e"));
   1473     test(S("abcde"), 2, 2, SV("1234567890"), 5, 6, S("ab67890e"));
   1474     test(S("abcde"), 2, 2, SV("1234567890"), 9, 0, S("abe"));
   1475     test(S("abcde"), 2, 2, SV("1234567890"), 9, 1, S("ab0e"));
   1476     test(S("abcde"), 2, 2, SV("1234567890"), 9, 2, S("ab0e"));
   1477     test(S("abcde"), 2, 2, SV("1234567890"), 10, 0, S("abe"));
   1478     test(S("abcde"), 2, 2, SV("1234567890"), 10, 1, S("abe"));
   1479     test(S("abcde"), 2, 2, SV("1234567890"), 11, 0, S("can't happen"));
   1480     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 0, S("abe"));
   1481     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 1, S("ab1e"));
   1482     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 10, S("ab1234567890e"));
   1483     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789e"));
   1484     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890e"));
   1485     test(S("abcde"), 2, 2, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890e"));
   1486     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 0, S("abe"));
   1487     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 1, S("ab2e"));
   1488     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 9, S("ab234567890e"));
   1489     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 18, S("ab234567890123456789e"));
   1490     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890e"));
   1491     test(S("abcde"), 2, 2, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890e"));
   1492     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 0, S("abe"));
   1493     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 1, S("ab1e"));
   1494     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 5, S("ab12345e"));
   1495     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 9, S("ab123456789e"));
   1496     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 10, S("ab1234567890e"));
   1497     test(S("abcde"), 2, 2, SV("12345678901234567890"), 10, 11, S("ab1234567890e"));
   1498     test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 0, S("abe"));
   1499     test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 1, S("ab0e"));
   1500     test(S("abcde"), 2, 2, SV("12345678901234567890"), 19, 2, S("ab0e"));
   1501     test(S("abcde"), 2, 2, SV("12345678901234567890"), 20, 0, S("abe"));
   1502     test(S("abcde"), 2, 2, SV("12345678901234567890"), 20, 1, S("abe"));
   1503     test(S("abcde"), 2, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1504     test(S("abcde"), 2, 3, SV(""), 0, 0, S("ab"));
   1505     test(S("abcde"), 2, 3, SV(""), 0, 1, S("ab"));
   1506     test(S("abcde"), 2, 3, SV(""), 1, 0, S("can't happen"));
   1507     test(S("abcde"), 2, 3, SV("12345"), 0, 0, S("ab"));
   1508     test(S("abcde"), 2, 3, SV("12345"), 0, 1, S("ab1"));
   1509     test(S("abcde"), 2, 3, SV("12345"), 0, 2, S("ab12"));
   1510     test(S("abcde"), 2, 3, SV("12345"), 0, 4, S("ab1234"));
   1511     test(S("abcde"), 2, 3, SV("12345"), 0, 5, S("ab12345"));
   1512     test(S("abcde"), 2, 3, SV("12345"), 0, 6, S("ab12345"));
   1513     test(S("abcde"), 2, 3, SV("12345"), 1, 0, S("ab"));
   1514     test(S("abcde"), 2, 3, SV("12345"), 1, 1, S("ab2"));
   1515     test(S("abcde"), 2, 3, SV("12345"), 1, 2, S("ab23"));
   1516     test(S("abcde"), 2, 3, SV("12345"), 1, 3, S("ab234"));
   1517     test(S("abcde"), 2, 3, SV("12345"), 1, 4, S("ab2345"));
   1518     test(S("abcde"), 2, 3, SV("12345"), 1, 5, S("ab2345"));
   1519     test(S("abcde"), 2, 3, SV("12345"), 2, 0, S("ab"));
   1520     test(S("abcde"), 2, 3, SV("12345"), 2, 1, S("ab3"));
   1521     test(S("abcde"), 2, 3, SV("12345"), 2, 2, S("ab34"));
   1522     test(S("abcde"), 2, 3, SV("12345"), 2, 3, S("ab345"));
   1523     test(S("abcde"), 2, 3, SV("12345"), 2, 4, S("ab345"));
   1524     test(S("abcde"), 2, 3, SV("12345"), 4, 0, S("ab"));
   1525     test(S("abcde"), 2, 3, SV("12345"), 4, 1, S("ab5"));
   1526     test(S("abcde"), 2, 3, SV("12345"), 4, 2, S("ab5"));
   1527     test(S("abcde"), 2, 3, SV("12345"), 5, 0, S("ab"));
   1528     test(S("abcde"), 2, 3, SV("12345"), 5, 1, S("ab"));
   1529     test(S("abcde"), 2, 3, SV("12345"), 6, 0, S("can't happen"));
   1530     test(S("abcde"), 2, 3, SV("1234567890"), 0, 0, S("ab"));
   1531     test(S("abcde"), 2, 3, SV("1234567890"), 0, 1, S("ab1"));
   1532     test(S("abcde"), 2, 3, SV("1234567890"), 0, 5, S("ab12345"));
   1533     test(S("abcde"), 2, 3, SV("1234567890"), 0, 9, S("ab123456789"));
   1534     test(S("abcde"), 2, 3, SV("1234567890"), 0, 10, S("ab1234567890"));
   1535     test(S("abcde"), 2, 3, SV("1234567890"), 0, 11, S("ab1234567890"));
   1536     test(S("abcde"), 2, 3, SV("1234567890"), 1, 0, S("ab"));
   1537     test(S("abcde"), 2, 3, SV("1234567890"), 1, 1, S("ab2"));
   1538     test(S("abcde"), 2, 3, SV("1234567890"), 1, 4, S("ab2345"));
   1539     test(S("abcde"), 2, 3, SV("1234567890"), 1, 8, S("ab23456789"));
   1540     test(S("abcde"), 2, 3, SV("1234567890"), 1, 9, S("ab234567890"));
   1541     test(S("abcde"), 2, 3, SV("1234567890"), 1, 10, S("ab234567890"));
   1542     test(S("abcde"), 2, 3, SV("1234567890"), 5, 0, S("ab"));
   1543     test(S("abcde"), 2, 3, SV("1234567890"), 5, 1, S("ab6"));
   1544     test(S("abcde"), 2, 3, SV("1234567890"), 5, 2, S("ab67"));
   1545     test(S("abcde"), 2, 3, SV("1234567890"), 5, 4, S("ab6789"));
   1546     test(S("abcde"), 2, 3, SV("1234567890"), 5, 5, S("ab67890"));
   1547     test(S("abcde"), 2, 3, SV("1234567890"), 5, 6, S("ab67890"));
   1548     test(S("abcde"), 2, 3, SV("1234567890"), 9, 0, S("ab"));
   1549     test(S("abcde"), 2, 3, SV("1234567890"), 9, 1, S("ab0"));
   1550     test(S("abcde"), 2, 3, SV("1234567890"), 9, 2, S("ab0"));
   1551     test(S("abcde"), 2, 3, SV("1234567890"), 10, 0, S("ab"));
   1552     test(S("abcde"), 2, 3, SV("1234567890"), 10, 1, S("ab"));
   1553     test(S("abcde"), 2, 3, SV("1234567890"), 11, 0, S("can't happen"));
   1554     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 0, S("ab"));
   1555     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 1, S("ab1"));
   1556     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 10, S("ab1234567890"));
   1557     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
   1558     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
   1559     test(S("abcde"), 2, 3, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
   1560     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 0, S("ab"));
   1561     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 1, S("ab2"));
   1562     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 9, S("ab234567890"));
   1563     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 18, S("ab234567890123456789"));
   1564     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
   1565     test(S("abcde"), 2, 3, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
   1566     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 0, S("ab"));
   1567     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 1, S("ab1"));
   1568     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 5, S("ab12345"));
   1569     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 9, S("ab123456789"));
   1570     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 10, S("ab1234567890"));
   1571     test(S("abcde"), 2, 3, SV("12345678901234567890"), 10, 11, S("ab1234567890"));
   1572 }
   1573 
   1574 template <class S, class SV>
   1575 void test14()
   1576 {
   1577     test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 0, S("ab"));
   1578     test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 1, S("ab0"));
   1579     test(S("abcde"), 2, 3, SV("12345678901234567890"), 19, 2, S("ab0"));
   1580     test(S("abcde"), 2, 3, SV("12345678901234567890"), 20, 0, S("ab"));
   1581     test(S("abcde"), 2, 3, SV("12345678901234567890"), 20, 1, S("ab"));
   1582     test(S("abcde"), 2, 3, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1583     test(S("abcde"), 2, 4, SV(""), 0, 0, S("ab"));
   1584     test(S("abcde"), 2, 4, SV(""), 0, 1, S("ab"));
   1585     test(S("abcde"), 2, 4, SV(""), 1, 0, S("can't happen"));
   1586     test(S("abcde"), 2, 4, SV("12345"), 0, 0, S("ab"));
   1587     test(S("abcde"), 2, 4, SV("12345"), 0, 1, S("ab1"));
   1588     test(S("abcde"), 2, 4, SV("12345"), 0, 2, S("ab12"));
   1589     test(S("abcde"), 2, 4, SV("12345"), 0, 4, S("ab1234"));
   1590     test(S("abcde"), 2, 4, SV("12345"), 0, 5, S("ab12345"));
   1591     test(S("abcde"), 2, 4, SV("12345"), 0, 6, S("ab12345"));
   1592     test(S("abcde"), 2, 4, SV("12345"), 1, 0, S("ab"));
   1593     test(S("abcde"), 2, 4, SV("12345"), 1, 1, S("ab2"));
   1594     test(S("abcde"), 2, 4, SV("12345"), 1, 2, S("ab23"));
   1595     test(S("abcde"), 2, 4, SV("12345"), 1, 3, S("ab234"));
   1596     test(S("abcde"), 2, 4, SV("12345"), 1, 4, S("ab2345"));
   1597     test(S("abcde"), 2, 4, SV("12345"), 1, 5, S("ab2345"));
   1598     test(S("abcde"), 2, 4, SV("12345"), 2, 0, S("ab"));
   1599     test(S("abcde"), 2, 4, SV("12345"), 2, 1, S("ab3"));
   1600     test(S("abcde"), 2, 4, SV("12345"), 2, 2, S("ab34"));
   1601     test(S("abcde"), 2, 4, SV("12345"), 2, 3, S("ab345"));
   1602     test(S("abcde"), 2, 4, SV("12345"), 2, 4, S("ab345"));
   1603     test(S("abcde"), 2, 4, SV("12345"), 4, 0, S("ab"));
   1604     test(S("abcde"), 2, 4, SV("12345"), 4, 1, S("ab5"));
   1605     test(S("abcde"), 2, 4, SV("12345"), 4, 2, S("ab5"));
   1606     test(S("abcde"), 2, 4, SV("12345"), 5, 0, S("ab"));
   1607     test(S("abcde"), 2, 4, SV("12345"), 5, 1, S("ab"));
   1608     test(S("abcde"), 2, 4, SV("12345"), 6, 0, S("can't happen"));
   1609     test(S("abcde"), 2, 4, SV("1234567890"), 0, 0, S("ab"));
   1610     test(S("abcde"), 2, 4, SV("1234567890"), 0, 1, S("ab1"));
   1611     test(S("abcde"), 2, 4, SV("1234567890"), 0, 5, S("ab12345"));
   1612     test(S("abcde"), 2, 4, SV("1234567890"), 0, 9, S("ab123456789"));
   1613     test(S("abcde"), 2, 4, SV("1234567890"), 0, 10, S("ab1234567890"));
   1614     test(S("abcde"), 2, 4, SV("1234567890"), 0, 11, S("ab1234567890"));
   1615     test(S("abcde"), 2, 4, SV("1234567890"), 1, 0, S("ab"));
   1616     test(S("abcde"), 2, 4, SV("1234567890"), 1, 1, S("ab2"));
   1617     test(S("abcde"), 2, 4, SV("1234567890"), 1, 4, S("ab2345"));
   1618     test(S("abcde"), 2, 4, SV("1234567890"), 1, 8, S("ab23456789"));
   1619     test(S("abcde"), 2, 4, SV("1234567890"), 1, 9, S("ab234567890"));
   1620     test(S("abcde"), 2, 4, SV("1234567890"), 1, 10, S("ab234567890"));
   1621     test(S("abcde"), 2, 4, SV("1234567890"), 5, 0, S("ab"));
   1622     test(S("abcde"), 2, 4, SV("1234567890"), 5, 1, S("ab6"));
   1623     test(S("abcde"), 2, 4, SV("1234567890"), 5, 2, S("ab67"));
   1624     test(S("abcde"), 2, 4, SV("1234567890"), 5, 4, S("ab6789"));
   1625     test(S("abcde"), 2, 4, SV("1234567890"), 5, 5, S("ab67890"));
   1626     test(S("abcde"), 2, 4, SV("1234567890"), 5, 6, S("ab67890"));
   1627     test(S("abcde"), 2, 4, SV("1234567890"), 9, 0, S("ab"));
   1628     test(S("abcde"), 2, 4, SV("1234567890"), 9, 1, S("ab0"));
   1629     test(S("abcde"), 2, 4, SV("1234567890"), 9, 2, S("ab0"));
   1630     test(S("abcde"), 2, 4, SV("1234567890"), 10, 0, S("ab"));
   1631     test(S("abcde"), 2, 4, SV("1234567890"), 10, 1, S("ab"));
   1632     test(S("abcde"), 2, 4, SV("1234567890"), 11, 0, S("can't happen"));
   1633     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 0, S("ab"));
   1634     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 1, S("ab1"));
   1635     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 10, S("ab1234567890"));
   1636     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 19, S("ab1234567890123456789"));
   1637     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 20, S("ab12345678901234567890"));
   1638     test(S("abcde"), 2, 4, SV("12345678901234567890"), 0, 21, S("ab12345678901234567890"));
   1639     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 0, S("ab"));
   1640     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 1, S("ab2"));
   1641     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 9, S("ab234567890"));
   1642     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 18, S("ab234567890123456789"));
   1643     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 19, S("ab2345678901234567890"));
   1644     test(S("abcde"), 2, 4, SV("12345678901234567890"), 1, 20, S("ab2345678901234567890"));
   1645     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 0, S("ab"));
   1646     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 1, S("ab1"));
   1647     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 5, S("ab12345"));
   1648     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 9, S("ab123456789"));
   1649     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 10, S("ab1234567890"));
   1650     test(S("abcde"), 2, 4, SV("12345678901234567890"), 10, 11, S("ab1234567890"));
   1651     test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 0, S("ab"));
   1652     test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 1, S("ab0"));
   1653     test(S("abcde"), 2, 4, SV("12345678901234567890"), 19, 2, S("ab0"));
   1654     test(S("abcde"), 2, 4, SV("12345678901234567890"), 20, 0, S("ab"));
   1655     test(S("abcde"), 2, 4, SV("12345678901234567890"), 20, 1, S("ab"));
   1656     test(S("abcde"), 2, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1657     test(S("abcde"), 4, 0, SV(""), 0, 0, S("abcde"));
   1658     test(S("abcde"), 4, 0, SV(""), 0, 1, S("abcde"));
   1659     test(S("abcde"), 4, 0, SV(""), 1, 0, S("can't happen"));
   1660     test(S("abcde"), 4, 0, SV("12345"), 0, 0, S("abcde"));
   1661     test(S("abcde"), 4, 0, SV("12345"), 0, 1, S("abcd1e"));
   1662     test(S("abcde"), 4, 0, SV("12345"), 0, 2, S("abcd12e"));
   1663     test(S("abcde"), 4, 0, SV("12345"), 0, 4, S("abcd1234e"));
   1664     test(S("abcde"), 4, 0, SV("12345"), 0, 5, S("abcd12345e"));
   1665     test(S("abcde"), 4, 0, SV("12345"), 0, 6, S("abcd12345e"));
   1666     test(S("abcde"), 4, 0, SV("12345"), 1, 0, S("abcde"));
   1667     test(S("abcde"), 4, 0, SV("12345"), 1, 1, S("abcd2e"));
   1668     test(S("abcde"), 4, 0, SV("12345"), 1, 2, S("abcd23e"));
   1669     test(S("abcde"), 4, 0, SV("12345"), 1, 3, S("abcd234e"));
   1670     test(S("abcde"), 4, 0, SV("12345"), 1, 4, S("abcd2345e"));
   1671     test(S("abcde"), 4, 0, SV("12345"), 1, 5, S("abcd2345e"));
   1672     test(S("abcde"), 4, 0, SV("12345"), 2, 0, S("abcde"));
   1673     test(S("abcde"), 4, 0, SV("12345"), 2, 1, S("abcd3e"));
   1674     test(S("abcde"), 4, 0, SV("12345"), 2, 2, S("abcd34e"));
   1675     test(S("abcde"), 4, 0, SV("12345"), 2, 3, S("abcd345e"));
   1676     test(S("abcde"), 4, 0, SV("12345"), 2, 4, S("abcd345e"));
   1677 }
   1678 
   1679 template <class S, class SV>
   1680 void test15()
   1681 {
   1682     test(S("abcde"), 4, 0, SV("12345"), 4, 0, S("abcde"));
   1683     test(S("abcde"), 4, 0, SV("12345"), 4, 1, S("abcd5e"));
   1684     test(S("abcde"), 4, 0, SV("12345"), 4, 2, S("abcd5e"));
   1685     test(S("abcde"), 4, 0, SV("12345"), 5, 0, S("abcde"));
   1686     test(S("abcde"), 4, 0, SV("12345"), 5, 1, S("abcde"));
   1687     test(S("abcde"), 4, 0, SV("12345"), 6, 0, S("can't happen"));
   1688     test(S("abcde"), 4, 0, SV("1234567890"), 0, 0, S("abcde"));
   1689     test(S("abcde"), 4, 0, SV("1234567890"), 0, 1, S("abcd1e"));
   1690     test(S("abcde"), 4, 0, SV("1234567890"), 0, 5, S("abcd12345e"));
   1691     test(S("abcde"), 4, 0, SV("1234567890"), 0, 9, S("abcd123456789e"));
   1692     test(S("abcde"), 4, 0, SV("1234567890"), 0, 10, S("abcd1234567890e"));
   1693     test(S("abcde"), 4, 0, SV("1234567890"), 0, 11, S("abcd1234567890e"));
   1694     test(S("abcde"), 4, 0, SV("1234567890"), 1, 0, S("abcde"));
   1695     test(S("abcde"), 4, 0, SV("1234567890"), 1, 1, S("abcd2e"));
   1696     test(S("abcde"), 4, 0, SV("1234567890"), 1, 4, S("abcd2345e"));
   1697     test(S("abcde"), 4, 0, SV("1234567890"), 1, 8, S("abcd23456789e"));
   1698     test(S("abcde"), 4, 0, SV("1234567890"), 1, 9, S("abcd234567890e"));
   1699     test(S("abcde"), 4, 0, SV("1234567890"), 1, 10, S("abcd234567890e"));
   1700     test(S("abcde"), 4, 0, SV("1234567890"), 5, 0, S("abcde"));
   1701     test(S("abcde"), 4, 0, SV("1234567890"), 5, 1, S("abcd6e"));
   1702     test(S("abcde"), 4, 0, SV("1234567890"), 5, 2, S("abcd67e"));
   1703     test(S("abcde"), 4, 0, SV("1234567890"), 5, 4, S("abcd6789e"));
   1704     test(S("abcde"), 4, 0, SV("1234567890"), 5, 5, S("abcd67890e"));
   1705     test(S("abcde"), 4, 0, SV("1234567890"), 5, 6, S("abcd67890e"));
   1706     test(S("abcde"), 4, 0, SV("1234567890"), 9, 0, S("abcde"));
   1707     test(S("abcde"), 4, 0, SV("1234567890"), 9, 1, S("abcd0e"));
   1708     test(S("abcde"), 4, 0, SV("1234567890"), 9, 2, S("abcd0e"));
   1709     test(S("abcde"), 4, 0, SV("1234567890"), 10, 0, S("abcde"));
   1710     test(S("abcde"), 4, 0, SV("1234567890"), 10, 1, S("abcde"));
   1711     test(S("abcde"), 4, 0, SV("1234567890"), 11, 0, S("can't happen"));
   1712     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
   1713     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 1, S("abcd1e"));
   1714     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 10, S("abcd1234567890e"));
   1715     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789e"));
   1716     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890e"));
   1717     test(S("abcde"), 4, 0, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890e"));
   1718     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
   1719     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 1, S("abcd2e"));
   1720     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 9, S("abcd234567890e"));
   1721     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789e"));
   1722     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890e"));
   1723     test(S("abcde"), 4, 0, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890e"));
   1724     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
   1725     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 1, S("abcd1e"));
   1726     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 5, S("abcd12345e"));
   1727     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 9, S("abcd123456789e"));
   1728     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 10, S("abcd1234567890e"));
   1729     test(S("abcde"), 4, 0, SV("12345678901234567890"), 10, 11, S("abcd1234567890e"));
   1730     test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
   1731     test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 1, S("abcd0e"));
   1732     test(S("abcde"), 4, 0, SV("12345678901234567890"), 19, 2, S("abcd0e"));
   1733     test(S("abcde"), 4, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
   1734     test(S("abcde"), 4, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
   1735     test(S("abcde"), 4, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1736     test(S("abcde"), 4, 1, SV(""), 0, 0, S("abcd"));
   1737     test(S("abcde"), 4, 1, SV(""), 0, 1, S("abcd"));
   1738     test(S("abcde"), 4, 1, SV(""), 1, 0, S("can't happen"));
   1739     test(S("abcde"), 4, 1, SV("12345"), 0, 0, S("abcd"));
   1740     test(S("abcde"), 4, 1, SV("12345"), 0, 1, S("abcd1"));
   1741     test(S("abcde"), 4, 1, SV("12345"), 0, 2, S("abcd12"));
   1742     test(S("abcde"), 4, 1, SV("12345"), 0, 4, S("abcd1234"));
   1743     test(S("abcde"), 4, 1, SV("12345"), 0, 5, S("abcd12345"));
   1744     test(S("abcde"), 4, 1, SV("12345"), 0, 6, S("abcd12345"));
   1745     test(S("abcde"), 4, 1, SV("12345"), 1, 0, S("abcd"));
   1746     test(S("abcde"), 4, 1, SV("12345"), 1, 1, S("abcd2"));
   1747     test(S("abcde"), 4, 1, SV("12345"), 1, 2, S("abcd23"));
   1748     test(S("abcde"), 4, 1, SV("12345"), 1, 3, S("abcd234"));
   1749     test(S("abcde"), 4, 1, SV("12345"), 1, 4, S("abcd2345"));
   1750     test(S("abcde"), 4, 1, SV("12345"), 1, 5, S("abcd2345"));
   1751     test(S("abcde"), 4, 1, SV("12345"), 2, 0, S("abcd"));
   1752     test(S("abcde"), 4, 1, SV("12345"), 2, 1, S("abcd3"));
   1753     test(S("abcde"), 4, 1, SV("12345"), 2, 2, S("abcd34"));
   1754     test(S("abcde"), 4, 1, SV("12345"), 2, 3, S("abcd345"));
   1755     test(S("abcde"), 4, 1, SV("12345"), 2, 4, S("abcd345"));
   1756     test(S("abcde"), 4, 1, SV("12345"), 4, 0, S("abcd"));
   1757     test(S("abcde"), 4, 1, SV("12345"), 4, 1, S("abcd5"));
   1758     test(S("abcde"), 4, 1, SV("12345"), 4, 2, S("abcd5"));
   1759     test(S("abcde"), 4, 1, SV("12345"), 5, 0, S("abcd"));
   1760     test(S("abcde"), 4, 1, SV("12345"), 5, 1, S("abcd"));
   1761     test(S("abcde"), 4, 1, SV("12345"), 6, 0, S("can't happen"));
   1762     test(S("abcde"), 4, 1, SV("1234567890"), 0, 0, S("abcd"));
   1763     test(S("abcde"), 4, 1, SV("1234567890"), 0, 1, S("abcd1"));
   1764     test(S("abcde"), 4, 1, SV("1234567890"), 0, 5, S("abcd12345"));
   1765     test(S("abcde"), 4, 1, SV("1234567890"), 0, 9, S("abcd123456789"));
   1766     test(S("abcde"), 4, 1, SV("1234567890"), 0, 10, S("abcd1234567890"));
   1767     test(S("abcde"), 4, 1, SV("1234567890"), 0, 11, S("abcd1234567890"));
   1768     test(S("abcde"), 4, 1, SV("1234567890"), 1, 0, S("abcd"));
   1769     test(S("abcde"), 4, 1, SV("1234567890"), 1, 1, S("abcd2"));
   1770     test(S("abcde"), 4, 1, SV("1234567890"), 1, 4, S("abcd2345"));
   1771     test(S("abcde"), 4, 1, SV("1234567890"), 1, 8, S("abcd23456789"));
   1772     test(S("abcde"), 4, 1, SV("1234567890"), 1, 9, S("abcd234567890"));
   1773     test(S("abcde"), 4, 1, SV("1234567890"), 1, 10, S("abcd234567890"));
   1774     test(S("abcde"), 4, 1, SV("1234567890"), 5, 0, S("abcd"));
   1775     test(S("abcde"), 4, 1, SV("1234567890"), 5, 1, S("abcd6"));
   1776     test(S("abcde"), 4, 1, SV("1234567890"), 5, 2, S("abcd67"));
   1777     test(S("abcde"), 4, 1, SV("1234567890"), 5, 4, S("abcd6789"));
   1778     test(S("abcde"), 4, 1, SV("1234567890"), 5, 5, S("abcd67890"));
   1779     test(S("abcde"), 4, 1, SV("1234567890"), 5, 6, S("abcd67890"));
   1780     test(S("abcde"), 4, 1, SV("1234567890"), 9, 0, S("abcd"));
   1781     test(S("abcde"), 4, 1, SV("1234567890"), 9, 1, S("abcd0"));
   1782 }
   1783 
   1784 template <class S, class SV>
   1785 void test16()
   1786 {
   1787     test(S("abcde"), 4, 1, SV("1234567890"), 9, 2, S("abcd0"));
   1788     test(S("abcde"), 4, 1, SV("1234567890"), 10, 0, S("abcd"));
   1789     test(S("abcde"), 4, 1, SV("1234567890"), 10, 1, S("abcd"));
   1790     test(S("abcde"), 4, 1, SV("1234567890"), 11, 0, S("can't happen"));
   1791     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 0, S("abcd"));
   1792     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 1, S("abcd1"));
   1793     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 10, S("abcd1234567890"));
   1794     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
   1795     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
   1796     test(S("abcde"), 4, 1, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
   1797     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 0, S("abcd"));
   1798     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 1, S("abcd2"));
   1799     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 9, S("abcd234567890"));
   1800     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
   1801     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
   1802     test(S("abcde"), 4, 1, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
   1803     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 0, S("abcd"));
   1804     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 1, S("abcd1"));
   1805     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 5, S("abcd12345"));
   1806     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 9, S("abcd123456789"));
   1807     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 10, S("abcd1234567890"));
   1808     test(S("abcde"), 4, 1, SV("12345678901234567890"), 10, 11, S("abcd1234567890"));
   1809     test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 0, S("abcd"));
   1810     test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 1, S("abcd0"));
   1811     test(S("abcde"), 4, 1, SV("12345678901234567890"), 19, 2, S("abcd0"));
   1812     test(S("abcde"), 4, 1, SV("12345678901234567890"), 20, 0, S("abcd"));
   1813     test(S("abcde"), 4, 1, SV("12345678901234567890"), 20, 1, S("abcd"));
   1814     test(S("abcde"), 4, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1815     test(S("abcde"), 4, 2, SV(""), 0, 0, S("abcd"));
   1816     test(S("abcde"), 4, 2, SV(""), 0, 1, S("abcd"));
   1817     test(S("abcde"), 4, 2, SV(""), 1, 0, S("can't happen"));
   1818     test(S("abcde"), 4, 2, SV("12345"), 0, 0, S("abcd"));
   1819     test(S("abcde"), 4, 2, SV("12345"), 0, 1, S("abcd1"));
   1820     test(S("abcde"), 4, 2, SV("12345"), 0, 2, S("abcd12"));
   1821     test(S("abcde"), 4, 2, SV("12345"), 0, 4, S("abcd1234"));
   1822     test(S("abcde"), 4, 2, SV("12345"), 0, 5, S("abcd12345"));
   1823     test(S("abcde"), 4, 2, SV("12345"), 0, 6, S("abcd12345"));
   1824     test(S("abcde"), 4, 2, SV("12345"), 1, 0, S("abcd"));
   1825     test(S("abcde"), 4, 2, SV("12345"), 1, 1, S("abcd2"));
   1826     test(S("abcde"), 4, 2, SV("12345"), 1, 2, S("abcd23"));
   1827     test(S("abcde"), 4, 2, SV("12345"), 1, 3, S("abcd234"));
   1828     test(S("abcde"), 4, 2, SV("12345"), 1, 4, S("abcd2345"));
   1829     test(S("abcde"), 4, 2, SV("12345"), 1, 5, S("abcd2345"));
   1830     test(S("abcde"), 4, 2, SV("12345"), 2, 0, S("abcd"));
   1831     test(S("abcde"), 4, 2, SV("12345"), 2, 1, S("abcd3"));
   1832     test(S("abcde"), 4, 2, SV("12345"), 2, 2, S("abcd34"));
   1833     test(S("abcde"), 4, 2, SV("12345"), 2, 3, S("abcd345"));
   1834     test(S("abcde"), 4, 2, SV("12345"), 2, 4, S("abcd345"));
   1835     test(S("abcde"), 4, 2, SV("12345"), 4, 0, S("abcd"));
   1836     test(S("abcde"), 4, 2, SV("12345"), 4, 1, S("abcd5"));
   1837     test(S("abcde"), 4, 2, SV("12345"), 4, 2, S("abcd5"));
   1838     test(S("abcde"), 4, 2, SV("12345"), 5, 0, S("abcd"));
   1839     test(S("abcde"), 4, 2, SV("12345"), 5, 1, S("abcd"));
   1840     test(S("abcde"), 4, 2, SV("12345"), 6, 0, S("can't happen"));
   1841     test(S("abcde"), 4, 2, SV("1234567890"), 0, 0, S("abcd"));
   1842     test(S("abcde"), 4, 2, SV("1234567890"), 0, 1, S("abcd1"));
   1843     test(S("abcde"), 4, 2, SV("1234567890"), 0, 5, S("abcd12345"));
   1844     test(S("abcde"), 4, 2, SV("1234567890"), 0, 9, S("abcd123456789"));
   1845     test(S("abcde"), 4, 2, SV("1234567890"), 0, 10, S("abcd1234567890"));
   1846     test(S("abcde"), 4, 2, SV("1234567890"), 0, 11, S("abcd1234567890"));
   1847     test(S("abcde"), 4, 2, SV("1234567890"), 1, 0, S("abcd"));
   1848     test(S("abcde"), 4, 2, SV("1234567890"), 1, 1, S("abcd2"));
   1849     test(S("abcde"), 4, 2, SV("1234567890"), 1, 4, S("abcd2345"));
   1850     test(S("abcde"), 4, 2, SV("1234567890"), 1, 8, S("abcd23456789"));
   1851     test(S("abcde"), 4, 2, SV("1234567890"), 1, 9, S("abcd234567890"));
   1852     test(S("abcde"), 4, 2, SV("1234567890"), 1, 10, S("abcd234567890"));
   1853     test(S("abcde"), 4, 2, SV("1234567890"), 5, 0, S("abcd"));
   1854     test(S("abcde"), 4, 2, SV("1234567890"), 5, 1, S("abcd6"));
   1855     test(S("abcde"), 4, 2, SV("1234567890"), 5, 2, S("abcd67"));
   1856     test(S("abcde"), 4, 2, SV("1234567890"), 5, 4, S("abcd6789"));
   1857     test(S("abcde"), 4, 2, SV("1234567890"), 5, 5, S("abcd67890"));
   1858     test(S("abcde"), 4, 2, SV("1234567890"), 5, 6, S("abcd67890"));
   1859     test(S("abcde"), 4, 2, SV("1234567890"), 9, 0, S("abcd"));
   1860     test(S("abcde"), 4, 2, SV("1234567890"), 9, 1, S("abcd0"));
   1861     test(S("abcde"), 4, 2, SV("1234567890"), 9, 2, S("abcd0"));
   1862     test(S("abcde"), 4, 2, SV("1234567890"), 10, 0, S("abcd"));
   1863     test(S("abcde"), 4, 2, SV("1234567890"), 10, 1, S("abcd"));
   1864     test(S("abcde"), 4, 2, SV("1234567890"), 11, 0, S("can't happen"));
   1865     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 0, S("abcd"));
   1866     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 1, S("abcd1"));
   1867     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 10, S("abcd1234567890"));
   1868     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 19, S("abcd1234567890123456789"));
   1869     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 20, S("abcd12345678901234567890"));
   1870     test(S("abcde"), 4, 2, SV("12345678901234567890"), 0, 21, S("abcd12345678901234567890"));
   1871     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 0, S("abcd"));
   1872     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 1, S("abcd2"));
   1873     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 9, S("abcd234567890"));
   1874     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 18, S("abcd234567890123456789"));
   1875     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 19, S("abcd2345678901234567890"));
   1876     test(S("abcde"), 4, 2, SV("12345678901234567890"), 1, 20, S("abcd2345678901234567890"));
   1877     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 0, S("abcd"));
   1878     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 1, S("abcd1"));
   1879     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 5, S("abcd12345"));
   1880     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 9, S("abcd123456789"));
   1881     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 10, S("abcd1234567890"));
   1882     test(S("abcde"), 4, 2, SV("12345678901234567890"), 10, 11, S("abcd1234567890"));
   1883     test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 0, S("abcd"));
   1884     test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 1, S("abcd0"));
   1885     test(S("abcde"), 4, 2, SV("12345678901234567890"), 19, 2, S("abcd0"));
   1886     test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 0, S("abcd"));
   1887 }
   1888 
   1889 template <class S, class SV>
   1890 void test17()
   1891 {
   1892     test(S("abcde"), 4, 2, SV("12345678901234567890"), 20, 1, S("abcd"));
   1893     test(S("abcde"), 4, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1894     test(S("abcde"), 5, 0, SV(""), 0, 0, S("abcde"));
   1895     test(S("abcde"), 5, 0, SV(""), 0, 1, S("abcde"));
   1896     test(S("abcde"), 5, 0, SV(""), 1, 0, S("can't happen"));
   1897     test(S("abcde"), 5, 0, SV("12345"), 0, 0, S("abcde"));
   1898     test(S("abcde"), 5, 0, SV("12345"), 0, 1, S("abcde1"));
   1899     test(S("abcde"), 5, 0, SV("12345"), 0, 2, S("abcde12"));
   1900     test(S("abcde"), 5, 0, SV("12345"), 0, 4, S("abcde1234"));
   1901     test(S("abcde"), 5, 0, SV("12345"), 0, 5, S("abcde12345"));
   1902     test(S("abcde"), 5, 0, SV("12345"), 0, 6, S("abcde12345"));
   1903     test(S("abcde"), 5, 0, SV("12345"), 1, 0, S("abcde"));
   1904     test(S("abcde"), 5, 0, SV("12345"), 1, 1, S("abcde2"));
   1905     test(S("abcde"), 5, 0, SV("12345"), 1, 2, S("abcde23"));
   1906     test(S("abcde"), 5, 0, SV("12345"), 1, 3, S("abcde234"));
   1907     test(S("abcde"), 5, 0, SV("12345"), 1, 4, S("abcde2345"));
   1908     test(S("abcde"), 5, 0, SV("12345"), 1, 5, S("abcde2345"));
   1909     test(S("abcde"), 5, 0, SV("12345"), 2, 0, S("abcde"));
   1910     test(S("abcde"), 5, 0, SV("12345"), 2, 1, S("abcde3"));
   1911     test(S("abcde"), 5, 0, SV("12345"), 2, 2, S("abcde34"));
   1912     test(S("abcde"), 5, 0, SV("12345"), 2, 3, S("abcde345"));
   1913     test(S("abcde"), 5, 0, SV("12345"), 2, 4, S("abcde345"));
   1914     test(S("abcde"), 5, 0, SV("12345"), 4, 0, S("abcde"));
   1915     test(S("abcde"), 5, 0, SV("12345"), 4, 1, S("abcde5"));
   1916     test(S("abcde"), 5, 0, SV("12345"), 4, 2, S("abcde5"));
   1917     test(S("abcde"), 5, 0, SV("12345"), 5, 0, S("abcde"));
   1918     test(S("abcde"), 5, 0, SV("12345"), 5, 1, S("abcde"));
   1919     test(S("abcde"), 5, 0, SV("12345"), 6, 0, S("can't happen"));
   1920     test(S("abcde"), 5, 0, SV("1234567890"), 0, 0, S("abcde"));
   1921     test(S("abcde"), 5, 0, SV("1234567890"), 0, 1, S("abcde1"));
   1922     test(S("abcde"), 5, 0, SV("1234567890"), 0, 5, S("abcde12345"));
   1923     test(S("abcde"), 5, 0, SV("1234567890"), 0, 9, S("abcde123456789"));
   1924     test(S("abcde"), 5, 0, SV("1234567890"), 0, 10, S("abcde1234567890"));
   1925     test(S("abcde"), 5, 0, SV("1234567890"), 0, 11, S("abcde1234567890"));
   1926     test(S("abcde"), 5, 0, SV("1234567890"), 1, 0, S("abcde"));
   1927     test(S("abcde"), 5, 0, SV("1234567890"), 1, 1, S("abcde2"));
   1928     test(S("abcde"), 5, 0, SV("1234567890"), 1, 4, S("abcde2345"));
   1929     test(S("abcde"), 5, 0, SV("1234567890"), 1, 8, S("abcde23456789"));
   1930     test(S("abcde"), 5, 0, SV("1234567890"), 1, 9, S("abcde234567890"));
   1931     test(S("abcde"), 5, 0, SV("1234567890"), 1, 10, S("abcde234567890"));
   1932     test(S("abcde"), 5, 0, SV("1234567890"), 5, 0, S("abcde"));
   1933     test(S("abcde"), 5, 0, SV("1234567890"), 5, 1, S("abcde6"));
   1934     test(S("abcde"), 5, 0, SV("1234567890"), 5, 2, S("abcde67"));
   1935     test(S("abcde"), 5, 0, SV("1234567890"), 5, 4, S("abcde6789"));
   1936     test(S("abcde"), 5, 0, SV("1234567890"), 5, 5, S("abcde67890"));
   1937     test(S("abcde"), 5, 0, SV("1234567890"), 5, 6, S("abcde67890"));
   1938     test(S("abcde"), 5, 0, SV("1234567890"), 9, 0, S("abcde"));
   1939     test(S("abcde"), 5, 0, SV("1234567890"), 9, 1, S("abcde0"));
   1940     test(S("abcde"), 5, 0, SV("1234567890"), 9, 2, S("abcde0"));
   1941     test(S("abcde"), 5, 0, SV("1234567890"), 10, 0, S("abcde"));
   1942     test(S("abcde"), 5, 0, SV("1234567890"), 10, 1, S("abcde"));
   1943     test(S("abcde"), 5, 0, SV("1234567890"), 11, 0, S("can't happen"));
   1944     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 0, S("abcde"));
   1945     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 1, S("abcde1"));
   1946     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
   1947     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
   1948     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
   1949     test(S("abcde"), 5, 0, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
   1950     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 0, S("abcde"));
   1951     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 1, S("abcde2"));
   1952     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
   1953     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
   1954     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
   1955     test(S("abcde"), 5, 0, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
   1956     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 0, S("abcde"));
   1957     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 1, S("abcde1"));
   1958     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 5, S("abcde12345"));
   1959     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
   1960     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
   1961     test(S("abcde"), 5, 0, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
   1962     test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 0, S("abcde"));
   1963     test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 1, S("abcde0"));
   1964     test(S("abcde"), 5, 0, SV("12345678901234567890"), 19, 2, S("abcde0"));
   1965     test(S("abcde"), 5, 0, SV("12345678901234567890"), 20, 0, S("abcde"));
   1966     test(S("abcde"), 5, 0, SV("12345678901234567890"), 20, 1, S("abcde"));
   1967     test(S("abcde"), 5, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   1968     test(S("abcde"), 5, 1, SV(""), 0, 0, S("abcde"));
   1969     test(S("abcde"), 5, 1, SV(""), 0, 1, S("abcde"));
   1970     test(S("abcde"), 5, 1, SV(""), 1, 0, S("can't happen"));
   1971     test(S("abcde"), 5, 1, SV("12345"), 0, 0, S("abcde"));
   1972     test(S("abcde"), 5, 1, SV("12345"), 0, 1, S("abcde1"));
   1973     test(S("abcde"), 5, 1, SV("12345"), 0, 2, S("abcde12"));
   1974     test(S("abcde"), 5, 1, SV("12345"), 0, 4, S("abcde1234"));
   1975     test(S("abcde"), 5, 1, SV("12345"), 0, 5, S("abcde12345"));
   1976     test(S("abcde"), 5, 1, SV("12345"), 0, 6, S("abcde12345"));
   1977     test(S("abcde"), 5, 1, SV("12345"), 1, 0, S("abcde"));
   1978     test(S("abcde"), 5, 1, SV("12345"), 1, 1, S("abcde2"));
   1979     test(S("abcde"), 5, 1, SV("12345"), 1, 2, S("abcde23"));
   1980     test(S("abcde"), 5, 1, SV("12345"), 1, 3, S("abcde234"));
   1981     test(S("abcde"), 5, 1, SV("12345"), 1, 4, S("abcde2345"));
   1982     test(S("abcde"), 5, 1, SV("12345"), 1, 5, S("abcde2345"));
   1983     test(S("abcde"), 5, 1, SV("12345"), 2, 0, S("abcde"));
   1984     test(S("abcde"), 5, 1, SV("12345"), 2, 1, S("abcde3"));
   1985     test(S("abcde"), 5, 1, SV("12345"), 2, 2, S("abcde34"));
   1986     test(S("abcde"), 5, 1, SV("12345"), 2, 3, S("abcde345"));
   1987     test(S("abcde"), 5, 1, SV("12345"), 2, 4, S("abcde345"));
   1988     test(S("abcde"), 5, 1, SV("12345"), 4, 0, S("abcde"));
   1989     test(S("abcde"), 5, 1, SV("12345"), 4, 1, S("abcde5"));
   1990     test(S("abcde"), 5, 1, SV("12345"), 4, 2, S("abcde5"));
   1991     test(S("abcde"), 5, 1, SV("12345"), 5, 0, S("abcde"));
   1992 }
   1993 
   1994 template <class S, class SV>
   1995 void test18()
   1996 {
   1997     test(S("abcde"), 5, 1, SV("12345"), 5, 1, S("abcde"));
   1998     test(S("abcde"), 5, 1, SV("12345"), 6, 0, S("can't happen"));
   1999     test(S("abcde"), 5, 1, SV("1234567890"), 0, 0, S("abcde"));
   2000     test(S("abcde"), 5, 1, SV("1234567890"), 0, 1, S("abcde1"));
   2001     test(S("abcde"), 5, 1, SV("1234567890"), 0, 5, S("abcde12345"));
   2002     test(S("abcde"), 5, 1, SV("1234567890"), 0, 9, S("abcde123456789"));
   2003     test(S("abcde"), 5, 1, SV("1234567890"), 0, 10, S("abcde1234567890"));
   2004     test(S("abcde"), 5, 1, SV("1234567890"), 0, 11, S("abcde1234567890"));
   2005     test(S("abcde"), 5, 1, SV("1234567890"), 1, 0, S("abcde"));
   2006     test(S("abcde"), 5, 1, SV("1234567890"), 1, 1, S("abcde2"));
   2007     test(S("abcde"), 5, 1, SV("1234567890"), 1, 4, S("abcde2345"));
   2008     test(S("abcde"), 5, 1, SV("1234567890"), 1, 8, S("abcde23456789"));
   2009     test(S("abcde"), 5, 1, SV("1234567890"), 1, 9, S("abcde234567890"));
   2010     test(S("abcde"), 5, 1, SV("1234567890"), 1, 10, S("abcde234567890"));
   2011     test(S("abcde"), 5, 1, SV("1234567890"), 5, 0, S("abcde"));
   2012     test(S("abcde"), 5, 1, SV("1234567890"), 5, 1, S("abcde6"));
   2013     test(S("abcde"), 5, 1, SV("1234567890"), 5, 2, S("abcde67"));
   2014     test(S("abcde"), 5, 1, SV("1234567890"), 5, 4, S("abcde6789"));
   2015     test(S("abcde"), 5, 1, SV("1234567890"), 5, 5, S("abcde67890"));
   2016     test(S("abcde"), 5, 1, SV("1234567890"), 5, 6, S("abcde67890"));
   2017     test(S("abcde"), 5, 1, SV("1234567890"), 9, 0, S("abcde"));
   2018     test(S("abcde"), 5, 1, SV("1234567890"), 9, 1, S("abcde0"));
   2019     test(S("abcde"), 5, 1, SV("1234567890"), 9, 2, S("abcde0"));
   2020     test(S("abcde"), 5, 1, SV("1234567890"), 10, 0, S("abcde"));
   2021     test(S("abcde"), 5, 1, SV("1234567890"), 10, 1, S("abcde"));
   2022     test(S("abcde"), 5, 1, SV("1234567890"), 11, 0, S("can't happen"));
   2023     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 0, S("abcde"));
   2024     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 1, S("abcde1"));
   2025     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
   2026     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
   2027     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
   2028     test(S("abcde"), 5, 1, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
   2029     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 0, S("abcde"));
   2030     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 1, S("abcde2"));
   2031     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
   2032     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
   2033     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
   2034     test(S("abcde"), 5, 1, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
   2035     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 0, S("abcde"));
   2036     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 1, S("abcde1"));
   2037     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 5, S("abcde12345"));
   2038     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
   2039     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
   2040     test(S("abcde"), 5, 1, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
   2041     test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 0, S("abcde"));
   2042     test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 1, S("abcde0"));
   2043     test(S("abcde"), 5, 1, SV("12345678901234567890"), 19, 2, S("abcde0"));
   2044     test(S("abcde"), 5, 1, SV("12345678901234567890"), 20, 0, S("abcde"));
   2045     test(S("abcde"), 5, 1, SV("12345678901234567890"), 20, 1, S("abcde"));
   2046     test(S("abcde"), 5, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2047     test(S("abcde"), 6, 0, SV(""), 0, 0, S("can't happen"));
   2048     test(S("abcde"), 6, 0, SV(""), 0, 1, S("can't happen"));
   2049     test(S("abcde"), 6, 0, SV(""), 1, 0, S("can't happen"));
   2050     test(S("abcde"), 6, 0, SV("12345"), 0, 0, S("can't happen"));
   2051     test(S("abcde"), 6, 0, SV("12345"), 0, 1, S("can't happen"));
   2052     test(S("abcde"), 6, 0, SV("12345"), 0, 2, S("can't happen"));
   2053     test(S("abcde"), 6, 0, SV("12345"), 0, 4, S("can't happen"));
   2054     test(S("abcde"), 6, 0, SV("12345"), 0, 5, S("can't happen"));
   2055     test(S("abcde"), 6, 0, SV("12345"), 0, 6, S("can't happen"));
   2056     test(S("abcde"), 6, 0, SV("12345"), 1, 0, S("can't happen"));
   2057     test(S("abcde"), 6, 0, SV("12345"), 1, 1, S("can't happen"));
   2058     test(S("abcde"), 6, 0, SV("12345"), 1, 2, S("can't happen"));
   2059     test(S("abcde"), 6, 0, SV("12345"), 1, 3, S("can't happen"));
   2060     test(S("abcde"), 6, 0, SV("12345"), 1, 4, S("can't happen"));
   2061     test(S("abcde"), 6, 0, SV("12345"), 1, 5, S("can't happen"));
   2062     test(S("abcde"), 6, 0, SV("12345"), 2, 0, S("can't happen"));
   2063     test(S("abcde"), 6, 0, SV("12345"), 2, 1, S("can't happen"));
   2064     test(S("abcde"), 6, 0, SV("12345"), 2, 2, S("can't happen"));
   2065     test(S("abcde"), 6, 0, SV("12345"), 2, 3, S("can't happen"));
   2066     test(S("abcde"), 6, 0, SV("12345"), 2, 4, S("can't happen"));
   2067     test(S("abcde"), 6, 0, SV("12345"), 4, 0, S("can't happen"));
   2068     test(S("abcde"), 6, 0, SV("12345"), 4, 1, S("can't happen"));
   2069     test(S("abcde"), 6, 0, SV("12345"), 4, 2, S("can't happen"));
   2070     test(S("abcde"), 6, 0, SV("12345"), 5, 0, S("can't happen"));
   2071     test(S("abcde"), 6, 0, SV("12345"), 5, 1, S("can't happen"));
   2072     test(S("abcde"), 6, 0, SV("12345"), 6, 0, S("can't happen"));
   2073     test(S("abcde"), 6, 0, SV("1234567890"), 0, 0, S("can't happen"));
   2074     test(S("abcde"), 6, 0, SV("1234567890"), 0, 1, S("can't happen"));
   2075     test(S("abcde"), 6, 0, SV("1234567890"), 0, 5, S("can't happen"));
   2076     test(S("abcde"), 6, 0, SV("1234567890"), 0, 9, S("can't happen"));
   2077     test(S("abcde"), 6, 0, SV("1234567890"), 0, 10, S("can't happen"));
   2078     test(S("abcde"), 6, 0, SV("1234567890"), 0, 11, S("can't happen"));
   2079     test(S("abcde"), 6, 0, SV("1234567890"), 1, 0, S("can't happen"));
   2080     test(S("abcde"), 6, 0, SV("1234567890"), 1, 1, S("can't happen"));
   2081     test(S("abcde"), 6, 0, SV("1234567890"), 1, 4, S("can't happen"));
   2082     test(S("abcde"), 6, 0, SV("1234567890"), 1, 8, S("can't happen"));
   2083     test(S("abcde"), 6, 0, SV("1234567890"), 1, 9, S("can't happen"));
   2084     test(S("abcde"), 6, 0, SV("1234567890"), 1, 10, S("can't happen"));
   2085     test(S("abcde"), 6, 0, SV("1234567890"), 5, 0, S("can't happen"));
   2086     test(S("abcde"), 6, 0, SV("1234567890"), 5, 1, S("can't happen"));
   2087     test(S("abcde"), 6, 0, SV("1234567890"), 5, 2, S("can't happen"));
   2088     test(S("abcde"), 6, 0, SV("1234567890"), 5, 4, S("can't happen"));
   2089     test(S("abcde"), 6, 0, SV("1234567890"), 5, 5, S("can't happen"));
   2090     test(S("abcde"), 6, 0, SV("1234567890"), 5, 6, S("can't happen"));
   2091     test(S("abcde"), 6, 0, SV("1234567890"), 9, 0, S("can't happen"));
   2092     test(S("abcde"), 6, 0, SV("1234567890"), 9, 1, S("can't happen"));
   2093     test(S("abcde"), 6, 0, SV("1234567890"), 9, 2, S("can't happen"));
   2094     test(S("abcde"), 6, 0, SV("1234567890"), 10, 0, S("can't happen"));
   2095     test(S("abcde"), 6, 0, SV("1234567890"), 10, 1, S("can't happen"));
   2096     test(S("abcde"), 6, 0, SV("1234567890"), 11, 0, S("can't happen"));
   2097 }
   2098 
   2099 template <class S, class SV>
   2100 void test19()
   2101 {
   2102     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
   2103     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
   2104     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
   2105     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
   2106     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
   2107     test(S("abcde"), 6, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
   2108     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
   2109     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
   2110     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
   2111     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
   2112     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
   2113     test(S("abcde"), 6, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
   2114     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
   2115     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
   2116     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
   2117     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
   2118     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
   2119     test(S("abcde"), 6, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
   2120     test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
   2121     test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
   2122     test(S("abcde"), 6, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
   2123     test(S("abcde"), 6, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
   2124     test(S("abcde"), 6, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
   2125     test(S("abcde"), 6, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2126     test(S("abcdefghij"), 0, 0, SV(""), 0, 0, S("abcdefghij"));
   2127     test(S("abcdefghij"), 0, 0, SV(""), 0, 1, S("abcdefghij"));
   2128     test(S("abcdefghij"), 0, 0, SV(""), 1, 0, S("can't happen"));
   2129     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 0, S("abcdefghij"));
   2130     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 1, S("1abcdefghij"));
   2131     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 2, S("12abcdefghij"));
   2132     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 4, S("1234abcdefghij"));
   2133     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 5, S("12345abcdefghij"));
   2134     test(S("abcdefghij"), 0, 0, SV("12345"), 0, 6, S("12345abcdefghij"));
   2135     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 0, S("abcdefghij"));
   2136     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 1, S("2abcdefghij"));
   2137     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 2, S("23abcdefghij"));
   2138     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 3, S("234abcdefghij"));
   2139     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 4, S("2345abcdefghij"));
   2140     test(S("abcdefghij"), 0, 0, SV("12345"), 1, 5, S("2345abcdefghij"));
   2141     test(S("abcdefghij"), 0, 0, SV("12345"), 2, 0, S("abcdefghij"));
   2142     test(S("abcdefghij"), 0, 0, SV("12345"), 2, 1, S("3abcdefghij"));
   2143     test(S("abcdefghij"), 0, 0, SV("12345"), 2, 2, S("34abcdefghij"));
   2144     test(S("abcdefghij"), 0, 0, SV("12345"), 2, 3, S("345abcdefghij"));
   2145     test(S("abcdefghij"), 0, 0, SV("12345"), 2, 4, S("345abcdefghij"));
   2146     test(S("abcdefghij"), 0, 0, SV("12345"), 4, 0, S("abcdefghij"));
   2147     test(S("abcdefghij"), 0, 0, SV("12345"), 4, 1, S("5abcdefghij"));
   2148     test(S("abcdefghij"), 0, 0, SV("12345"), 4, 2, S("5abcdefghij"));
   2149     test(S("abcdefghij"), 0, 0, SV("12345"), 5, 0, S("abcdefghij"));
   2150     test(S("abcdefghij"), 0, 0, SV("12345"), 5, 1, S("abcdefghij"));
   2151     test(S("abcdefghij"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
   2152     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
   2153     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 1, S("1abcdefghij"));
   2154     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 5, S("12345abcdefghij"));
   2155     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcdefghij"));
   2156     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcdefghij"));
   2157     test(S("abcdefghij"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcdefghij"));
   2158     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
   2159     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 1, S("2abcdefghij"));
   2160     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 4, S("2345abcdefghij"));
   2161     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcdefghij"));
   2162     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcdefghij"));
   2163     test(S("abcdefghij"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcdefghij"));
   2164     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
   2165     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 1, S("6abcdefghij"));
   2166     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 2, S("67abcdefghij"));
   2167     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 4, S("6789abcdefghij"));
   2168     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 5, S("67890abcdefghij"));
   2169     test(S("abcdefghij"), 0, 0, SV("1234567890"), 5, 6, S("67890abcdefghij"));
   2170     test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
   2171     test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 1, S("0abcdefghij"));
   2172     test(S("abcdefghij"), 0, 0, SV("1234567890"), 9, 2, S("0abcdefghij"));
   2173     test(S("abcdefghij"), 0, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
   2174     test(S("abcdefghij"), 0, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
   2175     test(S("abcdefghij"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
   2176     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   2177     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcdefghij"));
   2178     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghij"));
   2179     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghij"));
   2180     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghij"));
   2181     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghij"));
   2182     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   2183     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcdefghij"));
   2184     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghij"));
   2185     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghij"));
   2186     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghij"));
   2187     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghij"));
   2188     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   2189     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcdefghij"));
   2190     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghij"));
   2191     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghij"));
   2192     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghij"));
   2193     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghij"));
   2194     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   2195     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcdefghij"));
   2196     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcdefghij"));
   2197     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   2198     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   2199     test(S("abcdefghij"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2200     test(S("abcdefghij"), 0, 1, SV(""), 0, 0, S("bcdefghij"));
   2201     test(S("abcdefghij"), 0, 1, SV(""), 0, 1, S("bcdefghij"));
   2202 }
   2203 
   2204 template <class S, class SV>
   2205 void test20()
   2206 {
   2207     test(S("abcdefghij"), 0, 1, SV(""), 1, 0, S("can't happen"));
   2208     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 0, S("bcdefghij"));
   2209     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 1, S("1bcdefghij"));
   2210     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 2, S("12bcdefghij"));
   2211     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 4, S("1234bcdefghij"));
   2212     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 5, S("12345bcdefghij"));
   2213     test(S("abcdefghij"), 0, 1, SV("12345"), 0, 6, S("12345bcdefghij"));
   2214     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 0, S("bcdefghij"));
   2215     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 1, S("2bcdefghij"));
   2216     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 2, S("23bcdefghij"));
   2217     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 3, S("234bcdefghij"));
   2218     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 4, S("2345bcdefghij"));
   2219     test(S("abcdefghij"), 0, 1, SV("12345"), 1, 5, S("2345bcdefghij"));
   2220     test(S("abcdefghij"), 0, 1, SV("12345"), 2, 0, S("bcdefghij"));
   2221     test(S("abcdefghij"), 0, 1, SV("12345"), 2, 1, S("3bcdefghij"));
   2222     test(S("abcdefghij"), 0, 1, SV("12345"), 2, 2, S("34bcdefghij"));
   2223     test(S("abcdefghij"), 0, 1, SV("12345"), 2, 3, S("345bcdefghij"));
   2224     test(S("abcdefghij"), 0, 1, SV("12345"), 2, 4, S("345bcdefghij"));
   2225     test(S("abcdefghij"), 0, 1, SV("12345"), 4, 0, S("bcdefghij"));
   2226     test(S("abcdefghij"), 0, 1, SV("12345"), 4, 1, S("5bcdefghij"));
   2227     test(S("abcdefghij"), 0, 1, SV("12345"), 4, 2, S("5bcdefghij"));
   2228     test(S("abcdefghij"), 0, 1, SV("12345"), 5, 0, S("bcdefghij"));
   2229     test(S("abcdefghij"), 0, 1, SV("12345"), 5, 1, S("bcdefghij"));
   2230     test(S("abcdefghij"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
   2231     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 0, S("bcdefghij"));
   2232     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 1, S("1bcdefghij"));
   2233     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 5, S("12345bcdefghij"));
   2234     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcdefghij"));
   2235     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcdefghij"));
   2236     test(S("abcdefghij"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcdefghij"));
   2237     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 0, S("bcdefghij"));
   2238     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 1, S("2bcdefghij"));
   2239     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 4, S("2345bcdefghij"));
   2240     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcdefghij"));
   2241     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcdefghij"));
   2242     test(S("abcdefghij"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcdefghij"));
   2243     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 0, S("bcdefghij"));
   2244     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 1, S("6bcdefghij"));
   2245     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 2, S("67bcdefghij"));
   2246     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 4, S("6789bcdefghij"));
   2247     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 5, S("67890bcdefghij"));
   2248     test(S("abcdefghij"), 0, 1, SV("1234567890"), 5, 6, S("67890bcdefghij"));
   2249     test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 0, S("bcdefghij"));
   2250     test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 1, S("0bcdefghij"));
   2251     test(S("abcdefghij"), 0, 1, SV("1234567890"), 9, 2, S("0bcdefghij"));
   2252     test(S("abcdefghij"), 0, 1, SV("1234567890"), 10, 0, S("bcdefghij"));
   2253     test(S("abcdefghij"), 0, 1, SV("1234567890"), 10, 1, S("bcdefghij"));
   2254     test(S("abcdefghij"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
   2255     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcdefghij"));
   2256     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcdefghij"));
   2257     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcdefghij"));
   2258     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghij"));
   2259     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghij"));
   2260     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghij"));
   2261     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcdefghij"));
   2262     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcdefghij"));
   2263     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcdefghij"));
   2264     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcdefghij"));
   2265     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghij"));
   2266     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghij"));
   2267     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcdefghij"));
   2268     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcdefghij"));
   2269     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcdefghij"));
   2270     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcdefghij"));
   2271     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcdefghij"));
   2272     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcdefghij"));
   2273     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcdefghij"));
   2274     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcdefghij"));
   2275     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcdefghij"));
   2276     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcdefghij"));
   2277     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcdefghij"));
   2278     test(S("abcdefghij"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2279     test(S("abcdefghij"), 0, 5, SV(""), 0, 0, S("fghij"));
   2280     test(S("abcdefghij"), 0, 5, SV(""), 0, 1, S("fghij"));
   2281     test(S("abcdefghij"), 0, 5, SV(""), 1, 0, S("can't happen"));
   2282     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 0, S("fghij"));
   2283     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 1, S("1fghij"));
   2284     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 2, S("12fghij"));
   2285     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 4, S("1234fghij"));
   2286     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 5, S("12345fghij"));
   2287     test(S("abcdefghij"), 0, 5, SV("12345"), 0, 6, S("12345fghij"));
   2288     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 0, S("fghij"));
   2289     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 1, S("2fghij"));
   2290     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 2, S("23fghij"));
   2291     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 3, S("234fghij"));
   2292     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 4, S("2345fghij"));
   2293     test(S("abcdefghij"), 0, 5, SV("12345"), 1, 5, S("2345fghij"));
   2294     test(S("abcdefghij"), 0, 5, SV("12345"), 2, 0, S("fghij"));
   2295     test(S("abcdefghij"), 0, 5, SV("12345"), 2, 1, S("3fghij"));
   2296     test(S("abcdefghij"), 0, 5, SV("12345"), 2, 2, S("34fghij"));
   2297     test(S("abcdefghij"), 0, 5, SV("12345"), 2, 3, S("345fghij"));
   2298     test(S("abcdefghij"), 0, 5, SV("12345"), 2, 4, S("345fghij"));
   2299     test(S("abcdefghij"), 0, 5, SV("12345"), 4, 0, S("fghij"));
   2300     test(S("abcdefghij"), 0, 5, SV("12345"), 4, 1, S("5fghij"));
   2301     test(S("abcdefghij"), 0, 5, SV("12345"), 4, 2, S("5fghij"));
   2302     test(S("abcdefghij"), 0, 5, SV("12345"), 5, 0, S("fghij"));
   2303     test(S("abcdefghij"), 0, 5, SV("12345"), 5, 1, S("fghij"));
   2304     test(S("abcdefghij"), 0, 5, SV("12345"), 6, 0, S("can't happen"));
   2305     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 0, S("fghij"));
   2306     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 1, S("1fghij"));
   2307 }
   2308 
   2309 template <class S, class SV>
   2310 void test21()
   2311 {
   2312     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 5, S("12345fghij"));
   2313     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 9, S("123456789fghij"));
   2314     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 10, S("1234567890fghij"));
   2315     test(S("abcdefghij"), 0, 5, SV("1234567890"), 0, 11, S("1234567890fghij"));
   2316     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 0, S("fghij"));
   2317     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 1, S("2fghij"));
   2318     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 4, S("2345fghij"));
   2319     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 8, S("23456789fghij"));
   2320     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 9, S("234567890fghij"));
   2321     test(S("abcdefghij"), 0, 5, SV("1234567890"), 1, 10, S("234567890fghij"));
   2322     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 0, S("fghij"));
   2323     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 1, S("6fghij"));
   2324     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 2, S("67fghij"));
   2325     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 4, S("6789fghij"));
   2326     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 5, S("67890fghij"));
   2327     test(S("abcdefghij"), 0, 5, SV("1234567890"), 5, 6, S("67890fghij"));
   2328     test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 0, S("fghij"));
   2329     test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 1, S("0fghij"));
   2330     test(S("abcdefghij"), 0, 5, SV("1234567890"), 9, 2, S("0fghij"));
   2331     test(S("abcdefghij"), 0, 5, SV("1234567890"), 10, 0, S("fghij"));
   2332     test(S("abcdefghij"), 0, 5, SV("1234567890"), 10, 1, S("fghij"));
   2333     test(S("abcdefghij"), 0, 5, SV("1234567890"), 11, 0, S("can't happen"));
   2334     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 0, S("fghij"));
   2335     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 1, S("1fghij"));
   2336     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 10, S("1234567890fghij"));
   2337     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 19, S("1234567890123456789fghij"));
   2338     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 20, S("12345678901234567890fghij"));
   2339     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 0, 21, S("12345678901234567890fghij"));
   2340     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 0, S("fghij"));
   2341     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 1, S("2fghij"));
   2342     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 9, S("234567890fghij"));
   2343     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 18, S("234567890123456789fghij"));
   2344     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 19, S("2345678901234567890fghij"));
   2345     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 1, 20, S("2345678901234567890fghij"));
   2346     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 0, S("fghij"));
   2347     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 1, S("1fghij"));
   2348     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 5, S("12345fghij"));
   2349     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 9, S("123456789fghij"));
   2350     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 10, S("1234567890fghij"));
   2351     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 10, 11, S("1234567890fghij"));
   2352     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 0, S("fghij"));
   2353     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 1, S("0fghij"));
   2354     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 19, 2, S("0fghij"));
   2355     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 20, 0, S("fghij"));
   2356     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 20, 1, S("fghij"));
   2357     test(S("abcdefghij"), 0, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2358     test(S("abcdefghij"), 0, 9, SV(""), 0, 0, S("j"));
   2359     test(S("abcdefghij"), 0, 9, SV(""), 0, 1, S("j"));
   2360     test(S("abcdefghij"), 0, 9, SV(""), 1, 0, S("can't happen"));
   2361     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 0, S("j"));
   2362     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 1, S("1j"));
   2363     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 2, S("12j"));
   2364     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 4, S("1234j"));
   2365     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 5, S("12345j"));
   2366     test(S("abcdefghij"), 0, 9, SV("12345"), 0, 6, S("12345j"));
   2367     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 0, S("j"));
   2368     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 1, S("2j"));
   2369     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 2, S("23j"));
   2370     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 3, S("234j"));
   2371     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 4, S("2345j"));
   2372     test(S("abcdefghij"), 0, 9, SV("12345"), 1, 5, S("2345j"));
   2373     test(S("abcdefghij"), 0, 9, SV("12345"), 2, 0, S("j"));
   2374     test(S("abcdefghij"), 0, 9, SV("12345"), 2, 1, S("3j"));
   2375     test(S("abcdefghij"), 0, 9, SV("12345"), 2, 2, S("34j"));
   2376     test(S("abcdefghij"), 0, 9, SV("12345"), 2, 3, S("345j"));
   2377     test(S("abcdefghij"), 0, 9, SV("12345"), 2, 4, S("345j"));
   2378     test(S("abcdefghij"), 0, 9, SV("12345"), 4, 0, S("j"));
   2379     test(S("abcdefghij"), 0, 9, SV("12345"), 4, 1, S("5j"));
   2380     test(S("abcdefghij"), 0, 9, SV("12345"), 4, 2, S("5j"));
   2381     test(S("abcdefghij"), 0, 9, SV("12345"), 5, 0, S("j"));
   2382     test(S("abcdefghij"), 0, 9, SV("12345"), 5, 1, S("j"));
   2383     test(S("abcdefghij"), 0, 9, SV("12345"), 6, 0, S("can't happen"));
   2384     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 0, S("j"));
   2385     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 1, S("1j"));
   2386     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 5, S("12345j"));
   2387     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 9, S("123456789j"));
   2388     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 10, S("1234567890j"));
   2389     test(S("abcdefghij"), 0, 9, SV("1234567890"), 0, 11, S("1234567890j"));
   2390     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 0, S("j"));
   2391     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 1, S("2j"));
   2392     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 4, S("2345j"));
   2393     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 8, S("23456789j"));
   2394     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 9, S("234567890j"));
   2395     test(S("abcdefghij"), 0, 9, SV("1234567890"), 1, 10, S("234567890j"));
   2396     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 0, S("j"));
   2397     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 1, S("6j"));
   2398     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 2, S("67j"));
   2399     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 4, S("6789j"));
   2400     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 5, S("67890j"));
   2401     test(S("abcdefghij"), 0, 9, SV("1234567890"), 5, 6, S("67890j"));
   2402     test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 0, S("j"));
   2403     test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 1, S("0j"));
   2404     test(S("abcdefghij"), 0, 9, SV("1234567890"), 9, 2, S("0j"));
   2405     test(S("abcdefghij"), 0, 9, SV("1234567890"), 10, 0, S("j"));
   2406     test(S("abcdefghij"), 0, 9, SV("1234567890"), 10, 1, S("j"));
   2407     test(S("abcdefghij"), 0, 9, SV("1234567890"), 11, 0, S("can't happen"));
   2408     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 0, S("j"));
   2409     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 1, S("1j"));
   2410     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 10, S("1234567890j"));
   2411     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 19, S("1234567890123456789j"));
   2412 }
   2413 
   2414 template <class S, class SV>
   2415 void test22()
   2416 {
   2417     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 20, S("12345678901234567890j"));
   2418     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 0, 21, S("12345678901234567890j"));
   2419     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 0, S("j"));
   2420     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 1, S("2j"));
   2421     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 9, S("234567890j"));
   2422     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 18, S("234567890123456789j"));
   2423     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 19, S("2345678901234567890j"));
   2424     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 1, 20, S("2345678901234567890j"));
   2425     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 0, S("j"));
   2426     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 1, S("1j"));
   2427     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 5, S("12345j"));
   2428     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 9, S("123456789j"));
   2429     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 10, S("1234567890j"));
   2430     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 10, 11, S("1234567890j"));
   2431     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 0, S("j"));
   2432     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 1, S("0j"));
   2433     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 19, 2, S("0j"));
   2434     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 20, 0, S("j"));
   2435     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 20, 1, S("j"));
   2436     test(S("abcdefghij"), 0, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2437     test(S("abcdefghij"), 0, 10, SV(""), 0, 0, S(""));
   2438     test(S("abcdefghij"), 0, 10, SV(""), 0, 1, S(""));
   2439     test(S("abcdefghij"), 0, 10, SV(""), 1, 0, S("can't happen"));
   2440     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 0, S(""));
   2441     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 1, S("1"));
   2442     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 2, S("12"));
   2443     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 4, S("1234"));
   2444     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 5, S("12345"));
   2445     test(S("abcdefghij"), 0, 10, SV("12345"), 0, 6, S("12345"));
   2446     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 0, S(""));
   2447     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 1, S("2"));
   2448     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 2, S("23"));
   2449     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 3, S("234"));
   2450     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 4, S("2345"));
   2451     test(S("abcdefghij"), 0, 10, SV("12345"), 1, 5, S("2345"));
   2452     test(S("abcdefghij"), 0, 10, SV("12345"), 2, 0, S(""));
   2453     test(S("abcdefghij"), 0, 10, SV("12345"), 2, 1, S("3"));
   2454     test(S("abcdefghij"), 0, 10, SV("12345"), 2, 2, S("34"));
   2455     test(S("abcdefghij"), 0, 10, SV("12345"), 2, 3, S("345"));
   2456     test(S("abcdefghij"), 0, 10, SV("12345"), 2, 4, S("345"));
   2457     test(S("abcdefghij"), 0, 10, SV("12345"), 4, 0, S(""));
   2458     test(S("abcdefghij"), 0, 10, SV("12345"), 4, 1, S("5"));
   2459     test(S("abcdefghij"), 0, 10, SV("12345"), 4, 2, S("5"));
   2460     test(S("abcdefghij"), 0, 10, SV("12345"), 5, 0, S(""));
   2461     test(S("abcdefghij"), 0, 10, SV("12345"), 5, 1, S(""));
   2462     test(S("abcdefghij"), 0, 10, SV("12345"), 6, 0, S("can't happen"));
   2463     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 0, S(""));
   2464     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 1, S("1"));
   2465     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 5, S("12345"));
   2466     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 9, S("123456789"));
   2467     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 10, S("1234567890"));
   2468     test(S("abcdefghij"), 0, 10, SV("1234567890"), 0, 11, S("1234567890"));
   2469     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 0, S(""));
   2470     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 1, S("2"));
   2471     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 4, S("2345"));
   2472     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 8, S("23456789"));
   2473     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 9, S("234567890"));
   2474     test(S("abcdefghij"), 0, 10, SV("1234567890"), 1, 10, S("234567890"));
   2475     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 0, S(""));
   2476     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 1, S("6"));
   2477     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 2, S("67"));
   2478     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 4, S("6789"));
   2479     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 5, S("67890"));
   2480     test(S("abcdefghij"), 0, 10, SV("1234567890"), 5, 6, S("67890"));
   2481     test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 0, S(""));
   2482     test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 1, S("0"));
   2483     test(S("abcdefghij"), 0, 10, SV("1234567890"), 9, 2, S("0"));
   2484     test(S("abcdefghij"), 0, 10, SV("1234567890"), 10, 0, S(""));
   2485     test(S("abcdefghij"), 0, 10, SV("1234567890"), 10, 1, S(""));
   2486     test(S("abcdefghij"), 0, 10, SV("1234567890"), 11, 0, S("can't happen"));
   2487     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 0, S(""));
   2488     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 1, S("1"));
   2489     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 10, S("1234567890"));
   2490     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
   2491     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
   2492     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
   2493     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 0, S(""));
   2494     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 1, S("2"));
   2495     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 9, S("234567890"));
   2496     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
   2497     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
   2498     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
   2499     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 0, S(""));
   2500     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 1, S("1"));
   2501     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 5, S("12345"));
   2502     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 9, S("123456789"));
   2503     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 10, S("1234567890"));
   2504     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 10, 11, S("1234567890"));
   2505     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 0, S(""));
   2506     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 1, S("0"));
   2507     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 19, 2, S("0"));
   2508     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 20, 0, S(""));
   2509     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 20, 1, S(""));
   2510     test(S("abcdefghij"), 0, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2511     test(S("abcdefghij"), 0, 11, SV(""), 0, 0, S(""));
   2512     test(S("abcdefghij"), 0, 11, SV(""), 0, 1, S(""));
   2513     test(S("abcdefghij"), 0, 11, SV(""), 1, 0, S("can't happen"));
   2514     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 0, S(""));
   2515     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 1, S("1"));
   2516     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 2, S("12"));
   2517 }
   2518 
   2519 template <class S, class SV>
   2520 void test23()
   2521 {
   2522     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 4, S("1234"));
   2523     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 5, S("12345"));
   2524     test(S("abcdefghij"), 0, 11, SV("12345"), 0, 6, S("12345"));
   2525     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 0, S(""));
   2526     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 1, S("2"));
   2527     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 2, S("23"));
   2528     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 3, S("234"));
   2529     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 4, S("2345"));
   2530     test(S("abcdefghij"), 0, 11, SV("12345"), 1, 5, S("2345"));
   2531     test(S("abcdefghij"), 0, 11, SV("12345"), 2, 0, S(""));
   2532     test(S("abcdefghij"), 0, 11, SV("12345"), 2, 1, S("3"));
   2533     test(S("abcdefghij"), 0, 11, SV("12345"), 2, 2, S("34"));
   2534     test(S("abcdefghij"), 0, 11, SV("12345"), 2, 3, S("345"));
   2535     test(S("abcdefghij"), 0, 11, SV("12345"), 2, 4, S("345"));
   2536     test(S("abcdefghij"), 0, 11, SV("12345"), 4, 0, S(""));
   2537     test(S("abcdefghij"), 0, 11, SV("12345"), 4, 1, S("5"));
   2538     test(S("abcdefghij"), 0, 11, SV("12345"), 4, 2, S("5"));
   2539     test(S("abcdefghij"), 0, 11, SV("12345"), 5, 0, S(""));
   2540     test(S("abcdefghij"), 0, 11, SV("12345"), 5, 1, S(""));
   2541     test(S("abcdefghij"), 0, 11, SV("12345"), 6, 0, S("can't happen"));
   2542     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 0, S(""));
   2543     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 1, S("1"));
   2544     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 5, S("12345"));
   2545     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 9, S("123456789"));
   2546     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 10, S("1234567890"));
   2547     test(S("abcdefghij"), 0, 11, SV("1234567890"), 0, 11, S("1234567890"));
   2548     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 0, S(""));
   2549     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 1, S("2"));
   2550     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 4, S("2345"));
   2551     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 8, S("23456789"));
   2552     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 9, S("234567890"));
   2553     test(S("abcdefghij"), 0, 11, SV("1234567890"), 1, 10, S("234567890"));
   2554     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 0, S(""));
   2555     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 1, S("6"));
   2556     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 2, S("67"));
   2557     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 4, S("6789"));
   2558     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 5, S("67890"));
   2559     test(S("abcdefghij"), 0, 11, SV("1234567890"), 5, 6, S("67890"));
   2560     test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 0, S(""));
   2561     test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 1, S("0"));
   2562     test(S("abcdefghij"), 0, 11, SV("1234567890"), 9, 2, S("0"));
   2563     test(S("abcdefghij"), 0, 11, SV("1234567890"), 10, 0, S(""));
   2564     test(S("abcdefghij"), 0, 11, SV("1234567890"), 10, 1, S(""));
   2565     test(S("abcdefghij"), 0, 11, SV("1234567890"), 11, 0, S("can't happen"));
   2566     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 0, S(""));
   2567     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 1, S("1"));
   2568     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 10, S("1234567890"));
   2569     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
   2570     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
   2571     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
   2572     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 0, S(""));
   2573     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 1, S("2"));
   2574     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 9, S("234567890"));
   2575     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
   2576     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
   2577     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
   2578     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 0, S(""));
   2579     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 1, S("1"));
   2580     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 5, S("12345"));
   2581     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 9, S("123456789"));
   2582     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 10, S("1234567890"));
   2583     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 10, 11, S("1234567890"));
   2584     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 0, S(""));
   2585     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 1, S("0"));
   2586     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 19, 2, S("0"));
   2587     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 20, 0, S(""));
   2588     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 20, 1, S(""));
   2589     test(S("abcdefghij"), 0, 11, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2590     test(S("abcdefghij"), 1, 0, SV(""), 0, 0, S("abcdefghij"));
   2591     test(S("abcdefghij"), 1, 0, SV(""), 0, 1, S("abcdefghij"));
   2592     test(S("abcdefghij"), 1, 0, SV(""), 1, 0, S("can't happen"));
   2593     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 0, S("abcdefghij"));
   2594     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 1, S("a1bcdefghij"));
   2595     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 2, S("a12bcdefghij"));
   2596     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 4, S("a1234bcdefghij"));
   2597     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 5, S("a12345bcdefghij"));
   2598     test(S("abcdefghij"), 1, 0, SV("12345"), 0, 6, S("a12345bcdefghij"));
   2599     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 0, S("abcdefghij"));
   2600     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 1, S("a2bcdefghij"));
   2601     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 2, S("a23bcdefghij"));
   2602     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 3, S("a234bcdefghij"));
   2603     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 4, S("a2345bcdefghij"));
   2604     test(S("abcdefghij"), 1, 0, SV("12345"), 1, 5, S("a2345bcdefghij"));
   2605     test(S("abcdefghij"), 1, 0, SV("12345"), 2, 0, S("abcdefghij"));
   2606     test(S("abcdefghij"), 1, 0, SV("12345"), 2, 1, S("a3bcdefghij"));
   2607     test(S("abcdefghij"), 1, 0, SV("12345"), 2, 2, S("a34bcdefghij"));
   2608     test(S("abcdefghij"), 1, 0, SV("12345"), 2, 3, S("a345bcdefghij"));
   2609     test(S("abcdefghij"), 1, 0, SV("12345"), 2, 4, S("a345bcdefghij"));
   2610     test(S("abcdefghij"), 1, 0, SV("12345"), 4, 0, S("abcdefghij"));
   2611     test(S("abcdefghij"), 1, 0, SV("12345"), 4, 1, S("a5bcdefghij"));
   2612     test(S("abcdefghij"), 1, 0, SV("12345"), 4, 2, S("a5bcdefghij"));
   2613     test(S("abcdefghij"), 1, 0, SV("12345"), 5, 0, S("abcdefghij"));
   2614     test(S("abcdefghij"), 1, 0, SV("12345"), 5, 1, S("abcdefghij"));
   2615     test(S("abcdefghij"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
   2616     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
   2617     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 1, S("a1bcdefghij"));
   2618     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcdefghij"));
   2619     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcdefghij"));
   2620     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcdefghij"));
   2621     test(S("abcdefghij"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcdefghij"));
   2622 }
   2623 
   2624 template <class S, class SV>
   2625 void test24()
   2626 {
   2627     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
   2628     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 1, S("a2bcdefghij"));
   2629     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcdefghij"));
   2630     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcdefghij"));
   2631     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcdefghij"));
   2632     test(S("abcdefghij"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcdefghij"));
   2633     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
   2634     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 1, S("a6bcdefghij"));
   2635     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 2, S("a67bcdefghij"));
   2636     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcdefghij"));
   2637     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcdefghij"));
   2638     test(S("abcdefghij"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcdefghij"));
   2639     test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
   2640     test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 1, S("a0bcdefghij"));
   2641     test(S("abcdefghij"), 1, 0, SV("1234567890"), 9, 2, S("a0bcdefghij"));
   2642     test(S("abcdefghij"), 1, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
   2643     test(S("abcdefghij"), 1, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
   2644     test(S("abcdefghij"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
   2645     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   2646     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcdefghij"));
   2647     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghij"));
   2648     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghij"));
   2649     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghij"));
   2650     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghij"));
   2651     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   2652     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcdefghij"));
   2653     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghij"));
   2654     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghij"));
   2655     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghij"));
   2656     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghij"));
   2657     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   2658     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcdefghij"));
   2659     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcdefghij"));
   2660     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghij"));
   2661     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghij"));
   2662     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghij"));
   2663     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   2664     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcdefghij"));
   2665     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcdefghij"));
   2666     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   2667     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   2668     test(S("abcdefghij"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2669     test(S("abcdefghij"), 1, 1, SV(""), 0, 0, S("acdefghij"));
   2670     test(S("abcdefghij"), 1, 1, SV(""), 0, 1, S("acdefghij"));
   2671     test(S("abcdefghij"), 1, 1, SV(""), 1, 0, S("can't happen"));
   2672     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 0, S("acdefghij"));
   2673     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 1, S("a1cdefghij"));
   2674     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 2, S("a12cdefghij"));
   2675     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 4, S("a1234cdefghij"));
   2676     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 5, S("a12345cdefghij"));
   2677     test(S("abcdefghij"), 1, 1, SV("12345"), 0, 6, S("a12345cdefghij"));
   2678     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 0, S("acdefghij"));
   2679     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 1, S("a2cdefghij"));
   2680     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 2, S("a23cdefghij"));
   2681     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 3, S("a234cdefghij"));
   2682     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 4, S("a2345cdefghij"));
   2683     test(S("abcdefghij"), 1, 1, SV("12345"), 1, 5, S("a2345cdefghij"));
   2684     test(S("abcdefghij"), 1, 1, SV("12345"), 2, 0, S("acdefghij"));
   2685     test(S("abcdefghij"), 1, 1, SV("12345"), 2, 1, S("a3cdefghij"));
   2686     test(S("abcdefghij"), 1, 1, SV("12345"), 2, 2, S("a34cdefghij"));
   2687     test(S("abcdefghij"), 1, 1, SV("12345"), 2, 3, S("a345cdefghij"));
   2688     test(S("abcdefghij"), 1, 1, SV("12345"), 2, 4, S("a345cdefghij"));
   2689     test(S("abcdefghij"), 1, 1, SV("12345"), 4, 0, S("acdefghij"));
   2690     test(S("abcdefghij"), 1, 1, SV("12345"), 4, 1, S("a5cdefghij"));
   2691     test(S("abcdefghij"), 1, 1, SV("12345"), 4, 2, S("a5cdefghij"));
   2692     test(S("abcdefghij"), 1, 1, SV("12345"), 5, 0, S("acdefghij"));
   2693     test(S("abcdefghij"), 1, 1, SV("12345"), 5, 1, S("acdefghij"));
   2694     test(S("abcdefghij"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
   2695     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 0, S("acdefghij"));
   2696     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 1, S("a1cdefghij"));
   2697     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 5, S("a12345cdefghij"));
   2698     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cdefghij"));
   2699     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cdefghij"));
   2700     test(S("abcdefghij"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cdefghij"));
   2701     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 0, S("acdefghij"));
   2702     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 1, S("a2cdefghij"));
   2703     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 4, S("a2345cdefghij"));
   2704     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cdefghij"));
   2705     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cdefghij"));
   2706     test(S("abcdefghij"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cdefghij"));
   2707     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 0, S("acdefghij"));
   2708     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 1, S("a6cdefghij"));
   2709     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 2, S("a67cdefghij"));
   2710     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 4, S("a6789cdefghij"));
   2711     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 5, S("a67890cdefghij"));
   2712     test(S("abcdefghij"), 1, 1, SV("1234567890"), 5, 6, S("a67890cdefghij"));
   2713     test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 0, S("acdefghij"));
   2714     test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 1, S("a0cdefghij"));
   2715     test(S("abcdefghij"), 1, 1, SV("1234567890"), 9, 2, S("a0cdefghij"));
   2716     test(S("abcdefghij"), 1, 1, SV("1234567890"), 10, 0, S("acdefghij"));
   2717     test(S("abcdefghij"), 1, 1, SV("1234567890"), 10, 1, S("acdefghij"));
   2718     test(S("abcdefghij"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
   2719     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 0, S("acdefghij"));
   2720     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cdefghij"));
   2721     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cdefghij"));
   2722     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghij"));
   2723     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghij"));
   2724     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghij"));
   2725     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 0, S("acdefghij"));
   2726     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cdefghij"));
   2727 }
   2728 
   2729 template <class S, class SV>
   2730 void test25()
   2731 {
   2732     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cdefghij"));
   2733     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cdefghij"));
   2734     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghij"));
   2735     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghij"));
   2736     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 0, S("acdefghij"));
   2737     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cdefghij"));
   2738     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cdefghij"));
   2739     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cdefghij"));
   2740     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cdefghij"));
   2741     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cdefghij"));
   2742     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 0, S("acdefghij"));
   2743     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cdefghij"));
   2744     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cdefghij"));
   2745     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 20, 0, S("acdefghij"));
   2746     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 20, 1, S("acdefghij"));
   2747     test(S("abcdefghij"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2748     test(S("abcdefghij"), 1, 4, SV(""), 0, 0, S("afghij"));
   2749     test(S("abcdefghij"), 1, 4, SV(""), 0, 1, S("afghij"));
   2750     test(S("abcdefghij"), 1, 4, SV(""), 1, 0, S("can't happen"));
   2751     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 0, S("afghij"));
   2752     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 1, S("a1fghij"));
   2753     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 2, S("a12fghij"));
   2754     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 4, S("a1234fghij"));
   2755     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 5, S("a12345fghij"));
   2756     test(S("abcdefghij"), 1, 4, SV("12345"), 0, 6, S("a12345fghij"));
   2757     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 0, S("afghij"));
   2758     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 1, S("a2fghij"));
   2759     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 2, S("a23fghij"));
   2760     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 3, S("a234fghij"));
   2761     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 4, S("a2345fghij"));
   2762     test(S("abcdefghij"), 1, 4, SV("12345"), 1, 5, S("a2345fghij"));
   2763     test(S("abcdefghij"), 1, 4, SV("12345"), 2, 0, S("afghij"));
   2764     test(S("abcdefghij"), 1, 4, SV("12345"), 2, 1, S("a3fghij"));
   2765     test(S("abcdefghij"), 1, 4, SV("12345"), 2, 2, S("a34fghij"));
   2766     test(S("abcdefghij"), 1, 4, SV("12345"), 2, 3, S("a345fghij"));
   2767     test(S("abcdefghij"), 1, 4, SV("12345"), 2, 4, S("a345fghij"));
   2768     test(S("abcdefghij"), 1, 4, SV("12345"), 4, 0, S("afghij"));
   2769     test(S("abcdefghij"), 1, 4, SV("12345"), 4, 1, S("a5fghij"));
   2770     test(S("abcdefghij"), 1, 4, SV("12345"), 4, 2, S("a5fghij"));
   2771     test(S("abcdefghij"), 1, 4, SV("12345"), 5, 0, S("afghij"));
   2772     test(S("abcdefghij"), 1, 4, SV("12345"), 5, 1, S("afghij"));
   2773     test(S("abcdefghij"), 1, 4, SV("12345"), 6, 0, S("can't happen"));
   2774     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 0, S("afghij"));
   2775     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 1, S("a1fghij"));
   2776     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 5, S("a12345fghij"));
   2777     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 9, S("a123456789fghij"));
   2778     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 10, S("a1234567890fghij"));
   2779     test(S("abcdefghij"), 1, 4, SV("1234567890"), 0, 11, S("a1234567890fghij"));
   2780     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 0, S("afghij"));
   2781     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 1, S("a2fghij"));
   2782     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 4, S("a2345fghij"));
   2783     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 8, S("a23456789fghij"));
   2784     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 9, S("a234567890fghij"));
   2785     test(S("abcdefghij"), 1, 4, SV("1234567890"), 1, 10, S("a234567890fghij"));
   2786     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 0, S("afghij"));
   2787     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 1, S("a6fghij"));
   2788     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 2, S("a67fghij"));
   2789     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 4, S("a6789fghij"));
   2790     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 5, S("a67890fghij"));
   2791     test(S("abcdefghij"), 1, 4, SV("1234567890"), 5, 6, S("a67890fghij"));
   2792     test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 0, S("afghij"));
   2793     test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 1, S("a0fghij"));
   2794     test(S("abcdefghij"), 1, 4, SV("1234567890"), 9, 2, S("a0fghij"));
   2795     test(S("abcdefghij"), 1, 4, SV("1234567890"), 10, 0, S("afghij"));
   2796     test(S("abcdefghij"), 1, 4, SV("1234567890"), 10, 1, S("afghij"));
   2797     test(S("abcdefghij"), 1, 4, SV("1234567890"), 11, 0, S("can't happen"));
   2798     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 0, S("afghij"));
   2799     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 1, S("a1fghij"));
   2800     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 10, S("a1234567890fghij"));
   2801     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 19, S("a1234567890123456789fghij"));
   2802     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 20, S("a12345678901234567890fghij"));
   2803     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 0, 21, S("a12345678901234567890fghij"));
   2804     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 0, S("afghij"));
   2805     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 1, S("a2fghij"));
   2806     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 9, S("a234567890fghij"));
   2807     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 18, S("a234567890123456789fghij"));
   2808     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 19, S("a2345678901234567890fghij"));
   2809     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 1, 20, S("a2345678901234567890fghij"));
   2810     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 0, S("afghij"));
   2811     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 1, S("a1fghij"));
   2812     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 5, S("a12345fghij"));
   2813     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 9, S("a123456789fghij"));
   2814     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 10, S("a1234567890fghij"));
   2815     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 10, 11, S("a1234567890fghij"));
   2816     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 0, S("afghij"));
   2817     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 1, S("a0fghij"));
   2818     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 19, 2, S("a0fghij"));
   2819     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 20, 0, S("afghij"));
   2820     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 20, 1, S("afghij"));
   2821     test(S("abcdefghij"), 1, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2822     test(S("abcdefghij"), 1, 8, SV(""), 0, 0, S("aj"));
   2823     test(S("abcdefghij"), 1, 8, SV(""), 0, 1, S("aj"));
   2824     test(S("abcdefghij"), 1, 8, SV(""), 1, 0, S("can't happen"));
   2825     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 0, S("aj"));
   2826     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 1, S("a1j"));
   2827     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 2, S("a12j"));
   2828     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 4, S("a1234j"));
   2829     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 5, S("a12345j"));
   2830     test(S("abcdefghij"), 1, 8, SV("12345"), 0, 6, S("a12345j"));
   2831     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 0, S("aj"));
   2832 }
   2833 
   2834 template <class S, class SV>
   2835 void test26()
   2836 {
   2837     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 1, S("a2j"));
   2838     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 2, S("a23j"));
   2839     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 3, S("a234j"));
   2840     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 4, S("a2345j"));
   2841     test(S("abcdefghij"), 1, 8, SV("12345"), 1, 5, S("a2345j"));
   2842     test(S("abcdefghij"), 1, 8, SV("12345"), 2, 0, S("aj"));
   2843     test(S("abcdefghij"), 1, 8, SV("12345"), 2, 1, S("a3j"));
   2844     test(S("abcdefghij"), 1, 8, SV("12345"), 2, 2, S("a34j"));
   2845     test(S("abcdefghij"), 1, 8, SV("12345"), 2, 3, S("a345j"));
   2846     test(S("abcdefghij"), 1, 8, SV("12345"), 2, 4, S("a345j"));
   2847     test(S("abcdefghij"), 1, 8, SV("12345"), 4, 0, S("aj"));
   2848     test(S("abcdefghij"), 1, 8, SV("12345"), 4, 1, S("a5j"));
   2849     test(S("abcdefghij"), 1, 8, SV("12345"), 4, 2, S("a5j"));
   2850     test(S("abcdefghij"), 1, 8, SV("12345"), 5, 0, S("aj"));
   2851     test(S("abcdefghij"), 1, 8, SV("12345"), 5, 1, S("aj"));
   2852     test(S("abcdefghij"), 1, 8, SV("12345"), 6, 0, S("can't happen"));
   2853     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 0, S("aj"));
   2854     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 1, S("a1j"));
   2855     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 5, S("a12345j"));
   2856     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 9, S("a123456789j"));
   2857     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 10, S("a1234567890j"));
   2858     test(S("abcdefghij"), 1, 8, SV("1234567890"), 0, 11, S("a1234567890j"));
   2859     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 0, S("aj"));
   2860     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 1, S("a2j"));
   2861     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 4, S("a2345j"));
   2862     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 8, S("a23456789j"));
   2863     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 9, S("a234567890j"));
   2864     test(S("abcdefghij"), 1, 8, SV("1234567890"), 1, 10, S("a234567890j"));
   2865     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 0, S("aj"));
   2866     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 1, S("a6j"));
   2867     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 2, S("a67j"));
   2868     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 4, S("a6789j"));
   2869     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 5, S("a67890j"));
   2870     test(S("abcdefghij"), 1, 8, SV("1234567890"), 5, 6, S("a67890j"));
   2871     test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 0, S("aj"));
   2872     test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 1, S("a0j"));
   2873     test(S("abcdefghij"), 1, 8, SV("1234567890"), 9, 2, S("a0j"));
   2874     test(S("abcdefghij"), 1, 8, SV("1234567890"), 10, 0, S("aj"));
   2875     test(S("abcdefghij"), 1, 8, SV("1234567890"), 10, 1, S("aj"));
   2876     test(S("abcdefghij"), 1, 8, SV("1234567890"), 11, 0, S("can't happen"));
   2877     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 0, S("aj"));
   2878     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 1, S("a1j"));
   2879     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 10, S("a1234567890j"));
   2880     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 19, S("a1234567890123456789j"));
   2881     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 20, S("a12345678901234567890j"));
   2882     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 0, 21, S("a12345678901234567890j"));
   2883     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 0, S("aj"));
   2884     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 1, S("a2j"));
   2885     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 9, S("a234567890j"));
   2886     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 18, S("a234567890123456789j"));
   2887     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 19, S("a2345678901234567890j"));
   2888     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 1, 20, S("a2345678901234567890j"));
   2889     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 0, S("aj"));
   2890     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 1, S("a1j"));
   2891     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 5, S("a12345j"));
   2892     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 9, S("a123456789j"));
   2893     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 10, S("a1234567890j"));
   2894     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 10, 11, S("a1234567890j"));
   2895     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 0, S("aj"));
   2896     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 1, S("a0j"));
   2897     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 19, 2, S("a0j"));
   2898     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 20, 0, S("aj"));
   2899     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 20, 1, S("aj"));
   2900     test(S("abcdefghij"), 1, 8, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2901     test(S("abcdefghij"), 1, 9, SV(""), 0, 0, S("a"));
   2902     test(S("abcdefghij"), 1, 9, SV(""), 0, 1, S("a"));
   2903     test(S("abcdefghij"), 1, 9, SV(""), 1, 0, S("can't happen"));
   2904     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 0, S("a"));
   2905     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 1, S("a1"));
   2906     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 2, S("a12"));
   2907     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 4, S("a1234"));
   2908     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 5, S("a12345"));
   2909     test(S("abcdefghij"), 1, 9, SV("12345"), 0, 6, S("a12345"));
   2910     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 0, S("a"));
   2911     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 1, S("a2"));
   2912     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 2, S("a23"));
   2913     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 3, S("a234"));
   2914     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 4, S("a2345"));
   2915     test(S("abcdefghij"), 1, 9, SV("12345"), 1, 5, S("a2345"));
   2916     test(S("abcdefghij"), 1, 9, SV("12345"), 2, 0, S("a"));
   2917     test(S("abcdefghij"), 1, 9, SV("12345"), 2, 1, S("a3"));
   2918     test(S("abcdefghij"), 1, 9, SV("12345"), 2, 2, S("a34"));
   2919     test(S("abcdefghij"), 1, 9, SV("12345"), 2, 3, S("a345"));
   2920     test(S("abcdefghij"), 1, 9, SV("12345"), 2, 4, S("a345"));
   2921     test(S("abcdefghij"), 1, 9, SV("12345"), 4, 0, S("a"));
   2922     test(S("abcdefghij"), 1, 9, SV("12345"), 4, 1, S("a5"));
   2923     test(S("abcdefghij"), 1, 9, SV("12345"), 4, 2, S("a5"));
   2924     test(S("abcdefghij"), 1, 9, SV("12345"), 5, 0, S("a"));
   2925     test(S("abcdefghij"), 1, 9, SV("12345"), 5, 1, S("a"));
   2926     test(S("abcdefghij"), 1, 9, SV("12345"), 6, 0, S("can't happen"));
   2927     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 0, S("a"));
   2928     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 1, S("a1"));
   2929     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 5, S("a12345"));
   2930     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 9, S("a123456789"));
   2931     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 10, S("a1234567890"));
   2932     test(S("abcdefghij"), 1, 9, SV("1234567890"), 0, 11, S("a1234567890"));
   2933     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 0, S("a"));
   2934     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 1, S("a2"));
   2935     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 4, S("a2345"));
   2936     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 8, S("a23456789"));
   2937 }
   2938 
   2939 template <class S, class SV>
   2940 void test27()
   2941 {
   2942     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 9, S("a234567890"));
   2943     test(S("abcdefghij"), 1, 9, SV("1234567890"), 1, 10, S("a234567890"));
   2944     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 0, S("a"));
   2945     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 1, S("a6"));
   2946     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 2, S("a67"));
   2947     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 4, S("a6789"));
   2948     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 5, S("a67890"));
   2949     test(S("abcdefghij"), 1, 9, SV("1234567890"), 5, 6, S("a67890"));
   2950     test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 0, S("a"));
   2951     test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 1, S("a0"));
   2952     test(S("abcdefghij"), 1, 9, SV("1234567890"), 9, 2, S("a0"));
   2953     test(S("abcdefghij"), 1, 9, SV("1234567890"), 10, 0, S("a"));
   2954     test(S("abcdefghij"), 1, 9, SV("1234567890"), 10, 1, S("a"));
   2955     test(S("abcdefghij"), 1, 9, SV("1234567890"), 11, 0, S("can't happen"));
   2956     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 0, S("a"));
   2957     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 1, S("a1"));
   2958     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   2959     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   2960     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   2961     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   2962     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 0, S("a"));
   2963     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 1, S("a2"));
   2964     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 9, S("a234567890"));
   2965     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   2966     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   2967     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   2968     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 0, S("a"));
   2969     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 1, S("a1"));
   2970     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 5, S("a12345"));
   2971     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 9, S("a123456789"));
   2972     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   2973     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   2974     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 0, S("a"));
   2975     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 1, S("a0"));
   2976     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 19, 2, S("a0"));
   2977     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 20, 0, S("a"));
   2978     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 20, 1, S("a"));
   2979     test(S("abcdefghij"), 1, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
   2980     test(S("abcdefghij"), 1, 10, SV(""), 0, 0, S("a"));
   2981     test(S("abcdefghij"), 1, 10, SV(""), 0, 1, S("a"));
   2982     test(S("abcdefghij"), 1, 10, SV(""), 1, 0, S("can't happen"));
   2983     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 0, S("a"));
   2984     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 1, S("a1"));
   2985     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 2, S("a12"));
   2986     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 4, S("a1234"));
   2987     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 5, S("a12345"));
   2988     test(S("abcdefghij"), 1, 10, SV("12345"), 0, 6, S("a12345"));
   2989     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 0, S("a"));
   2990     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 1, S("a2"));
   2991     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 2, S("a23"));
   2992     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 3, S("a234"));
   2993     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 4, S("a2345"));
   2994     test(S("abcdefghij"), 1, 10, SV("12345"), 1, 5, S("a2345"));
   2995     test(S("abcdefghij"), 1, 10, SV("12345"), 2, 0, S("a"));
   2996     test(S("abcdefghij"), 1, 10, SV("12345"), 2, 1, S("a3"));
   2997     test(S("abcdefghij"), 1, 10, SV("12345"), 2, 2, S("a34"));
   2998     test(S("abcdefghij"), 1, 10, SV("12345"), 2, 3, S("a345"));
   2999     test(S("abcdefghij"), 1, 10, SV("12345"), 2, 4, S("a345"));
   3000     test(S("abcdefghij"), 1, 10, SV("12345"), 4, 0, S("a"));
   3001     test(S("abcdefghij"), 1, 10, SV("12345"), 4, 1, S("a5"));
   3002     test(S("abcdefghij"), 1, 10, SV("12345"), 4, 2, S("a5"));
   3003     test(S("abcdefghij"), 1, 10, SV("12345"), 5, 0, S("a"));
   3004     test(S("abcdefghij"), 1, 10, SV("12345"), 5, 1, S("a"));
   3005     test(S("abcdefghij"), 1, 10, SV("12345"), 6, 0, S("can't happen"));
   3006     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 0, S("a"));
   3007     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 1, S("a1"));
   3008     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 5, S("a12345"));
   3009     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 9, S("a123456789"));
   3010     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 10, S("a1234567890"));
   3011     test(S("abcdefghij"), 1, 10, SV("1234567890"), 0, 11, S("a1234567890"));
   3012     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 0, S("a"));
   3013     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 1, S("a2"));
   3014     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 4, S("a2345"));
   3015     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 8, S("a23456789"));
   3016     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 9, S("a234567890"));
   3017     test(S("abcdefghij"), 1, 10, SV("1234567890"), 1, 10, S("a234567890"));
   3018     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 0, S("a"));
   3019     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 1, S("a6"));
   3020     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 2, S("a67"));
   3021     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 4, S("a6789"));
   3022     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 5, S("a67890"));
   3023     test(S("abcdefghij"), 1, 10, SV("1234567890"), 5, 6, S("a67890"));
   3024     test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 0, S("a"));
   3025     test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 1, S("a0"));
   3026     test(S("abcdefghij"), 1, 10, SV("1234567890"), 9, 2, S("a0"));
   3027     test(S("abcdefghij"), 1, 10, SV("1234567890"), 10, 0, S("a"));
   3028     test(S("abcdefghij"), 1, 10, SV("1234567890"), 10, 1, S("a"));
   3029     test(S("abcdefghij"), 1, 10, SV("1234567890"), 11, 0, S("can't happen"));
   3030     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 0, S("a"));
   3031     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 1, S("a1"));
   3032     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   3033     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   3034     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   3035     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   3036     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 0, S("a"));
   3037     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 1, S("a2"));
   3038     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 9, S("a234567890"));
   3039     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   3040     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   3041     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   3042 }
   3043 
   3044 template <class S, class SV>
   3045 void test28()
   3046 {
   3047     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 0, S("a"));
   3048     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 1, S("a1"));
   3049     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 5, S("a12345"));
   3050     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 9, S("a123456789"));
   3051     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   3052     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   3053     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 0, S("a"));
   3054     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 1, S("a0"));
   3055     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 19, 2, S("a0"));
   3056     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 20, 0, S("a"));
   3057     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 20, 1, S("a"));
   3058     test(S("abcdefghij"), 1, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3059     test(S("abcdefghij"), 5, 0, SV(""), 0, 0, S("abcdefghij"));
   3060     test(S("abcdefghij"), 5, 0, SV(""), 0, 1, S("abcdefghij"));
   3061     test(S("abcdefghij"), 5, 0, SV(""), 1, 0, S("can't happen"));
   3062     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 0, S("abcdefghij"));
   3063     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 1, S("abcde1fghij"));
   3064     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 2, S("abcde12fghij"));
   3065     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 4, S("abcde1234fghij"));
   3066     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 5, S("abcde12345fghij"));
   3067     test(S("abcdefghij"), 5, 0, SV("12345"), 0, 6, S("abcde12345fghij"));
   3068     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 0, S("abcdefghij"));
   3069     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 1, S("abcde2fghij"));
   3070     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 2, S("abcde23fghij"));
   3071     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 3, S("abcde234fghij"));
   3072     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 4, S("abcde2345fghij"));
   3073     test(S("abcdefghij"), 5, 0, SV("12345"), 1, 5, S("abcde2345fghij"));
   3074     test(S("abcdefghij"), 5, 0, SV("12345"), 2, 0, S("abcdefghij"));
   3075     test(S("abcdefghij"), 5, 0, SV("12345"), 2, 1, S("abcde3fghij"));
   3076     test(S("abcdefghij"), 5, 0, SV("12345"), 2, 2, S("abcde34fghij"));
   3077     test(S("abcdefghij"), 5, 0, SV("12345"), 2, 3, S("abcde345fghij"));
   3078     test(S("abcdefghij"), 5, 0, SV("12345"), 2, 4, S("abcde345fghij"));
   3079     test(S("abcdefghij"), 5, 0, SV("12345"), 4, 0, S("abcdefghij"));
   3080     test(S("abcdefghij"), 5, 0, SV("12345"), 4, 1, S("abcde5fghij"));
   3081     test(S("abcdefghij"), 5, 0, SV("12345"), 4, 2, S("abcde5fghij"));
   3082     test(S("abcdefghij"), 5, 0, SV("12345"), 5, 0, S("abcdefghij"));
   3083     test(S("abcdefghij"), 5, 0, SV("12345"), 5, 1, S("abcdefghij"));
   3084     test(S("abcdefghij"), 5, 0, SV("12345"), 6, 0, S("can't happen"));
   3085     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
   3086     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 1, S("abcde1fghij"));
   3087     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 5, S("abcde12345fghij"));
   3088     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 9, S("abcde123456789fghij"));
   3089     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 10, S("abcde1234567890fghij"));
   3090     test(S("abcdefghij"), 5, 0, SV("1234567890"), 0, 11, S("abcde1234567890fghij"));
   3091     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
   3092     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 1, S("abcde2fghij"));
   3093     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 4, S("abcde2345fghij"));
   3094     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 8, S("abcde23456789fghij"));
   3095     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 9, S("abcde234567890fghij"));
   3096     test(S("abcdefghij"), 5, 0, SV("1234567890"), 1, 10, S("abcde234567890fghij"));
   3097     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
   3098     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 1, S("abcde6fghij"));
   3099     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 2, S("abcde67fghij"));
   3100     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 4, S("abcde6789fghij"));
   3101     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 5, S("abcde67890fghij"));
   3102     test(S("abcdefghij"), 5, 0, SV("1234567890"), 5, 6, S("abcde67890fghij"));
   3103     test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
   3104     test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 1, S("abcde0fghij"));
   3105     test(S("abcdefghij"), 5, 0, SV("1234567890"), 9, 2, S("abcde0fghij"));
   3106     test(S("abcdefghij"), 5, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
   3107     test(S("abcdefghij"), 5, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
   3108     test(S("abcdefghij"), 5, 0, SV("1234567890"), 11, 0, S("can't happen"));
   3109     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   3110     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 1, S("abcde1fghij"));
   3111     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 10, S("abcde1234567890fghij"));
   3112     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789fghij"));
   3113     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890fghij"));
   3114     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890fghij"));
   3115     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   3116     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 1, S("abcde2fghij"));
   3117     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 9, S("abcde234567890fghij"));
   3118     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789fghij"));
   3119     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890fghij"));
   3120     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890fghij"));
   3121     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   3122     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 1, S("abcde1fghij"));
   3123     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 5, S("abcde12345fghij"));
   3124     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 9, S("abcde123456789fghij"));
   3125     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 10, S("abcde1234567890fghij"));
   3126     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 10, 11, S("abcde1234567890fghij"));
   3127     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   3128     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 1, S("abcde0fghij"));
   3129     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 19, 2, S("abcde0fghij"));
   3130     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   3131     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   3132     test(S("abcdefghij"), 5, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3133     test(S("abcdefghij"), 5, 1, SV(""), 0, 0, S("abcdeghij"));
   3134     test(S("abcdefghij"), 5, 1, SV(""), 0, 1, S("abcdeghij"));
   3135     test(S("abcdefghij"), 5, 1, SV(""), 1, 0, S("can't happen"));
   3136     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 0, S("abcdeghij"));
   3137     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 1, S("abcde1ghij"));
   3138     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 2, S("abcde12ghij"));
   3139     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 4, S("abcde1234ghij"));
   3140     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 5, S("abcde12345ghij"));
   3141     test(S("abcdefghij"), 5, 1, SV("12345"), 0, 6, S("abcde12345ghij"));
   3142     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 0, S("abcdeghij"));
   3143     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 1, S("abcde2ghij"));
   3144     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 2, S("abcde23ghij"));
   3145     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 3, S("abcde234ghij"));
   3146     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 4, S("abcde2345ghij"));
   3147 }
   3148 
   3149 template <class S, class SV>
   3150 void test29()
   3151 {
   3152     test(S("abcdefghij"), 5, 1, SV("12345"), 1, 5, S("abcde2345ghij"));
   3153     test(S("abcdefghij"), 5, 1, SV("12345"), 2, 0, S("abcdeghij"));
   3154     test(S("abcdefghij"), 5, 1, SV("12345"), 2, 1, S("abcde3ghij"));
   3155     test(S("abcdefghij"), 5, 1, SV("12345"), 2, 2, S("abcde34ghij"));
   3156     test(S("abcdefghij"), 5, 1, SV("12345"), 2, 3, S("abcde345ghij"));
   3157     test(S("abcdefghij"), 5, 1, SV("12345"), 2, 4, S("abcde345ghij"));
   3158     test(S("abcdefghij"), 5, 1, SV("12345"), 4, 0, S("abcdeghij"));
   3159     test(S("abcdefghij"), 5, 1, SV("12345"), 4, 1, S("abcde5ghij"));
   3160     test(S("abcdefghij"), 5, 1, SV("12345"), 4, 2, S("abcde5ghij"));
   3161     test(S("abcdefghij"), 5, 1, SV("12345"), 5, 0, S("abcdeghij"));
   3162     test(S("abcdefghij"), 5, 1, SV("12345"), 5, 1, S("abcdeghij"));
   3163     test(S("abcdefghij"), 5, 1, SV("12345"), 6, 0, S("can't happen"));
   3164     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 0, S("abcdeghij"));
   3165     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 1, S("abcde1ghij"));
   3166     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 5, S("abcde12345ghij"));
   3167     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 9, S("abcde123456789ghij"));
   3168     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 10, S("abcde1234567890ghij"));
   3169     test(S("abcdefghij"), 5, 1, SV("1234567890"), 0, 11, S("abcde1234567890ghij"));
   3170     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 0, S("abcdeghij"));
   3171     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 1, S("abcde2ghij"));
   3172     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 4, S("abcde2345ghij"));
   3173     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 8, S("abcde23456789ghij"));
   3174     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 9, S("abcde234567890ghij"));
   3175     test(S("abcdefghij"), 5, 1, SV("1234567890"), 1, 10, S("abcde234567890ghij"));
   3176     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 0, S("abcdeghij"));
   3177     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 1, S("abcde6ghij"));
   3178     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 2, S("abcde67ghij"));
   3179     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 4, S("abcde6789ghij"));
   3180     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 5, S("abcde67890ghij"));
   3181     test(S("abcdefghij"), 5, 1, SV("1234567890"), 5, 6, S("abcde67890ghij"));
   3182     test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 0, S("abcdeghij"));
   3183     test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 1, S("abcde0ghij"));
   3184     test(S("abcdefghij"), 5, 1, SV("1234567890"), 9, 2, S("abcde0ghij"));
   3185     test(S("abcdefghij"), 5, 1, SV("1234567890"), 10, 0, S("abcdeghij"));
   3186     test(S("abcdefghij"), 5, 1, SV("1234567890"), 10, 1, S("abcdeghij"));
   3187     test(S("abcdefghij"), 5, 1, SV("1234567890"), 11, 0, S("can't happen"));
   3188     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 0, S("abcdeghij"));
   3189     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 1, S("abcde1ghij"));
   3190     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 10, S("abcde1234567890ghij"));
   3191     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789ghij"));
   3192     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890ghij"));
   3193     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890ghij"));
   3194     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 0, S("abcdeghij"));
   3195     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 1, S("abcde2ghij"));
   3196     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 9, S("abcde234567890ghij"));
   3197     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789ghij"));
   3198     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890ghij"));
   3199     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890ghij"));
   3200     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 0, S("abcdeghij"));
   3201     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 1, S("abcde1ghij"));
   3202     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 5, S("abcde12345ghij"));
   3203     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 9, S("abcde123456789ghij"));
   3204     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 10, S("abcde1234567890ghij"));
   3205     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 10, 11, S("abcde1234567890ghij"));
   3206     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 0, S("abcdeghij"));
   3207     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 1, S("abcde0ghij"));
   3208     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 19, 2, S("abcde0ghij"));
   3209     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 20, 0, S("abcdeghij"));
   3210     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 20, 1, S("abcdeghij"));
   3211     test(S("abcdefghij"), 5, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3212     test(S("abcdefghij"), 5, 2, SV(""), 0, 0, S("abcdehij"));
   3213     test(S("abcdefghij"), 5, 2, SV(""), 0, 1, S("abcdehij"));
   3214     test(S("abcdefghij"), 5, 2, SV(""), 1, 0, S("can't happen"));
   3215     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 0, S("abcdehij"));
   3216     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 1, S("abcde1hij"));
   3217     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 2, S("abcde12hij"));
   3218     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 4, S("abcde1234hij"));
   3219     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 5, S("abcde12345hij"));
   3220     test(S("abcdefghij"), 5, 2, SV("12345"), 0, 6, S("abcde12345hij"));
   3221     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 0, S("abcdehij"));
   3222     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 1, S("abcde2hij"));
   3223     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 2, S("abcde23hij"));
   3224     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 3, S("abcde234hij"));
   3225     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 4, S("abcde2345hij"));
   3226     test(S("abcdefghij"), 5, 2, SV("12345"), 1, 5, S("abcde2345hij"));
   3227     test(S("abcdefghij"), 5, 2, SV("12345"), 2, 0, S("abcdehij"));
   3228     test(S("abcdefghij"), 5, 2, SV("12345"), 2, 1, S("abcde3hij"));
   3229     test(S("abcdefghij"), 5, 2, SV("12345"), 2, 2, S("abcde34hij"));
   3230     test(S("abcdefghij"), 5, 2, SV("12345"), 2, 3, S("abcde345hij"));
   3231     test(S("abcdefghij"), 5, 2, SV("12345"), 2, 4, S("abcde345hij"));
   3232     test(S("abcdefghij"), 5, 2, SV("12345"), 4, 0, S("abcdehij"));
   3233     test(S("abcdefghij"), 5, 2, SV("12345"), 4, 1, S("abcde5hij"));
   3234     test(S("abcdefghij"), 5, 2, SV("12345"), 4, 2, S("abcde5hij"));
   3235     test(S("abcdefghij"), 5, 2, SV("12345"), 5, 0, S("abcdehij"));
   3236     test(S("abcdefghij"), 5, 2, SV("12345"), 5, 1, S("abcdehij"));
   3237     test(S("abcdefghij"), 5, 2, SV("12345"), 6, 0, S("can't happen"));
   3238     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 0, S("abcdehij"));
   3239     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 1, S("abcde1hij"));
   3240     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 5, S("abcde12345hij"));
   3241     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 9, S("abcde123456789hij"));
   3242     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 10, S("abcde1234567890hij"));
   3243     test(S("abcdefghij"), 5, 2, SV("1234567890"), 0, 11, S("abcde1234567890hij"));
   3244     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 0, S("abcdehij"));
   3245     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 1, S("abcde2hij"));
   3246     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 4, S("abcde2345hij"));
   3247     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 8, S("abcde23456789hij"));
   3248     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 9, S("abcde234567890hij"));
   3249     test(S("abcdefghij"), 5, 2, SV("1234567890"), 1, 10, S("abcde234567890hij"));
   3250     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 0, S("abcdehij"));
   3251     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 1, S("abcde6hij"));
   3252 }
   3253 
   3254 template <class S, class SV>
   3255 void test30()
   3256 {
   3257     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 2, S("abcde67hij"));
   3258     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 4, S("abcde6789hij"));
   3259     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 5, S("abcde67890hij"));
   3260     test(S("abcdefghij"), 5, 2, SV("1234567890"), 5, 6, S("abcde67890hij"));
   3261     test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 0, S("abcdehij"));
   3262     test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 1, S("abcde0hij"));
   3263     test(S("abcdefghij"), 5, 2, SV("1234567890"), 9, 2, S("abcde0hij"));
   3264     test(S("abcdefghij"), 5, 2, SV("1234567890"), 10, 0, S("abcdehij"));
   3265     test(S("abcdefghij"), 5, 2, SV("1234567890"), 10, 1, S("abcdehij"));
   3266     test(S("abcdefghij"), 5, 2, SV("1234567890"), 11, 0, S("can't happen"));
   3267     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 0, S("abcdehij"));
   3268     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 1, S("abcde1hij"));
   3269     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 10, S("abcde1234567890hij"));
   3270     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789hij"));
   3271     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890hij"));
   3272     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890hij"));
   3273     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 0, S("abcdehij"));
   3274     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 1, S("abcde2hij"));
   3275     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 9, S("abcde234567890hij"));
   3276     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789hij"));
   3277     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890hij"));
   3278     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890hij"));
   3279     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 0, S("abcdehij"));
   3280     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 1, S("abcde1hij"));
   3281     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 5, S("abcde12345hij"));
   3282     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 9, S("abcde123456789hij"));
   3283     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 10, S("abcde1234567890hij"));
   3284     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 10, 11, S("abcde1234567890hij"));
   3285     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 0, S("abcdehij"));
   3286     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 1, S("abcde0hij"));
   3287     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 19, 2, S("abcde0hij"));
   3288     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 20, 0, S("abcdehij"));
   3289     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 20, 1, S("abcdehij"));
   3290     test(S("abcdefghij"), 5, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3291     test(S("abcdefghij"), 5, 4, SV(""), 0, 0, S("abcdej"));
   3292     test(S("abcdefghij"), 5, 4, SV(""), 0, 1, S("abcdej"));
   3293     test(S("abcdefghij"), 5, 4, SV(""), 1, 0, S("can't happen"));
   3294     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 0, S("abcdej"));
   3295     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 1, S("abcde1j"));
   3296     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 2, S("abcde12j"));
   3297     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 4, S("abcde1234j"));
   3298     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 5, S("abcde12345j"));
   3299     test(S("abcdefghij"), 5, 4, SV("12345"), 0, 6, S("abcde12345j"));
   3300     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 0, S("abcdej"));
   3301     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 1, S("abcde2j"));
   3302     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 2, S("abcde23j"));
   3303     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 3, S("abcde234j"));
   3304     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 4, S("abcde2345j"));
   3305     test(S("abcdefghij"), 5, 4, SV("12345"), 1, 5, S("abcde2345j"));
   3306     test(S("abcdefghij"), 5, 4, SV("12345"), 2, 0, S("abcdej"));
   3307     test(S("abcdefghij"), 5, 4, SV("12345"), 2, 1, S("abcde3j"));
   3308     test(S("abcdefghij"), 5, 4, SV("12345"), 2, 2, S("abcde34j"));
   3309     test(S("abcdefghij"), 5, 4, SV("12345"), 2, 3, S("abcde345j"));
   3310     test(S("abcdefghij"), 5, 4, SV("12345"), 2, 4, S("abcde345j"));
   3311     test(S("abcdefghij"), 5, 4, SV("12345"), 4, 0, S("abcdej"));
   3312     test(S("abcdefghij"), 5, 4, SV("12345"), 4, 1, S("abcde5j"));
   3313     test(S("abcdefghij"), 5, 4, SV("12345"), 4, 2, S("abcde5j"));
   3314     test(S("abcdefghij"), 5, 4, SV("12345"), 5, 0, S("abcdej"));
   3315     test(S("abcdefghij"), 5, 4, SV("12345"), 5, 1, S("abcdej"));
   3316     test(S("abcdefghij"), 5, 4, SV("12345"), 6, 0, S("can't happen"));
   3317     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 0, S("abcdej"));
   3318     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 1, S("abcde1j"));
   3319     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 5, S("abcde12345j"));
   3320     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 9, S("abcde123456789j"));
   3321     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 10, S("abcde1234567890j"));
   3322     test(S("abcdefghij"), 5, 4, SV("1234567890"), 0, 11, S("abcde1234567890j"));
   3323     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 0, S("abcdej"));
   3324     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 1, S("abcde2j"));
   3325     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 4, S("abcde2345j"));
   3326     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 8, S("abcde23456789j"));
   3327     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 9, S("abcde234567890j"));
   3328     test(S("abcdefghij"), 5, 4, SV("1234567890"), 1, 10, S("abcde234567890j"));
   3329     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 0, S("abcdej"));
   3330     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 1, S("abcde6j"));
   3331     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 2, S("abcde67j"));
   3332     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 4, S("abcde6789j"));
   3333     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 5, S("abcde67890j"));
   3334     test(S("abcdefghij"), 5, 4, SV("1234567890"), 5, 6, S("abcde67890j"));
   3335     test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 0, S("abcdej"));
   3336     test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 1, S("abcde0j"));
   3337     test(S("abcdefghij"), 5, 4, SV("1234567890"), 9, 2, S("abcde0j"));
   3338     test(S("abcdefghij"), 5, 4, SV("1234567890"), 10, 0, S("abcdej"));
   3339     test(S("abcdefghij"), 5, 4, SV("1234567890"), 10, 1, S("abcdej"));
   3340     test(S("abcdefghij"), 5, 4, SV("1234567890"), 11, 0, S("can't happen"));
   3341     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 0, S("abcdej"));
   3342     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 1, S("abcde1j"));
   3343     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 10, S("abcde1234567890j"));
   3344     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789j"));
   3345     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890j"));
   3346     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890j"));
   3347     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 0, S("abcdej"));
   3348     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 1, S("abcde2j"));
   3349     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 9, S("abcde234567890j"));
   3350     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789j"));
   3351     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890j"));
   3352     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890j"));
   3353     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 0, S("abcdej"));
   3354     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 1, S("abcde1j"));
   3355     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 5, S("abcde12345j"));
   3356     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 9, S("abcde123456789j"));
   3357 }
   3358 
   3359 template <class S, class SV>
   3360 void test31()
   3361 {
   3362     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 10, S("abcde1234567890j"));
   3363     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 10, 11, S("abcde1234567890j"));
   3364     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 0, S("abcdej"));
   3365     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 1, S("abcde0j"));
   3366     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 19, 2, S("abcde0j"));
   3367     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 20, 0, S("abcdej"));
   3368     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 20, 1, S("abcdej"));
   3369     test(S("abcdefghij"), 5, 4, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3370     test(S("abcdefghij"), 5, 5, SV(""), 0, 0, S("abcde"));
   3371     test(S("abcdefghij"), 5, 5, SV(""), 0, 1, S("abcde"));
   3372     test(S("abcdefghij"), 5, 5, SV(""), 1, 0, S("can't happen"));
   3373     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 0, S("abcde"));
   3374     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 1, S("abcde1"));
   3375     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 2, S("abcde12"));
   3376     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 4, S("abcde1234"));
   3377     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 5, S("abcde12345"));
   3378     test(S("abcdefghij"), 5, 5, SV("12345"), 0, 6, S("abcde12345"));
   3379     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 0, S("abcde"));
   3380     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 1, S("abcde2"));
   3381     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 2, S("abcde23"));
   3382     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 3, S("abcde234"));
   3383     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 4, S("abcde2345"));
   3384     test(S("abcdefghij"), 5, 5, SV("12345"), 1, 5, S("abcde2345"));
   3385     test(S("abcdefghij"), 5, 5, SV("12345"), 2, 0, S("abcde"));
   3386     test(S("abcdefghij"), 5, 5, SV("12345"), 2, 1, S("abcde3"));
   3387     test(S("abcdefghij"), 5, 5, SV("12345"), 2, 2, S("abcde34"));
   3388     test(S("abcdefghij"), 5, 5, SV("12345"), 2, 3, S("abcde345"));
   3389     test(S("abcdefghij"), 5, 5, SV("12345"), 2, 4, S("abcde345"));
   3390     test(S("abcdefghij"), 5, 5, SV("12345"), 4, 0, S("abcde"));
   3391     test(S("abcdefghij"), 5, 5, SV("12345"), 4, 1, S("abcde5"));
   3392     test(S("abcdefghij"), 5, 5, SV("12345"), 4, 2, S("abcde5"));
   3393     test(S("abcdefghij"), 5, 5, SV("12345"), 5, 0, S("abcde"));
   3394     test(S("abcdefghij"), 5, 5, SV("12345"), 5, 1, S("abcde"));
   3395     test(S("abcdefghij"), 5, 5, SV("12345"), 6, 0, S("can't happen"));
   3396     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 0, S("abcde"));
   3397     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 1, S("abcde1"));
   3398     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 5, S("abcde12345"));
   3399     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 9, S("abcde123456789"));
   3400     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 10, S("abcde1234567890"));
   3401     test(S("abcdefghij"), 5, 5, SV("1234567890"), 0, 11, S("abcde1234567890"));
   3402     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 0, S("abcde"));
   3403     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 1, S("abcde2"));
   3404     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 4, S("abcde2345"));
   3405     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 8, S("abcde23456789"));
   3406     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 9, S("abcde234567890"));
   3407     test(S("abcdefghij"), 5, 5, SV("1234567890"), 1, 10, S("abcde234567890"));
   3408     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 0, S("abcde"));
   3409     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 1, S("abcde6"));
   3410     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 2, S("abcde67"));
   3411     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 4, S("abcde6789"));
   3412     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 5, S("abcde67890"));
   3413     test(S("abcdefghij"), 5, 5, SV("1234567890"), 5, 6, S("abcde67890"));
   3414     test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 0, S("abcde"));
   3415     test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 1, S("abcde0"));
   3416     test(S("abcdefghij"), 5, 5, SV("1234567890"), 9, 2, S("abcde0"));
   3417     test(S("abcdefghij"), 5, 5, SV("1234567890"), 10, 0, S("abcde"));
   3418     test(S("abcdefghij"), 5, 5, SV("1234567890"), 10, 1, S("abcde"));
   3419     test(S("abcdefghij"), 5, 5, SV("1234567890"), 11, 0, S("can't happen"));
   3420     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 0, S("abcde"));
   3421     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 1, S("abcde1"));
   3422     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
   3423     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
   3424     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
   3425     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
   3426     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 0, S("abcde"));
   3427     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 1, S("abcde2"));
   3428     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
   3429     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
   3430     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
   3431     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
   3432     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 0, S("abcde"));
   3433     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 1, S("abcde1"));
   3434     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 5, S("abcde12345"));
   3435     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
   3436     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
   3437     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
   3438     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 0, S("abcde"));
   3439     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 1, S("abcde0"));
   3440     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 19, 2, S("abcde0"));
   3441     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 20, 0, S("abcde"));
   3442     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 20, 1, S("abcde"));
   3443     test(S("abcdefghij"), 5, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3444     test(S("abcdefghij"), 5, 6, SV(""), 0, 0, S("abcde"));
   3445     test(S("abcdefghij"), 5, 6, SV(""), 0, 1, S("abcde"));
   3446     test(S("abcdefghij"), 5, 6, SV(""), 1, 0, S("can't happen"));
   3447     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 0, S("abcde"));
   3448     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 1, S("abcde1"));
   3449     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 2, S("abcde12"));
   3450     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 4, S("abcde1234"));
   3451     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 5, S("abcde12345"));
   3452     test(S("abcdefghij"), 5, 6, SV("12345"), 0, 6, S("abcde12345"));
   3453     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 0, S("abcde"));
   3454     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 1, S("abcde2"));
   3455     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 2, S("abcde23"));
   3456     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 3, S("abcde234"));
   3457     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 4, S("abcde2345"));
   3458     test(S("abcdefghij"), 5, 6, SV("12345"), 1, 5, S("abcde2345"));
   3459     test(S("abcdefghij"), 5, 6, SV("12345"), 2, 0, S("abcde"));
   3460     test(S("abcdefghij"), 5, 6, SV("12345"), 2, 1, S("abcde3"));
   3461     test(S("abcdefghij"), 5, 6, SV("12345"), 2, 2, S("abcde34"));
   3462 }
   3463 
   3464 template <class S, class SV>
   3465 void test32()
   3466 {
   3467     test(S("abcdefghij"), 5, 6, SV("12345"), 2, 3, S("abcde345"));
   3468     test(S("abcdefghij"), 5, 6, SV("12345"), 2, 4, S("abcde345"));
   3469     test(S("abcdefghij"), 5, 6, SV("12345"), 4, 0, S("abcde"));
   3470     test(S("abcdefghij"), 5, 6, SV("12345"), 4, 1, S("abcde5"));
   3471     test(S("abcdefghij"), 5, 6, SV("12345"), 4, 2, S("abcde5"));
   3472     test(S("abcdefghij"), 5, 6, SV("12345"), 5, 0, S("abcde"));
   3473     test(S("abcdefghij"), 5, 6, SV("12345"), 5, 1, S("abcde"));
   3474     test(S("abcdefghij"), 5, 6, SV("12345"), 6, 0, S("can't happen"));
   3475     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 0, S("abcde"));
   3476     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 1, S("abcde1"));
   3477     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 5, S("abcde12345"));
   3478     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 9, S("abcde123456789"));
   3479     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 10, S("abcde1234567890"));
   3480     test(S("abcdefghij"), 5, 6, SV("1234567890"), 0, 11, S("abcde1234567890"));
   3481     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 0, S("abcde"));
   3482     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 1, S("abcde2"));
   3483     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 4, S("abcde2345"));
   3484     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 8, S("abcde23456789"));
   3485     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 9, S("abcde234567890"));
   3486     test(S("abcdefghij"), 5, 6, SV("1234567890"), 1, 10, S("abcde234567890"));
   3487     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 0, S("abcde"));
   3488     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 1, S("abcde6"));
   3489     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 2, S("abcde67"));
   3490     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 4, S("abcde6789"));
   3491     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 5, S("abcde67890"));
   3492     test(S("abcdefghij"), 5, 6, SV("1234567890"), 5, 6, S("abcde67890"));
   3493     test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 0, S("abcde"));
   3494     test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 1, S("abcde0"));
   3495     test(S("abcdefghij"), 5, 6, SV("1234567890"), 9, 2, S("abcde0"));
   3496     test(S("abcdefghij"), 5, 6, SV("1234567890"), 10, 0, S("abcde"));
   3497     test(S("abcdefghij"), 5, 6, SV("1234567890"), 10, 1, S("abcde"));
   3498     test(S("abcdefghij"), 5, 6, SV("1234567890"), 11, 0, S("can't happen"));
   3499     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 0, S("abcde"));
   3500     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 1, S("abcde1"));
   3501     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 10, S("abcde1234567890"));
   3502     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 19, S("abcde1234567890123456789"));
   3503     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 20, S("abcde12345678901234567890"));
   3504     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 0, 21, S("abcde12345678901234567890"));
   3505     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 0, S("abcde"));
   3506     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 1, S("abcde2"));
   3507     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 9, S("abcde234567890"));
   3508     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 18, S("abcde234567890123456789"));
   3509     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 19, S("abcde2345678901234567890"));
   3510     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 1, 20, S("abcde2345678901234567890"));
   3511     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 0, S("abcde"));
   3512     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 1, S("abcde1"));
   3513     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 5, S("abcde12345"));
   3514     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 9, S("abcde123456789"));
   3515     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 10, S("abcde1234567890"));
   3516     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 10, 11, S("abcde1234567890"));
   3517     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 0, S("abcde"));
   3518     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 1, S("abcde0"));
   3519     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 19, 2, S("abcde0"));
   3520     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 20, 0, S("abcde"));
   3521     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 20, 1, S("abcde"));
   3522     test(S("abcdefghij"), 5, 6, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3523     test(S("abcdefghij"), 9, 0, SV(""), 0, 0, S("abcdefghij"));
   3524     test(S("abcdefghij"), 9, 0, SV(""), 0, 1, S("abcdefghij"));
   3525     test(S("abcdefghij"), 9, 0, SV(""), 1, 0, S("can't happen"));
   3526     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 0, S("abcdefghij"));
   3527     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 1, S("abcdefghi1j"));
   3528     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 2, S("abcdefghi12j"));
   3529     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 4, S("abcdefghi1234j"));
   3530     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 5, S("abcdefghi12345j"));
   3531     test(S("abcdefghij"), 9, 0, SV("12345"), 0, 6, S("abcdefghi12345j"));
   3532     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 0, S("abcdefghij"));
   3533     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 1, S("abcdefghi2j"));
   3534     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 2, S("abcdefghi23j"));
   3535     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 3, S("abcdefghi234j"));
   3536     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 4, S("abcdefghi2345j"));
   3537     test(S("abcdefghij"), 9, 0, SV("12345"), 1, 5, S("abcdefghi2345j"));
   3538     test(S("abcdefghij"), 9, 0, SV("12345"), 2, 0, S("abcdefghij"));
   3539     test(S("abcdefghij"), 9, 0, SV("12345"), 2, 1, S("abcdefghi3j"));
   3540     test(S("abcdefghij"), 9, 0, SV("12345"), 2, 2, S("abcdefghi34j"));
   3541     test(S("abcdefghij"), 9, 0, SV("12345"), 2, 3, S("abcdefghi345j"));
   3542     test(S("abcdefghij"), 9, 0, SV("12345"), 2, 4, S("abcdefghi345j"));
   3543     test(S("abcdefghij"), 9, 0, SV("12345"), 4, 0, S("abcdefghij"));
   3544     test(S("abcdefghij"), 9, 0, SV("12345"), 4, 1, S("abcdefghi5j"));
   3545     test(S("abcdefghij"), 9, 0, SV("12345"), 4, 2, S("abcdefghi5j"));
   3546     test(S("abcdefghij"), 9, 0, SV("12345"), 5, 0, S("abcdefghij"));
   3547     test(S("abcdefghij"), 9, 0, SV("12345"), 5, 1, S("abcdefghij"));
   3548     test(S("abcdefghij"), 9, 0, SV("12345"), 6, 0, S("can't happen"));
   3549     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
   3550     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 1, S("abcdefghi1j"));
   3551     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 5, S("abcdefghi12345j"));
   3552     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 9, S("abcdefghi123456789j"));
   3553     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 10, S("abcdefghi1234567890j"));
   3554     test(S("abcdefghij"), 9, 0, SV("1234567890"), 0, 11, S("abcdefghi1234567890j"));
   3555     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
   3556     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 1, S("abcdefghi2j"));
   3557     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 4, S("abcdefghi2345j"));
   3558     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 8, S("abcdefghi23456789j"));
   3559     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 9, S("abcdefghi234567890j"));
   3560     test(S("abcdefghij"), 9, 0, SV("1234567890"), 1, 10, S("abcdefghi234567890j"));
   3561     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
   3562     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 1, S("abcdefghi6j"));
   3563     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 2, S("abcdefghi67j"));
   3564     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 4, S("abcdefghi6789j"));
   3565     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 5, S("abcdefghi67890j"));
   3566     test(S("abcdefghij"), 9, 0, SV("1234567890"), 5, 6, S("abcdefghi67890j"));
   3567 }
   3568 
   3569 template <class S, class SV>
   3570 void test33()
   3571 {
   3572     test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
   3573     test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 1, S("abcdefghi0j"));
   3574     test(S("abcdefghij"), 9, 0, SV("1234567890"), 9, 2, S("abcdefghi0j"));
   3575     test(S("abcdefghij"), 9, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
   3576     test(S("abcdefghij"), 9, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
   3577     test(S("abcdefghij"), 9, 0, SV("1234567890"), 11, 0, S("can't happen"));
   3578     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   3579     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 1, S("abcdefghi1j"));
   3580     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890j"));
   3581     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789j"));
   3582     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890j"));
   3583     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890j"));
   3584     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   3585     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 1, S("abcdefghi2j"));
   3586     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890j"));
   3587     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789j"));
   3588     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890j"));
   3589     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890j"));
   3590     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   3591     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 1, S("abcdefghi1j"));
   3592     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 5, S("abcdefghi12345j"));
   3593     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789j"));
   3594     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890j"));
   3595     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890j"));
   3596     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   3597     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 1, S("abcdefghi0j"));
   3598     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 19, 2, S("abcdefghi0j"));
   3599     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   3600     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   3601     test(S("abcdefghij"), 9, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3602     test(S("abcdefghij"), 9, 1, SV(""), 0, 0, S("abcdefghi"));
   3603     test(S("abcdefghij"), 9, 1, SV(""), 0, 1, S("abcdefghi"));
   3604     test(S("abcdefghij"), 9, 1, SV(""), 1, 0, S("can't happen"));
   3605     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 0, S("abcdefghi"));
   3606     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 1, S("abcdefghi1"));
   3607     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 2, S("abcdefghi12"));
   3608     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 4, S("abcdefghi1234"));
   3609     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 5, S("abcdefghi12345"));
   3610     test(S("abcdefghij"), 9, 1, SV("12345"), 0, 6, S("abcdefghi12345"));
   3611     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 0, S("abcdefghi"));
   3612     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 1, S("abcdefghi2"));
   3613     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 2, S("abcdefghi23"));
   3614     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 3, S("abcdefghi234"));
   3615     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 4, S("abcdefghi2345"));
   3616     test(S("abcdefghij"), 9, 1, SV("12345"), 1, 5, S("abcdefghi2345"));
   3617     test(S("abcdefghij"), 9, 1, SV("12345"), 2, 0, S("abcdefghi"));
   3618     test(S("abcdefghij"), 9, 1, SV("12345"), 2, 1, S("abcdefghi3"));
   3619     test(S("abcdefghij"), 9, 1, SV("12345"), 2, 2, S("abcdefghi34"));
   3620     test(S("abcdefghij"), 9, 1, SV("12345"), 2, 3, S("abcdefghi345"));
   3621     test(S("abcdefghij"), 9, 1, SV("12345"), 2, 4, S("abcdefghi345"));
   3622     test(S("abcdefghij"), 9, 1, SV("12345"), 4, 0, S("abcdefghi"));
   3623     test(S("abcdefghij"), 9, 1, SV("12345"), 4, 1, S("abcdefghi5"));
   3624     test(S("abcdefghij"), 9, 1, SV("12345"), 4, 2, S("abcdefghi5"));
   3625     test(S("abcdefghij"), 9, 1, SV("12345"), 5, 0, S("abcdefghi"));
   3626     test(S("abcdefghij"), 9, 1, SV("12345"), 5, 1, S("abcdefghi"));
   3627     test(S("abcdefghij"), 9, 1, SV("12345"), 6, 0, S("can't happen"));
   3628     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 0, S("abcdefghi"));
   3629     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 1, S("abcdefghi1"));
   3630     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 5, S("abcdefghi12345"));
   3631     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 9, S("abcdefghi123456789"));
   3632     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 10, S("abcdefghi1234567890"));
   3633     test(S("abcdefghij"), 9, 1, SV("1234567890"), 0, 11, S("abcdefghi1234567890"));
   3634     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 0, S("abcdefghi"));
   3635     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 1, S("abcdefghi2"));
   3636     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 4, S("abcdefghi2345"));
   3637     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 8, S("abcdefghi23456789"));
   3638     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 9, S("abcdefghi234567890"));
   3639     test(S("abcdefghij"), 9, 1, SV("1234567890"), 1, 10, S("abcdefghi234567890"));
   3640     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 0, S("abcdefghi"));
   3641     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 1, S("abcdefghi6"));
   3642     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 2, S("abcdefghi67"));
   3643     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 4, S("abcdefghi6789"));
   3644     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 5, S("abcdefghi67890"));
   3645     test(S("abcdefghij"), 9, 1, SV("1234567890"), 5, 6, S("abcdefghi67890"));
   3646     test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 0, S("abcdefghi"));
   3647     test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 1, S("abcdefghi0"));
   3648     test(S("abcdefghij"), 9, 1, SV("1234567890"), 9, 2, S("abcdefghi0"));
   3649     test(S("abcdefghij"), 9, 1, SV("1234567890"), 10, 0, S("abcdefghi"));
   3650     test(S("abcdefghij"), 9, 1, SV("1234567890"), 10, 1, S("abcdefghi"));
   3651     test(S("abcdefghij"), 9, 1, SV("1234567890"), 11, 0, S("can't happen"));
   3652     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 0, S("abcdefghi"));
   3653     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 1, S("abcdefghi1"));
   3654     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
   3655     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
   3656     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
   3657     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
   3658     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 0, S("abcdefghi"));
   3659     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 1, S("abcdefghi2"));
   3660     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
   3661     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
   3662     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
   3663     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
   3664     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 0, S("abcdefghi"));
   3665     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 1, S("abcdefghi1"));
   3666     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 5, S("abcdefghi12345"));
   3667     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
   3668     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
   3669     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
   3670     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 0, S("abcdefghi"));
   3671     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 1, S("abcdefghi0"));
   3672 }
   3673 
   3674 template <class S, class SV>
   3675 void test34()
   3676 {
   3677     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, 2, S("abcdefghi0"));
   3678     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, 0, S("abcdefghi"));
   3679     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, 1, S("abcdefghi"));
   3680     test(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3681     test(S("abcdefghij"), 9, 2, SV(""), 0, 0, S("abcdefghi"));
   3682     test(S("abcdefghij"), 9, 2, SV(""), 0, 1, S("abcdefghi"));
   3683     test(S("abcdefghij"), 9, 2, SV(""), 1, 0, S("can't happen"));
   3684     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 0, S("abcdefghi"));
   3685     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 1, S("abcdefghi1"));
   3686     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 2, S("abcdefghi12"));
   3687     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 4, S("abcdefghi1234"));
   3688     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 5, S("abcdefghi12345"));
   3689     test(S("abcdefghij"), 9, 2, SV("12345"), 0, 6, S("abcdefghi12345"));
   3690     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 0, S("abcdefghi"));
   3691     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 1, S("abcdefghi2"));
   3692     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 2, S("abcdefghi23"));
   3693     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 3, S("abcdefghi234"));
   3694     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 4, S("abcdefghi2345"));
   3695     test(S("abcdefghij"), 9, 2, SV("12345"), 1, 5, S("abcdefghi2345"));
   3696     test(S("abcdefghij"), 9, 2, SV("12345"), 2, 0, S("abcdefghi"));
   3697     test(S("abcdefghij"), 9, 2, SV("12345"), 2, 1, S("abcdefghi3"));
   3698     test(S("abcdefghij"), 9, 2, SV("12345"), 2, 2, S("abcdefghi34"));
   3699     test(S("abcdefghij"), 9, 2, SV("12345"), 2, 3, S("abcdefghi345"));
   3700     test(S("abcdefghij"), 9, 2, SV("12345"), 2, 4, S("abcdefghi345"));
   3701     test(S("abcdefghij"), 9, 2, SV("12345"), 4, 0, S("abcdefghi"));
   3702     test(S("abcdefghij"), 9, 2, SV("12345"), 4, 1, S("abcdefghi5"));
   3703     test(S("abcdefghij"), 9, 2, SV("12345"), 4, 2, S("abcdefghi5"));
   3704     test(S("abcdefghij"), 9, 2, SV("12345"), 5, 0, S("abcdefghi"));
   3705     test(S("abcdefghij"), 9, 2, SV("12345"), 5, 1, S("abcdefghi"));
   3706     test(S("abcdefghij"), 9, 2, SV("12345"), 6, 0, S("can't happen"));
   3707     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 0, S("abcdefghi"));
   3708     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 1, S("abcdefghi1"));
   3709     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 5, S("abcdefghi12345"));
   3710     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 9, S("abcdefghi123456789"));
   3711     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 10, S("abcdefghi1234567890"));
   3712     test(S("abcdefghij"), 9, 2, SV("1234567890"), 0, 11, S("abcdefghi1234567890"));
   3713     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 0, S("abcdefghi"));
   3714     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 1, S("abcdefghi2"));
   3715     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 4, S("abcdefghi2345"));
   3716     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 8, S("abcdefghi23456789"));
   3717     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 9, S("abcdefghi234567890"));
   3718     test(S("abcdefghij"), 9, 2, SV("1234567890"), 1, 10, S("abcdefghi234567890"));
   3719     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 0, S("abcdefghi"));
   3720     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 1, S("abcdefghi6"));
   3721     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 2, S("abcdefghi67"));
   3722     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 4, S("abcdefghi6789"));
   3723     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 5, S("abcdefghi67890"));
   3724     test(S("abcdefghij"), 9, 2, SV("1234567890"), 5, 6, S("abcdefghi67890"));
   3725     test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 0, S("abcdefghi"));
   3726     test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 1, S("abcdefghi0"));
   3727     test(S("abcdefghij"), 9, 2, SV("1234567890"), 9, 2, S("abcdefghi0"));
   3728     test(S("abcdefghij"), 9, 2, SV("1234567890"), 10, 0, S("abcdefghi"));
   3729     test(S("abcdefghij"), 9, 2, SV("1234567890"), 10, 1, S("abcdefghi"));
   3730     test(S("abcdefghij"), 9, 2, SV("1234567890"), 11, 0, S("can't happen"));
   3731     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 0, S("abcdefghi"));
   3732     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 1, S("abcdefghi1"));
   3733     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 10, S("abcdefghi1234567890"));
   3734     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 19, S("abcdefghi1234567890123456789"));
   3735     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 20, S("abcdefghi12345678901234567890"));
   3736     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 0, 21, S("abcdefghi12345678901234567890"));
   3737     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 0, S("abcdefghi"));
   3738     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 1, S("abcdefghi2"));
   3739     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 9, S("abcdefghi234567890"));
   3740     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 18, S("abcdefghi234567890123456789"));
   3741     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 19, S("abcdefghi2345678901234567890"));
   3742     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 1, 20, S("abcdefghi2345678901234567890"));
   3743     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 0, S("abcdefghi"));
   3744     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 1, S("abcdefghi1"));
   3745     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 5, S("abcdefghi12345"));
   3746     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 9, S("abcdefghi123456789"));
   3747     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 10, S("abcdefghi1234567890"));
   3748     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 10, 11, S("abcdefghi1234567890"));
   3749     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 0, S("abcdefghi"));
   3750     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 1, S("abcdefghi0"));
   3751     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 19, 2, S("abcdefghi0"));
   3752     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 20, 0, S("abcdefghi"));
   3753     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 20, 1, S("abcdefghi"));
   3754     test(S("abcdefghij"), 9, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3755     test(S("abcdefghij"), 10, 0, SV(""), 0, 0, S("abcdefghij"));
   3756     test(S("abcdefghij"), 10, 0, SV(""), 0, 1, S("abcdefghij"));
   3757     test(S("abcdefghij"), 10, 0, SV(""), 1, 0, S("can't happen"));
   3758     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 0, S("abcdefghij"));
   3759     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 1, S("abcdefghij1"));
   3760     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 2, S("abcdefghij12"));
   3761     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 4, S("abcdefghij1234"));
   3762     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 5, S("abcdefghij12345"));
   3763     test(S("abcdefghij"), 10, 0, SV("12345"), 0, 6, S("abcdefghij12345"));
   3764     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 0, S("abcdefghij"));
   3765     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 1, S("abcdefghij2"));
   3766     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 2, S("abcdefghij23"));
   3767     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 3, S("abcdefghij234"));
   3768     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 4, S("abcdefghij2345"));
   3769     test(S("abcdefghij"), 10, 0, SV("12345"), 1, 5, S("abcdefghij2345"));
   3770     test(S("abcdefghij"), 10, 0, SV("12345"), 2, 0, S("abcdefghij"));
   3771     test(S("abcdefghij"), 10, 0, SV("12345"), 2, 1, S("abcdefghij3"));
   3772     test(S("abcdefghij"), 10, 0, SV("12345"), 2, 2, S("abcdefghij34"));
   3773     test(S("abcdefghij"), 10, 0, SV("12345"), 2, 3, S("abcdefghij345"));
   3774     test(S("abcdefghij"), 10, 0, SV("12345"), 2, 4, S("abcdefghij345"));
   3775     test(S("abcdefghij"), 10, 0, SV("12345"), 4, 0, S("abcdefghij"));
   3776     test(S("abcdefghij"), 10, 0, SV("12345"), 4, 1, S("abcdefghij5"));
   3777 }
   3778 
   3779 template <class S, class SV>
   3780 void test35()
   3781 {
   3782     test(S("abcdefghij"), 10, 0, SV("12345"), 4, 2, S("abcdefghij5"));
   3783     test(S("abcdefghij"), 10, 0, SV("12345"), 5, 0, S("abcdefghij"));
   3784     test(S("abcdefghij"), 10, 0, SV("12345"), 5, 1, S("abcdefghij"));
   3785     test(S("abcdefghij"), 10, 0, SV("12345"), 6, 0, S("can't happen"));
   3786     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 0, S("abcdefghij"));
   3787     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 1, S("abcdefghij1"));
   3788     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 5, S("abcdefghij12345"));
   3789     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
   3790     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
   3791     test(S("abcdefghij"), 10, 0, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
   3792     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 0, S("abcdefghij"));
   3793     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 1, S("abcdefghij2"));
   3794     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 4, S("abcdefghij2345"));
   3795     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
   3796     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
   3797     test(S("abcdefghij"), 10, 0, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
   3798     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 0, S("abcdefghij"));
   3799     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 1, S("abcdefghij6"));
   3800     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 2, S("abcdefghij67"));
   3801     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 4, S("abcdefghij6789"));
   3802     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 5, S("abcdefghij67890"));
   3803     test(S("abcdefghij"), 10, 0, SV("1234567890"), 5, 6, S("abcdefghij67890"));
   3804     test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 0, S("abcdefghij"));
   3805     test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 1, S("abcdefghij0"));
   3806     test(S("abcdefghij"), 10, 0, SV("1234567890"), 9, 2, S("abcdefghij0"));
   3807     test(S("abcdefghij"), 10, 0, SV("1234567890"), 10, 0, S("abcdefghij"));
   3808     test(S("abcdefghij"), 10, 0, SV("1234567890"), 10, 1, S("abcdefghij"));
   3809     test(S("abcdefghij"), 10, 0, SV("1234567890"), 11, 0, S("can't happen"));
   3810     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   3811     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
   3812     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
   3813     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
   3814     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
   3815     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
   3816     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   3817     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
   3818     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
   3819     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
   3820     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
   3821     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
   3822     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   3823     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
   3824     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
   3825     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
   3826     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
   3827     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
   3828     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   3829     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
   3830     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
   3831     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   3832     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   3833     test(S("abcdefghij"), 10, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3834     test(S("abcdefghij"), 10, 1, SV(""), 0, 0, S("abcdefghij"));
   3835     test(S("abcdefghij"), 10, 1, SV(""), 0, 1, S("abcdefghij"));
   3836     test(S("abcdefghij"), 10, 1, SV(""), 1, 0, S("can't happen"));
   3837     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 0, S("abcdefghij"));
   3838     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 1, S("abcdefghij1"));
   3839     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 2, S("abcdefghij12"));
   3840     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 4, S("abcdefghij1234"));
   3841     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 5, S("abcdefghij12345"));
   3842     test(S("abcdefghij"), 10, 1, SV("12345"), 0, 6, S("abcdefghij12345"));
   3843     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 0, S("abcdefghij"));
   3844     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 1, S("abcdefghij2"));
   3845     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 2, S("abcdefghij23"));
   3846     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 3, S("abcdefghij234"));
   3847     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 4, S("abcdefghij2345"));
   3848     test(S("abcdefghij"), 10, 1, SV("12345"), 1, 5, S("abcdefghij2345"));
   3849     test(S("abcdefghij"), 10, 1, SV("12345"), 2, 0, S("abcdefghij"));
   3850     test(S("abcdefghij"), 10, 1, SV("12345"), 2, 1, S("abcdefghij3"));
   3851     test(S("abcdefghij"), 10, 1, SV("12345"), 2, 2, S("abcdefghij34"));
   3852     test(S("abcdefghij"), 10, 1, SV("12345"), 2, 3, S("abcdefghij345"));
   3853     test(S("abcdefghij"), 10, 1, SV("12345"), 2, 4, S("abcdefghij345"));
   3854     test(S("abcdefghij"), 10, 1, SV("12345"), 4, 0, S("abcdefghij"));
   3855     test(S("abcdefghij"), 10, 1, SV("12345"), 4, 1, S("abcdefghij5"));
   3856     test(S("abcdefghij"), 10, 1, SV("12345"), 4, 2, S("abcdefghij5"));
   3857     test(S("abcdefghij"), 10, 1, SV("12345"), 5, 0, S("abcdefghij"));
   3858     test(S("abcdefghij"), 10, 1, SV("12345"), 5, 1, S("abcdefghij"));
   3859     test(S("abcdefghij"), 10, 1, SV("12345"), 6, 0, S("can't happen"));
   3860     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 0, S("abcdefghij"));
   3861     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 1, S("abcdefghij1"));
   3862     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 5, S("abcdefghij12345"));
   3863     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
   3864     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
   3865     test(S("abcdefghij"), 10, 1, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
   3866     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 0, S("abcdefghij"));
   3867     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 1, S("abcdefghij2"));
   3868     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 4, S("abcdefghij2345"));
   3869     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
   3870     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
   3871     test(S("abcdefghij"), 10, 1, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
   3872     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 0, S("abcdefghij"));
   3873     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 1, S("abcdefghij6"));
   3874     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 2, S("abcdefghij67"));
   3875     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 4, S("abcdefghij6789"));
   3876     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 5, S("abcdefghij67890"));
   3877     test(S("abcdefghij"), 10, 1, SV("1234567890"), 5, 6, S("abcdefghij67890"));
   3878     test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 0, S("abcdefghij"));
   3879     test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 1, S("abcdefghij0"));
   3880     test(S("abcdefghij"), 10, 1, SV("1234567890"), 9, 2, S("abcdefghij0"));
   3881     test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 0, S("abcdefghij"));
   3882 }
   3883 
   3884 template <class S, class SV>
   3885 void test36()
   3886 {
   3887     test(S("abcdefghij"), 10, 1, SV("1234567890"), 10, 1, S("abcdefghij"));
   3888     test(S("abcdefghij"), 10, 1, SV("1234567890"), 11, 0, S("can't happen"));
   3889     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   3890     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
   3891     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
   3892     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
   3893     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
   3894     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
   3895     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   3896     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
   3897     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
   3898     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
   3899     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
   3900     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
   3901     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   3902     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
   3903     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
   3904     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
   3905     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
   3906     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
   3907     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   3908     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
   3909     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
   3910     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   3911     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   3912     test(S("abcdefghij"), 10, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3913     test(S("abcdefghij"), 11, 0, SV(""), 0, 0, S("can't happen"));
   3914     test(S("abcdefghij"), 11, 0, SV(""), 0, 1, S("can't happen"));
   3915     test(S("abcdefghij"), 11, 0, SV(""), 1, 0, S("can't happen"));
   3916     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 0, S("can't happen"));
   3917     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 1, S("can't happen"));
   3918     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 2, S("can't happen"));
   3919     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 4, S("can't happen"));
   3920     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 5, S("can't happen"));
   3921     test(S("abcdefghij"), 11, 0, SV("12345"), 0, 6, S("can't happen"));
   3922     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 0, S("can't happen"));
   3923     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 1, S("can't happen"));
   3924     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 2, S("can't happen"));
   3925     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 3, S("can't happen"));
   3926     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 4, S("can't happen"));
   3927     test(S("abcdefghij"), 11, 0, SV("12345"), 1, 5, S("can't happen"));
   3928     test(S("abcdefghij"), 11, 0, SV("12345"), 2, 0, S("can't happen"));
   3929     test(S("abcdefghij"), 11, 0, SV("12345"), 2, 1, S("can't happen"));
   3930     test(S("abcdefghij"), 11, 0, SV("12345"), 2, 2, S("can't happen"));
   3931     test(S("abcdefghij"), 11, 0, SV("12345"), 2, 3, S("can't happen"));
   3932     test(S("abcdefghij"), 11, 0, SV("12345"), 2, 4, S("can't happen"));
   3933     test(S("abcdefghij"), 11, 0, SV("12345"), 4, 0, S("can't happen"));
   3934     test(S("abcdefghij"), 11, 0, SV("12345"), 4, 1, S("can't happen"));
   3935     test(S("abcdefghij"), 11, 0, SV("12345"), 4, 2, S("can't happen"));
   3936     test(S("abcdefghij"), 11, 0, SV("12345"), 5, 0, S("can't happen"));
   3937     test(S("abcdefghij"), 11, 0, SV("12345"), 5, 1, S("can't happen"));
   3938     test(S("abcdefghij"), 11, 0, SV("12345"), 6, 0, S("can't happen"));
   3939     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 0, S("can't happen"));
   3940     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 1, S("can't happen"));
   3941     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 5, S("can't happen"));
   3942     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 9, S("can't happen"));
   3943     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 10, S("can't happen"));
   3944     test(S("abcdefghij"), 11, 0, SV("1234567890"), 0, 11, S("can't happen"));
   3945     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 0, S("can't happen"));
   3946     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 1, S("can't happen"));
   3947     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 4, S("can't happen"));
   3948     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 8, S("can't happen"));
   3949     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 9, S("can't happen"));
   3950     test(S("abcdefghij"), 11, 0, SV("1234567890"), 1, 10, S("can't happen"));
   3951     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 0, S("can't happen"));
   3952     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 1, S("can't happen"));
   3953     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 2, S("can't happen"));
   3954     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 4, S("can't happen"));
   3955     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 5, S("can't happen"));
   3956     test(S("abcdefghij"), 11, 0, SV("1234567890"), 5, 6, S("can't happen"));
   3957     test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 0, S("can't happen"));
   3958     test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 1, S("can't happen"));
   3959     test(S("abcdefghij"), 11, 0, SV("1234567890"), 9, 2, S("can't happen"));
   3960     test(S("abcdefghij"), 11, 0, SV("1234567890"), 10, 0, S("can't happen"));
   3961     test(S("abcdefghij"), 11, 0, SV("1234567890"), 10, 1, S("can't happen"));
   3962     test(S("abcdefghij"), 11, 0, SV("1234567890"), 11, 0, S("can't happen"));
   3963     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
   3964     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
   3965     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
   3966     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
   3967     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
   3968     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
   3969     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
   3970     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
   3971     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
   3972     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
   3973     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
   3974     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
   3975     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
   3976     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
   3977     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
   3978     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
   3979     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
   3980     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
   3981     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
   3982     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
   3983     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
   3984     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
   3985     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
   3986     test(S("abcdefghij"), 11, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   3987 }
   3988 
   3989 template <class S, class SV>
   3990 void test37()
   3991 {
   3992     test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   3993     test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   3994     test(S("abcdefghijklmnopqrst"), 0, 0, SV(""), 1, 0, S("can't happen"));
   3995     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   3996     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 1, S("1abcdefghijklmnopqrst"));
   3997     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 2, S("12abcdefghijklmnopqrst"));
   3998     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 4, S("1234abcdefghijklmnopqrst"));
   3999     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 5, S("12345abcdefghijklmnopqrst"));
   4000     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 0, 6, S("12345abcdefghijklmnopqrst"));
   4001     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   4002     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 1, S("2abcdefghijklmnopqrst"));
   4003     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 2, S("23abcdefghijklmnopqrst"));
   4004     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 3, S("234abcdefghijklmnopqrst"));
   4005     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 4, S("2345abcdefghijklmnopqrst"));
   4006     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 1, 5, S("2345abcdefghijklmnopqrst"));
   4007     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   4008     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 1, S("3abcdefghijklmnopqrst"));
   4009     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 2, S("34abcdefghijklmnopqrst"));
   4010     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 3, S("345abcdefghijklmnopqrst"));
   4011     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 2, 4, S("345abcdefghijklmnopqrst"));
   4012     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   4013     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 1, S("5abcdefghijklmnopqrst"));
   4014     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 4, 2, S("5abcdefghijklmnopqrst"));
   4015     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   4016     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   4017     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345"), 6, 0, S("can't happen"));
   4018     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4019     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
   4020     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 5, S("12345abcdefghijklmnopqrst"));
   4021     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 9, S("123456789abcdefghijklmnopqrst"));
   4022     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
   4023     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 0, 11, S("1234567890abcdefghijklmnopqrst"));
   4024     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4025     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
   4026     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 4, S("2345abcdefghijklmnopqrst"));
   4027     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 8, S("23456789abcdefghijklmnopqrst"));
   4028     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
   4029     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 1, 10, S("234567890abcdefghijklmnopqrst"));
   4030     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   4031     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 1, S("6abcdefghijklmnopqrst"));
   4032     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 2, S("67abcdefghijklmnopqrst"));
   4033     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 4, S("6789abcdefghijklmnopqrst"));
   4034     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 5, S("67890abcdefghijklmnopqrst"));
   4035     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 5, 6, S("67890abcdefghijklmnopqrst"));
   4036     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   4037     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 1, S("0abcdefghijklmnopqrst"));
   4038     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 9, 2, S("0abcdefghijklmnopqrst"));
   4039     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4040     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   4041     test(S("abcdefghijklmnopqrst"), 0, 0, SV("1234567890"), 11, 0, S("can't happen"));
   4042     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4043     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 1, S("1abcdefghijklmnopqrst"));
   4044     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 10, S("1234567890abcdefghijklmnopqrst"));
   4045     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 19, S("1234567890123456789abcdefghijklmnopqrst"));
   4046     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 20, S("12345678901234567890abcdefghijklmnopqrst"));
   4047     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 0, 21, S("12345678901234567890abcdefghijklmnopqrst"));
   4048     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4049     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 1, S("2abcdefghijklmnopqrst"));
   4050     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 9, S("234567890abcdefghijklmnopqrst"));
   4051     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 18, S("234567890123456789abcdefghijklmnopqrst"));
   4052     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 19, S("2345678901234567890abcdefghijklmnopqrst"));
   4053     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 1, 20, S("2345678901234567890abcdefghijklmnopqrst"));
   4054     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4055     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 1, S("1abcdefghijklmnopqrst"));
   4056     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 5, S("12345abcdefghijklmnopqrst"));
   4057     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 9, S("123456789abcdefghijklmnopqrst"));
   4058     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 10, S("1234567890abcdefghijklmnopqrst"));
   4059     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 10, 11, S("1234567890abcdefghijklmnopqrst"));
   4060     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   4061     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 1, S("0abcdefghijklmnopqrst"));
   4062     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 19, 2, S("0abcdefghijklmnopqrst"));
   4063     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   4064     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   4065     test(S("abcdefghijklmnopqrst"), 0, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4066     test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 0, S("bcdefghijklmnopqrst"));
   4067     test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 0, 1, S("bcdefghijklmnopqrst"));
   4068     test(S("abcdefghijklmnopqrst"), 0, 1, SV(""), 1, 0, S("can't happen"));
   4069     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 0, S("bcdefghijklmnopqrst"));
   4070     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 1, S("1bcdefghijklmnopqrst"));
   4071     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 2, S("12bcdefghijklmnopqrst"));
   4072     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 4, S("1234bcdefghijklmnopqrst"));
   4073     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 5, S("12345bcdefghijklmnopqrst"));
   4074     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 0, 6, S("12345bcdefghijklmnopqrst"));
   4075     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 0, S("bcdefghijklmnopqrst"));
   4076     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 1, S("2bcdefghijklmnopqrst"));
   4077     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 2, S("23bcdefghijklmnopqrst"));
   4078     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 3, S("234bcdefghijklmnopqrst"));
   4079     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 4, S("2345bcdefghijklmnopqrst"));
   4080     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 1, 5, S("2345bcdefghijklmnopqrst"));
   4081     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 0, S("bcdefghijklmnopqrst"));
   4082     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 1, S("3bcdefghijklmnopqrst"));
   4083     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 2, S("34bcdefghijklmnopqrst"));
   4084     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 3, S("345bcdefghijklmnopqrst"));
   4085     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 2, 4, S("345bcdefghijklmnopqrst"));
   4086     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 0, S("bcdefghijklmnopqrst"));
   4087     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 1, S("5bcdefghijklmnopqrst"));
   4088     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 4, 2, S("5bcdefghijklmnopqrst"));
   4089     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 0, S("bcdefghijklmnopqrst"));
   4090     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 5, 1, S("bcdefghijklmnopqrst"));
   4091     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345"), 6, 0, S("can't happen"));
   4092 }
   4093 
   4094 template <class S, class SV>
   4095 void test38()
   4096 {
   4097     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 0, S("bcdefghijklmnopqrst"));
   4098     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
   4099     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 5, S("12345bcdefghijklmnopqrst"));
   4100     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 9, S("123456789bcdefghijklmnopqrst"));
   4101     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
   4102     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 0, 11, S("1234567890bcdefghijklmnopqrst"));
   4103     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 0, S("bcdefghijklmnopqrst"));
   4104     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
   4105     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 4, S("2345bcdefghijklmnopqrst"));
   4106     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 8, S("23456789bcdefghijklmnopqrst"));
   4107     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
   4108     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 1, 10, S("234567890bcdefghijklmnopqrst"));
   4109     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 0, S("bcdefghijklmnopqrst"));
   4110     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 1, S("6bcdefghijklmnopqrst"));
   4111     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 2, S("67bcdefghijklmnopqrst"));
   4112     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 4, S("6789bcdefghijklmnopqrst"));
   4113     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 5, S("67890bcdefghijklmnopqrst"));
   4114     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 5, 6, S("67890bcdefghijklmnopqrst"));
   4115     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 0, S("bcdefghijklmnopqrst"));
   4116     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 1, S("0bcdefghijklmnopqrst"));
   4117     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 9, 2, S("0bcdefghijklmnopqrst"));
   4118     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 10, 0, S("bcdefghijklmnopqrst"));
   4119     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 10, 1, S("bcdefghijklmnopqrst"));
   4120     test(S("abcdefghijklmnopqrst"), 0, 1, SV("1234567890"), 11, 0, S("can't happen"));
   4121     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 0, S("bcdefghijklmnopqrst"));
   4122     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 1, S("1bcdefghijklmnopqrst"));
   4123     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 10, S("1234567890bcdefghijklmnopqrst"));
   4124     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 19, S("1234567890123456789bcdefghijklmnopqrst"));
   4125     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 20, S("12345678901234567890bcdefghijklmnopqrst"));
   4126     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 0, 21, S("12345678901234567890bcdefghijklmnopqrst"));
   4127     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 0, S("bcdefghijklmnopqrst"));
   4128     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 1, S("2bcdefghijklmnopqrst"));
   4129     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 9, S("234567890bcdefghijklmnopqrst"));
   4130     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 18, S("234567890123456789bcdefghijklmnopqrst"));
   4131     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 19, S("2345678901234567890bcdefghijklmnopqrst"));
   4132     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 1, 20, S("2345678901234567890bcdefghijklmnopqrst"));
   4133     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 0, S("bcdefghijklmnopqrst"));
   4134     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 1, S("1bcdefghijklmnopqrst"));
   4135     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 5, S("12345bcdefghijklmnopqrst"));
   4136     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 9, S("123456789bcdefghijklmnopqrst"));
   4137     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 10, S("1234567890bcdefghijklmnopqrst"));
   4138     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 10, 11, S("1234567890bcdefghijklmnopqrst"));
   4139     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 0, S("bcdefghijklmnopqrst"));
   4140     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 1, S("0bcdefghijklmnopqrst"));
   4141     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 19, 2, S("0bcdefghijklmnopqrst"));
   4142     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 20, 0, S("bcdefghijklmnopqrst"));
   4143     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 20, 1, S("bcdefghijklmnopqrst"));
   4144     test(S("abcdefghijklmnopqrst"), 0, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4145     test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 0, S("klmnopqrst"));
   4146     test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 0, 1, S("klmnopqrst"));
   4147     test(S("abcdefghijklmnopqrst"), 0, 10, SV(""), 1, 0, S("can't happen"));
   4148     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 0, S("klmnopqrst"));
   4149     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 1, S("1klmnopqrst"));
   4150     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 2, S("12klmnopqrst"));
   4151     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 4, S("1234klmnopqrst"));
   4152     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 5, S("12345klmnopqrst"));
   4153     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 0, 6, S("12345klmnopqrst"));
   4154     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 0, S("klmnopqrst"));
   4155     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 1, S("2klmnopqrst"));
   4156     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 2, S("23klmnopqrst"));
   4157     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 3, S("234klmnopqrst"));
   4158     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 4, S("2345klmnopqrst"));
   4159     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 1, 5, S("2345klmnopqrst"));
   4160     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 0, S("klmnopqrst"));
   4161     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 1, S("3klmnopqrst"));
   4162     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 2, S("34klmnopqrst"));
   4163     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 3, S("345klmnopqrst"));
   4164     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 2, 4, S("345klmnopqrst"));
   4165     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 0, S("klmnopqrst"));
   4166     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 1, S("5klmnopqrst"));
   4167     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 4, 2, S("5klmnopqrst"));
   4168     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 5, 0, S("klmnopqrst"));
   4169     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 5, 1, S("klmnopqrst"));
   4170     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345"), 6, 0, S("can't happen"));
   4171     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 0, S("klmnopqrst"));
   4172     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 1, S("1klmnopqrst"));
   4173     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 5, S("12345klmnopqrst"));
   4174     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 9, S("123456789klmnopqrst"));
   4175     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 10, S("1234567890klmnopqrst"));
   4176     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 0, 11, S("1234567890klmnopqrst"));
   4177     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 0, S("klmnopqrst"));
   4178     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 1, S("2klmnopqrst"));
   4179     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 4, S("2345klmnopqrst"));
   4180     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 8, S("23456789klmnopqrst"));
   4181     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 9, S("234567890klmnopqrst"));
   4182     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 1, 10, S("234567890klmnopqrst"));
   4183     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 0, S("klmnopqrst"));
   4184     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 1, S("6klmnopqrst"));
   4185     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 2, S("67klmnopqrst"));
   4186     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 4, S("6789klmnopqrst"));
   4187     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 5, S("67890klmnopqrst"));
   4188     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 5, 6, S("67890klmnopqrst"));
   4189     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 0, S("klmnopqrst"));
   4190     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 1, S("0klmnopqrst"));
   4191     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 9, 2, S("0klmnopqrst"));
   4192     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 10, 0, S("klmnopqrst"));
   4193     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 10, 1, S("klmnopqrst"));
   4194     test(S("abcdefghijklmnopqrst"), 0, 10, SV("1234567890"), 11, 0, S("can't happen"));
   4195     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 0, S("klmnopqrst"));
   4196     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 1, S("1klmnopqrst"));
   4197 }
   4198 
   4199 template <class S, class SV>
   4200 void test39()
   4201 {
   4202     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 10, S("1234567890klmnopqrst"));
   4203     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 19, S("1234567890123456789klmnopqrst"));
   4204     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 20, S("12345678901234567890klmnopqrst"));
   4205     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 0, 21, S("12345678901234567890klmnopqrst"));
   4206     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 0, S("klmnopqrst"));
   4207     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 1, S("2klmnopqrst"));
   4208     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 9, S("234567890klmnopqrst"));
   4209     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 18, S("234567890123456789klmnopqrst"));
   4210     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 19, S("2345678901234567890klmnopqrst"));
   4211     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 1, 20, S("2345678901234567890klmnopqrst"));
   4212     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 0, S("klmnopqrst"));
   4213     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 1, S("1klmnopqrst"));
   4214     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 5, S("12345klmnopqrst"));
   4215     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 9, S("123456789klmnopqrst"));
   4216     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 10, S("1234567890klmnopqrst"));
   4217     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 10, 11, S("1234567890klmnopqrst"));
   4218     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 0, S("klmnopqrst"));
   4219     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 1, S("0klmnopqrst"));
   4220     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 19, 2, S("0klmnopqrst"));
   4221     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 20, 0, S("klmnopqrst"));
   4222     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 20, 1, S("klmnopqrst"));
   4223     test(S("abcdefghijklmnopqrst"), 0, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4224     test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 0, S("t"));
   4225     test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 0, 1, S("t"));
   4226     test(S("abcdefghijklmnopqrst"), 0, 19, SV(""), 1, 0, S("can't happen"));
   4227     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 0, S("t"));
   4228     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 1, S("1t"));
   4229     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 2, S("12t"));
   4230     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 4, S("1234t"));
   4231     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 5, S("12345t"));
   4232     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 0, 6, S("12345t"));
   4233     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 0, S("t"));
   4234     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 1, S("2t"));
   4235     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 2, S("23t"));
   4236     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 3, S("234t"));
   4237     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 4, S("2345t"));
   4238     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 1, 5, S("2345t"));
   4239     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 0, S("t"));
   4240     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 1, S("3t"));
   4241     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 2, S("34t"));
   4242     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 3, S("345t"));
   4243     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 2, 4, S("345t"));
   4244     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 0, S("t"));
   4245     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 1, S("5t"));
   4246     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 4, 2, S("5t"));
   4247     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 5, 0, S("t"));
   4248     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 5, 1, S("t"));
   4249     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345"), 6, 0, S("can't happen"));
   4250     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 0, S("t"));
   4251     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 1, S("1t"));
   4252     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 5, S("12345t"));
   4253     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 9, S("123456789t"));
   4254     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 10, S("1234567890t"));
   4255     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 0, 11, S("1234567890t"));
   4256     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 0, S("t"));
   4257     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 1, S("2t"));
   4258     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 4, S("2345t"));
   4259     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 8, S("23456789t"));
   4260     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 9, S("234567890t"));
   4261     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 1, 10, S("234567890t"));
   4262     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 0, S("t"));
   4263     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 1, S("6t"));
   4264     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 2, S("67t"));
   4265     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 4, S("6789t"));
   4266     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 5, S("67890t"));
   4267     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 5, 6, S("67890t"));
   4268     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 0, S("t"));
   4269     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 1, S("0t"));
   4270     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 9, 2, S("0t"));
   4271     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 10, 0, S("t"));
   4272     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 10, 1, S("t"));
   4273     test(S("abcdefghijklmnopqrst"), 0, 19, SV("1234567890"), 11, 0, S("can't happen"));
   4274     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 0, S("t"));
   4275     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 1, S("1t"));
   4276     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 10, S("1234567890t"));
   4277     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 19, S("1234567890123456789t"));
   4278     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 20, S("12345678901234567890t"));
   4279     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 0, 21, S("12345678901234567890t"));
   4280     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 0, S("t"));
   4281     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 1, S("2t"));
   4282     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 9, S("234567890t"));
   4283     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 18, S("234567890123456789t"));
   4284     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 19, S("2345678901234567890t"));
   4285     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 1, 20, S("2345678901234567890t"));
   4286     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 0, S("t"));
   4287     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 1, S("1t"));
   4288     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 5, S("12345t"));
   4289     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 9, S("123456789t"));
   4290     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 10, S("1234567890t"));
   4291     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 10, 11, S("1234567890t"));
   4292     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 0, S("t"));
   4293     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 1, S("0t"));
   4294     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 19, 2, S("0t"));
   4295     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 20, 0, S("t"));
   4296     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 20, 1, S("t"));
   4297     test(S("abcdefghijklmnopqrst"), 0, 19, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4298     test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 0, S(""));
   4299     test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 0, 1, S(""));
   4300     test(S("abcdefghijklmnopqrst"), 0, 20, SV(""), 1, 0, S("can't happen"));
   4301     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 0, S(""));
   4302 }
   4303 
   4304 template <class S, class SV>
   4305 void test40()
   4306 {
   4307     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 1, S("1"));
   4308     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 2, S("12"));
   4309     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 4, S("1234"));
   4310     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 5, S("12345"));
   4311     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 0, 6, S("12345"));
   4312     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 0, S(""));
   4313     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 1, S("2"));
   4314     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 2, S("23"));
   4315     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 3, S("234"));
   4316     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 4, S("2345"));
   4317     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 1, 5, S("2345"));
   4318     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 0, S(""));
   4319     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 1, S("3"));
   4320     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 2, S("34"));
   4321     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 3, S("345"));
   4322     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 2, 4, S("345"));
   4323     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 0, S(""));
   4324     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 1, S("5"));
   4325     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 4, 2, S("5"));
   4326     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 5, 0, S(""));
   4327     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 5, 1, S(""));
   4328     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345"), 6, 0, S("can't happen"));
   4329     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 0, S(""));
   4330     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 1, S("1"));
   4331     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 5, S("12345"));
   4332     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 9, S("123456789"));
   4333     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 10, S("1234567890"));
   4334     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 0, 11, S("1234567890"));
   4335     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 0, S(""));
   4336     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 1, S("2"));
   4337     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 4, S("2345"));
   4338     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 8, S("23456789"));
   4339     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 9, S("234567890"));
   4340     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 1, 10, S("234567890"));
   4341     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 0, S(""));
   4342     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 1, S("6"));
   4343     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 2, S("67"));
   4344     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 4, S("6789"));
   4345     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 5, S("67890"));
   4346     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 5, 6, S("67890"));
   4347     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 0, S(""));
   4348     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 1, S("0"));
   4349     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 9, 2, S("0"));
   4350     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 10, 0, S(""));
   4351     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 10, 1, S(""));
   4352     test(S("abcdefghijklmnopqrst"), 0, 20, SV("1234567890"), 11, 0, S("can't happen"));
   4353     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 0, S(""));
   4354     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 1, S("1"));
   4355     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 10, S("1234567890"));
   4356     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
   4357     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
   4358     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
   4359     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 0, S(""));
   4360     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 1, S("2"));
   4361     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 9, S("234567890"));
   4362     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
   4363     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
   4364     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
   4365     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 0, S(""));
   4366     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 1, S("1"));
   4367     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 5, S("12345"));
   4368     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 9, S("123456789"));
   4369     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 10, S("1234567890"));
   4370     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 10, 11, S("1234567890"));
   4371     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 0, S(""));
   4372     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 1, S("0"));
   4373     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 19, 2, S("0"));
   4374     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 20, 0, S(""));
   4375     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 20, 1, S(""));
   4376     test(S("abcdefghijklmnopqrst"), 0, 20, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4377     test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 0, S(""));
   4378     test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 0, 1, S(""));
   4379     test(S("abcdefghijklmnopqrst"), 0, 21, SV(""), 1, 0, S("can't happen"));
   4380     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 0, S(""));
   4381     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 1, S("1"));
   4382     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 2, S("12"));
   4383     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 4, S("1234"));
   4384     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 5, S("12345"));
   4385     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 0, 6, S("12345"));
   4386     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 0, S(""));
   4387     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 1, S("2"));
   4388     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 2, S("23"));
   4389     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 3, S("234"));
   4390     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 4, S("2345"));
   4391     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 1, 5, S("2345"));
   4392     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 0, S(""));
   4393     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 1, S("3"));
   4394     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 2, S("34"));
   4395     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 3, S("345"));
   4396     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 2, 4, S("345"));
   4397     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 0, S(""));
   4398     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 1, S("5"));
   4399     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 4, 2, S("5"));
   4400     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 5, 0, S(""));
   4401     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 5, 1, S(""));
   4402     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345"), 6, 0, S("can't happen"));
   4403     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 0, S(""));
   4404     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 1, S("1"));
   4405     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 5, S("12345"));
   4406     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 9, S("123456789"));
   4407 }
   4408 
   4409 template <class S, class SV>
   4410 void test41()
   4411 {
   4412     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 10, S("1234567890"));
   4413     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 0, 11, S("1234567890"));
   4414     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 0, S(""));
   4415     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 1, S("2"));
   4416     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 4, S("2345"));
   4417     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 8, S("23456789"));
   4418     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 9, S("234567890"));
   4419     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 1, 10, S("234567890"));
   4420     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 0, S(""));
   4421     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 1, S("6"));
   4422     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 2, S("67"));
   4423     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 4, S("6789"));
   4424     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 5, S("67890"));
   4425     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 5, 6, S("67890"));
   4426     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 0, S(""));
   4427     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 1, S("0"));
   4428     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 9, 2, S("0"));
   4429     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 10, 0, S(""));
   4430     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 10, 1, S(""));
   4431     test(S("abcdefghijklmnopqrst"), 0, 21, SV("1234567890"), 11, 0, S("can't happen"));
   4432     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 0, S(""));
   4433     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 1, S("1"));
   4434     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 10, S("1234567890"));
   4435     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 19, S("1234567890123456789"));
   4436     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 20, S("12345678901234567890"));
   4437     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 0, 21, S("12345678901234567890"));
   4438     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 0, S(""));
   4439     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 1, S("2"));
   4440     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 9, S("234567890"));
   4441     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 18, S("234567890123456789"));
   4442     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 19, S("2345678901234567890"));
   4443     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 1, 20, S("2345678901234567890"));
   4444     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 0, S(""));
   4445     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 1, S("1"));
   4446     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 5, S("12345"));
   4447     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 9, S("123456789"));
   4448     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 10, S("1234567890"));
   4449     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 10, 11, S("1234567890"));
   4450     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 0, S(""));
   4451     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 1, S("0"));
   4452     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 19, 2, S("0"));
   4453     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 20, 0, S(""));
   4454     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 20, 1, S(""));
   4455     test(S("abcdefghijklmnopqrst"), 0, 21, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4456     test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   4457     test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   4458     test(S("abcdefghijklmnopqrst"), 1, 0, SV(""), 1, 0, S("can't happen"));
   4459     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   4460     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 1, S("a1bcdefghijklmnopqrst"));
   4461     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 2, S("a12bcdefghijklmnopqrst"));
   4462     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 4, S("a1234bcdefghijklmnopqrst"));
   4463     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 5, S("a12345bcdefghijklmnopqrst"));
   4464     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 0, 6, S("a12345bcdefghijklmnopqrst"));
   4465     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   4466     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 1, S("a2bcdefghijklmnopqrst"));
   4467     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 2, S("a23bcdefghijklmnopqrst"));
   4468     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 3, S("a234bcdefghijklmnopqrst"));
   4469     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 4, S("a2345bcdefghijklmnopqrst"));
   4470     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 1, 5, S("a2345bcdefghijklmnopqrst"));
   4471     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   4472     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 1, S("a3bcdefghijklmnopqrst"));
   4473     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 2, S("a34bcdefghijklmnopqrst"));
   4474     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 3, S("a345bcdefghijklmnopqrst"));
   4475     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 2, 4, S("a345bcdefghijklmnopqrst"));
   4476     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   4477     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 1, S("a5bcdefghijklmnopqrst"));
   4478     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 4, 2, S("a5bcdefghijklmnopqrst"));
   4479     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   4480     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   4481     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345"), 6, 0, S("can't happen"));
   4482     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4483     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
   4484     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 5, S("a12345bcdefghijklmnopqrst"));
   4485     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 9, S("a123456789bcdefghijklmnopqrst"));
   4486     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
   4487     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 0, 11, S("a1234567890bcdefghijklmnopqrst"));
   4488     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4489     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
   4490     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 4, S("a2345bcdefghijklmnopqrst"));
   4491     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 8, S("a23456789bcdefghijklmnopqrst"));
   4492     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
   4493     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 1, 10, S("a234567890bcdefghijklmnopqrst"));
   4494     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   4495     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 1, S("a6bcdefghijklmnopqrst"));
   4496     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 2, S("a67bcdefghijklmnopqrst"));
   4497     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 4, S("a6789bcdefghijklmnopqrst"));
   4498     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 5, S("a67890bcdefghijklmnopqrst"));
   4499     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 5, 6, S("a67890bcdefghijklmnopqrst"));
   4500     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   4501     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 1, S("a0bcdefghijklmnopqrst"));
   4502     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 9, 2, S("a0bcdefghijklmnopqrst"));
   4503     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4504     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   4505     test(S("abcdefghijklmnopqrst"), 1, 0, SV("1234567890"), 11, 0, S("can't happen"));
   4506     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4507     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 1, S("a1bcdefghijklmnopqrst"));
   4508     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 10, S("a1234567890bcdefghijklmnopqrst"));
   4509     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 19, S("a1234567890123456789bcdefghijklmnopqrst"));
   4510     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 20, S("a12345678901234567890bcdefghijklmnopqrst"));
   4511     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 0, 21, S("a12345678901234567890bcdefghijklmnopqrst"));
   4512 }
   4513 
   4514 template <class S, class SV>
   4515 void test42()
   4516 {
   4517     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4518     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 1, S("a2bcdefghijklmnopqrst"));
   4519     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 9, S("a234567890bcdefghijklmnopqrst"));
   4520     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 18, S("a234567890123456789bcdefghijklmnopqrst"));
   4521     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 19, S("a2345678901234567890bcdefghijklmnopqrst"));
   4522     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 1, 20, S("a2345678901234567890bcdefghijklmnopqrst"));
   4523     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4524     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 1, S("a1bcdefghijklmnopqrst"));
   4525     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 5, S("a12345bcdefghijklmnopqrst"));
   4526     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 9, S("a123456789bcdefghijklmnopqrst"));
   4527     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 10, S("a1234567890bcdefghijklmnopqrst"));
   4528     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 10, 11, S("a1234567890bcdefghijklmnopqrst"));
   4529     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   4530     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 1, S("a0bcdefghijklmnopqrst"));
   4531     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 19, 2, S("a0bcdefghijklmnopqrst"));
   4532     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   4533     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   4534     test(S("abcdefghijklmnopqrst"), 1, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4535     test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 0, S("acdefghijklmnopqrst"));
   4536     test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 0, 1, S("acdefghijklmnopqrst"));
   4537     test(S("abcdefghijklmnopqrst"), 1, 1, SV(""), 1, 0, S("can't happen"));
   4538     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 0, S("acdefghijklmnopqrst"));
   4539     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 1, S("a1cdefghijklmnopqrst"));
   4540     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 2, S("a12cdefghijklmnopqrst"));
   4541     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 4, S("a1234cdefghijklmnopqrst"));
   4542     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 5, S("a12345cdefghijklmnopqrst"));
   4543     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 0, 6, S("a12345cdefghijklmnopqrst"));
   4544     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 0, S("acdefghijklmnopqrst"));
   4545     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 1, S("a2cdefghijklmnopqrst"));
   4546     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 2, S("a23cdefghijklmnopqrst"));
   4547     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 3, S("a234cdefghijklmnopqrst"));
   4548     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 4, S("a2345cdefghijklmnopqrst"));
   4549     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 1, 5, S("a2345cdefghijklmnopqrst"));
   4550     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 0, S("acdefghijklmnopqrst"));
   4551     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 1, S("a3cdefghijklmnopqrst"));
   4552     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 2, S("a34cdefghijklmnopqrst"));
   4553     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 3, S("a345cdefghijklmnopqrst"));
   4554     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 2, 4, S("a345cdefghijklmnopqrst"));
   4555     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 0, S("acdefghijklmnopqrst"));
   4556     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 1, S("a5cdefghijklmnopqrst"));
   4557     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 4, 2, S("a5cdefghijklmnopqrst"));
   4558     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 5, 0, S("acdefghijklmnopqrst"));
   4559     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 5, 1, S("acdefghijklmnopqrst"));
   4560     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345"), 6, 0, S("can't happen"));
   4561     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 0, S("acdefghijklmnopqrst"));
   4562     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
   4563     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 5, S("a12345cdefghijklmnopqrst"));
   4564     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 9, S("a123456789cdefghijklmnopqrst"));
   4565     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
   4566     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 0, 11, S("a1234567890cdefghijklmnopqrst"));
   4567     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 0, S("acdefghijklmnopqrst"));
   4568     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
   4569     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 4, S("a2345cdefghijklmnopqrst"));
   4570     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 8, S("a23456789cdefghijklmnopqrst"));
   4571     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
   4572     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 1, 10, S("a234567890cdefghijklmnopqrst"));
   4573     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 0, S("acdefghijklmnopqrst"));
   4574     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 1, S("a6cdefghijklmnopqrst"));
   4575     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 2, S("a67cdefghijklmnopqrst"));
   4576     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 4, S("a6789cdefghijklmnopqrst"));
   4577     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 5, S("a67890cdefghijklmnopqrst"));
   4578     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 5, 6, S("a67890cdefghijklmnopqrst"));
   4579     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 0, S("acdefghijklmnopqrst"));
   4580     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 1, S("a0cdefghijklmnopqrst"));
   4581     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 9, 2, S("a0cdefghijklmnopqrst"));
   4582     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 10, 0, S("acdefghijklmnopqrst"));
   4583     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 10, 1, S("acdefghijklmnopqrst"));
   4584     test(S("abcdefghijklmnopqrst"), 1, 1, SV("1234567890"), 11, 0, S("can't happen"));
   4585     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 0, S("acdefghijklmnopqrst"));
   4586     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 1, S("a1cdefghijklmnopqrst"));
   4587     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 10, S("a1234567890cdefghijklmnopqrst"));
   4588     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 19, S("a1234567890123456789cdefghijklmnopqrst"));
   4589     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 20, S("a12345678901234567890cdefghijklmnopqrst"));
   4590     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 0, 21, S("a12345678901234567890cdefghijklmnopqrst"));
   4591     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 0, S("acdefghijklmnopqrst"));
   4592     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 1, S("a2cdefghijklmnopqrst"));
   4593     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 9, S("a234567890cdefghijklmnopqrst"));
   4594     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 18, S("a234567890123456789cdefghijklmnopqrst"));
   4595     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 19, S("a2345678901234567890cdefghijklmnopqrst"));
   4596     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 1, 20, S("a2345678901234567890cdefghijklmnopqrst"));
   4597     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 0, S("acdefghijklmnopqrst"));
   4598     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 1, S("a1cdefghijklmnopqrst"));
   4599     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 5, S("a12345cdefghijklmnopqrst"));
   4600     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 9, S("a123456789cdefghijklmnopqrst"));
   4601     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 10, S("a1234567890cdefghijklmnopqrst"));
   4602     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 10, 11, S("a1234567890cdefghijklmnopqrst"));
   4603     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 0, S("acdefghijklmnopqrst"));
   4604     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 1, S("a0cdefghijklmnopqrst"));
   4605     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 19, 2, S("a0cdefghijklmnopqrst"));
   4606     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 20, 0, S("acdefghijklmnopqrst"));
   4607     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 20, 1, S("acdefghijklmnopqrst"));
   4608     test(S("abcdefghijklmnopqrst"), 1, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4609     test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 0, S("aklmnopqrst"));
   4610     test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 0, 1, S("aklmnopqrst"));
   4611     test(S("abcdefghijklmnopqrst"), 1, 9, SV(""), 1, 0, S("can't happen"));
   4612     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 0, S("aklmnopqrst"));
   4613     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 1, S("a1klmnopqrst"));
   4614     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 2, S("a12klmnopqrst"));
   4615     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 4, S("a1234klmnopqrst"));
   4616     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 5, S("a12345klmnopqrst"));
   4617 }
   4618 
   4619 template <class S, class SV>
   4620 void test43()
   4621 {
   4622     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 0, 6, S("a12345klmnopqrst"));
   4623     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 0, S("aklmnopqrst"));
   4624     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 1, S("a2klmnopqrst"));
   4625     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 2, S("a23klmnopqrst"));
   4626     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 3, S("a234klmnopqrst"));
   4627     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 4, S("a2345klmnopqrst"));
   4628     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 1, 5, S("a2345klmnopqrst"));
   4629     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 0, S("aklmnopqrst"));
   4630     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 1, S("a3klmnopqrst"));
   4631     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 2, S("a34klmnopqrst"));
   4632     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 3, S("a345klmnopqrst"));
   4633     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 2, 4, S("a345klmnopqrst"));
   4634     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 0, S("aklmnopqrst"));
   4635     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 1, S("a5klmnopqrst"));
   4636     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 4, 2, S("a5klmnopqrst"));
   4637     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 5, 0, S("aklmnopqrst"));
   4638     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 5, 1, S("aklmnopqrst"));
   4639     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345"), 6, 0, S("can't happen"));
   4640     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 0, S("aklmnopqrst"));
   4641     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 1, S("a1klmnopqrst"));
   4642     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 5, S("a12345klmnopqrst"));
   4643     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 9, S("a123456789klmnopqrst"));
   4644     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 10, S("a1234567890klmnopqrst"));
   4645     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 0, 11, S("a1234567890klmnopqrst"));
   4646     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 0, S("aklmnopqrst"));
   4647     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 1, S("a2klmnopqrst"));
   4648     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 4, S("a2345klmnopqrst"));
   4649     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 8, S("a23456789klmnopqrst"));
   4650     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 9, S("a234567890klmnopqrst"));
   4651     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 1, 10, S("a234567890klmnopqrst"));
   4652     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 0, S("aklmnopqrst"));
   4653     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 1, S("a6klmnopqrst"));
   4654     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 2, S("a67klmnopqrst"));
   4655     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 4, S("a6789klmnopqrst"));
   4656     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 5, S("a67890klmnopqrst"));
   4657     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 5, 6, S("a67890klmnopqrst"));
   4658     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 0, S("aklmnopqrst"));
   4659     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 1, S("a0klmnopqrst"));
   4660     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 9, 2, S("a0klmnopqrst"));
   4661     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 10, 0, S("aklmnopqrst"));
   4662     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 10, 1, S("aklmnopqrst"));
   4663     test(S("abcdefghijklmnopqrst"), 1, 9, SV("1234567890"), 11, 0, S("can't happen"));
   4664     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 0, S("aklmnopqrst"));
   4665     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 1, S("a1klmnopqrst"));
   4666     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 10, S("a1234567890klmnopqrst"));
   4667     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 19, S("a1234567890123456789klmnopqrst"));
   4668     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 20, S("a12345678901234567890klmnopqrst"));
   4669     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 0, 21, S("a12345678901234567890klmnopqrst"));
   4670     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 0, S("aklmnopqrst"));
   4671     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 1, S("a2klmnopqrst"));
   4672     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 9, S("a234567890klmnopqrst"));
   4673     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 18, S("a234567890123456789klmnopqrst"));
   4674     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 19, S("a2345678901234567890klmnopqrst"));
   4675     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 1, 20, S("a2345678901234567890klmnopqrst"));
   4676     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 0, S("aklmnopqrst"));
   4677     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 1, S("a1klmnopqrst"));
   4678     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 5, S("a12345klmnopqrst"));
   4679     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 9, S("a123456789klmnopqrst"));
   4680     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 10, S("a1234567890klmnopqrst"));
   4681     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 10, 11, S("a1234567890klmnopqrst"));
   4682     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 0, S("aklmnopqrst"));
   4683     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 1, S("a0klmnopqrst"));
   4684     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 19, 2, S("a0klmnopqrst"));
   4685     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 20, 0, S("aklmnopqrst"));
   4686     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 20, 1, S("aklmnopqrst"));
   4687     test(S("abcdefghijklmnopqrst"), 1, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4688     test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 0, S("at"));
   4689     test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 0, 1, S("at"));
   4690     test(S("abcdefghijklmnopqrst"), 1, 18, SV(""), 1, 0, S("can't happen"));
   4691     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 0, S("at"));
   4692     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 1, S("a1t"));
   4693     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 2, S("a12t"));
   4694     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 4, S("a1234t"));
   4695     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 5, S("a12345t"));
   4696     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 0, 6, S("a12345t"));
   4697     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 0, S("at"));
   4698     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 1, S("a2t"));
   4699     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 2, S("a23t"));
   4700     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 3, S("a234t"));
   4701     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 4, S("a2345t"));
   4702     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 1, 5, S("a2345t"));
   4703     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 0, S("at"));
   4704     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 1, S("a3t"));
   4705     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 2, S("a34t"));
   4706     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 3, S("a345t"));
   4707     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 2, 4, S("a345t"));
   4708     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 0, S("at"));
   4709     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 1, S("a5t"));
   4710     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 4, 2, S("a5t"));
   4711     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 5, 0, S("at"));
   4712     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 5, 1, S("at"));
   4713     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345"), 6, 0, S("can't happen"));
   4714     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 0, S("at"));
   4715     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 1, S("a1t"));
   4716     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 5, S("a12345t"));
   4717     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 9, S("a123456789t"));
   4718     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 10, S("a1234567890t"));
   4719     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 0, 11, S("a1234567890t"));
   4720     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 0, S("at"));
   4721     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 1, S("a2t"));
   4722 }
   4723 
   4724 template <class S, class SV>
   4725 void test44()
   4726 {
   4727     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 4, S("a2345t"));
   4728     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 8, S("a23456789t"));
   4729     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 9, S("a234567890t"));
   4730     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 1, 10, S("a234567890t"));
   4731     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 0, S("at"));
   4732     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 1, S("a6t"));
   4733     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 2, S("a67t"));
   4734     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 4, S("a6789t"));
   4735     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 5, S("a67890t"));
   4736     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 5, 6, S("a67890t"));
   4737     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 0, S("at"));
   4738     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 1, S("a0t"));
   4739     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 9, 2, S("a0t"));
   4740     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 10, 0, S("at"));
   4741     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 10, 1, S("at"));
   4742     test(S("abcdefghijklmnopqrst"), 1, 18, SV("1234567890"), 11, 0, S("can't happen"));
   4743     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 0, S("at"));
   4744     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 1, S("a1t"));
   4745     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 10, S("a1234567890t"));
   4746     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 19, S("a1234567890123456789t"));
   4747     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 20, S("a12345678901234567890t"));
   4748     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 0, 21, S("a12345678901234567890t"));
   4749     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 0, S("at"));
   4750     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 1, S("a2t"));
   4751     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 9, S("a234567890t"));
   4752     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 18, S("a234567890123456789t"));
   4753     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 19, S("a2345678901234567890t"));
   4754     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 1, 20, S("a2345678901234567890t"));
   4755     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 0, S("at"));
   4756     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 1, S("a1t"));
   4757     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 5, S("a12345t"));
   4758     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 9, S("a123456789t"));
   4759     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 10, S("a1234567890t"));
   4760     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 10, 11, S("a1234567890t"));
   4761     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 0, S("at"));
   4762     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 1, S("a0t"));
   4763     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 19, 2, S("a0t"));
   4764     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 20, 0, S("at"));
   4765     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 20, 1, S("at"));
   4766     test(S("abcdefghijklmnopqrst"), 1, 18, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4767     test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 0, S("a"));
   4768     test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 0, 1, S("a"));
   4769     test(S("abcdefghijklmnopqrst"), 1, 19, SV(""), 1, 0, S("can't happen"));
   4770     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 0, S("a"));
   4771     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 1, S("a1"));
   4772     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 2, S("a12"));
   4773     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 4, S("a1234"));
   4774     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 5, S("a12345"));
   4775     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 0, 6, S("a12345"));
   4776     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 0, S("a"));
   4777     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 1, S("a2"));
   4778     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 2, S("a23"));
   4779     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 3, S("a234"));
   4780     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 4, S("a2345"));
   4781     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 1, 5, S("a2345"));
   4782     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 0, S("a"));
   4783     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 1, S("a3"));
   4784     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 2, S("a34"));
   4785     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 3, S("a345"));
   4786     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 2, 4, S("a345"));
   4787     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 0, S("a"));
   4788     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 1, S("a5"));
   4789     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 4, 2, S("a5"));
   4790     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 5, 0, S("a"));
   4791     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 5, 1, S("a"));
   4792     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345"), 6, 0, S("can't happen"));
   4793     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 0, S("a"));
   4794     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 1, S("a1"));
   4795     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 5, S("a12345"));
   4796     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 9, S("a123456789"));
   4797     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 10, S("a1234567890"));
   4798     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 0, 11, S("a1234567890"));
   4799     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 0, S("a"));
   4800     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 1, S("a2"));
   4801     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 4, S("a2345"));
   4802     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 8, S("a23456789"));
   4803     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 9, S("a234567890"));
   4804     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 1, 10, S("a234567890"));
   4805     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 0, S("a"));
   4806     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 1, S("a6"));
   4807     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 2, S("a67"));
   4808     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 4, S("a6789"));
   4809     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 5, S("a67890"));
   4810     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 5, 6, S("a67890"));
   4811     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 0, S("a"));
   4812     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 1, S("a0"));
   4813     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 9, 2, S("a0"));
   4814     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 10, 0, S("a"));
   4815     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 10, 1, S("a"));
   4816     test(S("abcdefghijklmnopqrst"), 1, 19, SV("1234567890"), 11, 0, S("can't happen"));
   4817     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 0, S("a"));
   4818     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 1, S("a1"));
   4819     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   4820     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   4821     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   4822     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   4823     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 0, S("a"));
   4824     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 1, S("a2"));
   4825     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 9, S("a234567890"));
   4826     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   4827 }
   4828 
   4829 template <class S, class SV>
   4830 void test45()
   4831 {
   4832     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   4833     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   4834     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 0, S("a"));
   4835     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 1, S("a1"));
   4836     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 5, S("a12345"));
   4837     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 9, S("a123456789"));
   4838     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   4839     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   4840     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 0, S("a"));
   4841     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 1, S("a0"));
   4842     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 19, 2, S("a0"));
   4843     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 20, 0, S("a"));
   4844     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 20, 1, S("a"));
   4845     test(S("abcdefghijklmnopqrst"), 1, 19, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4846     test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 0, S("a"));
   4847     test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 0, 1, S("a"));
   4848     test(S("abcdefghijklmnopqrst"), 1, 20, SV(""), 1, 0, S("can't happen"));
   4849     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 0, S("a"));
   4850     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 1, S("a1"));
   4851     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 2, S("a12"));
   4852     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 4, S("a1234"));
   4853     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 5, S("a12345"));
   4854     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 0, 6, S("a12345"));
   4855     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 0, S("a"));
   4856     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 1, S("a2"));
   4857     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 2, S("a23"));
   4858     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 3, S("a234"));
   4859     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 4, S("a2345"));
   4860     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 1, 5, S("a2345"));
   4861     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 0, S("a"));
   4862     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 1, S("a3"));
   4863     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 2, S("a34"));
   4864     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 3, S("a345"));
   4865     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 2, 4, S("a345"));
   4866     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 0, S("a"));
   4867     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 1, S("a5"));
   4868     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 4, 2, S("a5"));
   4869     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 5, 0, S("a"));
   4870     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 5, 1, S("a"));
   4871     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345"), 6, 0, S("can't happen"));
   4872     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 0, S("a"));
   4873     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 1, S("a1"));
   4874     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 5, S("a12345"));
   4875     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 9, S("a123456789"));
   4876     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 10, S("a1234567890"));
   4877     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 0, 11, S("a1234567890"));
   4878     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 0, S("a"));
   4879     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 1, S("a2"));
   4880     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 4, S("a2345"));
   4881     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 8, S("a23456789"));
   4882     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 9, S("a234567890"));
   4883     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 1, 10, S("a234567890"));
   4884     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 0, S("a"));
   4885     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 1, S("a6"));
   4886     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 2, S("a67"));
   4887     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 4, S("a6789"));
   4888     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 5, S("a67890"));
   4889     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 5, 6, S("a67890"));
   4890     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 0, S("a"));
   4891     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 1, S("a0"));
   4892     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 9, 2, S("a0"));
   4893     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 10, 0, S("a"));
   4894     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 10, 1, S("a"));
   4895     test(S("abcdefghijklmnopqrst"), 1, 20, SV("1234567890"), 11, 0, S("can't happen"));
   4896     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 0, S("a"));
   4897     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 1, S("a1"));
   4898     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 10, S("a1234567890"));
   4899     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 19, S("a1234567890123456789"));
   4900     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 20, S("a12345678901234567890"));
   4901     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 0, 21, S("a12345678901234567890"));
   4902     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 0, S("a"));
   4903     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 1, S("a2"));
   4904     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 9, S("a234567890"));
   4905     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 18, S("a234567890123456789"));
   4906     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 19, S("a2345678901234567890"));
   4907     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 1, 20, S("a2345678901234567890"));
   4908     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 0, S("a"));
   4909     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 1, S("a1"));
   4910     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 5, S("a12345"));
   4911     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 9, S("a123456789"));
   4912     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 10, S("a1234567890"));
   4913     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 10, 11, S("a1234567890"));
   4914     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 0, S("a"));
   4915     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 1, S("a0"));
   4916     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 19, 2, S("a0"));
   4917     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 20, 0, S("a"));
   4918     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 20, 1, S("a"));
   4919     test(S("abcdefghijklmnopqrst"), 1, 20, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4920     test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   4921     test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   4922     test(S("abcdefghijklmnopqrst"), 10, 0, SV(""), 1, 0, S("can't happen"));
   4923     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   4924     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 1, S("abcdefghij1klmnopqrst"));
   4925     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 2, S("abcdefghij12klmnopqrst"));
   4926     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 4, S("abcdefghij1234klmnopqrst"));
   4927     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 5, S("abcdefghij12345klmnopqrst"));
   4928     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 0, 6, S("abcdefghij12345klmnopqrst"));
   4929     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   4930     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 1, S("abcdefghij2klmnopqrst"));
   4931     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 2, S("abcdefghij23klmnopqrst"));
   4932 }
   4933 
   4934 template <class S, class SV>
   4935 void test46()
   4936 {
   4937     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 3, S("abcdefghij234klmnopqrst"));
   4938     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 4, S("abcdefghij2345klmnopqrst"));
   4939     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 1, 5, S("abcdefghij2345klmnopqrst"));
   4940     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   4941     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 1, S("abcdefghij3klmnopqrst"));
   4942     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 2, S("abcdefghij34klmnopqrst"));
   4943     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 3, S("abcdefghij345klmnopqrst"));
   4944     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 2, 4, S("abcdefghij345klmnopqrst"));
   4945     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   4946     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 1, S("abcdefghij5klmnopqrst"));
   4947     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 4, 2, S("abcdefghij5klmnopqrst"));
   4948     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   4949     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   4950     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345"), 6, 0, S("can't happen"));
   4951     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4952     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
   4953     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 5, S("abcdefghij12345klmnopqrst"));
   4954     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 9, S("abcdefghij123456789klmnopqrst"));
   4955     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
   4956     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 0, 11, S("abcdefghij1234567890klmnopqrst"));
   4957     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4958     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
   4959     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 4, S("abcdefghij2345klmnopqrst"));
   4960     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 8, S("abcdefghij23456789klmnopqrst"));
   4961     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
   4962     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 1, 10, S("abcdefghij234567890klmnopqrst"));
   4963     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   4964     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 1, S("abcdefghij6klmnopqrst"));
   4965     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 2, S("abcdefghij67klmnopqrst"));
   4966     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 4, S("abcdefghij6789klmnopqrst"));
   4967     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 5, S("abcdefghij67890klmnopqrst"));
   4968     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 5, 6, S("abcdefghij67890klmnopqrst"));
   4969     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   4970     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 1, S("abcdefghij0klmnopqrst"));
   4971     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 9, 2, S("abcdefghij0klmnopqrst"));
   4972     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4973     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   4974     test(S("abcdefghijklmnopqrst"), 10, 0, SV("1234567890"), 11, 0, S("can't happen"));
   4975     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   4976     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 1, S("abcdefghij1klmnopqrst"));
   4977     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890klmnopqrst"));
   4978     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789klmnopqrst"));
   4979     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890klmnopqrst"));
   4980     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890klmnopqrst"));
   4981     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   4982     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 1, S("abcdefghij2klmnopqrst"));
   4983     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890klmnopqrst"));
   4984     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789klmnopqrst"));
   4985     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890klmnopqrst"));
   4986     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890klmnopqrst"));
   4987     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   4988     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 1, S("abcdefghij1klmnopqrst"));
   4989     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 5, S("abcdefghij12345klmnopqrst"));
   4990     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789klmnopqrst"));
   4991     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890klmnopqrst"));
   4992     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890klmnopqrst"));
   4993     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   4994     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 1, S("abcdefghij0klmnopqrst"));
   4995     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 19, 2, S("abcdefghij0klmnopqrst"));
   4996     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   4997     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   4998     test(S("abcdefghijklmnopqrst"), 10, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   4999     test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 0, S("abcdefghijlmnopqrst"));
   5000     test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 0, 1, S("abcdefghijlmnopqrst"));
   5001     test(S("abcdefghijklmnopqrst"), 10, 1, SV(""), 1, 0, S("can't happen"));
   5002     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 0, S("abcdefghijlmnopqrst"));
   5003     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 1, S("abcdefghij1lmnopqrst"));
   5004     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 2, S("abcdefghij12lmnopqrst"));
   5005     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 4, S("abcdefghij1234lmnopqrst"));
   5006     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 5, S("abcdefghij12345lmnopqrst"));
   5007     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 0, 6, S("abcdefghij12345lmnopqrst"));
   5008     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 0, S("abcdefghijlmnopqrst"));
   5009     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 1, S("abcdefghij2lmnopqrst"));
   5010     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 2, S("abcdefghij23lmnopqrst"));
   5011     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 3, S("abcdefghij234lmnopqrst"));
   5012     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 4, S("abcdefghij2345lmnopqrst"));
   5013     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 1, 5, S("abcdefghij2345lmnopqrst"));
   5014     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 0, S("abcdefghijlmnopqrst"));
   5015     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 1, S("abcdefghij3lmnopqrst"));
   5016     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 2, S("abcdefghij34lmnopqrst"));
   5017     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 3, S("abcdefghij345lmnopqrst"));
   5018     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 2, 4, S("abcdefghij345lmnopqrst"));
   5019     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 0, S("abcdefghijlmnopqrst"));
   5020     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 1, S("abcdefghij5lmnopqrst"));
   5021     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 4, 2, S("abcdefghij5lmnopqrst"));
   5022     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 5, 0, S("abcdefghijlmnopqrst"));
   5023     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 5, 1, S("abcdefghijlmnopqrst"));
   5024     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345"), 6, 0, S("can't happen"));
   5025     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 0, S("abcdefghijlmnopqrst"));
   5026     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
   5027     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 5, S("abcdefghij12345lmnopqrst"));
   5028     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 9, S("abcdefghij123456789lmnopqrst"));
   5029     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
   5030     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 0, 11, S("abcdefghij1234567890lmnopqrst"));
   5031     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 0, S("abcdefghijlmnopqrst"));
   5032     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
   5033     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 4, S("abcdefghij2345lmnopqrst"));
   5034     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 8, S("abcdefghij23456789lmnopqrst"));
   5035     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
   5036     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 1, 10, S("abcdefghij234567890lmnopqrst"));
   5037 }
   5038 
   5039 template <class S, class SV>
   5040 void test47()
   5041 {
   5042     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 0, S("abcdefghijlmnopqrst"));
   5043     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 1, S("abcdefghij6lmnopqrst"));
   5044     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 2, S("abcdefghij67lmnopqrst"));
   5045     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 4, S("abcdefghij6789lmnopqrst"));
   5046     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 5, S("abcdefghij67890lmnopqrst"));
   5047     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 5, 6, S("abcdefghij67890lmnopqrst"));
   5048     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 0, S("abcdefghijlmnopqrst"));
   5049     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 1, S("abcdefghij0lmnopqrst"));
   5050     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 9, 2, S("abcdefghij0lmnopqrst"));
   5051     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 10, 0, S("abcdefghijlmnopqrst"));
   5052     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 10, 1, S("abcdefghijlmnopqrst"));
   5053     test(S("abcdefghijklmnopqrst"), 10, 1, SV("1234567890"), 11, 0, S("can't happen"));
   5054     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijlmnopqrst"));
   5055     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 1, S("abcdefghij1lmnopqrst"));
   5056     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890lmnopqrst"));
   5057     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789lmnopqrst"));
   5058     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890lmnopqrst"));
   5059     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890lmnopqrst"));
   5060     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijlmnopqrst"));
   5061     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 1, S("abcdefghij2lmnopqrst"));
   5062     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890lmnopqrst"));
   5063     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789lmnopqrst"));
   5064     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890lmnopqrst"));
   5065     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890lmnopqrst"));
   5066     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijlmnopqrst"));
   5067     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 1, S("abcdefghij1lmnopqrst"));
   5068     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 5, S("abcdefghij12345lmnopqrst"));
   5069     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789lmnopqrst"));
   5070     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890lmnopqrst"));
   5071     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890lmnopqrst"));
   5072     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijlmnopqrst"));
   5073     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 1, S("abcdefghij0lmnopqrst"));
   5074     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 19, 2, S("abcdefghij0lmnopqrst"));
   5075     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijlmnopqrst"));
   5076     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijlmnopqrst"));
   5077     test(S("abcdefghijklmnopqrst"), 10, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5078     test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 0, S("abcdefghijpqrst"));
   5079     test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 0, 1, S("abcdefghijpqrst"));
   5080     test(S("abcdefghijklmnopqrst"), 10, 5, SV(""), 1, 0, S("can't happen"));
   5081     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 0, S("abcdefghijpqrst"));
   5082     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 1, S("abcdefghij1pqrst"));
   5083     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 2, S("abcdefghij12pqrst"));
   5084     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 4, S("abcdefghij1234pqrst"));
   5085     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 5, S("abcdefghij12345pqrst"));
   5086     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 0, 6, S("abcdefghij12345pqrst"));
   5087     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 0, S("abcdefghijpqrst"));
   5088     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 1, S("abcdefghij2pqrst"));
   5089     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 2, S("abcdefghij23pqrst"));
   5090     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 3, S("abcdefghij234pqrst"));
   5091     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 4, S("abcdefghij2345pqrst"));
   5092     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 1, 5, S("abcdefghij2345pqrst"));
   5093     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 0, S("abcdefghijpqrst"));
   5094     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 1, S("abcdefghij3pqrst"));
   5095     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 2, S("abcdefghij34pqrst"));
   5096     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 3, S("abcdefghij345pqrst"));
   5097     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 2, 4, S("abcdefghij345pqrst"));
   5098     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 0, S("abcdefghijpqrst"));
   5099     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 1, S("abcdefghij5pqrst"));
   5100     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 4, 2, S("abcdefghij5pqrst"));
   5101     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 5, 0, S("abcdefghijpqrst"));
   5102     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 5, 1, S("abcdefghijpqrst"));
   5103     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345"), 6, 0, S("can't happen"));
   5104     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 0, S("abcdefghijpqrst"));
   5105     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 1, S("abcdefghij1pqrst"));
   5106     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 5, S("abcdefghij12345pqrst"));
   5107     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 9, S("abcdefghij123456789pqrst"));
   5108     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
   5109     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 0, 11, S("abcdefghij1234567890pqrst"));
   5110     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 0, S("abcdefghijpqrst"));
   5111     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 1, S("abcdefghij2pqrst"));
   5112     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 4, S("abcdefghij2345pqrst"));
   5113     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 8, S("abcdefghij23456789pqrst"));
   5114     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 9, S("abcdefghij234567890pqrst"));
   5115     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 1, 10, S("abcdefghij234567890pqrst"));
   5116     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 0, S("abcdefghijpqrst"));
   5117     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 1, S("abcdefghij6pqrst"));
   5118     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 2, S("abcdefghij67pqrst"));
   5119     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 4, S("abcdefghij6789pqrst"));
   5120     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 5, S("abcdefghij67890pqrst"));
   5121     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 5, 6, S("abcdefghij67890pqrst"));
   5122     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 0, S("abcdefghijpqrst"));
   5123     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 1, S("abcdefghij0pqrst"));
   5124     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 9, 2, S("abcdefghij0pqrst"));
   5125     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 10, 0, S("abcdefghijpqrst"));
   5126     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 10, 1, S("abcdefghijpqrst"));
   5127     test(S("abcdefghijklmnopqrst"), 10, 5, SV("1234567890"), 11, 0, S("can't happen"));
   5128     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 0, S("abcdefghijpqrst"));
   5129     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 1, S("abcdefghij1pqrst"));
   5130     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890pqrst"));
   5131     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789pqrst"));
   5132     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890pqrst"));
   5133     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890pqrst"));
   5134     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 0, S("abcdefghijpqrst"));
   5135     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 1, S("abcdefghij2pqrst"));
   5136     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890pqrst"));
   5137     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789pqrst"));
   5138     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890pqrst"));
   5139     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890pqrst"));
   5140     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 0, S("abcdefghijpqrst"));
   5141     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 1, S("abcdefghij1pqrst"));
   5142 }
   5143 
   5144 template <class S, class SV>
   5145 void test48()
   5146 {
   5147     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 5, S("abcdefghij12345pqrst"));
   5148     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789pqrst"));
   5149     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890pqrst"));
   5150     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890pqrst"));
   5151     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 0, S("abcdefghijpqrst"));
   5152     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 1, S("abcdefghij0pqrst"));
   5153     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 19, 2, S("abcdefghij0pqrst"));
   5154     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 20, 0, S("abcdefghijpqrst"));
   5155     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 20, 1, S("abcdefghijpqrst"));
   5156     test(S("abcdefghijklmnopqrst"), 10, 5, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5157     test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 0, S("abcdefghijt"));
   5158     test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 0, 1, S("abcdefghijt"));
   5159     test(S("abcdefghijklmnopqrst"), 10, 9, SV(""), 1, 0, S("can't happen"));
   5160     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 0, S("abcdefghijt"));
   5161     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 1, S("abcdefghij1t"));
   5162     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 2, S("abcdefghij12t"));
   5163     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 4, S("abcdefghij1234t"));
   5164     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 5, S("abcdefghij12345t"));
   5165     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 0, 6, S("abcdefghij12345t"));
   5166     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 0, S("abcdefghijt"));
   5167     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 1, S("abcdefghij2t"));
   5168     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 2, S("abcdefghij23t"));
   5169     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 3, S("abcdefghij234t"));
   5170     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 4, S("abcdefghij2345t"));
   5171     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 1, 5, S("abcdefghij2345t"));
   5172     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 0, S("abcdefghijt"));
   5173     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 1, S("abcdefghij3t"));
   5174     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 2, S("abcdefghij34t"));
   5175     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 3, S("abcdefghij345t"));
   5176     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 2, 4, S("abcdefghij345t"));
   5177     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 0, S("abcdefghijt"));
   5178     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 1, S("abcdefghij5t"));
   5179     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 4, 2, S("abcdefghij5t"));
   5180     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 5, 0, S("abcdefghijt"));
   5181     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 5, 1, S("abcdefghijt"));
   5182     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345"), 6, 0, S("can't happen"));
   5183     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 0, S("abcdefghijt"));
   5184     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 1, S("abcdefghij1t"));
   5185     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 5, S("abcdefghij12345t"));
   5186     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 9, S("abcdefghij123456789t"));
   5187     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 10, S("abcdefghij1234567890t"));
   5188     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 0, 11, S("abcdefghij1234567890t"));
   5189     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 0, S("abcdefghijt"));
   5190     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 1, S("abcdefghij2t"));
   5191     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 4, S("abcdefghij2345t"));
   5192     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 8, S("abcdefghij23456789t"));
   5193     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 9, S("abcdefghij234567890t"));
   5194     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 1, 10, S("abcdefghij234567890t"));
   5195     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 0, S("abcdefghijt"));
   5196     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 1, S("abcdefghij6t"));
   5197     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 2, S("abcdefghij67t"));
   5198     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 4, S("abcdefghij6789t"));
   5199     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 5, S("abcdefghij67890t"));
   5200     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 5, 6, S("abcdefghij67890t"));
   5201     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 0, S("abcdefghijt"));
   5202     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 1, S("abcdefghij0t"));
   5203     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 9, 2, S("abcdefghij0t"));
   5204     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 10, 0, S("abcdefghijt"));
   5205     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 10, 1, S("abcdefghijt"));
   5206     test(S("abcdefghijklmnopqrst"), 10, 9, SV("1234567890"), 11, 0, S("can't happen"));
   5207     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 0, S("abcdefghijt"));
   5208     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 1, S("abcdefghij1t"));
   5209     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890t"));
   5210     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789t"));
   5211     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890t"));
   5212     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890t"));
   5213     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 0, S("abcdefghijt"));
   5214     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 1, S("abcdefghij2t"));
   5215     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890t"));
   5216     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789t"));
   5217     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890t"));
   5218     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890t"));
   5219     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 0, S("abcdefghijt"));
   5220     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 1, S("abcdefghij1t"));
   5221     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 5, S("abcdefghij12345t"));
   5222     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789t"));
   5223     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890t"));
   5224     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890t"));
   5225     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 0, S("abcdefghijt"));
   5226     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 1, S("abcdefghij0t"));
   5227     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 19, 2, S("abcdefghij0t"));
   5228     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 20, 0, S("abcdefghijt"));
   5229     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 20, 1, S("abcdefghijt"));
   5230     test(S("abcdefghijklmnopqrst"), 10, 9, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5231     test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 0, S("abcdefghij"));
   5232     test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 0, 1, S("abcdefghij"));
   5233     test(S("abcdefghijklmnopqrst"), 10, 10, SV(""), 1, 0, S("can't happen"));
   5234     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 0, S("abcdefghij"));
   5235     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 1, S("abcdefghij1"));
   5236     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 2, S("abcdefghij12"));
   5237     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 4, S("abcdefghij1234"));
   5238     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 5, S("abcdefghij12345"));
   5239     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 0, 6, S("abcdefghij12345"));
   5240     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 0, S("abcdefghij"));
   5241     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 1, S("abcdefghij2"));
   5242     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 2, S("abcdefghij23"));
   5243     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 3, S("abcdefghij234"));
   5244     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 4, S("abcdefghij2345"));
   5245     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 1, 5, S("abcdefghij2345"));
   5246     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 0, S("abcdefghij"));
   5247 }
   5248 
   5249 template <class S, class SV>
   5250 void test49()
   5251 {
   5252     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 1, S("abcdefghij3"));
   5253     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 2, S("abcdefghij34"));
   5254     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 3, S("abcdefghij345"));
   5255     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 2, 4, S("abcdefghij345"));
   5256     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 0, S("abcdefghij"));
   5257     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 1, S("abcdefghij5"));
   5258     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 4, 2, S("abcdefghij5"));
   5259     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 5, 0, S("abcdefghij"));
   5260     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 5, 1, S("abcdefghij"));
   5261     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345"), 6, 0, S("can't happen"));
   5262     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 0, S("abcdefghij"));
   5263     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 1, S("abcdefghij1"));
   5264     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 5, S("abcdefghij12345"));
   5265     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
   5266     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
   5267     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
   5268     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 0, S("abcdefghij"));
   5269     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 1, S("abcdefghij2"));
   5270     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 4, S("abcdefghij2345"));
   5271     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
   5272     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
   5273     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
   5274     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 0, S("abcdefghij"));
   5275     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 1, S("abcdefghij6"));
   5276     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 2, S("abcdefghij67"));
   5277     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 4, S("abcdefghij6789"));
   5278     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 5, S("abcdefghij67890"));
   5279     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 5, 6, S("abcdefghij67890"));
   5280     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 0, S("abcdefghij"));
   5281     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 1, S("abcdefghij0"));
   5282     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 9, 2, S("abcdefghij0"));
   5283     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 10, 0, S("abcdefghij"));
   5284     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 10, 1, S("abcdefghij"));
   5285     test(S("abcdefghijklmnopqrst"), 10, 10, SV("1234567890"), 11, 0, S("can't happen"));
   5286     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   5287     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
   5288     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
   5289     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
   5290     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
   5291     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
   5292     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   5293     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
   5294     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
   5295     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
   5296     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
   5297     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
   5298     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   5299     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
   5300     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
   5301     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
   5302     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
   5303     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
   5304     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   5305     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
   5306     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
   5307     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   5308     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   5309     test(S("abcdefghijklmnopqrst"), 10, 10, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5310     test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 0, S("abcdefghij"));
   5311     test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 0, 1, S("abcdefghij"));
   5312     test(S("abcdefghijklmnopqrst"), 10, 11, SV(""), 1, 0, S("can't happen"));
   5313     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 0, S("abcdefghij"));
   5314     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 1, S("abcdefghij1"));
   5315     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 2, S("abcdefghij12"));
   5316     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 4, S("abcdefghij1234"));
   5317     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 5, S("abcdefghij12345"));
   5318     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 0, 6, S("abcdefghij12345"));
   5319     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 0, S("abcdefghij"));
   5320     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 1, S("abcdefghij2"));
   5321     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 2, S("abcdefghij23"));
   5322     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 3, S("abcdefghij234"));
   5323     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 4, S("abcdefghij2345"));
   5324     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 1, 5, S("abcdefghij2345"));
   5325     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 0, S("abcdefghij"));
   5326     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 1, S("abcdefghij3"));
   5327     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 2, S("abcdefghij34"));
   5328     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 3, S("abcdefghij345"));
   5329     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 2, 4, S("abcdefghij345"));
   5330     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 0, S("abcdefghij"));
   5331     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 1, S("abcdefghij5"));
   5332     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 4, 2, S("abcdefghij5"));
   5333     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 5, 0, S("abcdefghij"));
   5334     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 5, 1, S("abcdefghij"));
   5335     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345"), 6, 0, S("can't happen"));
   5336     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 0, S("abcdefghij"));
   5337     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 1, S("abcdefghij1"));
   5338     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 5, S("abcdefghij12345"));
   5339     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 9, S("abcdefghij123456789"));
   5340     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 10, S("abcdefghij1234567890"));
   5341     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 0, 11, S("abcdefghij1234567890"));
   5342     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 0, S("abcdefghij"));
   5343     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 1, S("abcdefghij2"));
   5344     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 4, S("abcdefghij2345"));
   5345     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 8, S("abcdefghij23456789"));
   5346     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 9, S("abcdefghij234567890"));
   5347     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 1, 10, S("abcdefghij234567890"));
   5348     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 0, S("abcdefghij"));
   5349     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 1, S("abcdefghij6"));
   5350     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 2, S("abcdefghij67"));
   5351     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 4, S("abcdefghij6789"));
   5352 }
   5353 
   5354 template <class S, class SV>
   5355 void test50()
   5356 {
   5357     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 5, S("abcdefghij67890"));
   5358     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 5, 6, S("abcdefghij67890"));
   5359     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 0, S("abcdefghij"));
   5360     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 1, S("abcdefghij0"));
   5361     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 9, 2, S("abcdefghij0"));
   5362     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 10, 0, S("abcdefghij"));
   5363     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 10, 1, S("abcdefghij"));
   5364     test(S("abcdefghijklmnopqrst"), 10, 11, SV("1234567890"), 11, 0, S("can't happen"));
   5365     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 0, S("abcdefghij"));
   5366     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 1, S("abcdefghij1"));
   5367     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 10, S("abcdefghij1234567890"));
   5368     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 19, S("abcdefghij1234567890123456789"));
   5369     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 20, S("abcdefghij12345678901234567890"));
   5370     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 0, 21, S("abcdefghij12345678901234567890"));
   5371     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 0, S("abcdefghij"));
   5372     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 1, S("abcdefghij2"));
   5373     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 9, S("abcdefghij234567890"));
   5374     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 18, S("abcdefghij234567890123456789"));
   5375     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 19, S("abcdefghij2345678901234567890"));
   5376     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 1, 20, S("abcdefghij2345678901234567890"));
   5377     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 0, S("abcdefghij"));
   5378     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 1, S("abcdefghij1"));
   5379     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 5, S("abcdefghij12345"));
   5380     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 9, S("abcdefghij123456789"));
   5381     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 10, S("abcdefghij1234567890"));
   5382     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 10, 11, S("abcdefghij1234567890"));
   5383     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 0, S("abcdefghij"));
   5384     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 1, S("abcdefghij0"));
   5385     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 19, 2, S("abcdefghij0"));
   5386     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 20, 0, S("abcdefghij"));
   5387     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 20, 1, S("abcdefghij"));
   5388     test(S("abcdefghijklmnopqrst"), 10, 11, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5389     test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   5390     test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   5391     test(S("abcdefghijklmnopqrst"), 19, 0, SV(""), 1, 0, S("can't happen"));
   5392     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   5393     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1t"));
   5394     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12t"));
   5395     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234t"));
   5396     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345t"));
   5397     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345t"));
   5398     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   5399     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2t"));
   5400     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23t"));
   5401     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234t"));
   5402     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345t"));
   5403     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345t"));
   5404     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   5405     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3t"));
   5406     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34t"));
   5407     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345t"));
   5408     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345t"));
   5409     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   5410     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5t"));
   5411     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5t"));
   5412     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   5413     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   5414     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345"), 6, 0, S("can't happen"));
   5415     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5416     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
   5417     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345t"));
   5418     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789t"));
   5419     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
   5420     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890t"));
   5421     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5422     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
   5423     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345t"));
   5424     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789t"));
   5425     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
   5426     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890t"));
   5427     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   5428     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6t"));
   5429     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67t"));
   5430     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789t"));
   5431     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890t"));
   5432     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890t"));
   5433     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   5434     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0t"));
   5435     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0t"));
   5436     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5437     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   5438     test(S("abcdefghijklmnopqrst"), 19, 0, SV("1234567890"), 11, 0, S("can't happen"));
   5439     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5440     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1t"));
   5441     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890t"));
   5442     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789t"));
   5443     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890t"));
   5444     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890t"));
   5445     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5446     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2t"));
   5447     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890t"));
   5448     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789t"));
   5449     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890t"));
   5450     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890t"));
   5451     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5452     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1t"));
   5453     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345t"));
   5454     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789t"));
   5455     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890t"));
   5456     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890t"));
   5457 }
   5458 
   5459 template <class S, class SV>
   5460 void test51()
   5461 {
   5462     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   5463     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0t"));
   5464     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0t"));
   5465     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   5466     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   5467     test(S("abcdefghijklmnopqrst"), 19, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5468     test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 0, S("abcdefghijklmnopqrs"));
   5469     test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 0, 1, S("abcdefghijklmnopqrs"));
   5470     test(S("abcdefghijklmnopqrst"), 19, 1, SV(""), 1, 0, S("can't happen"));
   5471     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 0, S("abcdefghijklmnopqrs"));
   5472     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
   5473     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
   5474     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
   5475     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
   5476     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
   5477     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 0, S("abcdefghijklmnopqrs"));
   5478     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
   5479     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
   5480     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
   5481     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
   5482     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
   5483     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 0, S("abcdefghijklmnopqrs"));
   5484     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
   5485     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
   5486     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
   5487     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
   5488     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 0, S("abcdefghijklmnopqrs"));
   5489     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
   5490     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
   5491     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 5, 0, S("abcdefghijklmnopqrs"));
   5492     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 5, 1, S("abcdefghijklmnopqrs"));
   5493     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345"), 6, 0, S("can't happen"));
   5494     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
   5495     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
   5496     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
   5497     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
   5498     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
   5499     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
   5500     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
   5501     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
   5502     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
   5503     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
   5504     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
   5505     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
   5506     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
   5507     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
   5508     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
   5509     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
   5510     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
   5511     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
   5512     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
   5513     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
   5514     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
   5515     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
   5516     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
   5517     test(S("abcdefghijklmnopqrst"), 19, 1, SV("1234567890"), 11, 0, S("can't happen"));
   5518     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
   5519     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
   5520     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
   5521     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
   5522     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
   5523     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
   5524     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
   5525     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
   5526     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
   5527     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
   5528     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
   5529     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
   5530     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
   5531     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
   5532     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
   5533     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
   5534     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
   5535     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
   5536     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
   5537     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
   5538     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
   5539     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
   5540     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
   5541     test(S("abcdefghijklmnopqrst"), 19, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5542     test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 0, S("abcdefghijklmnopqrs"));
   5543     test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 0, 1, S("abcdefghijklmnopqrs"));
   5544     test(S("abcdefghijklmnopqrst"), 19, 2, SV(""), 1, 0, S("can't happen"));
   5545     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 0, S("abcdefghijklmnopqrs"));
   5546     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 1, S("abcdefghijklmnopqrs1"));
   5547     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 2, S("abcdefghijklmnopqrs12"));
   5548     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 4, S("abcdefghijklmnopqrs1234"));
   5549     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 5, S("abcdefghijklmnopqrs12345"));
   5550     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 0, 6, S("abcdefghijklmnopqrs12345"));
   5551     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 0, S("abcdefghijklmnopqrs"));
   5552     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 1, S("abcdefghijklmnopqrs2"));
   5553     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 2, S("abcdefghijklmnopqrs23"));
   5554     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 3, S("abcdefghijklmnopqrs234"));
   5555     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 4, S("abcdefghijklmnopqrs2345"));
   5556     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 1, 5, S("abcdefghijklmnopqrs2345"));
   5557     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 0, S("abcdefghijklmnopqrs"));
   5558     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 1, S("abcdefghijklmnopqrs3"));
   5559     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 2, S("abcdefghijklmnopqrs34"));
   5560     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 3, S("abcdefghijklmnopqrs345"));
   5561     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 2, 4, S("abcdefghijklmnopqrs345"));
   5562 }
   5563 
   5564 template <class S, class SV>
   5565 void test52()
   5566 {
   5567     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 0, S("abcdefghijklmnopqrs"));
   5568     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 1, S("abcdefghijklmnopqrs5"));
   5569     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 4, 2, S("abcdefghijklmnopqrs5"));
   5570     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 5, 0, S("abcdefghijklmnopqrs"));
   5571     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 5, 1, S("abcdefghijklmnopqrs"));
   5572     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345"), 6, 0, S("can't happen"));
   5573     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrs"));
   5574     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
   5575     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrs12345"));
   5576     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrs123456789"));
   5577     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
   5578     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrs1234567890"));
   5579     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrs"));
   5580     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
   5581     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrs2345"));
   5582     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrs23456789"));
   5583     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
   5584     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrs234567890"));
   5585     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrs"));
   5586     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrs6"));
   5587     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrs67"));
   5588     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrs6789"));
   5589     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrs67890"));
   5590     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrs67890"));
   5591     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrs"));
   5592     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrs0"));
   5593     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrs0"));
   5594     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrs"));
   5595     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrs"));
   5596     test(S("abcdefghijklmnopqrst"), 19, 2, SV("1234567890"), 11, 0, S("can't happen"));
   5597     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrs"));
   5598     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrs1"));
   5599     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrs1234567890"));
   5600     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrs1234567890123456789"));
   5601     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrs12345678901234567890"));
   5602     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrs12345678901234567890"));
   5603     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrs"));
   5604     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrs2"));
   5605     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrs234567890"));
   5606     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrs234567890123456789"));
   5607     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrs2345678901234567890"));
   5608     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrs2345678901234567890"));
   5609     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrs"));
   5610     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrs1"));
   5611     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrs12345"));
   5612     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrs123456789"));
   5613     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrs1234567890"));
   5614     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrs1234567890"));
   5615     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrs"));
   5616     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrs0"));
   5617     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrs0"));
   5618     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrs"));
   5619     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrs"));
   5620     test(S("abcdefghijklmnopqrst"), 19, 2, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5621     test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   5622     test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   5623     test(S("abcdefghijklmnopqrst"), 20, 0, SV(""), 1, 0, S("can't happen"));
   5624     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   5625     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
   5626     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
   5627     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
   5628     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
   5629     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
   5630     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   5631     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
   5632     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
   5633     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
   5634     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
   5635     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
   5636     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   5637     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
   5638     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
   5639     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
   5640     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
   5641     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   5642     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
   5643     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
   5644     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   5645     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   5646     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345"), 6, 0, S("can't happen"));
   5647     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5648     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
   5649     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
   5650     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
   5651     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
   5652     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
   5653     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5654     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
   5655     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
   5656     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
   5657     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
   5658     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
   5659     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   5660     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
   5661     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
   5662     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
   5663     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
   5664     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
   5665     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   5666     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
   5667 }
   5668 
   5669 template <class S, class SV>
   5670 void test53()
   5671 {
   5672     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
   5673     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5674     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   5675     test(S("abcdefghijklmnopqrst"), 20, 0, SV("1234567890"), 11, 0, S("can't happen"));
   5676     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5677     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
   5678     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
   5679     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
   5680     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
   5681     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
   5682     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5683     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
   5684     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
   5685     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
   5686     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
   5687     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
   5688     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5689     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
   5690     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
   5691     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
   5692     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
   5693     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
   5694     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   5695     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
   5696     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
   5697     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   5698     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   5699     test(S("abcdefghijklmnopqrst"), 20, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5700     test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 0, S("abcdefghijklmnopqrst"));
   5701     test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 0, 1, S("abcdefghijklmnopqrst"));
   5702     test(S("abcdefghijklmnopqrst"), 20, 1, SV(""), 1, 0, S("can't happen"));
   5703     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 0, S("abcdefghijklmnopqrst"));
   5704     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 1, S("abcdefghijklmnopqrst1"));
   5705     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 2, S("abcdefghijklmnopqrst12"));
   5706     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 4, S("abcdefghijklmnopqrst1234"));
   5707     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 5, S("abcdefghijklmnopqrst12345"));
   5708     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 0, 6, S("abcdefghijklmnopqrst12345"));
   5709     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 0, S("abcdefghijklmnopqrst"));
   5710     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 1, S("abcdefghijklmnopqrst2"));
   5711     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 2, S("abcdefghijklmnopqrst23"));
   5712     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 3, S("abcdefghijklmnopqrst234"));
   5713     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 4, S("abcdefghijklmnopqrst2345"));
   5714     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 1, 5, S("abcdefghijklmnopqrst2345"));
   5715     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 0, S("abcdefghijklmnopqrst"));
   5716     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 1, S("abcdefghijklmnopqrst3"));
   5717     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 2, S("abcdefghijklmnopqrst34"));
   5718     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 3, S("abcdefghijklmnopqrst345"));
   5719     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 2, 4, S("abcdefghijklmnopqrst345"));
   5720     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 0, S("abcdefghijklmnopqrst"));
   5721     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 1, S("abcdefghijklmnopqrst5"));
   5722     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 4, 2, S("abcdefghijklmnopqrst5"));
   5723     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 5, 0, S("abcdefghijklmnopqrst"));
   5724     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 5, 1, S("abcdefghijklmnopqrst"));
   5725     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345"), 6, 0, S("can't happen"));
   5726     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5727     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
   5728     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 5, S("abcdefghijklmnopqrst12345"));
   5729     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 9, S("abcdefghijklmnopqrst123456789"));
   5730     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
   5731     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 0, 11, S("abcdefghijklmnopqrst1234567890"));
   5732     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5733     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
   5734     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 4, S("abcdefghijklmnopqrst2345"));
   5735     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 8, S("abcdefghijklmnopqrst23456789"));
   5736     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
   5737     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 1, 10, S("abcdefghijklmnopqrst234567890"));
   5738     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 0, S("abcdefghijklmnopqrst"));
   5739     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 1, S("abcdefghijklmnopqrst6"));
   5740     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 2, S("abcdefghijklmnopqrst67"));
   5741     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 4, S("abcdefghijklmnopqrst6789"));
   5742     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 5, S("abcdefghijklmnopqrst67890"));
   5743     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 5, 6, S("abcdefghijklmnopqrst67890"));
   5744     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 0, S("abcdefghijklmnopqrst"));
   5745     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 1, S("abcdefghijklmnopqrst0"));
   5746     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 9, 2, S("abcdefghijklmnopqrst0"));
   5747     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5748     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 10, 1, S("abcdefghijklmnopqrst"));
   5749     test(S("abcdefghijklmnopqrst"), 20, 1, SV("1234567890"), 11, 0, S("can't happen"));
   5750     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 0, S("abcdefghijklmnopqrst"));
   5751     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 1, S("abcdefghijklmnopqrst1"));
   5752     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 10, S("abcdefghijklmnopqrst1234567890"));
   5753     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 19, S("abcdefghijklmnopqrst1234567890123456789"));
   5754     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 20, S("abcdefghijklmnopqrst12345678901234567890"));
   5755     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 0, 21, S("abcdefghijklmnopqrst12345678901234567890"));
   5756     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 0, S("abcdefghijklmnopqrst"));
   5757     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 1, S("abcdefghijklmnopqrst2"));
   5758     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 9, S("abcdefghijklmnopqrst234567890"));
   5759     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 18, S("abcdefghijklmnopqrst234567890123456789"));
   5760     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 19, S("abcdefghijklmnopqrst2345678901234567890"));
   5761     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 1, 20, S("abcdefghijklmnopqrst2345678901234567890"));
   5762     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 0, S("abcdefghijklmnopqrst"));
   5763     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 1, S("abcdefghijklmnopqrst1"));
   5764     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 5, S("abcdefghijklmnopqrst12345"));
   5765     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 9, S("abcdefghijklmnopqrst123456789"));
   5766     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 10, S("abcdefghijklmnopqrst1234567890"));
   5767     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 10, 11, S("abcdefghijklmnopqrst1234567890"));
   5768     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 0, S("abcdefghijklmnopqrst"));
   5769     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 1, S("abcdefghijklmnopqrst0"));
   5770     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 19, 2, S("abcdefghijklmnopqrst0"));
   5771     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 0, S("abcdefghijklmnopqrst"));
   5772 }
   5773 
   5774 template <class S, class SV>
   5775 void test54()
   5776 {
   5777     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 20, 1, S("abcdefghijklmnopqrst"));
   5778     test(S("abcdefghijklmnopqrst"), 20, 1, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5779     test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 0, S("can't happen"));
   5780     test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 0, 1, S("can't happen"));
   5781     test(S("abcdefghijklmnopqrst"), 21, 0, SV(""), 1, 0, S("can't happen"));
   5782     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 0, S("can't happen"));
   5783     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 1, S("can't happen"));
   5784     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 2, S("can't happen"));
   5785     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 4, S("can't happen"));
   5786     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 5, S("can't happen"));
   5787     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 0, 6, S("can't happen"));
   5788     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 0, S("can't happen"));
   5789     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 1, S("can't happen"));
   5790     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 2, S("can't happen"));
   5791     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 3, S("can't happen"));
   5792     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 4, S("can't happen"));
   5793     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 1, 5, S("can't happen"));
   5794     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 0, S("can't happen"));
   5795     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 1, S("can't happen"));
   5796     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 2, S("can't happen"));
   5797     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 3, S("can't happen"));
   5798     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 2, 4, S("can't happen"));
   5799     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 0, S("can't happen"));
   5800     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 1, S("can't happen"));
   5801     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 4, 2, S("can't happen"));
   5802     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 5, 0, S("can't happen"));
   5803     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 5, 1, S("can't happen"));
   5804     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345"), 6, 0, S("can't happen"));
   5805     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 0, S("can't happen"));
   5806     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 1, S("can't happen"));
   5807     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 5, S("can't happen"));
   5808     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 9, S("can't happen"));
   5809     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 10, S("can't happen"));
   5810     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 0, 11, S("can't happen"));
   5811     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 0, S("can't happen"));
   5812     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 1, S("can't happen"));
   5813     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 4, S("can't happen"));
   5814     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 8, S("can't happen"));
   5815     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 9, S("can't happen"));
   5816     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 1, 10, S("can't happen"));
   5817     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 0, S("can't happen"));
   5818     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 1, S("can't happen"));
   5819     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 2, S("can't happen"));
   5820     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 4, S("can't happen"));
   5821     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 5, S("can't happen"));
   5822     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 5, 6, S("can't happen"));
   5823     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 0, S("can't happen"));
   5824     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 1, S("can't happen"));
   5825     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 9, 2, S("can't happen"));
   5826     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 10, 0, S("can't happen"));
   5827     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 10, 1, S("can't happen"));
   5828     test(S("abcdefghijklmnopqrst"), 21, 0, SV("1234567890"), 11, 0, S("can't happen"));
   5829     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 0, S("can't happen"));
   5830     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 1, S("can't happen"));
   5831     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 10, S("can't happen"));
   5832     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 19, S("can't happen"));
   5833     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 20, S("can't happen"));
   5834     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 0, 21, S("can't happen"));
   5835     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 0, S("can't happen"));
   5836     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 1, S("can't happen"));
   5837     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 9, S("can't happen"));
   5838     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 18, S("can't happen"));
   5839     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 19, S("can't happen"));
   5840     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 1, 20, S("can't happen"));
   5841     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 0, S("can't happen"));
   5842     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 1, S("can't happen"));
   5843     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 5, S("can't happen"));
   5844     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 9, S("can't happen"));
   5845     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 10, S("can't happen"));
   5846     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 10, 11, S("can't happen"));
   5847     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 0, S("can't happen"));
   5848     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 1, S("can't happen"));
   5849     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 19, 2, S("can't happen"));
   5850     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 0, S("can't happen"));
   5851     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 20, 1, S("can't happen"));
   5852     test(S("abcdefghijklmnopqrst"), 21, 0, SV("12345678901234567890"), 21, 0, S("can't happen"));
   5853 }
   5854 
   5855 template <class S, class SV>
   5856 void test55()
   5857 {
   5858     test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 10, S("abcdefghi1234567890"));
   5859     test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 19, S("abcdefghi0"));
   5860     test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, S("abcdefghi"));
   5861     test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 20, S("abcdefghi"));
   5862     test_npos(S("abcdefghij"), 9, 1, SV("12345678901234567890"), 21, S("can't happen"));
   5863     test_npos(S("abcdefghij"), 9, 2, SV(""), 0, S("abcdefghi"));
   5864     test_npos(S("abcdefghij"), 9, 2, SV(""), 1, S("can't happen"));
   5865     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 0, S("abcdefghi12345"));
   5866     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 1, S("abcdefghi2345"));
   5867     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 2, S("abcdefghi345"));
   5868     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 4, S("abcdefghi5"));
   5869     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 5, S("abcdefghi"));
   5870     test_npos(S("abcdefghij"), 9, 2, SV("12345"), 6, S("can't happen"));
   5871 }
   5872 
   5873 int main()
   5874 {
   5875     {
   5876     typedef std::string S;
   5877     typedef std::string_view SV;
   5878     test0<S, SV>();
   5879     test1<S, SV>();
   5880     test2<S, SV>();
   5881     test3<S, SV>();
   5882     test4<S, SV>();
   5883     test5<S, SV>();
   5884     test6<S, SV>();
   5885     test7<S, SV>();
   5886     test8<S, SV>();
   5887     test9<S, SV>();
   5888     test10<S, SV>();
   5889     test11<S, SV>();
   5890     test12<S, SV>();
   5891     test13<S, SV>();
   5892     test14<S, SV>();
   5893     test15<S, SV>();
   5894     test16<S, SV>();
   5895     test17<S, SV>();
   5896     test18<S, SV>();
   5897     test19<S, SV>();
   5898     test20<S, SV>();
   5899     test21<S, SV>();
   5900     test22<S, SV>();
   5901     test23<S, SV>();
   5902     test24<S, SV>();
   5903     test25<S, SV>();
   5904     test26<S, SV>();
   5905     test27<S, SV>();
   5906     test28<S, SV>();
   5907     test29<S, SV>();
   5908     test30<S, SV>();
   5909     test31<S, SV>();
   5910     test32<S, SV>();
   5911     test33<S, SV>();
   5912     test34<S, SV>();
   5913     test35<S, SV>();
   5914     test36<S, SV>();
   5915     test37<S, SV>();
   5916     test38<S, SV>();
   5917     test39<S, SV>();
   5918     test40<S, SV>();
   5919     test41<S, SV>();
   5920     test42<S, SV>();
   5921     test43<S, SV>();
   5922     test44<S, SV>();
   5923     test45<S, SV>();
   5924     test46<S, SV>();
   5925     test47<S, SV>();
   5926     test48<S, SV>();
   5927     test49<S, SV>();
   5928     test50<S, SV>();
   5929     test51<S, SV>();
   5930     test52<S, SV>();
   5931     test53<S, SV>();
   5932     test54<S, SV>();
   5933     test55<S, SV>();
   5934     }
   5935 #if TEST_STD_VER >= 11
   5936     {
   5937     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
   5938     typedef std::basic_string_view<char, std::char_traits<char>> SV;
   5939     test0<S, SV>();
   5940     test1<S, SV>();
   5941     test2<S, SV>();
   5942     test3<S, SV>();
   5943     test4<S, SV>();
   5944     test5<S, SV>();
   5945     test6<S, SV>();
   5946     test7<S, SV>();
   5947     test8<S, SV>();
   5948     test9<S, SV>();
   5949     test10<S, SV>();
   5950     test11<S, SV>();
   5951     test12<S, SV>();
   5952     test13<S, SV>();
   5953     test14<S, SV>();
   5954     test15<S, SV>();
   5955     test16<S, SV>();
   5956     test17<S, SV>();
   5957     test18<S, SV>();
   5958     test19<S, SV>();
   5959     test20<S, SV>();
   5960     test21<S, SV>();
   5961     test22<S, SV>();
   5962     test23<S, SV>();
   5963     test24<S, SV>();
   5964     test25<S, SV>();
   5965     test26<S, SV>();
   5966     test27<S, SV>();
   5967     test28<S, SV>();
   5968     test29<S, SV>();
   5969     test30<S, SV>();
   5970     test31<S, SV>();
   5971     test32<S, SV>();
   5972     test33<S, SV>();
   5973     test34<S, SV>();
   5974     test35<S, SV>();
   5975     test36<S, SV>();
   5976     test37<S, SV>();
   5977     test38<S, SV>();
   5978     test39<S, SV>();
   5979     test40<S, SV>();
   5980     test41<S, SV>();
   5981     test42<S, SV>();
   5982     test43<S, SV>();
   5983     test44<S, SV>();
   5984     test45<S, SV>();
   5985     test46<S, SV>();
   5986     test47<S, SV>();
   5987     test48<S, SV>();
   5988     test49<S, SV>();
   5989     test50<S, SV>();
   5990     test51<S, SV>();
   5991     test52<S, SV>();
   5992     test53<S, SV>();
   5993     test54<S, SV>();
   5994     test55<S, SV>();
   5995     }
   5996 #endif
   5997     {
   5998     typedef std::string S;
   5999     typedef std::string_view SV;
   6000     S s0 = "ABCD";
   6001     S s;
   6002     SV sv = "EFGH";
   6003     char arr[] = "IJKL";
   6004 
   6005     s = s0;
   6006     s.replace(0, 4, "CDEF", 0);    // calls replace(pos1, n1, const char *, len)
   6007     assert(s == "");
   6008 
   6009     s = s0;
   6010     s.replace(0, 4, "QRST", 0, std::string::npos); // calls replace(pos1, n1, string("QRST"), pos, npos)
   6011     assert(s == "QRST");
   6012 
   6013     s = s0;
   6014     s.replace(0, 4, sv, 0);  // calls replace(pos1, n1, T, pos, npos)
   6015     assert(s == sv);
   6016 
   6017     s = s0;
   6018     s.replace(0, 4, sv, 0, std::string::npos);   // calls replace(pos1, n1, T, pos, npos)
   6019     assert(s == sv);
   6020 
   6021     s = s0;
   6022     s.replace(0, 4, arr, 0);     // calls replace(pos1, n1, const char *, len)
   6023     assert(s == "");
   6024 
   6025     s = s0;
   6026     s.replace(0, 4, arr, 0, std::string::npos);    // calls replace(pos1, n1, string("IJKL"), pos, npos)
   6027     assert(s == "IJKL");
   6028     }
   6029 }
   6030