3 TEMPDIR=/tmp/pspp-tst-$$
5 trap 'cd /; rm -rf $TEMPDIR' 0
7 # ensure that top_builddir are absolute
8 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 top_builddir=`cd $top_builddir; pwd`
11 PSPP=$top_builddir/src/ui/terminal/pspp
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
41 activity="write pspp syntax"
42 cat > date-out.pspp <<EOF
44 data list /x 1-30 (datetime).
47 30-6-1680 4:50:38.12301
48 24-7-1716 12:31:35.23453
49 19-6-1768 12:47:53.34505
51 27-3-1839 20:58:11.56677
52 19-4-1903 7:36:5.18964
53 25-8-1929 15:43:49.83132
54 29-9-1941 4:25:9.01293
55 19-4-1943 6:49:27.52375
56 7-10-1943 2:57:52.01565
57 17-3-1992 16:45:44.86529
58 25-2-1996 21:30:57.82047
62 17-3-92 16:45:44.65827
63 25-2-96 21:30:57.58219
64 10-11-2038 22:30:4.18347
65 18-7-2094 1:56:51.59319
67 print outfile='date-out.out'/x(date9) ' | ' x(date11).
68 print outfile='date-out.out'/x(adate8) ' | ' x(adate10).
69 print outfile='date-out.out'/x(edate8) ' | ' x(edate10).
70 print outfile='date-out.out'/x(jdate5) ' | ' x(jdate7).
71 print outfile='date-out.out'/x(sdate8) ' | ' x(sdate10).
72 print outfile='date-out.out'/x(qyr6) ' | ' x(qyr8).
73 print outfile='date-out.out'/x(moyr6) ' | ' x(moyr8).
74 print outfile='date-out.out'/x(wkyr8) ' | ' x(wkyr10).
75 print outfile='date-out.out'/x(datetime17).
76 print outfile='date-out.out'/x(datetime18).
77 print outfile='date-out.out'/x(datetime19).
78 print outfile='date-out.out'/x(datetime20).
79 print outfile='date-out.out'/x(datetime21).
80 print outfile='date-out.out'/x(datetime22).
81 print outfile='date-out.out'/x(datetime22.1).
82 print outfile='date-out.out'/x(datetime23.2).
83 print outfile='date-out.out'/x(datetime24.3).
84 print outfile='date-out.out'/x(datetime25.4).
85 print outfile='date-out.out'/x(datetime26.5).
88 if [ $? -ne 0 ] ; then no_result ; fi
90 activity="run program"
91 $SUPERVISOR $PSPP -o pspp.csv date-out.pspp
92 if [ $? -ne 0 ] ; then no_result ; fi
94 activity="compare output"
95 diff -u date-out.out - <<EOF
96 ********* | 10-JUN-1648
100 ******** | 1648/06/10
103 ******** | 24 WK 1648
110 10-JUN-1648 00:00:00.0
111 10-JUN-1648 00:00:00.00
112 10-JUN-1648 00:00:00.000
113 10-JUN-1648 00:00:00.0000
114 10-JUN-1648 00:00:00.00000
115 ********* | 30-JUN-1680
116 ******** | 06/30/1680
117 ******** | 30.06.1680
119 ******** | 1680/06/30
122 ******** | 26 WK 1680
129 30-JUN-1680 04:50:38.1
130 30-JUN-1680 04:50:38.12
131 30-JUN-1680 04:50:38.123
132 30-JUN-1680 04:50:38.1230
133 30-JUN-1680 04:50:38.12301
134 ********* | 24-JUL-1716
135 ******** | 07/24/1716
136 ******** | 24.07.1716
138 ******** | 1716/07/24
141 ******** | 30 WK 1716
148 24-JUL-1716 12:31:35.2
149 24-JUL-1716 12:31:35.23
150 24-JUL-1716 12:31:35.235
151 24-JUL-1716 12:31:35.2345
152 24-JUL-1716 12:31:35.23453
153 ********* | 19-JUN-1768
154 ******** | 06/19/1768
155 ******** | 19.06.1768
157 ******** | 1768/06/19
160 ******** | 25 WK 1768
167 19-JUN-1768 12:47:53.3
168 19-JUN-1768 12:47:53.35
169 19-JUN-1768 12:47:53.345
170 19-JUN-1768 12:47:53.3450
171 19-JUN-1768 12:47:53.34505
172 ********* | 02-AUG-1819
173 ******** | 08/02/1819
174 ******** | 02.08.1819
176 ******** | 1819/08/02
179 ******** | 31 WK 1819
186 02-AUG-1819 01:26:00.5
187 02-AUG-1819 01:26:00.46
188 02-AUG-1819 01:26:00.456
189 02-AUG-1819 01:26:00.4562
190 02-AUG-1819 01:26:00.45615
191 ********* | 27-MAR-1839
192 ******** | 03/27/1839
193 ******** | 27.03.1839
195 ******** | 1839/03/27
198 ******** | 13 WK 1839
205 27-MAR-1839 20:58:11.6
206 27-MAR-1839 20:58:11.57
207 27-MAR-1839 20:58:11.567
208 27-MAR-1839 20:58:11.5668
209 27-MAR-1839 20:58:11.56677
210 ********* | 19-APR-1903
211 ******** | 04/19/1903
212 ******** | 19.04.1903
214 ******** | 1903/04/19
217 ******** | 16 WK 1903
224 19-APR-1903 07:36:05.2
225 19-APR-1903 07:36:05.19
226 19-APR-1903 07:36:05.190
227 19-APR-1903 07:36:05.1896
228 19-APR-1903 07:36:05.18964
229 ********* | 25-AUG-1929
230 ******** | 08/25/1929
231 ******** | 25.08.1929
233 ******** | 1929/08/25
236 ******** | 34 WK 1929
243 25-AUG-1929 15:43:49.8
244 25-AUG-1929 15:43:49.83
245 25-AUG-1929 15:43:49.831
246 25-AUG-1929 15:43:49.8313
247 25-AUG-1929 15:43:49.83132
248 29-SEP-41 | 29-SEP-1941
249 09/29/41 | 09/29/1941
250 29.09.41 | 29.09.1941
252 41/09/29 | 1941/09/29
255 39 WK 41 | 39 WK 1941
262 29-SEP-1941 04:25:09.0
263 29-SEP-1941 04:25:09.01
264 29-SEP-1941 04:25:09.013
265 29-SEP-1941 04:25:09.0129
266 29-SEP-1941 04:25:09.01293
267 19-APR-43 | 19-APR-1943
268 04/19/43 | 04/19/1943
269 19.04.43 | 19.04.1943
271 43/04/19 | 1943/04/19
274 16 WK 43 | 16 WK 1943
281 19-APR-1943 06:49:27.5
282 19-APR-1943 06:49:27.52
283 19-APR-1943 06:49:27.524
284 19-APR-1943 06:49:27.5238
285 19-APR-1943 06:49:27.52375
286 07-OCT-43 | 07-OCT-1943
287 10/07/43 | 10/07/1943
288 07.10.43 | 07.10.1943
290 43/10/07 | 1943/10/07
293 40 WK 43 | 40 WK 1943
300 07-OCT-1943 02:57:52.0
301 07-OCT-1943 02:57:52.02
302 07-OCT-1943 02:57:52.016
303 07-OCT-1943 02:57:52.0156
304 07-OCT-1943 02:57:52.01565
305 17-MAR-92 | 17-MAR-1992
306 03/17/92 | 03/17/1992
307 17.03.92 | 17.03.1992
309 92/03/17 | 1992/03/17
312 11 WK 92 | 11 WK 1992
319 17-MAR-1992 16:45:44.9
320 17-MAR-1992 16:45:44.87
321 17-MAR-1992 16:45:44.865
322 17-MAR-1992 16:45:44.8653
323 17-MAR-1992 16:45:44.86529
324 25-FEB-96 | 25-FEB-1996
325 02/25/96 | 02/25/1996
326 25.02.96 | 25.02.1996
328 96/02/25 | 1996/02/25
338 25-FEB-1996 21:30:57.8
339 25-FEB-1996 21:30:57.82
340 25-FEB-1996 21:30:57.820
341 25-FEB-1996 21:30:57.8205
342 25-FEB-1996 21:30:57.82047
343 29-SEP-41 | 29-SEP-1941
344 09/29/41 | 09/29/1941
345 29.09.41 | 29.09.1941
347 41/09/29 | 1941/09/29
350 39 WK 41 | 39 WK 1941
357 29-SEP-1941 04:25:09.2
358 29-SEP-1941 04:25:09.15
359 29-SEP-1941 04:25:09.154
360 29-SEP-1941 04:25:09.1539
361 29-SEP-1941 04:25:09.15395
362 19-APR-43 | 19-APR-1943
363 04/19/43 | 04/19/1943
364 19.04.43 | 19.04.1943
366 43/04/19 | 1943/04/19
369 16 WK 43 | 16 WK 1943
376 19-APR-1943 06:49:27.1
377 19-APR-1943 06:49:27.11
378 19-APR-1943 06:49:27.105
379 19-APR-1943 06:49:27.1053
380 19-APR-1943 06:49:27.10533
381 07-OCT-43 | 07-OCT-1943
382 10/07/43 | 10/07/1943
383 07.10.43 | 07.10.1943
385 43/10/07 | 1943/10/07
388 40 WK 43 | 40 WK 1943
395 07-OCT-1943 02:57:52.5
396 07-OCT-1943 02:57:52.48
397 07-OCT-1943 02:57:52.482
398 07-OCT-1943 02:57:52.4823
399 07-OCT-1943 02:57:52.48229
400 17-MAR-92 | 17-MAR-1992
401 03/17/92 | 03/17/1992
402 17.03.92 | 17.03.1992
404 92/03/17 | 1992/03/17
407 11 WK 92 | 11 WK 1992
414 17-MAR-1992 16:45:44.7
415 17-MAR-1992 16:45:44.66
416 17-MAR-1992 16:45:44.658
417 17-MAR-1992 16:45:44.6583
418 17-MAR-1992 16:45:44.65827
419 25-FEB-96 | 25-FEB-1996
420 02/25/96 | 02/25/1996
421 25.02.96 | 25.02.1996
423 96/02/25 | 1996/02/25
433 25-FEB-1996 21:30:57.6
434 25-FEB-1996 21:30:57.58
435 25-FEB-1996 21:30:57.582
436 25-FEB-1996 21:30:57.5822
437 25-FEB-1996 21:30:57.58219
438 ********* | 10-NOV-2038
439 ******** | 11/10/2038
440 ******** | 10.11.2038
442 ******** | 2038/11/10
445 ******** | 45 WK 2038
452 10-NOV-2038 22:30:04.2
453 10-NOV-2038 22:30:04.18
454 10-NOV-2038 22:30:04.183
455 10-NOV-2038 22:30:04.1835
456 10-NOV-2038 22:30:04.18347
457 ********* | 18-JUL-2094
458 ******** | 07/18/2094
459 ******** | 18.07.2094
461 ******** | 2094/07/18
464 ******** | 29 WK 2094
471 18-JUL-2094 01:56:51.6
472 18-JUL-2094 01:56:51.59
473 18-JUL-2094 01:56:51.593
474 18-JUL-2094 01:56:51.5932
475 18-JUL-2094 01:56:51.59319
477 if [ $? -ne 0 ] ; then fail ; fi
479 activity="write pspp syntax"
480 cat > bad-date-out.pspp <<EOF
489 print outfile='bad-date.out'/x(date9) ' | ' x(date11).
490 print outfile='bad-date.out'/x(adate8) ' | ' x(adate10).
491 print outfile='bad-date.out'/x(edate8) ' | ' x(edate10).
492 print outfile='bad-date.out'/x(jdate5) ' | ' x(jdate7).
493 print outfile='bad-date.out'/x(sdate8) ' | ' x(sdate10).
494 print outfile='bad-date.out'/x(qyr6) ' | ' x(qyr8).
495 print outfile='bad-date.out'/x(moyr6) ' | ' x(moyr8).
496 print outfile='bad-date.out'/x(wkyr8) ' | ' x(wkyr10).
497 print outfile='bad-date.out'/x(datetime17).
498 print outfile='bad-date.out'/x(datetime18).
499 print outfile='bad-date.out'/x(datetime19).
500 print outfile='bad-date.out'/x(datetime20).
501 print outfile='bad-date.out'/x(datetime21).
502 print outfile='bad-date.out'/x(datetime22).
503 print outfile='bad-date.out'/x(datetime22.1).
504 print outfile='bad-date.out'/x(datetime23.2).
505 print outfile='bad-date.out'/x(datetime24.3).
506 print outfile='bad-date.out'/x(datetime25.4).
507 print outfile='bad-date.out'/x(datetime26.5).
510 if [ $? -ne 0 ] ; then no_result ; fi
512 activity="run program"
513 $SUPERVISOR $PSPP -o pspp.csv bad-date-out.pspp
514 if [ $? -ne 0 ] ; then no_result ; fi
516 activity="compare output"
517 diff -u bad-date.out - <<EOF
556 ********* | ***********
557 ******** | **********
558 ******** | **********
560 ******** | **********
563 ******** | **********
570 28-MAY-**** 05:20:00.0
571 28-MAY-**** 05:20:00.00
572 28-MAY-**** 05:20:00.000
573 28-MAY-**** 05:20:00.0000
574 28-MAY-**** 05:20:00.00000
576 if [ $? -ne 0 ] ; then fail ; fi