SYSFILE INFO: Improve output formatting by using nested tables.
[pspp] / tests / language / data-io / get-data-spreadsheet.at
index c9060aef5f7a4bf29c0604dab0e2165bca149772..b6a18ddf2c5e5c21c8ace8b3295e7f2abf2b6d38 100644 (file)
@@ -3,7 +3,7 @@ m4_define([SPREADSHEET_TEST_PREP],[dnl
  m4_if($1,[GNM],[dnl
     AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])dnl
     m4_define([testsheet],[Book1.gnumeric])dnl
-    AT_SKIP_IF([test n$GNM_SUPPORT != nyes])dnl
+    AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes])dnl
     ]) dnl
  m4_if($1,[ODS],[dnl
     AT_CHECK([cp $top_srcdir/tests/language/data-io/test.ods test.ods])dnl
@@ -23,19 +23,10 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,,Position
-VAR001,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-VAR002,Format: A8,,2
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-VAR003,Format: F8.2,,3
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Variable,Description,Position
+VAR001,Format: F8.2,1
+VAR002,Format: A8,2
+VAR003,Format: F8.2,3
 
 Table: Data List
 VAR001,VAR002,VAR003
@@ -56,19 +47,10 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,,Position
-V1,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-V2,Format: A8,,2
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-VAR001,Format: F8.2,,3
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Variable,Description,Position
+V1,Format: F8.2,1
+V2,Format: A8,2
+VAR001,Format: F8.2,3
 
 Table: Data List
 V1,V2,VAR001
@@ -87,21 +69,13 @@ GET DATA /TYPE=$1 /FILE='testsheet' /SHEET=index 3.
 DISPLAY VARIABLES.
 LIST.
 ])
-AT_CHECK([pspp -o pspp.csv get-data.sps])
-AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,,Position
-name,Format: A8,,1
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-id,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-height,Format: F8.2,,3
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+AT_CHECK([pspp -O format=csv get-data.sps], [0], [dnl
+Variable,Description,Position
+name,Format: A8,1
+id,Format: F8.2,2
+height,Format: F8.2,3
+
+warning: Cannot convert the value in the spreadsheet cell C4 to format (F8.2): Field contents are not numeric.
 
 Table: Data List
 name,id,height
@@ -122,23 +96,11 @@ LIST.
 ])
 AT_CHECK([pspp -o pspp.csv get-data.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
-Variable,Description,,Position
-vone,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-vtwo,Format: F8.2,,2
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
-vthree,Format: A8,,3
-,Measure: Nominal,,
-,Display Alignment: Left,,
-,Display Width: 8,,
-v4,Format: F8.2,,4
-,Measure: Scale,,
-,Display Alignment: Right,,
-,Display Width: 8,,
+Variable,Description,Position
+vone,Format: F8.2,1
+vtwo,Format: F8.2,2
+vthree,Format: A8,3
+v4,Format: F8.2,4
 
 Table: Data List
 vone,vtwo,vthree,v4
@@ -147,6 +109,22 @@ vone,vtwo,vthree,v4
 ])
 AT_CLEANUP
 
