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
57 activity="create passwd.data"
58 cat > passwd.data <<'EOF'
59 root:$1$nyeSP5gD$pDq/:0:0:,,,:/root:/bin/bash
60 blp:$1$BrP/pFg4$g7OG:1000:1000:Ben Pfaff,,,:/home/blp:/bin/bash
61 john:$1$JBuq/Fioq$g4A:1001:1001:John Darrington,,,:/home/john:/bin/bash
62 jhs:$1$D3li4hPL$88X1:1002:1002:Jason Stover,,,:/home/jhs:/bin/csh
64 if [ $? -ne 0 ] ; then no_result ; fi
66 activity="create cars.data"
67 cat > cars.data <<'EOF'
68 model year mileage price type age
69 Civic 2002 29883 15900 Si 2
70 Civic 2003 13415 15900 EX 1
71 Civic 1992 107000 3800 n/a 12
72 Accord 2002 26613 17900 EX 1
74 if [ $? -ne 0 ] ; then no_result ; fi
76 activity="create pets.data"
77 cat > pets.data <<'EOF'
78 'Pet''s Name', "Age", "Color", "Date Received", "Price", "Height", "Type"
79 , (Years), , , (Dollars), ,
80 "Rover", 4.5, Brown, "12 Feb 2004", 80, '1''4"', "Dog"
81 "Charlie", , Gold, "5 Apr 2007", 12.3, "3""", "Fish"
82 "Molly", 2, Black, "12 Dec 2006", 25, '5"', "Cat"
83 "Gilly", , White, "10 Apr 2007", 10, "3""", "Guinea Pig"
85 if [ $? -ne 0 ] ; then no_result ; fi
87 activity="create test.pspp"
88 cat > test.pspp <<'EOF'
89 GET DATA /TYPE=TXT /FILE='passwd.data' /DELIMITERS=':'
90 /VARIABLES=username A20
99 GET DATA /TYPE=TXT /FILE='cars.data' /DELIMITERS=' ' /FIRSTCASE=2
108 GET DATA /TYPE=TXT /FILE='cars.data' /ARRANGEMENT=FIXED /FIRSTCASE=2
109 /VARIABLES=model 0-7 A
117 GET DATA /TYPE=TXT /FILE='pets.data' /DELIMITERS=', ' /QUALIFIER='''"' /ESCAPE
128 if [ $? -ne 0 ] ; then no_result ; fi
131 $SUPERVISOR $PSPP --testing-mode test.pspp
132 if [ $? -ne 0 ] ; then no_result ; fi
134 activity="compare test results"
135 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
136 diff -b $TEMPDIR/pspp.list - <<'EOF'
137 username password uid gid gecos home shell
138 -------------------- ---------------------------------------- ---------- ---------- ---------------------------------------- ---------------------------------------- ----------------------------------------
139 root $1$nyeSP5gD$pDq/ 0 0 ,,, /root /bin/bash
140 blp $1$BrP/pFg4$g7OG 1000 1000 Ben Pfaff,,, /home/blp /bin/bash
141 john $1$JBuq/Fioq$g4A 1001 1001 John Darrington,,, /home/john /bin/bash
142 jhs $1$D3li4hPL$88X1 1002 1002 Jason Stover,,, /home/jhs /bin/csh
143 model year mileage price type age
144 -------- ---- ------- ----- ---- ---
145 Civic 2002 29883 15900 Si 2
146 Civic 2003 13415 15900 EX 1
147 Civic 1992 107000 3800 n/a 12
148 Accord 2002 26613 17900 EX 1
149 model year mileage price type age
150 -------- -------- -------- -------- -------- --------
151 Civic 2002 29883 15900 Si 2
152 Civic 2003 13415 15900 EX 1
153 Civic 1992 107000 3800 n/a 12
154 Accord 2002 26613 17900 EX 1
155 name age color received price height type
156 ---------- ---- ----- ---------- ------ ------ ----------
157 Rover 4.5 Brown 12.02.2004 80.00 1'4" Dog
158 Charlie . Gold 05.04.2007 12.30 3" Fish
159 Molly 2.0 Black 12.12.2006 25.00 5" Cat
160 Gilly . White 10.04.2007 10.00 3" Guinea Pig
162 if [ $? -ne 0 ] ; then fail ; fi