aboutsummaryrefslogtreecommitdiffstats
path: root/test/arraysort2.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-08-02 20:41:40 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-08-02 20:41:40 +0300
commitef5a30e67615e1acc931e2f542b09f114ba30a97 (patch)
tree6f99a27e320b0a90830475bb53afcdae050726ab /test/arraysort2.awk
parent0b5a1bcd8b7189cb2d3048ef8e8d39dd33e2bec6 (diff)
parent48f02e6672003d218d4c0348a6add7931522603b (diff)
downloadegawk-ef5a30e67615e1acc931e2f542b09f114ba30a97.tar.gz
egawk-ef5a30e67615e1acc931e2f542b09f114ba30a97.tar.bz2
egawk-ef5a30e67615e1acc931e2f542b09f114ba30a97.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'test/arraysort2.awk')
-rw-r--r--test/arraysort2.awk34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/arraysort2.awk b/test/arraysort2.awk
new file mode 100644
index 00000000..e52d2a7c
--- /dev/null
+++ b/test/arraysort2.awk
@@ -0,0 +1,34 @@
+# This should no longer core dump ... 7/31/2018
+function init(b, a, i)
+{
+ a[1] = "aardvark"
+ a[2] = "animal"
+ a[3] = "zebra"
+ a[4] = "zoo"
+ a[5] = "Iguana"
+ a[6] = "Alligator"
+ a[7] =a[8] = "people"
+ for (i in a)
+ b[IGNORECASE][i] = a[i]
+}
+
+BEGIN {
+
+ for (IGNORECASE = 0; IGNORECASE < 2; IGNORECASE++) {
+ init(b)
+
+ n = asort(b[IGNORECASE])
+
+ for (i = 1; i <= n; i++)
+ printf("b[%d][%d] = \"%s\"\n", IGNORECASE, i, b[IGi])
+
+ print "===="
+ }
+
+ IGNORECASE = 1
+ init(b)
+ b[2][1] = ""
+ n = asort(b[1], b[2])
+ for (i = 1; i <= n; i++)
+ printf("b[2][%d] = \"%s\"\n", i, b[2][i])
+}