+dnl This syntax doesn't do anything particularly useful.
+dnl It has been seen to cause a few crashes, so we check here that it
+dnl doesn't do anthing bad.
+AT_SETUP([GET DATA /TYPE=$1 with no options])
+SPREADSHEET_TEST_PREP($1)
+AT_DATA([get-data.sps], [dnl
+* This sheet is empty
+GET DATA /TYPE=$1 /FILE='testsheet'.
+DISPLAY DICTIONARY.
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv get-data.sps], [0], [ignore])
+AT_CLEANUP
+
+
+
 AT_SETUP([GET DATA /TYPE=$1 with empty sheet])
 SPREADSHEET_TEST_PREP($1)
 AT_DATA([get-data.sps], [dnl
@@ -177,6 +155,7 @@ CHECK_SPREADSHEET_READER([GNM])
 
 dnl Check for a bug where gnumeric files were interpreted incorrectly
 AT_SETUP([GET DATA /TYPE=GNM sheet index bug])
+AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes])
 AT_DATA([minimal3.gnumeric],[dnl
 <?xml version="1.0" encoding="UTF-8"?>
 <gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v9.xsd">
@@ -322,7 +301,77 @@ VAR001,VAR002,VAR003
 
 AT_CLEANUP
 
+
+dnl Check for a bug where certain gnumeric files failed an assertion
+AT_SETUP([GET DATA /TYPE=GNM assert-fail])
+AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes])
+AT_DATA([read.sps],[dnl
+GET DATA 
+       /TYPE=GNM
+       /FILE='crash.gnumeric' 
+       .
+list.
+])
+
+
+AT_DATA([crash.gnumeric],[dnl
+<?xml version="1.0" encoding="UTF-8"?>
+<gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v9.xsd">
+  <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.1">
+  </office:document-meta>
+  <gnm:SheetNameIndex>
+    <gnm:SheetName gnm:Cols="256" gnm:Rows="65536">Sheet1</gnm:SheetName>
+  </gnm:SheetNameIndex>
+  <gnm:Sheets>
+    <gnm:Sheet DisplayFormulas="0" HideZero="0" HideGrid="0" HideColHeader="0" HideRowHeader="0" DisplayOutlines="1" OutlineSymbolsBelow="1" OutlineSymbolsRight="1" Visibility="GNM_SHEET_VISIBILITY_VISIBLE" GridColor="0:0:0">
+      <gnm:Name>Sheet1</gnm:Name>
+      <gnm:MaxCol>2</gnm:MaxCol>
+      <gnm:MaxRow>4</gnm:MaxRow>
+      <gnm:Styles>
+        <gnm:StyleRegion startCol="0" startRow="0" endCol="255" endRow="65535">
+          <gnm:Style HAlign="1" VAlign="2" WrapText="0" ShrinkToFit="0" Rotation="0" Shade="0" Indent="0" Locked="1" Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General">
+          </gnm:Style>
+        </gnm:StyleRegion>
+      </gnm:Styles>
+      <gnm:Cells>
+        <gnm:Cell Row="1" Col="1" ValueType="60">one</gnm:Cell>
+        <gnm:Cell Row="1" Col="2" ValueType="60">two</gnm:Cell>
+        <gnm:Cell Row="2" Col="1" ValueType="40">1</gnm:Cell>
+        <gnm:Cell Row="2" Col="2" ValueType="40">2</gnm:Cell>
+        <gnm:Cell Row="3" Col="1" ValueType="40">1</gnm:Cell>
+        <gnm:Cell Row="3" Col="2" ValueType="40">2</gnm:Cell>
+        <gnm:Cell Row="4" Col="1" ValueType="40">1</gnm:Cell>
+        <gnm:Cell Row="4" Col="2" ValueType="40">2</gnm:Cell>
+      </gnm:Cells>
+    </gnm:Sheet>
+  </gnm:Sheets>
+</gnm:Workbook>
+])
+
+AT_CHECK([pspp -O format=csv read.sps], [0], [ignore])
+
+
+AT_CLEANUP
+
+
+
 AT_BANNER([GET DATA Spreadsheet /TYPE=ODS])
 
 CHECK_SPREADSHEET_READER([ODS])
 
+
+AT_SETUP([GET DATA /TYPE=ODS crash])
+AT_SKIP_IF([test n$ODF_READ_SUPPORT != nyes])
+
+                    
+AT_CHECK([cp $top_srcdir/tests/language/data-io/newone.ods this.ods])dnl
+
+AT_DATA([crash.sps],[dnl
+GET DATA /TYPE=ODS /FILE='this.ods' /CELLRANGE=RANGE 'A1:C8'  /READNAMES=ON
+LIST.
+])
+
+AT_CHECK([pspp -O format=csv crash.sps], [0], [ignore])
+
+AT_CLEANUP
+