1# This file is part of Eclat -*- Autotest -*-
2# Copyright (C) 2012-2018 Sergey Poznyakoff
3#
4# Eclat is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Eclat is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Eclat.  If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Timestamp sort])
18AT_KEYWORDS([sort sortts])
19
20AT_DATA([input],
21[<input>
22  <collection>
23    <item>
24      <key>2012-02-20T16:27:51.000Z</key>
25      <value>tolvte februar 2012, seksten tjuefem femtien</value>
26    </item>
27    <item>
28      <key>2012-10-14T15:51:00.000Z</key>
29      <value>fjortende oktober 2012, femten femtien</value>
30    </item>
31    <item>
32      <key>2011-01-22T00:00:00.000Z</key>
33      <value>tjueandre januar 2011, null null</value>
34    </item>
35    <item>
36      <key>2012-02-20T16:25:34.000Z</key>
37      <value>tjuende februar 2012, seksten tjuefem trettifire</value>
38    </item>
39    <item>
40      <key>2012-02-22T01:21:22.000Z</key>
41      <value>tjueandre februar 2012, ett tjueen tjueto</value>
42    </item>
43  </collection>
44</input>
45])
46
47AT_DATA([prog],[sort(.input.collection,".item.key","t");
48dump(.);
49])
50
51AT_CHECK([tforlan prog input|trws],
52[0],
53[.input.collection.item.key: "2011-01-22T00:00:00.000Z"
54.input.collection.item.value: "tjueandre januar 2011, null null"
55.input.collection.item.key: "2012-02-20T16:25:34.000Z"
56.input.collection.item.value: "tjuende februar 2012, seksten tjuefem trettifire"
57.input.collection.item.key: "2012-02-20T16:27:51.000Z"
58.input.collection.item.value: "tolvte februar 2012, seksten tjuefem femtien"
59.input.collection.item.key: "2012-02-22T01:21:22.000Z"
60.input.collection.item.value: "tjueandre februar 2012, ett tjueen tjueto"
61.input.collection.item.key: "2012-10-14T15:51:00.000Z"
62.input.collection.item.value: "fjortende oktober 2012, femten femtien"
63])
64
65AT_CLEANUP
66
67
68