summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2023-04-07 12:56:18 +0300
committerArnold D. Robbins <arnold@skeeve.com>2023-04-07 12:56:18 +0300
commit65ce68a3a74a7cacb567b22f961d91f584af3e4a (patch)
treeca842f6bcf132bbea524ad126a6960576bc8523e /test
parent2efd3d04a0298ae9dce7dde6ae58ddcd6ff6dc2a (diff)
downloadgawk-65ce68a3a74a7cacb567b22f961d91f584af3e4a.tar.gz
Improve sort1 test case.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/sort1.awk12
-rw-r--r--test/sort1.ok40
3 files changed, 57 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index e7f6a45c..1d6f5427 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2023-04-07 zhou shuiqing <zhoushuiqing321@outlook.com>
+
+ * sort1.awk: Add tests for ind_num_desc and @ind_str_asc.
+ * sort1.ok: Updated.
+
2023-03-09 Arnold D. Robbins <arnold@skeeve.com>
* badargs.ok: Update after code changes.
diff --git a/test/sort1.awk b/test/sort1.awk
index ef28e9cd..78840bf8 100644
--- a/test/sort1.awk
+++ b/test/sort1.awk
@@ -22,6 +22,18 @@ BEGIN{
SORT_STR, IGNORECASE)
makea(a)
+ SORT_STR = "@ind_num_desc"
+ asort1(a, "")
+ printf("---end asort(a, b, \"%s\"), IGNORECASE = %d---\n",
+ SORT_STR, IGNORECASE)
+
+ makea(a)
+ SORT_STR = "@ind_str_asc"
+ asort1(a, "")
+ printf("---end asort(a, a, \"%s\"), IGNORECASE = %d---\n",
+ SORT_STR, IGNORECASE)
+
+ makea(a)
SORT_STR = "@ind_str_desc"
asort1(a, "")
printf("---end asort(a, a, \"%s\"), IGNORECASE = %d---\n",
diff --git a/test/sort1.ok b/test/sort1.ok
index 00ed661a..d8b6d94f 100644
--- a/test/sort1.ok
+++ b/test/sort1.ok
@@ -47,6 +47,26 @@
[4]: Zebra
[5]: blattt
[6]: barz
+---end asort(a, b, "@ind_num_desc"), IGNORECASE = 0---
+ [1]: barz
+ [2]: blattt
+ [3]: Zebra
+ [4]: 1234
+ [5]: 234
+ [6][1]: 4321
+ [6][2]: arbeZ
+ [6][3]: tttalb
+ [6][4]: zrab
+---end asort(a, a, "@ind_str_asc"), IGNORECASE = 0---
+ [1][1]: zrab
+ [1][2]: tttalb
+ [1][3]: arbeZ
+ [1][4]: 4321
+ [2]: 234
+ [3]: 1234
+ [4]: Zebra
+ [5]: blattt
+ [6]: barz
---end asort(a, a, "@ind_str_desc"), IGNORECASE = 0---
[4]: 1234
[5]: 234
@@ -157,6 +177,26 @@
[4]: Zebra
[5]: blattt
[6]: barz
+---end asort(a, b, "@ind_num_desc"), IGNORECASE = 1---
+ [1]: barz
+ [2]: blattt
+ [3]: Zebra
+ [4]: 1234
+ [5]: 234
+ [6][1]: 4321
+ [6][2]: arbeZ
+ [6][3]: tttalb
+ [6][4]: zrab
+---end asort(a, a, "@ind_str_asc"), IGNORECASE = 1---
+ [1][1]: zrab
+ [1][2]: tttalb
+ [1][3]: arbeZ
+ [1][4]: 4321
+ [2]: 234
+ [3]: 1234
+ [4]: Zebra
+ [5]: blattt
+ [6]: barz
---end asort(a, a, "@ind_str_desc"), IGNORECASE = 1---
[4]: 1234
[5]: 234