Fix build requirements by correctly noting that Python is required.
[pspp] / tests / data / data-in.at
index 654c70e3eb17c86488f886587c7b7ba774e8650f..77a39db0103305ac7e22262438aef7cabfa01ce5 100644 (file)
@@ -1,7 +1,23 @@
+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
 AT_BANNER([data input (data-in)])
 
 m4_divert_push([PREPARE_TESTS])
-data_in_prng () {
+[data_in_prng () {
   cat > my-rand.pl <<'EOF'
 # This random number generator and the test for it below are drawn
 # from Park and Miller, "Random Number Generators: Good Ones are Hard
@@ -25,16 +41,17 @@ EOF
 #! /usr/bin/perl
 use strict;
 use warnings;
-do 'my-rand.pl';
+do './my-rand.pl';
 my_rand (1) foreach 1...10000;
 our $seed;
 die $seed if $seed != 1043618065;
 EOF
 }
+]
 m4_divert_pop([PREPARE_TESTS])
 
 AT_SETUP([numeric input formats])
-AT_KEYWORDS([data-in])
+AT_KEYWORDS([data-in slow])
 data_in_prng
 AT_CHECK([$PERL test-my-rand.pl])
 AT_DATA([num-in.pl],
@@ -44,7 +61,7 @@ use POSIX;
 use strict;
 use warnings;
 
-do 'my-rand.pl';
+do './my-rand.pl';
 
 for my $number (0, 1, .5, .015625, 123) {
     my ($base_exp) = floor ($number ? log10 ($number) : 0);
@@ -230,15 +247,122 @@ title 'Test use of big numbers'.
 data list file='bignum.txt'/BIGNUM 1-40.
 list.
 
-*** Do the nonportable output for fun. 
+*** Do the nonportable output for fun.
 descriptives BIGNUM.
 ])
 AT_CHECK([pspp -o pspp.csv bignum.sps], [0], [ignore])
 AT_CLEANUP
 
+AT_SETUP([DATE input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py date d-m-y])
+AT_FAIL_IF([test ! -s date.sps || test ! -s date.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv date.sps])
+AT_CHECK([cat date.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([ADATE input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py adate m-d-y])
+AT_FAIL_IF([test ! -s adate.sps || test ! -s adate.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv adate.sps])
+AT_CHECK([cat adate.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([EDATE input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py edate d-m-y])
+AT_FAIL_IF([test ! -s edate.sps || test ! -s edate.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv edate.sps])
+AT_CHECK([cat edate.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([JDATE input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py jdate j])
+AT_FAIL_IF([test ! -s jdate.sps || test ! -s jdate.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv jdate.sps])
+AT_CHECK([cat jdate.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([SDATE input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py sdate y-m-d])
+AT_FAIL_IF([test ! -s sdate.sps || test ! -s sdate.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv sdate.sps])
+AT_CHECK([cat sdate.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([QYR input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py qyr qQy])
+AT_FAIL_IF([test ! -s qyr.sps || test ! -s qyr.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv qyr.sps])
+AT_CHECK([cat qyr.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([MOYR input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py moyr m-y])
+AT_FAIL_IF([test ! -s moyr.sps || test ! -s moyr.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv moyr.sps])
+AT_CHECK([cat moyr.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([WKYR input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py wkyr wWy])
+AT_FAIL_IF([test ! -s wkyr.sps || test ! -s wkyr.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv wkyr.sps])
+AT_CHECK([cat wkyr.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([DATETIME input format])
+AT_KEYWORDS([data-in slow])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py datetime "d-m-y +H:M" "d-m-y +H:M:S"])
+AT_FAIL_IF([test ! -s datetime.sps || test ! -s datetime.input || \
+            test ! -s expout])
+AT_CHECK([pspp -O format=csv datetime.sps])
+AT_CHECK([cat datetime.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([YMDHMS input format])
+AT_KEYWORDS([data-in slow])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-date-input.py ymdhms "y-m-d +H:M" "y-m-d +H:M:S"])
+AT_FAIL_IF([test ! -s ymdhms.sps || test ! -s ymdhms.input || \
+            test ! -s expout])
+AT_CHECK([pspp -O format=csv ymdhms.sps])
+AT_CHECK([cat ymdhms.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([MTIME input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-time-input.py mtime +M:S])
+AT_FAIL_IF([test ! -s mtime.sps || test ! -s mtime.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv mtime.sps])
+AT_CHECK([cat mtime.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([TIME input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-time-input.py time +H:M +H:M:S])
+AT_FAIL_IF([test ! -s time.sps || test ! -s time.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv time.sps])
+AT_CHECK([cat time.output], [0], [expout])
+AT_CLEANUP
+
+AT_SETUP([DTIME input format])
+AT_KEYWORDS([data-in])
+AT_CHECK([$PYTHON3 $top_srcdir/tests/data/test-time-input.py dtime  '+D H:M' '+D H:M:S'])
+AT_FAIL_IF([test ! -s dtime.sps || test ! -s dtime.input || test ! -s expout])
+AT_CHECK([pspp -O format=csv dtime.sps])
+AT_CHECK([cat dtime.output], [0], [expout])
+AT_CLEANUP
+
 AT_SETUP([binary and hexadecimal input (IB, PIB, and PIBHEX formats)])
+AT_KEYWORDS([slow])
 AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > binhex-in.data])
-AT_CHECK([wc -c < binhex-in.data], [0], [131072
+AT_CHECK([[wc -c < binhex-in.data | sed 's/[   ]//g']], [0], [131072
 ])
 AT_DATA([binhex-in.sps], [dnl
 SET RIB=MSBFIRST.
@@ -258,8 +382,9 @@ AT_CHECK([cat binhex-in.out], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([BCD input (P and PK formats)])
+AT_KEYWORDS([slow])
 AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > bcd-in.data])
-AT_CHECK([wc -c < bcd-in.data], [0], [131072
+AT_CHECK([[wc -c < bcd-in.data | sed 's/[      ]//g']], [0], [131072
 ])
 AT_DATA([bcd-in.sps], [dnl
 SET ERRORS=NONE.
@@ -278,8 +403,9 @@ AT_CHECK([cat bcd-in.out], [0], [expout])
 AT_CLEANUP
 
 AT_SETUP([legacy input (N and Z formats)])
+AT_KEYWORDS([slow])
 AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > legacy-in.data])
-AT_CHECK([wc -c < legacy-in.data], [0], [131072
+AT_CHECK([[wc -c < legacy-in.data | sed 's/[   ]//g']], [0], [131072
 ])
 AT_DATA([legacy-in.sps], [dnl
 SET ERRORS=NONE.
@@ -325,23 +451,23 @@ PRINT OUTFILE='wkday.out'/ALL.
 EXECUTE.
 ])
 AT_CHECK([pspp -O format=csv wkday.sps], [0], [dnl
-wkday.sps:20.1-2: warning: Data for variable wkday2 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.2: warning: Data for variable wkday2 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-3: warning: Data for variable wkday3 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.3: warning: Data for variable wkday3 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-4: warning: Data for variable wkday4 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.4: warning: Data for variable wkday4 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-5: warning: Data for variable wkday5 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.5: warning: Data for variable wkday5 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-6: warning: Data for variable wkday6 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.6: warning: Data for variable wkday6 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-7: warning: Data for variable wkday7 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.7: warning: Data for variable wkday7 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-8: warning: Data for variable wkday8 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.8: warning: Data for variable wkday8 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-9: warning: Data for variable wkday9 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.9: warning: Data for variable wkday9 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 
-wkday.sps:20.1-10: warning: Data for variable wkday10 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
+wkday.sps:20.1-20.10: warning: Data for variable wkday10 is not valid as format WKDAY: Unrecognized weekday name.  At least the first two letters of an English weekday name must be specified.
 ])
 AT_CHECK([cat wkday.out], [0], [dnl
   .  .  .  .  .  .  .  .  . @&t@
@@ -420,51 +546,51 @@ PRINT OUTFILE='month.out'/ALL.
 EXECUTE.
 ])
 AT_CHECK([pspp -O format=csv month.sps], [0], [dnl
-month.sps:15.1-4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:15.1-10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:15.1-15.10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-3: warning: Data for variable month3 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.3: warning: Data for variable month3 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:26.1-10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:26.1-26.10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-3: warning: Data for variable month3 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.3: warning: Data for variable month3 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.4: warning: Data for variable month4 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.5: warning: Data for variable month5 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.6: warning: Data for variable month6 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.7: warning: Data for variable month7 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.8: warning: Data for variable month8 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.9: warning: Data for variable month9 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 
-month.sps:39.1-10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
+month.sps:39.1-39.10: warning: Data for variable month10 is not valid as format MONTH: Unrecognized month format.  Months may be specified as Arabic or Roman numerals or as at least 3 letters of their English names.
 ])
 AT_CHECK([cat month.out], [0], [dnl
    .   .   .   .   .   .   .   . @&t@