1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
|
dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017, 2023 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([SET])
# This crashed older versions of PSPP (bug #30682).
AT_SETUP([SET FORMAT to invalid output format])
AT_DATA([set.pspp], [dnl
DATA LIST LIST NOTABLE /x.
BEGIN DATA.
1
2
3
END DATA.
SET FORMAT F41.
DESCRIPTIVES /x.
])
AT_CHECK([pspp -O format=csv set.pspp], [1], [dnl
"set.pspp:7.12-7.14: error: SET: Output format F41.0 specifies width 41, but F requires a width between 1 and 40.
7 | SET FORMAT F41.
| ^~~"
Table: Descriptive Statistics
,N,Mean,Std Dev,Minimum,Maximum
x,3,2.00,1.00,1.00,3.00
Valid N (listwise),3,,,,
Missing N (listwise),0,,,,
])
AT_CLEANUP
dnl This scenario was observed to erroneously free things twice
AT_SETUP([SET crash on invalid cc])
AT_DATA([set.pspp], [dnl
SET CCA='xxxx'.SHGW CCA.
])
AT_CHECK([pspp -O format=csv set.pspp], [1], [dnl
"set.pspp:1.9-1.14: error: SET: Custom currency string `CCA' for xxxx does not contain exactly three periods or commas (or it contains both).
1 | SET CCA='xxxx'.SHGW CCA.
| ^~~~~~"
])
AT_CLEANUP
AT_SETUP([SET MXWARNS])
dnl Make sure that syntax processing stops and that
dnl a warning is issued when the MXWARNS figure is
dnl exceeded.
AT_DATA([set.pspp], [dnl
set mxwarns=2.
data list notable list /x (f8.2) y (f8.2).
begin data
1 2
3 r
5 x
q 8
9 9
3 x
w w
end data.
comment The following line should not be executed.
list.
])
AT_CHECK([pspp -O format=csv set.pspp], [0], [dnl
set.pspp:5.3: warning: Data for variable y is not valid as format F: Field contents are not numeric.
set.pspp:6.3: warning: Data for variable y is not valid as format F: Field contents are not numeric.
set.pspp:7.1: warning: Data for variable x is not valid as format F: Field contents are not numeric.
note: Warnings (3) exceed limit (2). Syntax processing will be halted.
])
AT_CLEANUP
AT_SETUP([SET MXWARNS special case zero])
dnl Make sure that MXWARNS interprets zero as infinity.
AT_DATA([mxwarns.pspp], [dnl
set mxwarns=0.
data list notable list /x (f8.2) y (f8.2) z *.
begin data
1 2 3
3 r 3
5 x 3
q 8 4
9 9 4
3 x 4
w w 4
end data.
list.
])
AT_CHECK([pspp -O format=csv mxwarns.pspp], [0],
[warning: MXWARNS set to zero. No further warnings will be given even when potentially problematic situations are encountered.
Table: Data List
x,y,z
1.00,2.00,3.00
3.00,. ,3.00
5.00,. ,3.00
. ,8.00,4.00
9.00,9.00,4.00
3.00,. ,4.00
. ,. ,4.00
])
AT_CLEANUP
AT_SETUP([SET macro - MEXPAND MPRINT MITERATE MNEST])
AT_DATA([set-macro.sps], [dnl
show mexpand mprint miterate mnest.
preserve.
set mexpand=off mprint=on miterate=10 mnest=11.
show mexpand mprint miterate mnest.
restore.
show mexpand mprint miterate mnest.
])
AT_CHECK([pspp -O format=csv set-macro.sps], [0], [dnl
Table: Settings
MEXPAND,ON
MPRINT,OFF
MITERATE,1000
MNEST,50
Table: Settings
MEXPAND,OFF
MPRINT,ON
MITERATE,10
MNEST,11
Table: Settings
MEXPAND,ON
MPRINT,OFF
MITERATE,1000
MNEST,50
])
AT_CLEANUP
AT_SETUP([SET syntax errors])
AT_DATA([set.sps], [dnl
SET **.
SET BASETEXTDIRECTION=**.
SET BLANKS=**.
SET BOX=**.
SET CACHE=**.
SET CCA=**.
SET CELLSBREAK=**.
SET CMPTRANS=**.
SET COMPRESSION=**.
SET CTEMPLATE=**.
SET DECIMAL=**.
SET EPOCH=**.
SET EPOCH=1234.
SET ERRORS=**.
SET FORMAT=**.
SET FORMAT=A8.
SET FORMAT=F1.2.
SET FUZZBITS=40.
SET HEADER=**.
SET INCLUDE=**.
SET JOURNAL=**.
SET LEADZERO=**.
SET LENGTH=**.
SET LOCALE='Neverland'.
SET LOCALE=**.
SET MDISPLAY=**.
SET MESSAGES=**.
SET MEXPAND=**.
SET MITERATE=0.
SET MNEST=0.
SET MPRINT=**.
SET MXERRS=0.
SET MXLOOPS=0.
SET MXWARNS=-1.
SET PRINTBACK=**.
SET RESULTS=**.
SET RIB=**.
SET RRB=**.
SET SAFER=**.
SET SCOMPRESSION=**.
SET SEED=**.
SET SMALL=**.
SET SUBTITLE=**.
SET SUMMARY=**.
SET TNUMBERS=**.
SET TVARS=**.
SET TLOOK='nonexistent.xml'.
SET UNDEFINED=**.
SET WIB=**.
SET WRB=**.
SET WIDTH=**.
SET WORKSPACE=**.
])
AT_CHECK([pspp -O format=csv set.sps], [1], [dnl
"set.sps:1.5-1.6: error: SET: Syntax error expecting the name of a setting.
1 | SET **.
| ^~"
"set.sps:2.5-2.24: warning: SET: BASETEXTDIRECTION is not yet implemented.
2 | SET BASETEXTDIRECTION=**.
| ^~~~~~~~~~~~~~~~~~~~"
"set.sps:3.12-3.13: error: SET: Syntax error expecting number.
3 | SET BLANKS=**.
| ^~"
"set.sps:4.5-4.10: warning: SET: BOX is not yet implemented.
4 | SET BOX=**.
| ^~~~~~"
"set.sps:5.5-5.12: warning: SET: CACHE is not yet implemented.
5 | SET CACHE=**.
| ^~~~~~~~"
"set.sps:6.9-6.10: error: SET: Syntax error expecting string.
6 | SET CCA=**.
| ^~"
"set.sps:7.5-7.17: warning: SET: CELLSBREAK is not yet implemented.
7 | SET CELLSBREAK=**.
| ^~~~~~~~~~~~~"
"set.sps:8.5-8.15: warning: SET: CMPTRANS is not yet implemented.
8 | SET CMPTRANS=**.
| ^~~~~~~~~~~"
"set.sps:9.5-9.18: warning: SET: COMPRESSION is not yet implemented.
9 | SET COMPRESSION=**.
| ^~~~~~~~~~~~~~"
"set.sps:10.5-10.16: warning: SET: CTEMPLATE is not yet implemented.
10 | SET CTEMPLATE=**.
| ^~~~~~~~~~~~"
"set.sps:11.13-11.14: error: SET: Syntax error expecting DOT or COMMA.
11 | SET DECIMAL=**.
| ^~"
"set.sps:12.11-12.12: error: SET: Syntax error expecting AUTOMATIC or year.
12 | SET EPOCH=**.
| ^~"
"set.sps:13.11-13.14: error: SET: Syntax error expecting integer 1500 or greater for EPOCH.
13 | SET EPOCH=1234.
| ^~~~"
"set.sps:14.12-14.13: error: SET: Syntax error expecting ON, BOTH, TERMINAL, LISTING, OFF, or NONE.
14 | SET ERRORS=**.
| ^~"
"set.sps:15.12-15.13: error: SET: Syntax error expecting valid format specifier.
15 | SET FORMAT=**.
| ^~"
"set.sps:16.5-16.13: error: SET: FORMAT requires numeric output format as an argument. Specified format A8 is of type string.
16 | SET FORMAT=A8.
| ^~~~~~~~~"
"set.sps:17.12-17.15: error: SET: Output format F1.2 specifies 2 decimal places, but width 1 does not allow for any decimals.
17 | SET FORMAT=F1.2.
| ^~~~"
"set.sps:18.14-18.15: error: SET: Syntax error expecting integer between 0 and 20 for FUZZBITS.
18 | SET FUZZBITS=40.
| ^~"
"set.sps:19.5-19.13: warning: SET: HEADER is not yet implemented.
19 | SET HEADER=**.
| ^~~~~~~~~"
"set.sps:20.13-20.14: error: SET: Syntax error expecting ON, YES, OFF, or NO.
20 | SET INCLUDE=**.
| ^~"
"set.sps:21.13-21.14: error: SET: Syntax error expecting ON or OFF or a file name.
21 | SET JOURNAL=**.
| ^~"
"set.sps:22.14-22.15: error: SET: Syntax error expecting ON, YES, OFF, or NO.
22 | SET LEADZERO=**.
| ^~"
"set.sps:23.12-23.13: error: SET: Syntax error expecting positive integer for LENGTH.
23 | SET LENGTH=**.
| ^~"
"set.sps:24.12-24.22: error: SET: Neverland is not a recognized encoding or locale name.
24 | SET LOCALE='Neverland'.
| ^~~~~~~~~~~"
"set.sps:25.12-25.13: error: SET: Syntax error expecting string.
25 | SET LOCALE=**.
| ^~"
"set.sps:26.14-26.15: error: SET: Syntax error expecting TEXT or TABLES.
26 | SET MDISPLAY=**.
| ^~"
"set.sps:27.14-27.15: error: SET: Syntax error expecting ON, BOTH, TERMINAL, LISTING, OFF, or NONE.
27 | SET MESSAGES=**.
| ^~"
"set.sps:28.13-28.14: error: SET: Syntax error expecting ON, YES, OFF, or NO.
28 | SET MEXPAND=**.
| ^~"
"set.sps:29.14: error: SET: Syntax error expecting positive integer for MITERATE.
29 | SET MITERATE=0.
| ^"
"set.sps:30.11: error: SET: Syntax error expecting positive integer for MNEST.
30 | SET MNEST=0.
| ^"
"set.sps:31.12-31.13: error: SET: Syntax error expecting ON, YES, OFF, or NO.
31 | SET MPRINT=**.
| ^~"
"set.sps:32.12: error: SET: Syntax error expecting positive integer for MXERRS.
32 | SET MXERRS=0.
| ^"
"set.sps:33.13: error: SET: Syntax error expecting positive integer for MXLOOPS.
33 | SET MXLOOPS=0.
| ^"
"set.sps:34.13-34.14: error: SET: Syntax error expecting non-negative integer for MXWARNS.
34 | SET MXWARNS=-1.
| ^~"
"set.sps:35.15-35.16: error: SET: Syntax error expecting ON, BOTH, TERMINAL, LISTING, OFF, or NONE.
35 | SET PRINTBACK=**.
| ^~"
"set.sps:36.13-36.14: error: SET: Syntax error expecting ON, BOTH, TERMINAL, LISTING, OFF, or NONE.
36 | SET RESULTS=**.
| ^~"
"set.sps:37.9-37.10: error: SET: Syntax error expecting MSBFIRST, LSBFIRST, VAX, or NATIVE.
37 | SET RIB=**.
| ^~"
"set.sps:38.9-38.10: error: SET: Syntax error expecting one of the following: NATIVE, ISL, ISB, IDL, IDB, VF, VD, VG, ZS.
38 | SET RRB=**.
| ^~"
"set.sps:39.11-39.12: error: SET: Syntax error expecting ON or YES.
39 | SET SAFER=**.
| ^~"
"set.sps:40.18-40.19: error: SET: Syntax error expecting ON, YES, OFF, or NO.
40 | SET SCOMPRESSION=**.
| ^~"
"set.sps:41.10-41.11: error: SET: Syntax error expecting number.
41 | SET SEED=**.
| ^~"
"set.sps:42.11-42.12: error: SET: Syntax error expecting number.
42 | SET SMALL=**.
| ^~"
"set.sps:43.5-43.12: error: SET: Syntax error expecting the name of a setting.
43 | SET SUBTITLE=**.
| ^~~~~~~~"
"set.sps:44.13-44.14: error: SET: Syntax error expecting string.
44 | SET SUMMARY=**.
| ^~"
"set.sps:45.14-45.15: error: SET: Syntax error expecting LABELS, VALUES, or BOTH.
45 | SET TNUMBERS=**.
| ^~"
"set.sps:46.11-46.12: error: SET: Syntax error expecting LABELS, NAMES, or BOTH.
46 | SET TVARS=**.
| ^~"
set.sps:47: error: SET: nonexistent.xml: not found
"set.sps:48.15-48.16: error: SET: Syntax error expecting WARN or NOWARN.
48 | SET UNDEFINED=**.
| ^~"
"set.sps:49.9-49.10: error: SET: Syntax error expecting MSBFIRST, LSBFIRST, VAX, or NATIVE.
49 | SET WIB=**.
| ^~"
"set.sps:50.9-50.10: error: SET: Syntax error expecting one of the following: NATIVE, ISL, ISB, IDL, IDB, VF, VD, VG, ZS.
50 | SET WRB=**.
| ^~"
"set.sps:51.11-51.12: error: SET: Syntax error expecting integer 40 or greater for WIDTH.
51 | SET WIDTH=**.
| ^~"
"set.sps:52.15-52.16: error: SET: Syntax error expecting integer 1024 or greater for WORKSPACE.
52 | SET WORKSPACE=**.
| ^~"
])
AT_CLEANUP
AT_BANNER([PRESERVE and RESTORE])
AT_SETUP([PRESERVE of SET FORMAT])
AT_DATA([set.pspp], [dnl
SHOW FORMAT.
PRESERVE.
SET FORMAT F10.0.
SHOW FORMAT
RESTORE.
SHOW FORMAT.
])
AT_CHECK([pspp -O format=csv set.pspp], [0], [dnl
Table: Settings
FORMAT,F8.2
Table: Settings
FORMAT,F10.0
Table: Settings
FORMAT,F8.2
])
AT_CLEANUP
AT_SETUP([PRESERVE and SHOW of TLOOK])
cp $srcdir/output/look.stt lines.stt
sed 's/solid/none/g
s/thick/none/g' lines.stt > no-lines.stt
AT_DATA([set.pspp], [dnl
DATA LIST LIST NOTABLE/x.
BEGIN DATA.
1
2
3
END DATA.
SHOW TLOOK.
SET TLOOK='lines.stt'.
SHOW TLOOK.
DESCRIPTIVES/x.
PRESERVE.
SET TLOOK='no-lines.stt'.
SHOW TLOOK.
DESCRIPTIVES/x.
RESTORE.
SHOW TLOOK.
DESCRIPTIVES/x.
])
AT_CHECK([pspp -O box=unicode set.pspp], [0], [dnl
Settings
╭─────┬────╮
│TLOOK│NONE│
╰─────┴────╯
Settings
╭─────┬─────────╮
│TLOOK│lines.stt│
╰─────┴─────────╯
Descriptive Statistics
╭────────────────────┬─┬────┬───────┬───────┬───────╮
│ │N│Mean│Std Dev│Minimum│Maximum│
├────────────────────┼─┼────┼───────┼───────┼───────┤
│x │3│2.00│ 1.00│ 1.00│ 3.00│
│Valid N (listwise) │3│ │ │ │ │
│Missing N (listwise)│0│ │ │ │ │
╰────────────────────┴─┴────┴───────┴───────┴───────╯
Settings
TLOOK no-lines.stt
Descriptive Statistics
N Mean Std Dev Minimum Maximum
x 3 2.00 1.00 1.00 3.00
Valid N (listwise) 3
Missing N (listwise) 0
Settings
╭─────┬─────────╮
│TLOOK│lines.stt│
╰─────┴─────────╯
Descriptive Statistics
╭────────────────────┬─┬────┬───────┬───────┬───────╮
│ │N│Mean│Std Dev│Minimum│Maximum│
├────────────────────┼─┼────┼───────┼───────┼───────┤
│x │3│2.00│ 1.00│ 1.00│ 3.00│
│Valid N (listwise) │3│ │ │ │ │
│Missing N (listwise)│0│ │ │ │ │
╰────────────────────┴─┴────┴───────┴───────┴───────╯
])
AT_CLEANUP
|