more tests
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 20 Jun 2025 00:00:38 +0000 (17:00 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 20 Jun 2025 00:00:38 +0000 (17:00 -0700)
19 files changed:
rust/pspp/src/sys/test.rs
rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.sack [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.expected [new file with mode: 0644]
rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.sack [new file with mode: 0644]

index b449d059998bc59b6cc69463984bc3cb44b95836..f6dd0cd10abefffeacad2224ca72c3f377facb79 100644 (file)
@@ -242,6 +242,51 @@ fn multiple_response_sets_missing_space_after_c() {
     test_sysfile("multiple_response_sets_missing_space_after_c");
 }
 
+#[test]
+fn multiple_response_sets_missing_space_after_e() {
+    test_sysfile("multiple_response_sets_missing_space_after_e");
+}
+
+#[test]
+fn multiple_response_sets_missing_label_source() {
+    test_sysfile("multiple_response_sets_missing_label_source");
+}
+
+#[test]
+fn multiple_response_sets_unexpected_label_source() {
+    test_sysfile("multiple_response_sets_unexpected_label_source");
+}
+
+#[test]
+fn multiple_response_sets_bad_counted_string() {
+    test_sysfile("multiple_response_sets_bad_counted_string");
+}
+
+#[test]
+fn multiple_response_sets_counted_string_missing_space() {
+    test_sysfile("multiple_response_sets_counted_string_missing_space");
+}
+
+#[test]
+fn multiple_response_sets_counted_string_bad_length() {
+    test_sysfile("multiple_response_sets_counted_string_bad_length");
+}
+
+#[test]
+fn multiple_response_sets_missing_space_after_counted_string() {
+    test_sysfile("multiple_response_sets_missing_space_after_counted_string");
+}
+
+#[test]
+fn multiple_response_sets_missing_newline_after_variable_name() {
+    test_sysfile("multiple_response_sets_missing_newline_after_variable_name");
+}
+
+#[test]
+fn multiple_response_sets_duplicate_variable_name() {
+    test_sysfile("multiple_response_sets_duplicate_variable_name");
+}
+
 /// Duplicate variable name handling negative test.
 ///
 /// SPSS-generated system file can contain duplicate variable names (see bug
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.expected
new file mode 100644 (file)
index 0000000..9b5bb88
--- /dev/null
@@ -0,0 +1,20 @@
+Syntax error parsing counted string (missing trailing space)
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_bad_counted_string.sack
new file mode 100644 (file)
index 0000000..fdd7265
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=Dx");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.expected
new file mode 100644 (file)
index 0000000..3a7ad8c
--- /dev/null
@@ -0,0 +1,20 @@
+Syntax error parsing counted string (length 4 goes past end of input)
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_bad_length.sack
new file mode 100644 (file)
index 0000000..f376380
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=D4 abc");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.expected
new file mode 100644 (file)
index 0000000..9b5bb88
--- /dev/null
@@ -0,0 +1,20 @@
+Syntax error parsing counted string (missing trailing space)
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_counted_string_missing_space.sack
new file mode 100644 (file)
index 0000000..3d55b83
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=D1x");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.expected
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_duplicate_variable_name.sack
new file mode 100644 (file)
index 0000000..7a8b147
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=C 0  NUM1 NUM1"; i8 10);
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.expected
new file mode 100644 (file)
index 0000000..01359ae
--- /dev/null
@@ -0,0 +1,20 @@
+Invalid multiple dichotomy label type
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_label_source.sack
new file mode 100644 (file)
index 0000000..5bc70ca
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=E ");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.expected
new file mode 100644 (file)
index 0000000..16dd47d
--- /dev/null
@@ -0,0 +1,20 @@
+Syntax error in multiple response record (missing variable name delimiter)
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_newline_after_variable_name.sack
new file mode 100644 (file)
index 0000000..63f765f
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=C 0  NUM1");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.expected
new file mode 100644 (file)
index 0000000..4fcc82f
--- /dev/null
@@ -0,0 +1,20 @@
+Syntax error in multiple response record (missing space after multiple response type)
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_counted_string.sack
new file mode 100644 (file)
index 0000000..b400ec0
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=D3 abcx");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.expected
new file mode 100644 (file)
index 0000000..01359ae
--- /dev/null
@@ -0,0 +1,20 @@
+Invalid multiple dichotomy label type
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_missing_space_after_e.sack
new file mode 100644 (file)
index 0000000..3738e09
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=Ex");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.expected b/rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.expected
new file mode 100644 (file)
index 0000000..01359ae
--- /dev/null
@@ -0,0 +1,20 @@
+Invalid multiple dichotomy label type
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│1│
+╰─────────┴─╯
+
+╭────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│    │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1│       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+╰────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
diff --git a/rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.sack b/rust/pspp/src/sys/testdata/multiple_response_sets_unexpected_label_source.sack
new file mode 100644 (file)
index 0000000..418a20e
--- /dev/null
@@ -0,0 +1,14 @@
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable, no label or missing values.
+2; 0; 0; 0; 0x050800 *2; s8 "NUM1";
+
+# Multiple response sets.
+7; 7; 1; COUNT("$a=E 2");
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+999; 0;