3 # This program tests epochs by running DEBUG EPOCH.
5 TEMPDIR=/tmp/pspp-tst-$$
7 # ensure that top_srcdir and top_builddir are absolute
8 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 top_srcdir=`cd $top_srcdir; pwd`
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
15 STAT_CONFIG_PATH=$top_srcdir/config
16 export STAT_CONFIG_PATH
21 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
22 echo "NOT cleaning $TEMPDIR"
57 activity="create program"
58 cat > $TEMPDIR/epoch.stat <<EOF
63 DEBUG EVALUATE/YRMODA(0,1,1) = YRMODA(1900,1,1).
64 DEBUG EVALUATE/YRMODA(1,1,1) = YRMODA(1901,1,1).
65 DEBUG EVALUATE/YRMODA(12,1,1) = YRMODA(1912,1,1).
66 DEBUG EVALUATE/YRMODA(70,1,1) = YRMODA(1970,1,1).
67 DEBUG EVALUATE/YRMODA(87,1,1) = YRMODA(1987,1,1).
68 DEBUG EVALUATE/YRMODA(99,1,1) = YRMODA(1999,1,1).
69 DEBUG EVALUATE/YRMODA(100,1,1).
70 DEBUG EVALUATE/DATE.DMY(1,1,0) = DATE.DMY(1,1,1900).
71 DEBUG EVALUATE/DATE.DMY(1,1,1) = DATE.DMY(1,1,1901).
72 DEBUG EVALUATE/DATE.DMY(1,1,12) = DATE.DMY(1,1,1912).
73 DEBUG EVALUATE/DATE.DMY(1,1,70) = DATE.DMY(1,1,1970).
74 DEBUG EVALUATE/DATE.DMY(1,1,87) = DATE.DMY(1,1,1987).
75 DEBUG EVALUATE/DATE.DMY(1,1,99) = DATE.DMY(1,1,1999).
76 DEBUG EVALUATE/DATE.DMY(1,1,100).
79 DEBUG EVALUATE/YRMODA(0,1,1) = YRMODA(1900,1,1).
80 DEBUG EVALUATE/YRMODA(1,1,1) = YRMODA(1901,1,1).
81 DEBUG EVALUATE/YRMODA(12,1,1) = YRMODA(1912,1,1).
82 DEBUG EVALUATE/YRMODA(70,1,1) = YRMODA(1970,1,1).
83 DEBUG EVALUATE/YRMODA(87,1,1) = YRMODA(1987,1,1).
84 DEBUG EVALUATE/YRMODA(99,1,1) = YRMODA(1999,1,1).
85 DEBUG EVALUATE/YRMODA(100,1,1).
86 DEBUG EVALUATE/DATE.DMY(1,1,0) = DATE.DMY(1,1,2000).
87 DEBUG EVALUATE/DATE.DMY(1,1,1) = DATE.DMY(1,1,1901).
88 DEBUG EVALUATE/DATE.DMY(1,1,12) = DATE.DMY(1,1,1912).
89 DEBUG EVALUATE/DATE.DMY(1,1,70) = DATE.DMY(1,1,1970).
90 DEBUG EVALUATE/DATE.DMY(1,1,87) = DATE.DMY(1,1,1987).
91 DEBUG EVALUATE/DATE.DMY(1,1,99) = DATE.DMY(1,1,1999).
92 DEBUG EVALUATE/DATE.DMY(1,1,100).
95 DEBUG EVALUATE/YRMODA(0,1,1) = YRMODA(1900,1,1).
96 DEBUG EVALUATE/YRMODA(1,1,1) = YRMODA(1901,1,1).
97 DEBUG EVALUATE/YRMODA(12,1,1) = YRMODA(1912,1,1).
98 DEBUG EVALUATE/YRMODA(70,1,1) = YRMODA(1970,1,1).
99 DEBUG EVALUATE/YRMODA(87,1,1) = YRMODA(1987,1,1).
100 DEBUG EVALUATE/YRMODA(99,1,1) = YRMODA(1999,1,1).
101 DEBUG EVALUATE/YRMODA(100,1,1).
102 DEBUG EVALUATE/DATE.DMY(1,1,0) = DATE.DMY(1,1,2000).
103 DEBUG EVALUATE/DATE.DMY(1,1,1) = DATE.DMY(1,1,2001).
104 DEBUG EVALUATE/DATE.DMY(1,1,12) = DATE.DMY(1,1,1912).
105 DEBUG EVALUATE/DATE.DMY(1,1,70) = DATE.DMY(1,1,1970).
106 DEBUG EVALUATE/DATE.DMY(1,1,87) = DATE.DMY(1,1,1987).
107 DEBUG EVALUATE/DATE.DMY(1,1,99) = DATE.DMY(1,1,1999).
108 DEBUG EVALUATE/DATE.DMY(1,1,100).
111 DEBUG EVALUATE/YRMODA(0,1,1) = YRMODA(1900,1,1).
112 DEBUG EVALUATE/YRMODA(1,1,1) = YRMODA(1901,1,1).
113 DEBUG EVALUATE/YRMODA(12,1,1) = YRMODA(1912,1,1).
114 DEBUG EVALUATE/YRMODA(70,1,1) = YRMODA(1970,1,1).
115 DEBUG EVALUATE/YRMODA(87,1,1) = YRMODA(1987,1,1).
116 DEBUG EVALUATE/YRMODA(99,1,1) = YRMODA(1999,1,1).
117 DEBUG EVALUATE/YRMODA(100,1,1).
118 DEBUG EVALUATE/DATE.DMY(1,1,0) = DATE.DMY(1,1,2000).
119 DEBUG EVALUATE/DATE.DMY(1,1,1) = DATE.DMY(1,1,2001).
120 DEBUG EVALUATE/DATE.DMY(1,1,12) = DATE.DMY(1,1,1912).
121 DEBUG EVALUATE/DATE.DMY(1,1,70) = DATE.DMY(1,1,1970).
122 DEBUG EVALUATE/DATE.DMY(1,1,87) = DATE.DMY(1,1,1987).
123 DEBUG EVALUATE/DATE.DMY(1,1,99) = DATE.DMY(1,1,1999).
124 DEBUG EVALUATE/DATE.DMY(1,1,100).
127 DEBUG EVALUATE/YRMODA(0,1,1) = YRMODA(1900,1,1).
128 DEBUG EVALUATE/YRMODA(1,1,1) = YRMODA(1901,1,1).
129 DEBUG EVALUATE/YRMODA(12,1,1) = YRMODA(1912,1,1).
130 DEBUG EVALUATE/YRMODA(70,1,1) = YRMODA(1970,1,1).
131 DEBUG EVALUATE/YRMODA(87,1,1) = YRMODA(1987,1,1).
132 DEBUG EVALUATE/YRMODA(99,1,1) = YRMODA(1999,1,1).
133 DEBUG EVALUATE/YRMODA(100,1,1).
134 DEBUG EVALUATE/DATE.DMY(1,1,0) = DATE.DMY(1,1,2100).
135 DEBUG EVALUATE/DATE.DMY(1,1,1) = DATE.DMY(1,1,2101).
136 DEBUG EVALUATE/DATE.DMY(1,1,12) = DATE.DMY(1,1,2012).
137 DEBUG EVALUATE/DATE.DMY(1,1,70) = DATE.DMY(1,1,2070).
138 DEBUG EVALUATE/DATE.DMY(1,1,87) = DATE.DMY(1,1,2087).
139 DEBUG EVALUATE/DATE.DMY(1,1,99) = DATE.DMY(1,1,2099).
140 DEBUG EVALUATE/DATE.DMY(1,1,100).
142 if [ $? -ne 0 ] ; then no_result ; fi
144 activity="run program"
145 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/epoch.stat > $TEMPDIR/epoch.err 2> $TEMPDIR/epoch.out
147 activity="compare results"
148 perl -pi -e 's/^\s*$//g' $TEMPDIR/epoch.out
149 diff -b $TEMPDIR/epoch.out - <<EOF
150 YRMODA(0,1,1) = YRMODA(1900,1,1) => true
151 YRMODA(1,1,1) = YRMODA(1901,1,1) => true
152 YRMODA(12,1,1) = YRMODA(1912,1,1) => true
153 YRMODA(70,1,1) = YRMODA(1970,1,1) => true
154 YRMODA(87,1,1) = YRMODA(1987,1,1) => true
155 YRMODA(99,1,1) = YRMODA(1999,1,1) => true
156 YRMODA(100,1,1) => sysmis
157 DATE.DMY(1,1,0) = DATE.DMY(1,1,1900) => true
158 DATE.DMY(1,1,1) = DATE.DMY(1,1,1901) => true
159 DATE.DMY(1,1,12) = DATE.DMY(1,1,1912) => true
160 DATE.DMY(1,1,70) = DATE.DMY(1,1,1970) => true
161 DATE.DMY(1,1,87) = DATE.DMY(1,1,1987) => true
162 DATE.DMY(1,1,99) = DATE.DMY(1,1,1999) => true
163 DATE.DMY(1,1,100) => sysmis
164 YRMODA(0,1,1) = YRMODA(1900,1,1) => true
165 YRMODA(1,1,1) = YRMODA(1901,1,1) => true
166 YRMODA(12,1,1) = YRMODA(1912,1,1) => true
167 YRMODA(70,1,1) = YRMODA(1970,1,1) => true
168 YRMODA(87,1,1) = YRMODA(1987,1,1) => true
169 YRMODA(99,1,1) = YRMODA(1999,1,1) => true
170 YRMODA(100,1,1) => sysmis
171 DATE.DMY(1,1,0) = DATE.DMY(1,1,2000) => true
172 DATE.DMY(1,1,1) = DATE.DMY(1,1,1901) => true
173 DATE.DMY(1,1,12) = DATE.DMY(1,1,1912) => true
174 DATE.DMY(1,1,70) = DATE.DMY(1,1,1970) => true
175 DATE.DMY(1,1,87) = DATE.DMY(1,1,1987) => true
176 DATE.DMY(1,1,99) = DATE.DMY(1,1,1999) => true
177 DATE.DMY(1,1,100) => sysmis
178 YRMODA(0,1,1) = YRMODA(1900,1,1) => true
179 YRMODA(1,1,1) = YRMODA(1901,1,1) => true
180 YRMODA(12,1,1) = YRMODA(1912,1,1) => true
181 YRMODA(70,1,1) = YRMODA(1970,1,1) => true
182 YRMODA(87,1,1) = YRMODA(1987,1,1) => true
183 YRMODA(99,1,1) = YRMODA(1999,1,1) => true
184 YRMODA(100,1,1) => sysmis
185 DATE.DMY(1,1,0) = DATE.DMY(1,1,2000) => true
186 DATE.DMY(1,1,1) = DATE.DMY(1,1,2001) => true
187 DATE.DMY(1,1,12) = DATE.DMY(1,1,1912) => true
188 DATE.DMY(1,1,70) = DATE.DMY(1,1,1970) => true
189 DATE.DMY(1,1,87) = DATE.DMY(1,1,1987) => true
190 DATE.DMY(1,1,99) = DATE.DMY(1,1,1999) => true
191 DATE.DMY(1,1,100) => sysmis
192 YRMODA(0,1,1) = YRMODA(1900,1,1) => true
193 YRMODA(1,1,1) = YRMODA(1901,1,1) => true
194 YRMODA(12,1,1) = YRMODA(1912,1,1) => true
195 YRMODA(70,1,1) = YRMODA(1970,1,1) => true
196 YRMODA(87,1,1) = YRMODA(1987,1,1) => true
197 YRMODA(99,1,1) = YRMODA(1999,1,1) => true
198 YRMODA(100,1,1) => sysmis
199 DATE.DMY(1,1,0) = DATE.DMY(1,1,2000) => true
200 DATE.DMY(1,1,1) = DATE.DMY(1,1,2001) => true
201 DATE.DMY(1,1,12) = DATE.DMY(1,1,1912) => true
202 DATE.DMY(1,1,70) = DATE.DMY(1,1,1970) => true
203 DATE.DMY(1,1,87) = DATE.DMY(1,1,1987) => true
204 DATE.DMY(1,1,99) = DATE.DMY(1,1,1999) => true
205 DATE.DMY(1,1,100) => sysmis
206 YRMODA(0,1,1) = YRMODA(1900,1,1) => true
207 YRMODA(1,1,1) = YRMODA(1901,1,1) => true
208 YRMODA(12,1,1) = YRMODA(1912,1,1) => true
209 YRMODA(70,1,1) = YRMODA(1970,1,1) => true
210 YRMODA(87,1,1) = YRMODA(1987,1,1) => true
211 YRMODA(99,1,1) = YRMODA(1999,1,1) => true
212 YRMODA(100,1,1) => sysmis
213 DATE.DMY(1,1,0) = DATE.DMY(1,1,2100) => true
214 DATE.DMY(1,1,1) = DATE.DMY(1,1,2101) => true
215 DATE.DMY(1,1,12) = DATE.DMY(1,1,2012) => true
216 DATE.DMY(1,1,70) = DATE.DMY(1,1,2070) => true
217 DATE.DMY(1,1,87) = DATE.DMY(1,1,2087) => true
218 DATE.DMY(1,1,99) = DATE.DMY(1,1,2099) => true
219 DATE.DMY(1,1,100) => sysmis
221 if [ $? -ne 0 ] ; then no_result ; fi