3 # This program tests the examples for GET DATA/TYPE=TXT given in the
6 TEMPDIR=/tmp/pspp-tst-$$
8 # ensure that top_builddir are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
61 activity="create passwd.data"
62 cat > passwd.data <<'EOF'
63 root:$1$nyeSP5gD$pDq/:0:0:,,,:/root:/bin/bash
64 blp:$1$BrP/pFg4$g7OG:1000:1000:Ben Pfaff,,,:/home/blp:/bin/bash
65 john:$1$JBuq/Fioq$g4A:1001:1001:John Darrington,,,:/home/john:/bin/bash
66 jhs:$1$D3li4hPL$88X1:1002:1002:Jason Stover,,,:/home/jhs:/bin/csh
68 if [ $? -ne 0 ] ; then no_result ; fi
70 activity="create cars.data"
71 cat > cars.data <<'EOF'
72 model year mileage price type age
73 Civic 2002 29883 15900 Si 2
74 Civic 2003 13415 15900 EX 1
75 Civic 1992 107000 3800 n/a 12
76 Accord 2002 26613 17900 EX 1
78 if [ $? -ne 0 ] ; then no_result ; fi
80 activity="create pets.data"
81 cat > pets.data <<'EOF'
82 'Pet''s Name', "Age", "Color", "Date Received", "Price", "Height", "Type"
83 , (Years), , , (Dollars), ,
84 "Rover", 4.5, Brown, "12 Feb 2004", 80, '1''4"', "Dog"
85 "Charlie", , Gold, "5 Apr 2007", 12.3, "3""", "Fish"
86 "Molly", 2, Black, "12 Dec 2006", 25, '5"', "Cat"
87 "Gilly", , White, "10 Apr 2007", 10, "3""", "Guinea Pig"
89 if [ $? -ne 0 ] ; then no_result ; fi
91 activity="create test.pspp"
92 cat > test.pspp <<'EOF'
93 GET DATA /TYPE=TXT /FILE='passwd.data' /DELIMITERS=':'
94 /VARIABLES=username A20
103 GET DATA /TYPE=TXT /FILE='cars.data' /DELIMITERS=' ' /FIRSTCASE=2
112 GET DATA /TYPE=TXT /FILE='cars.data' /ARRANGEMENT=FIXED /FIRSTCASE=2
113 /VARIABLES=model 0-7 A
121 GET DATA /TYPE=TXT /FILE='pets.data' /DELIMITERS=', ' /QUALIFIER='''"' /ESCAPE
132 if [ $? -ne 0 ] ; then no_result ; fi
135 $SUPERVISOR $PSPP --testing-mode test.pspp
136 if [ $? -ne 0 ] ; then no_result ; fi
138 activity="compare test results"
139 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
140 diff -b $TEMPDIR/pspp.list - <<'EOF'
141 username password uid gid gecos home shell
142 -------------------- ---------------------------------------- ---------- ---------- ---------------------------------------- ---------------------------------------- ----------------------------------------
143 root $1$nyeSP5gD$pDq/ 0 0 ,,, /root /bin/bash
144 blp $1$BrP/pFg4$g7OG 1000 1000 Ben Pfaff,,, /home/blp /bin/bash
145 john $1$JBuq/Fioq$g4A 1001 1001 John Darrington,,, /home/john /bin/bash
146 jhs $1$D3li4hPL$88X1 1002 1002 Jason Stover,,, /home/jhs /bin/csh
147 model year mileage price type age
148 -------- ---- ------- ----- ---- ---
149 Civic 2002 29883 15900 Si 2
150 Civic 2003 13415 15900 EX 1
151 Civic 1992 107000 3800 n/a 12
152 Accord 2002 26613 17900 EX 1
153 model year mileage price type age
154 -------- -------- -------- -------- -------- --------
155 Civic 2002 29883 15900 Si 2
156 Civic 2003 13415 15900 EX 1
157 Civic 1992 107000 3800 n/a 12
158 Accord 2002 26613 17900 EX 1
159 name age color received price height type
160 ---------- ---- ----- ---------- ------ ------ ----------
161 Rover 4.5 Brown 12.02.2004 80.00 1'4" Dog
162 Charlie . Gold 05.04.2007 12.30 3" Fish
163 Molly 2.0 Black 12.12.2006 25.00 5" Cat
164 Gilly . White 10.04.2007 10.00 3" Guinea Pig
166 if [ $? -ne 0 ] ; then fail ; fi