diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-10-14 16:21:16 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-10-14 16:25:44 +0300 |
commit | ffe010595a025ec6d9f0e2c248548b3dc2050cf7 (patch) | |
tree | 60ec5e69e32b980dd2b527105c296f0b19d7aad8 /tests/sortstring.at | |
parent | 4253839e72aebd5a71684a13d5a40d70cb34e593 (diff) | |
download | eclat-ffe010595a025ec6d9f0e2c248548b3dc2050cf7.tar.gz eclat-ffe010595a025ec6d9f0e2c248548b3dc2050cf7.tar.bz2 |
Improve the sort function.
* grecs: Upgrade.
* lib/forlan.c (strtots): New function.
(func_sort): Rewrite. The "sort" built-in takes two
optional arguments: a path to the node to use as a key,
and a string of flags that set the comparison function and
sorting order.
* lib/forlangrm.y: Bugfix in argument verification code.
* src/dscrsnap-cl.opt: Document filters.
* tests/sortnum.at: New file.
* tests/sortrevnum.at: New file.
* tests/sortstring.at: New file.
* tests/sortts.at: New file.
* tests/Makefile.am: Add new test cases.
* tests/testsuite.at: Likewise.
Diffstat (limited to 'tests/sortstring.at')
-rw-r--r-- | tests/sortstring.at | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/sortstring.at b/tests/sortstring.at new file mode 100644 index 0000000..4f722d3 --- /dev/null +++ b/tests/sortstring.at @@ -0,0 +1,67 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Eclat is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Eclat. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([String sort]) +AT_KEYWORDS([sort sortstring]) + +AT_DATA([input], +[<input> + <collection> + <item> + <key>7</key> + <value>syv</value> + </item> + <item> + <key>3</key> + <value>tre</value> + </item> + <item> + <key>10</key> + <value>ti</value> + </item> + <item> + <key>6</key> + <value>seks</value> + </item> + <item> + <key>1</key> + <value>en</value> + </item> + </collection> +</input> +]) + +AT_DATA([prog],[sort(.input.collection,".item.key"); +dump(.); +]) + +AT_CHECK([tforlan prog input|trws], +[0], +[.input.collection.item.key: "1" +.input.collection.item.value: "en" +.input.collection.item.key: "10" +.input.collection.item.value: "ti" +.input.collection.item.key: "3" +.input.collection.item.value: "tre" +.input.collection.item.key: "6" +.input.collection.item.value: "seks" +.input.collection.item.key: "7" +.input.collection.item.value: "syv" +]) + +AT_CLEANUP + +
\ No newline at end of file |