test_sysfile("invalid_variable_name");
}
+#[test]
+fn invalid_label_indicator() {
+ test_sysfile("invalid_label_indicator");
+}
+
+#[test]
+fn invalid_missing_indicator() {
+ test_sysfile("invalid_missing_indicator");
+}
+
+#[test]
+fn invalid_missing_indicator2() {
+ test_sysfile("invalid_missing_indicator2");
+}
+
+/// Duplicate variable name handling negative test.
+///
+/// SPSS-generated system file can contain duplicate variable names (see bug
+/// #41475).
+#[test]
+fn duplicate_variable_name() {
+ test_sysfile("duplicate_variable_name");
+}
+
fn test_sysfile(name: &str) {
let input_filename = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("src/sys/testdata")
--- /dev/null
+Renaming variable with duplicate name VAR1 to VAR001.
+
+╭──────────────────────┬────────────────────────╮
+│ Created │ 01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│ Compression │SAV │
+│ Number of Cases│Unknown │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│2│
+╰─────────┴─╯
+
+╭──────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│ │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├──────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│var1 │ 1│ │ │Input│ 8│Right │F8.0 │F8.0 │ │
+│var001│ 2│ │ │Input│ 8│Right │F8.0 │F8.0 │ │
+╰──────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
--- /dev/null
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variables.
+2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
+2; 0; 0; 0; 0x050800 *2; s8 "VAR1";
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+# End of dictionary.
+999; 0;
--- /dev/null
+In variable record starting at offset 0xb4, variable label code 2 at offset 0xb8 is not 0 or 1.
--- /dev/null
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable.
+2; 0; >>2<<; 0; 0x050800 *2; s8 "VAR1";
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+# End of dictionary.
+999; 0;
--- /dev/null
+At offset 0xb4, missing value code (-1) is not -3, -2, 0, 1, 2, or 3.
--- /dev/null
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# Numeric variable.
+2; 0; 0; >>-1<<; 0x050800 *2; s8 "VAR1";
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+# End of dictionary.
+999; 0;
--- /dev/null
+At offset 0xb4, missing value code (4) is not -3, -2, 0, 1, 2, or 3.
--- /dev/null
+# File header.
+"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file";
+2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3;
+
+# String variable.
+2; 8; 0; >>4<<; 0x010800 *2; s8 "VAR1";
+
+# Character encoding record.
+7; 20; 1; 12; "windows-1252";
+
+# End of dictionary.
+999; 0;