Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate tests/farray-alist.t @ 751:4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 10 Oct 2024 14:04:16 +0200 |
| parents | 7e2279d6db0f |
| children | 33df05108ba1 |
| rev | line source |
|---|---|
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 Basic tests of farray.sh's falist_XXX functions |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 Shell is /bin/sh. |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 Setup |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 ===== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 $ set -u |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 $ . "${TESTDIR}/testsetup.sh" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 $ _p_datadir="${TESTDIR}/../share/local-bsdtools" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 $ . "${_p_datadir}/farray.sh" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 Basic Creation and Destruction |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 ============================== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 Create an empty alist |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 $ test "${_i}" -eq 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 0 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
28 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
29 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
31 DEBUG: alist `LIST' has length 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
33 $ falist_release LIST |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
34 $ ( falist_release LIST ) |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
35 ERROR: object `LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 Clear |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 ===== |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 $ falist_create LIST |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
45 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
46 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 $ falist_set LIST K1 V1 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
48 $ falist_istrue LIST |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
49 $ falist_set LIST K2 V2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 DEBUG: alist `LIST' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
52 DEBUG: the items: |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 DEBUG: `K2' -> `V2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
55 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
56 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
57 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
60 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
61 $ falist_clear LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
62 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
63 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
64 0 |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
65 $ falist_istrue LIST |
|
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
66 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
67 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 0 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
70 $ falist_release LIST |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
71 $ falist_istrue LIST |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
72 ERROR: object `LIST' not created properly: token empty |
|
651
57ee25cec0dd
farray.sh: farray_istrue() and falist_istrue(): truth tests for arrays and alists.
Franz Glasner <fzglas.hg@dom66.de>
parents:
615
diff
changeset
|
73 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
74 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
75 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 |
|
745
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
77 Get / Set / Contains / Find Index |
|
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
78 ================================= |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
79 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
80 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
81 $ falist_set LIST K1 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
82 $ falist_set LIST K2 V2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
83 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
84 DEBUG: alist `LIST' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
85 DEBUG: the items: |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
86 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
87 DEBUG: `K2' -> `V2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
88 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
89 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
90 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
91 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
92 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
93 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
94 $ falist_set LIST K2 "V2 2" |
|
718
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
95 $ falist_set_unique LIST K2 "V2 duplicate" |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
96 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
97 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
98 $ falist_debug LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
99 DEBUG: alist `LIST' has length 3 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
100 DEBUG: the items: |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
101 DEBUG: `K1' -> `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
102 DEBUG: `K2' -> `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
103 DEBUG: `K3' -> `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
104 $ falist_length _i LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
105 $ echo "$_i" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
106 3 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
107 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
108 3 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
109 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
110 $ falist_contains LIST K1 |
|
745
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
111 $ falist_find idx LIST K1 |
|
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
112 $ test "$idx" -eq 1 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
113 $ falist_contains LIST K |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
114 [1] |
|
745
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
115 $ falist_find idx LIST K |
|
a5918c859fe9
farray.sh: Implement falist_find() -- a variant of falist_contains() that also returns the found index proper
Franz Glasner <fzglas.hg@dom66.de>
parents:
743
diff
changeset
|
116 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
117 $ falist_get _var LIST K2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
118 $ echo "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
119 V2 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
120 $ falist_tryget _var LIST K1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
121 $ echo "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
122 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
123 $ falist_tryget _i LIST K |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
124 [1] |
|
746
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
125 |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
126 $ falist_get _var LIST K2 _idx |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
127 $ echo "$_var" |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
128 V2 2 |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
129 $ echo "$_idx" |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
130 2 |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
131 $ falist_tryget _var LIST K1 _idx |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
132 $ echo "$_var" |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
133 V1 |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
134 $ echo "$_idx" |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
135 1 |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
136 $ falist_tryget _i LIST K _idx |
|
7e2279d6db0f
farray.sh: falist_get() and falist_tryget() now optionally can store the index of the found item into a variable also
Franz Glasner <fzglas.hg@dom66.de>
parents:
745
diff
changeset
|
137 [1] |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
138 $ _var="$(falist_print_length NON_EXISTING_LIST)" |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
139 ERROR: object `NON_EXISTING_LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
140 $ echo "${_var}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
141 -1 |
|
718
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
142 $ falist_set_unique LIST K4 "V4" |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
143 $ falist_debug LIST |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
144 DEBUG: alist `LIST' has length 4 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
145 DEBUG: the items: |
|
718
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
146 DEBUG: `K1' -> `V1' |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
147 DEBUG: `K2' -> `V2 2' |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
148 DEBUG: `K3' -> `" 111222333" \'444555 ' |
|
2502e077d5e9
farray.sh: Implement "falist_set_unique()" that does not overwrite existing key-value pairs
Franz Glasner <fzglas.hg@dom66.de>
parents:
717
diff
changeset
|
149 DEBUG: `K4' -> `V4' |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
150 $ falist_release LIST |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
151 $ check_no_alist_artifacts |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
152 |
|
751
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
153 Special case empty list (because of start/stop extra indexes) |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
154 |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
155 $ falist_create LIST |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
156 $ falist_find _var LIST foo |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
157 [1] |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
158 $ falist_release LIST |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
159 $ check_no_alist_artifacts |
|
4101e755b3e7
farray.sh: extra tests for falist_find/farray_find in empty collections
Franz Glasner <fzglas.hg@dom66.de>
parents:
746
diff
changeset
|
160 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
161 |
|
739
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
162 Add |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
163 === |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
164 |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
165 $ falist_create LIST |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
166 $ falist_add LIST K1 'V 1' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
167 $ falist_add LIST K2 'V 2' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
168 $ falist_add LIST K3 $'" 111222333" \\\'444555666 ' # ' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
169 $ falist_debug LIST |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
170 DEBUG: alist `LIST' has length 3 |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
171 DEBUG: the items: |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
172 DEBUG: `K1' -> `V 1' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
173 DEBUG: `K2' -> `V 2' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
174 DEBUG: `K3' -> `" 111222333" \'444555666 ' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
175 Yes: make a duplicate key |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
176 $ falist_add LIST K3 $'" 111222333" \\\'444555666 ' # |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
177 $ falist_debug LIST |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
178 DEBUG: alist `LIST' has length 4 |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
179 DEBUG: the items: |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
180 DEBUG: `K1' -> `V 1' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
181 DEBUG: `K2' -> `V 2' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
182 DEBUG: `K3' -> `" 111222333" \'444555666 ' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
183 DEBUG: `K3' -> `" 111222333" \'444555666 ' |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
184 $ falist_release LIST |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
185 $ check_no_alist_artifacts |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
186 |
|
dae85cddc47b
farray.sh: implement "falist_add()"
Franz Glasner <fzglas.hg@dom66.de>
parents:
733
diff
changeset
|
187 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
188 Iteration |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
189 ========= |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
190 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
191 ITERATE (manual indexing) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
192 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
193 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
194 $ falist_set LIST K1 V1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
195 $ falist_set LIST K2 "V2 2" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
196 $ falist_set LIST K3 $'" 111222333" \\\'444555 ' # ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
197 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
198 Iteration by indexing key and values separately |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
199 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
200 $ _i=1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
201 > while falist_tryget_key_at_index _k LIST ${_i}; do |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
202 > # cannot fail under "normal" circumstances |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
203 > falist_tryget_value_at_index _v LIST ${_i} |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
204 > printf " KEY: \`%s', VAL: \`%s'\\n" "${_k}" "${_v}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
205 > _i=$((_i + 1)) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
206 > done |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
207 KEY: `K1', VAL: `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
208 KEY: `K2', VAL: `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
209 KEY: `K3', VAL: `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
210 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
211 ITERATE (manual indexing over items) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
212 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
213 $ _i=1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
214 > while falist_tryget_item_at_index _k _v LIST ${_i}; do |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
215 > printf " KEY: \`%s', VAL: \`%s'\\n" "${_k}" "${_v}" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
216 > _i=$((_i + 1)) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
217 > done |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
218 KEY: `K1', VAL: `V1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
219 KEY: `K2', VAL: `V2 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
220 KEY: `K3', VAL: `" 111222333" \'444555 ' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
221 |
|
723
a97ec3f07bdb
farray.sh: REFACTOR: More flexible metadata retrieval.
Franz Glasner <fzglas.hg@dom66.de>
parents:
719
diff
changeset
|
222 ITERATE (for each, by name) |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
223 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
224 $ falist_for_each LIST $'printf "EACH: %s key \\`%s\\\', value \\`%s\\\' at idx %d\\n"' # ` |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
225 EACH: LIST key `K1', value `V1' at idx 1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
226 EACH: LIST key `K2', value `V2 2' at idx 2 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
227 EACH: LIST key `K3', value `" 111222333" \'444555 ' at idx 3 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
228 |
|
723
a97ec3f07bdb
farray.sh: REFACTOR: More flexible metadata retrieval.
Franz Glasner <fzglas.hg@dom66.de>
parents:
719
diff
changeset
|
229 ITERATE (for each, by value) |
|
a97ec3f07bdb
farray.sh: REFACTOR: More flexible metadata retrieval.
Franz Glasner <fzglas.hg@dom66.de>
parents:
719
diff
changeset
|
230 |
|
a97ec3f07bdb
farray.sh: REFACTOR: More flexible metadata retrieval.
Franz Glasner <fzglas.hg@dom66.de>
parents:
719
diff
changeset
|
231 $ falist_for_each "$LIST" $'printf "EACH: %s key \\`%s\\\', value \\`%s\\\' at idx %d\\n"' # ` |
|
729
05a325c7d5c5
farray.sh: change token prefixes again
Franz Glasner <fzglas.hg@dom66.de>
parents:
728
diff
changeset
|
232 EACH: _farr_KV\[\?,\?\]:[a-f0-9]+ key `K1', value `V1' at idx 1 (re) |
|
05a325c7d5c5
farray.sh: change token prefixes again
Franz Glasner <fzglas.hg@dom66.de>
parents:
728
diff
changeset
|
233 EACH: _farr_KV\[\?,\?\]:[a-f0-9]+ key `K2', value `V2 2' at idx 2 (re) |
|
05a325c7d5c5
farray.sh: change token prefixes again
Franz Glasner <fzglas.hg@dom66.de>
parents:
728
diff
changeset
|
234 EACH: _farr_KV\[\?,\?\]:[a-f0-9]+ key `K3', value `" 111222333" \\'444555 ' at idx 3 (re) |
|
723
a97ec3f07bdb
farray.sh: REFACTOR: More flexible metadata retrieval.
Franz Glasner <fzglas.hg@dom66.de>
parents:
719
diff
changeset
|
235 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
236 $ falist_clear LIST |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
237 $ falist_release LIST |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
238 $ falist_release LIST |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
239 ERROR: object `LIST' not created properly: token empty |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
240 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
241 |
|
606
0ad7b2120e74
farray.sh: tests: add forgotten check for left artifacts (memory leaks)
Franz Glasner <fzglas.hg@dom66.de>
parents:
605
diff
changeset
|
242 $ check_no_alist_artifacts |
|
0ad7b2120e74
farray.sh: tests: add forgotten check for left artifacts (memory leaks)
Franz Glasner <fzglas.hg@dom66.de>
parents:
605
diff
changeset
|
243 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
244 |
|
607
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
245 Valid and Invalid Indices |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
246 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
247 $ falist_create LIST |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
248 $ falist_set LIST 'KEY 1' 'VAL 1' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
249 $ falist_set LIST 'KEY 2' 'VAL 2' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
250 $ falist_set LIST 'KEY 3' 'VAL 3' |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
251 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
252 $ (falist_tryget_item_at_index _k _v LIST "") |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
253 ERROR: missing index |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
254 [70] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
255 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
256 $ (falist_tryget_item_at_index _k _v LIST) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
257 ERROR: missing index |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
258 [70] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
259 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
260 $ falist_tryget_item_at_index _k _v LIST 4 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
261 [1] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
262 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
263 $ falist_tryget_item_at_index _k _v LIST 0 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
264 $ printf '%s:%s' "$_k" "$_v" |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
265 KEY 3:VAL 3 (no-eol) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
266 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
267 $ falist_tryget_item_at_index _k _v LIST -2 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
268 $ printf '%s:%s' "$_k" "$_v" |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
269 KEY 1:VAL 1 (no-eol) |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
270 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
271 $ falist_tryget_item_at_index _k _v LIST -3 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
272 [1] |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
273 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
274 $ falist_release LIST |
|
607
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
275 $ check_no_alist_artifacts |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
276 |
|
c450fd0eaddb
farray.sh: Generalized indices for falist_tryget_{item,key,value}_at_index()
Franz Glasner <fzglas.hg@dom66.de>
parents:
606
diff
changeset
|
277 |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
278 Deletion of keys |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
279 ================ |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
280 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
281 $ falist_create LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
282 $ falist_set LIST 'key 1' 'value 1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
283 $ falist_set LIST 'key 2' 'value 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
284 $ falist_set LIST 'key 3' 'value 3' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
285 $ falist_set LIST 'key 4' 'value 4' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
286 $ falist_set LIST 'key 5' 'value 5' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
287 $ falist_trydel LIST 'key 1' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
288 $ falist_trydel LIST 'key 5' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
289 $ falist_trydel LIST 'key 3' |
|
605
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
290 $ falist_debug LIST |
|
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
291 DEBUG: alist `LIST' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
292 DEBUG: the items: |
|
605
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
293 DEBUG: `key 2' -> `value 2' |
|
96366e2075fe
farray.sh: enhance unittests for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
294 DEBUG: `key 4' -> `value 4' |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
295 $ falist_trydel LIST "non-existing key" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
296 [1] |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
297 $ falist_print_length LIST |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
298 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
299 $ falist_get _var LIST 'key 2' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
300 $ printf '%s' "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
301 value 2 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
302 $ falist_get _var LIST 'key 4' |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
303 $ printf '%s' "$_var" |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
304 value 4 (no-eol) |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
305 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
306 $ falist_release LIST |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
307 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
308 $ check_no_alist_artifacts |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
309 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
310 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
311 Compare |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
312 ======= |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
313 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
314 $ falist_create LIST1 K1 V1 K2 V2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
315 $ falist_debug LIST1 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
316 DEBUG: alist `LIST1' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
317 DEBUG: the items: |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
318 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
319 DEBUG: `K2' -> `V2' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
320 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
321 $ falist_create LIST2 K2 V2 K1 V1 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
322 $ falist_debug LIST2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
323 DEBUG: alist `LIST2' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
324 DEBUG: the items: |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
325 DEBUG: `K2' -> `V2' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
326 DEBUG: `K1' -> `V1' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
327 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
328 $ falist_create LIST3 K1 V1 K2 V2 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
329 $ falist_debug LIST3 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
330 DEBUG: alist `LIST3' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
331 DEBUG: the items: |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
332 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
333 DEBUG: `K2' -> `V2' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
334 |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
335 $ falist_create LIST4 K1 V1 K2 V2-4 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
336 $ falist_debug LIST4 |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
337 DEBUG: alist `LIST4' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
338 DEBUG: the items: |
|
613
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
339 DEBUG: `K1' -> `V1' |
|
17194ffe3638
farray.sh: falist_create() and falist_set() now accept a sequence of key-value pairs.
Franz Glasner <fzglas.hg@dom66.de>
parents:
612
diff
changeset
|
340 DEBUG: `K2' -> `V2-4' |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
341 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
342 $ falist_are_equal LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
343 $ falist_are_equal LIST1 LIST4 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
344 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
345 $ falist_are_equal_with_order LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
346 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
347 $ falist_are_equal_with_order LIST1 LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
348 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
349 $ falist_clear LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
350 $ falist_are_equal LIST1 LIST2 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
351 [1] |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
352 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
353 $ falist_clear LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
354 $ falist_are_equal_with_order LIST2 LIST3 |
|
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
355 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
356 $ falist_release LIST1 |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
357 $ falist_release LIST2 |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
358 $ falist_release LIST3 |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
359 $ falist_release LIST4 |
|
612
c9ef2339618d
farray.sh: Implemented comparison (ordered and unordered) for alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
607
diff
changeset
|
360 |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
361 $ check_no_alist_artifacts |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
362 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
363 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
364 Updating |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
365 ======== |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
366 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
367 $ falist_create ARR "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
368 $ falist_create UPDATE1 "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
369 $ falist_create UPDATE2 "Key 2" 'Value 2 (Updated) '\''' "Key 3" "Value 3" |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
370 $ falist_create EMPTY |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
371 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
372 $ falist_are_equal_with_order ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
373 $ falist_are_equal_with_order ARR UPDATE2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
374 [1] |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
375 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
376 $ falist_update ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
377 $ falist_are_equal_with_order ARR UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
378 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
379 $ falist_update ARR UPDATE2 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
380 $ falist_debug ARR |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
381 DEBUG: alist `ARR' has length 3 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
382 DEBUG: the items: |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
383 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
384 DEBUG: `Key 2' -> `Value 2 (Updated) '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
385 DEBUG: `Key 3' -> `Value 3' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
386 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
387 Updating an into an empty alist is just a copy |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
388 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
389 $ falist_update EMPTY UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
390 $ falist_debug EMPTY |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
391 DEBUG: alist `EMPTY' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
392 DEBUG: the items: |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
393 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
394 DEBUG: `Key 2' -> `Value 2 '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
395 $ falist_debug UPDATE1 |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
396 DEBUG: alist `UPDATE1' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
397 DEBUG: the items: |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
398 DEBUG: `Key 1' -> `Value 1' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
399 DEBUG: `Key 2' -> `Value 2 '' |
|
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
400 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
401 $ falist_release ARR |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
402 $ falist_release UPDATE1 |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
403 $ falist_release UPDATE2 |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
404 $ falist_release EMPTY |
|
614
62fbc4316d97
farray.sh: Implement falist_update(): update an existing alist from another
Franz Glasner <fzglas.hg@dom66.de>
parents:
613
diff
changeset
|
405 |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
406 $ check_no_alist_artifacts |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
407 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
408 |
|
743
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
409 Merging |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
410 ======= |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
411 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
412 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
413 $ falist_create INPUT1 "K1" "V1" "K2" "V2" "K3" "V3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
414 $ falist_create INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
415 $ falist_merge "$RES" "$INPUT1" "$INPUT2" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
416 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
417 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
418 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
419 DEBUG: alist `RES' has length 3 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
420 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
421 DEBUG: `K1' -> `V1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
422 DEBUG: `K2' -> `V2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
423 DEBUG: `K3' -> `V3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
424 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
425 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
426 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
427 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
428 $ falist_create INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
429 $ falist_create INPUT2 "k1" "v1" "k2" "v2" "k3" "v3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
430 $ falist_merge "$RES" "$INPUT1" "$INPUT2" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
431 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
432 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
433 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
434 DEBUG: alist `RES' has length 3 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
435 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
436 DEBUG: `k1' -> `v1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
437 DEBUG: `k2' -> `v2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
438 DEBUG: `k3' -> `v3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
439 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
440 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
441 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
442 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
443 $ falist_create INPUT1 "K1" "V1" "K2" "V2" "K3" "V3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
444 $ falist_create INPUT2 "k1" "v1" "k2" "v2" "k3" "v3" "k4" "v4" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
445 $ falist_merge "$RES" "$INPUT1" "$INPUT2" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
446 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
447 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
448 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
449 DEBUG: alist `RES' has length 7 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
450 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
451 DEBUG: `K1' -> `V1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
452 DEBUG: `K2' -> `V2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
453 DEBUG: `K3' -> `V3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
454 DEBUG: `k1' -> `v1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
455 DEBUG: `k2' -> `v2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
456 DEBUG: `k3' -> `v3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
457 DEBUG: `k4' -> `v4' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
458 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
459 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
460 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
461 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
462 $ falist_create INPUT1 "k1" "v1" "k2" "v2" "k3" "v3" "k4" "v4" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
463 $ falist_create INPUT2 "K1" "V1" "K2" "V2" "K3" "V3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
464 $ falist_merge "$RES" "$INPUT1" "$INPUT2" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
465 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
466 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
467 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
468 DEBUG: alist `RES' has length 7 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
469 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
470 DEBUG: `K1' -> `V1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
471 DEBUG: `K2' -> `V2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
472 DEBUG: `K3' -> `V3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
473 DEBUG: `k1' -> `v1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
474 DEBUG: `k2' -> `v2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
475 DEBUG: `k3' -> `v3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
476 DEBUG: `k4' -> `v4' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
477 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
478 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
479 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
480 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
481 $ falist_create INPUT1 "K1" "V1" "K3" "V3" "k1" "v1" "k4" "v4" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
482 $ falist_create INPUT2 "K2" "V2" "k2" "v2" "k3" "v3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
483 $ falist_merge "$RES" "$INPUT1" "$INPUT2" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
484 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
485 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
486 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
487 DEBUG: alist `RES' has length 7 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
488 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
489 DEBUG: `K1' -> `V1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
490 DEBUG: `K2' -> `V2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
491 DEBUG: `K3' -> `V3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
492 DEBUG: `k1' -> `v1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
493 DEBUG: `k2' -> `v2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
494 DEBUG: `k3' -> `v3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
495 DEBUG: `k4' -> `v4' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
496 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
497 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
498 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
499 $ falist_create RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
500 $ falist_create INPUT1 "K1" "V1" "K3" "V3" "k1" "v1" "k4" "v4" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
501 $ falist_create INPUT2 "K2" "V2" "k2" "v2" "k3" "v3" |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
502 $ falist_merge "$RES" INPUT2 INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
503 $ falist_release INPUT1 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
504 $ falist_release INPUT2 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
505 $ falist_debug RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
506 DEBUG: alist `RES' has length 7 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
507 DEBUG: the items: |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
508 DEBUG: `K1' -> `V1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
509 DEBUG: `K2' -> `V2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
510 DEBUG: `K3' -> `V3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
511 DEBUG: `k1' -> `v1' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
512 DEBUG: `k2' -> `v2' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
513 DEBUG: `k3' -> `v3' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
514 DEBUG: `k4' -> `v4' |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
515 $ falist_release RES |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
516 $ check_no_alist_artifacts |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
517 |
|
6fcf7da87981
farray.sh: implement "falist_merge()" to merge two "sorted" alists and add the result to a resulting alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
739
diff
changeset
|
518 |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
519 Items / Keys / Values |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
520 ===================== |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
521 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
522 $ farray_create KEYS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
523 $ farray_create VALUES |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
524 $ farray_create ITEMS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
525 $ falist_create LIST "Key 1" "Value 1" "Key 2" 'Value 2 '\''' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
526 $ falist_items ITEMS LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
527 $ farray_debug ITEMS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
528 DEBUG: array `ITEMS' has length 4 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
529 DEBUG: the items: |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
530 DEBUG: 1: `Key 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
531 DEBUG: 2: `Value 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
532 DEBUG: 3: `Key 2' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
533 DEBUG: 4: `Value 2 '' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
534 $ falist_keys KEYS LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
535 $ farray_debug KEYS |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
536 DEBUG: array `KEYS' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
537 DEBUG: the items: |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
538 DEBUG: 1: `Key 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
539 DEBUG: 2: `Key 2' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
540 $ falist_values VALUES LIST |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
541 $ farray_debug VALUES |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
542 DEBUG: array `VALUES' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
543 DEBUG: the items: |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
544 DEBUG: 1: `Value 1' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
545 DEBUG: 2: `Value 2 '' |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
546 |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
547 $ falist_release LIST |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
548 $ farray_release KEYS |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
549 $ farray_release VALUES |
|
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
550 $ farray_release ITEMS |
|
615
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
551 |
|
454ce7fa25c8
farray.sh: Implement falist_items(), falist_keys() and falist_values()
Franz Glasner <fzglas.hg@dom66.de>
parents:
614
diff
changeset
|
552 $ check_no_alist_artifacts |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
553 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
554 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
555 Cross Type Checks |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
556 ================= |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
557 |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
558 $ falist_create LIST |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
559 $ (farray_append LIST value) |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
560 ERROR: object `LIST' is not an array |
|
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
561 [70] |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
562 $ falist_release LIST |
|
716
36d953791e0c
farray.sh: The token values are prepended by a type-specific prefix: can now easily determine whether it is an array or alist from the value in its name
Franz Glasner <fzglas.hg@dom66.de>
parents:
651
diff
changeset
|
563 $ check_no_alist_artifacts |
|
717
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
564 |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
565 |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
566 Other Type Checks |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
567 ================= |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
568 |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
569 $ falist_type |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
570 unknown (no-eol) |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
571 $ falist_type __UNKNOWN_VARIABLE__ |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
572 unknown (no-eol) |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
573 $ testvar='foo' |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
574 $ falist_type testvar |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
575 value (no-eol) |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
576 $ testvar='' |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
577 $ falist_type testvar |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
578 null (no-eol) |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
579 $ falist_isalist testvar |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
580 [1] |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
581 $ falist_create LIST |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
582 $ falist_type LIST |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
583 alist (no-eol) |
|
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
584 $ falist_isalist LIST |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
585 $ falist_release LIST |
|
717
f4725ad5cd21
farray.sh: type tests for array and alist
Franz Glasner <fzglas.hg@dom66.de>
parents:
716
diff
changeset
|
586 $ check_no_alist_artifacts |
|
719
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
587 |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
588 |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
589 Generic Destruction |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
590 =================== |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
591 |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
592 $ falist_create LIST k1 v2 |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
593 $ falist_debug LIST |
|
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
594 DEBUG: alist `LIST' has length 1 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
595 DEBUG: the items: |
|
719
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
596 DEBUG: `k1' -> `v2' |
|
728
858f4208d9cb
farray.sh: Resource management by reference counting done
Franz Glasner <fzglas.hg@dom66.de>
parents:
726
diff
changeset
|
597 $ _farr_release_object "$LIST" |
|
719
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
598 $ check_no_alist_artifacts |
|
728
858f4208d9cb
farray.sh: Resource management by reference counting done
Franz Glasner <fzglas.hg@dom66.de>
parents:
726
diff
changeset
|
599 $ (_farr_release_object "$LIST") |
|
729
05a325c7d5c5
farray.sh: change token prefixes again
Franz Glasner <fzglas.hg@dom66.de>
parents:
728
diff
changeset
|
600 ERROR: falist `_farr_KV\[\?,\?\]:([a-f0-9]+)' not created properly: no object for token `\1' (re) |
|
728
858f4208d9cb
farray.sh: Resource management by reference counting done
Franz Glasner <fzglas.hg@dom66.de>
parents:
726
diff
changeset
|
601 [1] |
|
719
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
602 $ LIST='' |
|
728
858f4208d9cb
farray.sh: Resource management by reference counting done
Franz Glasner <fzglas.hg@dom66.de>
parents:
726
diff
changeset
|
603 $ _farr_release_object "$LIST" |
|
719
b2757e72b517
farray.sh: The first preparations to allow arrays/alists as values in other arrays or alists
Franz Glasner <fzglas.hg@dom66.de>
parents:
718
diff
changeset
|
604 $ check_no_alist_artifacts |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
605 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
606 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
607 Complex Debug |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
608 ============= |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
609 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
610 $ falist_create LIST |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
611 $ falist_set LIST K1 V1 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
612 $ falist_create ITEM1 K11 V11 K22 V22 |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
613 $ falist_set LIST K2 "$ITEM1" |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
614 $ falist_release ITEM1 |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
615 $ falist_debug LIST |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
616 DEBUG: alist `LIST' has length 2 |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
617 DEBUG: the items: |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
618 DEBUG: `K1' -> `V1' |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
619 DEBUG: `K2' -> >>> |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
620 DEBUG: alist with token `[a-f0-9]+' has length 2 (re) |
|
733
772e4999562b
farray.sh: Unified the output of farray_debug() and falist_debug()
Franz Glasner <fzglas.hg@dom66.de>
parents:
730
diff
changeset
|
621 DEBUG: the items: |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
622 DEBUG: `K11' -> `V11' |
|
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
623 DEBUG: `K22' -> `V22' |
|
730
8f1583faf9ea
farray.sh: Rename farray_destroy() to farray_release() and falist_destroy() to falist_release()
Franz Glasner <fzglas.hg@dom66.de>
parents:
729
diff
changeset
|
624 $ falist_release LIST |
|
726
23f6d2993fa2
farray.sh: Test the debug output and the destruction of complex objects.
Franz Glasner <fzglas.hg@dom66.de>
parents:
724
diff
changeset
|
625 $ check_no_alist_artifacts |
