tests: Convert test of compressed system files to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 16:49:29 +0000 (09:49 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 16:49:29 +0000 (09:49 -0700)
tests/automake.mk
tests/data/sys-file.at

index a60b344bb3706799be2b512589e934afaae48b2c..4c2c90d405e5be97c3f1206418475a7291b1f497 100644 (file)
@@ -28,7 +28,6 @@ dist_TESTS = \
        tests/formats/wkday-out.sh \
        tests/formats/360.sh \
        tests/bugs/comment-at-eof.sh \
-       tests/bugs/compression.sh \
        tests/bugs/curtailed.sh \
        tests/bugs/data-crash.sh \
        tests/bugs/if_crash.sh \
index e82166c9054c378e24933a35cb07e4e24d4de0e1..e726d535404934a6396a640681904baa570f0c2b 100644 (file)
@@ -37,7 +37,36 @@ variable001,variable002,variable003,variable004
 ])
 AT_CLEANUP
 
+AT_SETUP([write and read compressed files])
+AT_KEYWORDS([SAVE GET system file])
+AT_DATA([sysfile.sps], [dnl
+DATA LIST LIST NOTABLE /x * y (a200).
+BEGIN DATA.
+1.2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+.   yyyyyyyyyyyyyyy
+0   ddddddddddddddddddddddddddddddd
+101 z
+END DATA.
+
+SAVE OUTFILE='com.sav' /COMPRESS .
+
+GET FILE='com.sav'.
+
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv sysfile.sps])
+dnl Make sure file really was compressd.
+AT_CHECK([dd if=com.sav bs=1 skip=72 count=4 2> /dev/null | od | sed '1q' > com.txt])
+dnl Allow big- or little-endian format.
+AT_CHECK(
+  [(echo '0000000 000000 000001' | diff com.txt -) ||
+   (echo '0000000 000001 000000' | diff com.txt -)], [0],
+  [ignore])
+AT_CAPTURE_FILE([com.txt])
+AT_CLEANUP
+
 AT_SETUP([nonempty case_map doesn't crash])
+AT_KEYWORDS([SAVE system file])
 AT_DATA([save.sps], [dnl
 INPUT PROGRAM.
     COMPUTE #I = 1.