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 diff -c $TEMPDIR/pspp.csv - <<'EOF'
141 username,password,uid,gid,gecos,home,shell
142 root ,$1$nyeSP5gD$pDq/ ,0,0,",,, ",/root ,/bin/bash
143 blp ,$1$BrP/pFg4$g7OG ,1000,1000,"Ben Pfaff,,, ",/home/blp ,/bin/bash
144 john ,$1$JBuq/Fioq$g4A ,1001,1001,"John Darrington,,, ",/home/john ,/bin/bash
145 jhs ,$1$D3li4hPL$88X1 ,1002,1002,"Jason Stover,,, ",/home/jhs ,/bin/csh
148 model,year,mileage,price,type,age
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
155 model,year,mileage,price,type,age
156 Civic ,2002,29883,15900,Si ,2
157 Civic ,2003,13415,15900,EX ,1
158 Civic ,1992,107000,3800,n/a ,12
159 Accord ,2002,26613,17900,EX ,1
162 name,age,color,received,price,height,type
163 Rover ,4.5,Brown,12.02.2004,80.00,"1'4"" ",Dog
164 Charlie ,. ,Gold ,05.04.2007,12.30,"3"" ",Fish
165 Molly ,2.0,Black,12.12.2006,25.00,"5"" ",Cat
166 Gilly ,. ,White,10.04.2007,10.00,"3"" ",Guinea Pig
168 if [ $? -ne 0 ] ; then fail ; fi