Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate tests/testsetup.sh @ 756:33df05108ba1
farray.sh: New implementation alists: searching is done using a binary search now while preserving insertion order.
The implementation uses two key lists:
The first one is sorted and is used for searching using binary search.
The second is a double-linked list and is used for remembering the
insertion order.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 19 Oct 2024 22:40:11 +0200 |
| parents | 45c47bc1f7d2 |
| children | 7ead30e3b2f9 |
| rev | line source |
|---|---|
|
583
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 #!/bin/sh |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 # Test helpers for the shell unittests using cram. |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 # |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 #: |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 #: Check that no global variables that hold any array storage are left. |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 #: |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 #: Returns: |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 #: int: 0 if no unexpected storage is left, 1 otherwise |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 #: |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 check_no_array_artifacts() { |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 # _farr_A_ is the storage prefix for arrays |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 if set | grep -E -e '^_farr_A_.*='; then |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 return 1 |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 else |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 return 0 |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 fi |
|
55c024c809ca
Begin unittests for farray.sh using "cram"
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 } |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
20 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
21 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
22 #: |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
23 #: Check that no global variables that hold any alist storage are left. |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
24 #: |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
25 #: Returns: |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
26 #: int: 0 if no unexpected storage is left, 1 otherwise |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
27 #: |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
28 check_no_alist_artifacts() { |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
29 # This are all _farr_alist_XXX_prefix variables |
|
756
33df05108ba1
farray.sh: New implementation alists: searching is done using a binary search now while preserving insertion order.
Franz Glasner <fzglas.hg@dom66.de>
parents:
604
diff
changeset
|
30 if set | grep -E -e '^_farr_KV_.*=' -e '^_farr_Kb_.*=' -e '^_farr_Ks_.*=' -e '^_farr_Vs_.*='; then |
|
604
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
31 return 1 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
32 else |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
33 return 0 |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
34 fi |
|
45c47bc1f7d2
farray.sh: Moved all currently existing tests for alists into cram tests.
Franz Glasner <fzglas.hg@dom66.de>
parents:
583
diff
changeset
|
35 } |
