Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison tests/farray-array.t @ 596:1b40b875b281
farray.sh: farray_set() now accepts general indices
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 18 Sep 2024 16:44:47 +0200 |
| parents | 4babcf9abc1a |
| children | 46ff12cfeed0 |
comparison
equal
deleted
inserted
replaced
| 595:24f4dccaea45 | 596:1b40b875b281 |
|---|---|
| 230 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | 230 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 |
| 231 $ ( farray_del TEST 7 ) | 231 $ ( farray_del TEST 7 ) |
| 232 ERROR: array index out of bounds | 232 ERROR: array index out of bounds |
| 233 [70] | 233 [70] |
| 234 | 234 |
| 235 $ farray_destroy TEST | |
| 236 $ check_no_array_artifacts | |
| 237 | |
| 238 | |
| 239 Setting | |
| 240 ======= | |
| 241 | |
| 242 Append (relative) | |
| 243 | |
| 244 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 245 $ farray_set TEST "" $'the new value \\ \'' | |
| 246 $ farray_debug TEST | |
| 247 DEBUG: array `TEST' has length 7 | |
| 248 DEBUG: its contents: | |
| 249 DEBUG: 1: `0' | |
| 250 DEBUG: 2: `1' | |
| 251 DEBUG: 3: `2' | |
| 252 DEBUG: 4: `3 4 5' | |
| 253 DEBUG: 5: `" 678" \'910 ' | |
| 254 DEBUG: 6: `11' | |
| 255 DEBUG: 7: `the new value \ '' | |
| 256 $ farray_destroy TEST | |
| 257 $ check_no_array_artifacts | |
| 258 | |
| 259 Append (explicit) | |
| 260 | |
| 261 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 262 $ farray_set TEST 7 $'the new value \\ \'' | |
| 263 $ farray_debug TEST | |
| 264 DEBUG: array `TEST' has length 7 | |
| 265 DEBUG: its contents: | |
| 266 DEBUG: 1: `0' | |
| 267 DEBUG: 2: `1' | |
| 268 DEBUG: 3: `2' | |
| 269 DEBUG: 4: `3 4 5' | |
| 270 DEBUG: 5: `" 678" \'910 ' | |
| 271 DEBUG: 6: `11' | |
| 272 DEBUG: 7: `the new value \ '' | |
| 273 $ farray_destroy TEST | |
| 274 $ check_no_array_artifacts | |
| 275 | |
| 276 Replace the last element | |
| 277 | |
| 278 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 279 $ farray_set TEST 0 $'the new replaced value \\ \'' | |
| 280 $ farray_debug TEST | |
| 281 DEBUG: array `TEST' has length 6 | |
| 282 DEBUG: its contents: | |
| 283 DEBUG: 1: `0' | |
| 284 DEBUG: 2: `1' | |
| 285 DEBUG: 3: `2' | |
| 286 DEBUG: 4: `3 4 5' | |
| 287 DEBUG: 5: `" 678" \'910 ' | |
| 288 DEBUG: 6: `the new replaced value \ '' | |
| 289 $ farray_destroy TEST | |
| 290 $ check_no_array_artifacts | |
| 291 | |
| 292 Replace the first element | |
| 293 | |
| 294 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 295 $ farray_set TEST 1 $'the new replaced value \\ \'' | |
| 296 $ farray_debug TEST | |
| 297 DEBUG: array `TEST' has length 6 | |
| 298 DEBUG: its contents: | |
| 299 DEBUG: 1: `the new replaced value \ '' | |
| 300 DEBUG: 2: `1' | |
| 301 DEBUG: 3: `2' | |
| 302 DEBUG: 4: `3 4 5' | |
| 303 DEBUG: 5: `" 678" \'910 ' | |
| 304 DEBUG: 6: `11' | |
| 305 $ farray_destroy TEST | |
| 306 $ check_no_array_artifacts | |
| 307 | |
| 308 Replace some element in the middle | |
| 309 | |
| 310 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 311 $ farray_set TEST 5 $'the new replaced value \\ \' 2 ' | |
| 312 $ farray_debug TEST | |
| 313 DEBUG: array `TEST' has length 6 | |
| 314 DEBUG: its contents: | |
| 315 DEBUG: 1: `0' | |
| 316 DEBUG: 2: `1' | |
| 317 DEBUG: 3: `2' | |
| 318 DEBUG: 4: `3 4 5' | |
| 319 DEBUG: 5: `the new replaced value \ ' 2 ' | |
| 320 DEBUG: 6: `11' | |
| 321 $ farray_destroy TEST | |
| 322 $ check_no_array_artifacts | |
| 323 | |
| 324 Out of bounds | |
| 325 | |
| 326 $ farray_create TEST 0 1 2 '3 4 5' $'" 678" \\\'910 ' 11 | |
| 327 $ ( farray_set TEST 8 ) | |
| 328 ERROR: array index out of bounds (cannot create holes) | |
| 329 [70] | |
| 235 $ farray_destroy TEST | 330 $ farray_destroy TEST |
| 236 $ check_no_array_artifacts | 331 $ check_no_array_artifacts |
| 237 | 332 |
| 238 | 333 |
| 239 Splicing | 334 Splicing |
