Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame^] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <string> |
| 11 | |
Howard Hinnant | 6e0a1f4 | 2010-08-22 00:47:54 +0000 | [diff] [blame] | 12 | // basic_string<charT,traits,Allocator>& |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 13 | // insert(size_type pos, const charT* s, size_type n); |
| 14 | |
| 15 | #include <string> |
| 16 | #include <stdexcept> |
| 17 | #include <cassert> |
| 18 | |
| 19 | template <class S> |
| 20 | void |
| 21 | test(S s, typename S::size_type pos, const typename S::value_type* str, |
| 22 | typename S::size_type n, S expected) |
| 23 | { |
| 24 | typename S::size_type old_size = s.size(); |
| 25 | S s0 = s; |
| 26 | try |
| 27 | { |
| 28 | s.insert(pos, str, n); |
| 29 | assert(s.__invariants()); |
| 30 | assert(pos <= old_size); |
| 31 | assert(s == expected); |
| 32 | } |
| 33 | catch (std::out_of_range&) |
| 34 | { |
| 35 | assert(pos > old_size); |
| 36 | assert(s == s0); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | int main() |
| 41 | { |
| 42 | typedef std::string S; |
| 43 | test(S(""), 0, "", 0, S("")); |
| 44 | test(S(""), 0, "12345", 0, S("")); |
| 45 | test(S(""), 0, "12345", 1, S("1")); |
| 46 | test(S(""), 0, "12345", 2, S("12")); |
| 47 | test(S(""), 0, "12345", 4, S("1234")); |
| 48 | test(S(""), 0, "12345", 5, S("12345")); |
| 49 | test(S(""), 0, "1234567890", 0, S("")); |
| 50 | test(S(""), 0, "1234567890", 1, S("1")); |
| 51 | test(S(""), 0, "1234567890", 5, S("12345")); |
| 52 | test(S(""), 0, "1234567890", 9, S("123456789")); |
| 53 | test(S(""), 0, "1234567890", 10, S("1234567890")); |
| 54 | test(S(""), 0, "12345678901234567890", 0, S("")); |
| 55 | test(S(""), 0, "12345678901234567890", 1, S("1")); |
| 56 | test(S(""), 0, "12345678901234567890", 10, S("1234567890")); |
| 57 | test(S(""), 0, "12345678901234567890", 19, S("1234567890123456789")); |
| 58 | test(S(""), 0, "12345678901234567890", 20, S("12345678901234567890")); |
| 59 | test(S(""), 1, "", 0, S("can't happen")); |
| 60 | test(S(""), 1, "12345", 0, S("can't happen")); |
| 61 | test(S(""), 1, "12345", 1, S("can't happen")); |
| 62 | test(S(""), 1, "12345", 2, S("can't happen")); |
| 63 | test(S(""), 1, "12345", 4, S("can't happen")); |
| 64 | test(S(""), 1, "12345", 5, S("can't happen")); |
| 65 | test(S(""), 1, "1234567890", 0, S("can't happen")); |
| 66 | test(S(""), 1, "1234567890", 1, S("can't happen")); |
| 67 | test(S(""), 1, "1234567890", 5, S("can't happen")); |
| 68 | test(S(""), 1, "1234567890", 9, S("can't happen")); |
| 69 | test(S(""), 1, "1234567890", 10, S("can't happen")); |
| 70 | test(S(""), 1, "12345678901234567890", 0, S("can't happen")); |
| 71 | test(S(""), 1, "12345678901234567890", 1, S("can't happen")); |
| 72 | test(S(""), 1, "12345678901234567890", 10, S("can't happen")); |
| 73 | test(S(""), 1, "12345678901234567890", 19, S("can't happen")); |
| 74 | test(S(""), 1, "12345678901234567890", 20, S("can't happen")); |
| 75 | test(S("abcde"), 0, "", 0, S("abcde")); |
| 76 | test(S("abcde"), 0, "12345", 0, S("abcde")); |
| 77 | test(S("abcde"), 0, "12345", 1, S("1abcde")); |
| 78 | test(S("abcde"), 0, "12345", 2, S("12abcde")); |
| 79 | test(S("abcde"), 0, "12345", 4, S("1234abcde")); |
| 80 | test(S("abcde"), 0, "12345", 5, S("12345abcde")); |
| 81 | test(S("abcde"), 0, "1234567890", 0, S("abcde")); |
| 82 | test(S("abcde"), 0, "1234567890", 1, S("1abcde")); |
| 83 | test(S("abcde"), 0, "1234567890", 5, S("12345abcde")); |
| 84 | test(S("abcde"), 0, "1234567890", 9, S("123456789abcde")); |
| 85 | test(S("abcde"), 0, "1234567890", 10, S("1234567890abcde")); |
| 86 | test(S("abcde"), 0, "12345678901234567890", 0, S("abcde")); |
| 87 | test(S("abcde"), 0, "12345678901234567890", 1, S("1abcde")); |
| 88 | test(S("abcde"), 0, "12345678901234567890", 10, S("1234567890abcde")); |
| 89 | test(S("abcde"), 0, "12345678901234567890", 19, S("1234567890123456789abcde")); |
| 90 | test(S("abcde"), 0, "12345678901234567890", 20, S("12345678901234567890abcde")); |
| 91 | test(S("abcde"), 1, "", 0, S("abcde")); |
| 92 | test(S("abcde"), 1, "12345", 0, S("abcde")); |
| 93 | test(S("abcde"), 1, "12345", 1, S("a1bcde")); |
| 94 | test(S("abcde"), 1, "12345", 2, S("a12bcde")); |
| 95 | test(S("abcde"), 1, "12345", 4, S("a1234bcde")); |
| 96 | test(S("abcde"), 1, "12345", 5, S("a12345bcde")); |
| 97 | test(S("abcde"), 1, "1234567890", 0, S("abcde")); |
| 98 | test(S("abcde"), 1, "1234567890", 1, S("a1bcde")); |
| 99 | test(S("abcde"), 1, "1234567890", 5, S("a12345bcde")); |
| 100 | test(S("abcde"), 1, "1234567890", 9, S("a123456789bcde")); |
| 101 | test(S("abcde"), 1, "1234567890", 10, S("a1234567890bcde")); |
| 102 | test(S("abcde"), 1, "12345678901234567890", 0, S("abcde")); |
| 103 | test(S("abcde"), 1, "12345678901234567890", 1, S("a1bcde")); |
| 104 | test(S("abcde"), 1, "12345678901234567890", 10, S("a1234567890bcde")); |
| 105 | test(S("abcde"), 1, "12345678901234567890", 19, S("a1234567890123456789bcde")); |
| 106 | test(S("abcde"), 1, "12345678901234567890", 20, S("a12345678901234567890bcde")); |
| 107 | test(S("abcde"), 2, "", 0, S("abcde")); |
| 108 | test(S("abcde"), 2, "12345", 0, S("abcde")); |
| 109 | test(S("abcde"), 2, "12345", 1, S("ab1cde")); |
| 110 | test(S("abcde"), 2, "12345", 2, S("ab12cde")); |
| 111 | test(S("abcde"), 2, "12345", 4, S("ab1234cde")); |
| 112 | test(S("abcde"), 2, "12345", 5, S("ab12345cde")); |
| 113 | test(S("abcde"), 2, "1234567890", 0, S("abcde")); |
| 114 | test(S("abcde"), 2, "1234567890", 1, S("ab1cde")); |
| 115 | test(S("abcde"), 2, "1234567890", 5, S("ab12345cde")); |
| 116 | test(S("abcde"), 2, "1234567890", 9, S("ab123456789cde")); |
| 117 | test(S("abcde"), 2, "1234567890", 10, S("ab1234567890cde")); |
| 118 | test(S("abcde"), 2, "12345678901234567890", 0, S("abcde")); |
| 119 | test(S("abcde"), 2, "12345678901234567890", 1, S("ab1cde")); |
| 120 | test(S("abcde"), 2, "12345678901234567890", 10, S("ab1234567890cde")); |
| 121 | test(S("abcde"), 2, "12345678901234567890", 19, S("ab1234567890123456789cde")); |
| 122 | test(S("abcde"), 2, "12345678901234567890", 20, S("ab12345678901234567890cde")); |
| 123 | test(S("abcde"), 4, "", 0, S("abcde")); |
| 124 | test(S("abcde"), 4, "12345", 0, S("abcde")); |
| 125 | test(S("abcde"), 4, "12345", 1, S("abcd1e")); |
| 126 | test(S("abcde"), 4, "12345", 2, S("abcd12e")); |
| 127 | test(S("abcde"), 4, "12345", 4, S("abcd1234e")); |
| 128 | test(S("abcde"), 4, "12345", 5, S("abcd12345e")); |
| 129 | test(S("abcde"), 4, "1234567890", 0, S("abcde")); |
| 130 | test(S("abcde"), 4, "1234567890", 1, S("abcd1e")); |
| 131 | test(S("abcde"), 4, "1234567890", 5, S("abcd12345e")); |
| 132 | test(S("abcde"), 4, "1234567890", 9, S("abcd123456789e")); |
| 133 | test(S("abcde"), 4, "1234567890", 10, S("abcd1234567890e")); |
| 134 | test(S("abcde"), 4, "12345678901234567890", 0, S("abcde")); |
| 135 | test(S("abcde"), 4, "12345678901234567890", 1, S("abcd1e")); |
| 136 | test(S("abcde"), 4, "12345678901234567890", 10, S("abcd1234567890e")); |
| 137 | test(S("abcde"), 4, "12345678901234567890", 19, S("abcd1234567890123456789e")); |
| 138 | test(S("abcde"), 4, "12345678901234567890", 20, S("abcd12345678901234567890e")); |
| 139 | test(S("abcde"), 5, "", 0, S("abcde")); |
| 140 | test(S("abcde"), 5, "12345", 0, S("abcde")); |
| 141 | test(S("abcde"), 5, "12345", 1, S("abcde1")); |
| 142 | test(S("abcde"), 5, "12345", 2, S("abcde12")); |
| 143 | test(S("abcde"), 5, "12345", 4, S("abcde1234")); |
| 144 | test(S("abcde"), 5, "12345", 5, S("abcde12345")); |
| 145 | test(S("abcde"), 5, "1234567890", 0, S("abcde")); |
| 146 | test(S("abcde"), 5, "1234567890", 1, S("abcde1")); |
| 147 | test(S("abcde"), 5, "1234567890", 5, S("abcde12345")); |
| 148 | test(S("abcde"), 5, "1234567890", 9, S("abcde123456789")); |
| 149 | test(S("abcde"), 5, "1234567890", 10, S("abcde1234567890")); |
| 150 | test(S("abcde"), 5, "12345678901234567890", 0, S("abcde")); |
| 151 | test(S("abcde"), 5, "12345678901234567890", 1, S("abcde1")); |
| 152 | test(S("abcde"), 5, "12345678901234567890", 10, S("abcde1234567890")); |
| 153 | test(S("abcde"), 5, "12345678901234567890", 19, S("abcde1234567890123456789")); |
| 154 | test(S("abcde"), 5, "12345678901234567890", 20, S("abcde12345678901234567890")); |
| 155 | test(S("abcde"), 6, "", 0, S("can't happen")); |
| 156 | test(S("abcde"), 6, "12345", 0, S("can't happen")); |
| 157 | test(S("abcde"), 6, "12345", 1, S("can't happen")); |
| 158 | test(S("abcde"), 6, "12345", 2, S("can't happen")); |
| 159 | test(S("abcde"), 6, "12345", 4, S("can't happen")); |
| 160 | test(S("abcde"), 6, "12345", 5, S("can't happen")); |
| 161 | test(S("abcde"), 6, "1234567890", 0, S("can't happen")); |
| 162 | test(S("abcde"), 6, "1234567890", 1, S("can't happen")); |
| 163 | test(S("abcde"), 6, "1234567890", 5, S("can't happen")); |
| 164 | test(S("abcde"), 6, "1234567890", 9, S("can't happen")); |
| 165 | test(S("abcde"), 6, "1234567890", 10, S("can't happen")); |
| 166 | test(S("abcde"), 6, "12345678901234567890", 0, S("can't happen")); |
| 167 | test(S("abcde"), 6, "12345678901234567890", 1, S("can't happen")); |
| 168 | test(S("abcde"), 6, "12345678901234567890", 10, S("can't happen")); |
| 169 | test(S("abcde"), 6, "12345678901234567890", 19, S("can't happen")); |
| 170 | test(S("abcde"), 6, "12345678901234567890", 20, S("can't happen")); |
| 171 | test(S("abcdefghij"), 0, "", 0, S("abcdefghij")); |
| 172 | test(S("abcdefghij"), 0, "12345", 0, S("abcdefghij")); |
| 173 | test(S("abcdefghij"), 0, "12345", 1, S("1abcdefghij")); |
| 174 | test(S("abcdefghij"), 0, "12345", 2, S("12abcdefghij")); |
| 175 | test(S("abcdefghij"), 0, "12345", 4, S("1234abcdefghij")); |
| 176 | test(S("abcdefghij"), 0, "12345", 5, S("12345abcdefghij")); |
| 177 | test(S("abcdefghij"), 0, "1234567890", 0, S("abcdefghij")); |
| 178 | test(S("abcdefghij"), 0, "1234567890", 1, S("1abcdefghij")); |
| 179 | test(S("abcdefghij"), 0, "1234567890", 5, S("12345abcdefghij")); |
| 180 | test(S("abcdefghij"), 0, "1234567890", 9, S("123456789abcdefghij")); |
| 181 | test(S("abcdefghij"), 0, "1234567890", 10, S("1234567890abcdefghij")); |
| 182 | test(S("abcdefghij"), 0, "12345678901234567890", 0, S("abcdefghij")); |
| 183 | test(S("abcdefghij"), 0, "12345678901234567890", 1, S("1abcdefghij")); |
| 184 | test(S("abcdefghij"), 0, "12345678901234567890", 10, S("1234567890abcdefghij")); |
| 185 | test(S("abcdefghij"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghij")); |
| 186 | test(S("abcdefghij"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghij")); |
| 187 | test(S("abcdefghij"), 1, "", 0, S("abcdefghij")); |
| 188 | test(S("abcdefghij"), 1, "12345", 0, S("abcdefghij")); |
| 189 | test(S("abcdefghij"), 1, "12345", 1, S("a1bcdefghij")); |
| 190 | test(S("abcdefghij"), 1, "12345", 2, S("a12bcdefghij")); |
| 191 | test(S("abcdefghij"), 1, "12345", 4, S("a1234bcdefghij")); |
| 192 | test(S("abcdefghij"), 1, "12345", 5, S("a12345bcdefghij")); |
| 193 | test(S("abcdefghij"), 1, "1234567890", 0, S("abcdefghij")); |
| 194 | test(S("abcdefghij"), 1, "1234567890", 1, S("a1bcdefghij")); |
| 195 | test(S("abcdefghij"), 1, "1234567890", 5, S("a12345bcdefghij")); |
| 196 | test(S("abcdefghij"), 1, "1234567890", 9, S("a123456789bcdefghij")); |
| 197 | test(S("abcdefghij"), 1, "1234567890", 10, S("a1234567890bcdefghij")); |
| 198 | test(S("abcdefghij"), 1, "12345678901234567890", 0, S("abcdefghij")); |
| 199 | test(S("abcdefghij"), 1, "12345678901234567890", 1, S("a1bcdefghij")); |
| 200 | test(S("abcdefghij"), 1, "12345678901234567890", 10, S("a1234567890bcdefghij")); |
| 201 | test(S("abcdefghij"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghij")); |
| 202 | test(S("abcdefghij"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghij")); |
| 203 | test(S("abcdefghij"), 5, "", 0, S("abcdefghij")); |
| 204 | test(S("abcdefghij"), 5, "12345", 0, S("abcdefghij")); |
| 205 | test(S("abcdefghij"), 5, "12345", 1, S("abcde1fghij")); |
| 206 | test(S("abcdefghij"), 5, "12345", 2, S("abcde12fghij")); |
| 207 | test(S("abcdefghij"), 5, "12345", 4, S("abcde1234fghij")); |
| 208 | test(S("abcdefghij"), 5, "12345", 5, S("abcde12345fghij")); |
| 209 | test(S("abcdefghij"), 5, "1234567890", 0, S("abcdefghij")); |
| 210 | test(S("abcdefghij"), 5, "1234567890", 1, S("abcde1fghij")); |
| 211 | test(S("abcdefghij"), 5, "1234567890", 5, S("abcde12345fghij")); |
| 212 | test(S("abcdefghij"), 5, "1234567890", 9, S("abcde123456789fghij")); |
| 213 | test(S("abcdefghij"), 5, "1234567890", 10, S("abcde1234567890fghij")); |
| 214 | test(S("abcdefghij"), 5, "12345678901234567890", 0, S("abcdefghij")); |
| 215 | test(S("abcdefghij"), 5, "12345678901234567890", 1, S("abcde1fghij")); |
| 216 | test(S("abcdefghij"), 5, "12345678901234567890", 10, S("abcde1234567890fghij")); |
| 217 | test(S("abcdefghij"), 5, "12345678901234567890", 19, S("abcde1234567890123456789fghij")); |
| 218 | test(S("abcdefghij"), 5, "12345678901234567890", 20, S("abcde12345678901234567890fghij")); |
| 219 | test(S("abcdefghij"), 9, "", 0, S("abcdefghij")); |
| 220 | test(S("abcdefghij"), 9, "12345", 0, S("abcdefghij")); |
| 221 | test(S("abcdefghij"), 9, "12345", 1, S("abcdefghi1j")); |
| 222 | test(S("abcdefghij"), 9, "12345", 2, S("abcdefghi12j")); |
| 223 | test(S("abcdefghij"), 9, "12345", 4, S("abcdefghi1234j")); |
| 224 | test(S("abcdefghij"), 9, "12345", 5, S("abcdefghi12345j")); |
| 225 | test(S("abcdefghij"), 9, "1234567890", 0, S("abcdefghij")); |
| 226 | test(S("abcdefghij"), 9, "1234567890", 1, S("abcdefghi1j")); |
| 227 | test(S("abcdefghij"), 9, "1234567890", 5, S("abcdefghi12345j")); |
| 228 | test(S("abcdefghij"), 9, "1234567890", 9, S("abcdefghi123456789j")); |
| 229 | test(S("abcdefghij"), 9, "1234567890", 10, S("abcdefghi1234567890j")); |
| 230 | test(S("abcdefghij"), 9, "12345678901234567890", 0, S("abcdefghij")); |
| 231 | test(S("abcdefghij"), 9, "12345678901234567890", 1, S("abcdefghi1j")); |
| 232 | test(S("abcdefghij"), 9, "12345678901234567890", 10, S("abcdefghi1234567890j")); |
| 233 | test(S("abcdefghij"), 9, "12345678901234567890", 19, S("abcdefghi1234567890123456789j")); |
| 234 | test(S("abcdefghij"), 9, "12345678901234567890", 20, S("abcdefghi12345678901234567890j")); |
| 235 | test(S("abcdefghij"), 10, "", 0, S("abcdefghij")); |
| 236 | test(S("abcdefghij"), 10, "12345", 0, S("abcdefghij")); |
| 237 | test(S("abcdefghij"), 10, "12345", 1, S("abcdefghij1")); |
| 238 | test(S("abcdefghij"), 10, "12345", 2, S("abcdefghij12")); |
| 239 | test(S("abcdefghij"), 10, "12345", 4, S("abcdefghij1234")); |
| 240 | test(S("abcdefghij"), 10, "12345", 5, S("abcdefghij12345")); |
| 241 | test(S("abcdefghij"), 10, "1234567890", 0, S("abcdefghij")); |
| 242 | test(S("abcdefghij"), 10, "1234567890", 1, S("abcdefghij1")); |
| 243 | test(S("abcdefghij"), 10, "1234567890", 5, S("abcdefghij12345")); |
| 244 | test(S("abcdefghij"), 10, "1234567890", 9, S("abcdefghij123456789")); |
| 245 | test(S("abcdefghij"), 10, "1234567890", 10, S("abcdefghij1234567890")); |
| 246 | test(S("abcdefghij"), 10, "12345678901234567890", 0, S("abcdefghij")); |
| 247 | test(S("abcdefghij"), 10, "12345678901234567890", 1, S("abcdefghij1")); |
| 248 | test(S("abcdefghij"), 10, "12345678901234567890", 10, S("abcdefghij1234567890")); |
| 249 | test(S("abcdefghij"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789")); |
| 250 | test(S("abcdefghij"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890")); |
| 251 | test(S("abcdefghij"), 11, "", 0, S("can't happen")); |
| 252 | test(S("abcdefghij"), 11, "12345", 0, S("can't happen")); |
| 253 | test(S("abcdefghij"), 11, "12345", 1, S("can't happen")); |
| 254 | test(S("abcdefghij"), 11, "12345", 2, S("can't happen")); |
| 255 | test(S("abcdefghij"), 11, "12345", 4, S("can't happen")); |
| 256 | test(S("abcdefghij"), 11, "12345", 5, S("can't happen")); |
| 257 | test(S("abcdefghij"), 11, "1234567890", 0, S("can't happen")); |
| 258 | test(S("abcdefghij"), 11, "1234567890", 1, S("can't happen")); |
| 259 | test(S("abcdefghij"), 11, "1234567890", 5, S("can't happen")); |
| 260 | test(S("abcdefghij"), 11, "1234567890", 9, S("can't happen")); |
| 261 | test(S("abcdefghij"), 11, "1234567890", 10, S("can't happen")); |
| 262 | test(S("abcdefghij"), 11, "12345678901234567890", 0, S("can't happen")); |
| 263 | test(S("abcdefghij"), 11, "12345678901234567890", 1, S("can't happen")); |
| 264 | test(S("abcdefghij"), 11, "12345678901234567890", 10, S("can't happen")); |
| 265 | test(S("abcdefghij"), 11, "12345678901234567890", 19, S("can't happen")); |
| 266 | test(S("abcdefghij"), 11, "12345678901234567890", 20, S("can't happen")); |
| 267 | test(S("abcdefghijklmnopqrst"), 0, "", 0, S("abcdefghijklmnopqrst")); |
| 268 | test(S("abcdefghijklmnopqrst"), 0, "12345", 0, S("abcdefghijklmnopqrst")); |
| 269 | test(S("abcdefghijklmnopqrst"), 0, "12345", 1, S("1abcdefghijklmnopqrst")); |
| 270 | test(S("abcdefghijklmnopqrst"), 0, "12345", 2, S("12abcdefghijklmnopqrst")); |
| 271 | test(S("abcdefghijklmnopqrst"), 0, "12345", 4, S("1234abcdefghijklmnopqrst")); |
| 272 | test(S("abcdefghijklmnopqrst"), 0, "12345", 5, S("12345abcdefghijklmnopqrst")); |
| 273 | test(S("abcdefghijklmnopqrst"), 0, "1234567890", 0, S("abcdefghijklmnopqrst")); |
| 274 | test(S("abcdefghijklmnopqrst"), 0, "1234567890", 1, S("1abcdefghijklmnopqrst")); |
| 275 | test(S("abcdefghijklmnopqrst"), 0, "1234567890", 5, S("12345abcdefghijklmnopqrst")); |
| 276 | test(S("abcdefghijklmnopqrst"), 0, "1234567890", 9, S("123456789abcdefghijklmnopqrst")); |
| 277 | test(S("abcdefghijklmnopqrst"), 0, "1234567890", 10, S("1234567890abcdefghijklmnopqrst")); |
| 278 | test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); |
| 279 | test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 1, S("1abcdefghijklmnopqrst")); |
| 280 | test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 10, S("1234567890abcdefghijklmnopqrst")); |
| 281 | test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 19, S("1234567890123456789abcdefghijklmnopqrst")); |
| 282 | test(S("abcdefghijklmnopqrst"), 0, "12345678901234567890", 20, S("12345678901234567890abcdefghijklmnopqrst")); |
| 283 | test(S("abcdefghijklmnopqrst"), 1, "", 0, S("abcdefghijklmnopqrst")); |
| 284 | test(S("abcdefghijklmnopqrst"), 1, "12345", 0, S("abcdefghijklmnopqrst")); |
| 285 | test(S("abcdefghijklmnopqrst"), 1, "12345", 1, S("a1bcdefghijklmnopqrst")); |
| 286 | test(S("abcdefghijklmnopqrst"), 1, "12345", 2, S("a12bcdefghijklmnopqrst")); |
| 287 | test(S("abcdefghijklmnopqrst"), 1, "12345", 4, S("a1234bcdefghijklmnopqrst")); |
| 288 | test(S("abcdefghijklmnopqrst"), 1, "12345", 5, S("a12345bcdefghijklmnopqrst")); |
| 289 | test(S("abcdefghijklmnopqrst"), 1, "1234567890", 0, S("abcdefghijklmnopqrst")); |
| 290 | test(S("abcdefghijklmnopqrst"), 1, "1234567890", 1, S("a1bcdefghijklmnopqrst")); |
| 291 | test(S("abcdefghijklmnopqrst"), 1, "1234567890", 5, S("a12345bcdefghijklmnopqrst")); |
| 292 | test(S("abcdefghijklmnopqrst"), 1, "1234567890", 9, S("a123456789bcdefghijklmnopqrst")); |
| 293 | test(S("abcdefghijklmnopqrst"), 1, "1234567890", 10, S("a1234567890bcdefghijklmnopqrst")); |
| 294 | test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); |
| 295 | test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 1, S("a1bcdefghijklmnopqrst")); |
| 296 | test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 10, S("a1234567890bcdefghijklmnopqrst")); |
| 297 | test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 19, S("a1234567890123456789bcdefghijklmnopqrst")); |
| 298 | test(S("abcdefghijklmnopqrst"), 1, "12345678901234567890", 20, S("a12345678901234567890bcdefghijklmnopqrst")); |
| 299 | test(S("abcdefghijklmnopqrst"), 10, "", 0, S("abcdefghijklmnopqrst")); |
| 300 | test(S("abcdefghijklmnopqrst"), 10, "12345", 0, S("abcdefghijklmnopqrst")); |
| 301 | test(S("abcdefghijklmnopqrst"), 10, "12345", 1, S("abcdefghij1klmnopqrst")); |
| 302 | test(S("abcdefghijklmnopqrst"), 10, "12345", 2, S("abcdefghij12klmnopqrst")); |
| 303 | test(S("abcdefghijklmnopqrst"), 10, "12345", 4, S("abcdefghij1234klmnopqrst")); |
| 304 | test(S("abcdefghijklmnopqrst"), 10, "12345", 5, S("abcdefghij12345klmnopqrst")); |
| 305 | test(S("abcdefghijklmnopqrst"), 10, "1234567890", 0, S("abcdefghijklmnopqrst")); |
| 306 | test(S("abcdefghijklmnopqrst"), 10, "1234567890", 1, S("abcdefghij1klmnopqrst")); |
| 307 | test(S("abcdefghijklmnopqrst"), 10, "1234567890", 5, S("abcdefghij12345klmnopqrst")); |
| 308 | test(S("abcdefghijklmnopqrst"), 10, "1234567890", 9, S("abcdefghij123456789klmnopqrst")); |
| 309 | test(S("abcdefghijklmnopqrst"), 10, "1234567890", 10, S("abcdefghij1234567890klmnopqrst")); |
| 310 | test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); |
| 311 | test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 1, S("abcdefghij1klmnopqrst")); |
| 312 | test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 10, S("abcdefghij1234567890klmnopqrst")); |
| 313 | test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 19, S("abcdefghij1234567890123456789klmnopqrst")); |
| 314 | test(S("abcdefghijklmnopqrst"), 10, "12345678901234567890", 20, S("abcdefghij12345678901234567890klmnopqrst")); |
| 315 | test(S("abcdefghijklmnopqrst"), 19, "", 0, S("abcdefghijklmnopqrst")); |
| 316 | test(S("abcdefghijklmnopqrst"), 19, "12345", 0, S("abcdefghijklmnopqrst")); |
| 317 | test(S("abcdefghijklmnopqrst"), 19, "12345", 1, S("abcdefghijklmnopqrs1t")); |
| 318 | test(S("abcdefghijklmnopqrst"), 19, "12345", 2, S("abcdefghijklmnopqrs12t")); |
| 319 | test(S("abcdefghijklmnopqrst"), 19, "12345", 4, S("abcdefghijklmnopqrs1234t")); |
| 320 | test(S("abcdefghijklmnopqrst"), 19, "12345", 5, S("abcdefghijklmnopqrs12345t")); |
| 321 | test(S("abcdefghijklmnopqrst"), 19, "1234567890", 0, S("abcdefghijklmnopqrst")); |
| 322 | test(S("abcdefghijklmnopqrst"), 19, "1234567890", 1, S("abcdefghijklmnopqrs1t")); |
| 323 | test(S("abcdefghijklmnopqrst"), 19, "1234567890", 5, S("abcdefghijklmnopqrs12345t")); |
| 324 | test(S("abcdefghijklmnopqrst"), 19, "1234567890", 9, S("abcdefghijklmnopqrs123456789t")); |
| 325 | test(S("abcdefghijklmnopqrst"), 19, "1234567890", 10, S("abcdefghijklmnopqrs1234567890t")); |
| 326 | test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); |
| 327 | test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 1, S("abcdefghijklmnopqrs1t")); |
| 328 | test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 10, S("abcdefghijklmnopqrs1234567890t")); |
| 329 | test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 19, S("abcdefghijklmnopqrs1234567890123456789t")); |
| 330 | test(S("abcdefghijklmnopqrst"), 19, "12345678901234567890", 20, S("abcdefghijklmnopqrs12345678901234567890t")); |
| 331 | test(S("abcdefghijklmnopqrst"), 20, "", 0, S("abcdefghijklmnopqrst")); |
| 332 | test(S("abcdefghijklmnopqrst"), 20, "12345", 0, S("abcdefghijklmnopqrst")); |
| 333 | test(S("abcdefghijklmnopqrst"), 20, "12345", 1, S("abcdefghijklmnopqrst1")); |
| 334 | test(S("abcdefghijklmnopqrst"), 20, "12345", 2, S("abcdefghijklmnopqrst12")); |
| 335 | test(S("abcdefghijklmnopqrst"), 20, "12345", 4, S("abcdefghijklmnopqrst1234")); |
| 336 | test(S("abcdefghijklmnopqrst"), 20, "12345", 5, S("abcdefghijklmnopqrst12345")); |
| 337 | test(S("abcdefghijklmnopqrst"), 20, "1234567890", 0, S("abcdefghijklmnopqrst")); |
| 338 | test(S("abcdefghijklmnopqrst"), 20, "1234567890", 1, S("abcdefghijklmnopqrst1")); |
| 339 | test(S("abcdefghijklmnopqrst"), 20, "1234567890", 5, S("abcdefghijklmnopqrst12345")); |
| 340 | test(S("abcdefghijklmnopqrst"), 20, "1234567890", 9, S("abcdefghijklmnopqrst123456789")); |
| 341 | test(S("abcdefghijklmnopqrst"), 20, "1234567890", 10, S("abcdefghijklmnopqrst1234567890")); |
| 342 | test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 0, S("abcdefghijklmnopqrst")); |
| 343 | test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 1, S("abcdefghijklmnopqrst1")); |
| 344 | test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 10, S("abcdefghijklmnopqrst1234567890")); |
| 345 | test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 19, S("abcdefghijklmnopqrst1234567890123456789")); |
| 346 | test(S("abcdefghijklmnopqrst"), 20, "12345678901234567890", 20, S("abcdefghijklmnopqrst12345678901234567890")); |
| 347 | test(S("abcdefghijklmnopqrst"), 21, "", 0, S("can't happen")); |
| 348 | test(S("abcdefghijklmnopqrst"), 21, "12345", 0, S("can't happen")); |
| 349 | test(S("abcdefghijklmnopqrst"), 21, "12345", 1, S("can't happen")); |
| 350 | test(S("abcdefghijklmnopqrst"), 21, "12345", 2, S("can't happen")); |
| 351 | test(S("abcdefghijklmnopqrst"), 21, "12345", 4, S("can't happen")); |
| 352 | test(S("abcdefghijklmnopqrst"), 21, "12345", 5, S("can't happen")); |
| 353 | test(S("abcdefghijklmnopqrst"), 21, "1234567890", 0, S("can't happen")); |
| 354 | test(S("abcdefghijklmnopqrst"), 21, "1234567890", 1, S("can't happen")); |
| 355 | test(S("abcdefghijklmnopqrst"), 21, "1234567890", 5, S("can't happen")); |
| 356 | test(S("abcdefghijklmnopqrst"), 21, "1234567890", 9, S("can't happen")); |
| 357 | test(S("abcdefghijklmnopqrst"), 21, "1234567890", 10, S("can't happen")); |
| 358 | test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 0, S("can't happen")); |
| 359 | test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 1, S("can't happen")); |
| 360 | test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 10, S("can't happen")); |
| 361 | test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen")); |
| 362 | test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen")); |
| 363 | } |