From ee9100a5cd5728b98c37b333ce3e8af66504edc0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 8 Jun 2025 12:39:02 -0700 Subject: [PATCH] extra product info --- rust/pspp/src/sys/test.rs | 7 +++++ .../sys/testdata/extra_product_info.expected | 26 +++++++++++++++++++ .../src/sys/testdata/extra_product_info.sack | 25 ++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 rust/pspp/src/sys/testdata/extra_product_info.expected create mode 100644 rust/pspp/src/sys/testdata/extra_product_info.sack diff --git a/rust/pspp/src/sys/test.rs b/rust/pspp/src/sys/test.rs index 7a7801e27b..db94531a2f 100644 --- a/rust/pspp/src/sys/test.rs +++ b/rust/pspp/src/sys/test.rs @@ -55,6 +55,13 @@ fn multiple_response_sets() { test_sysfile("multiple_response_sets"); } +#[test] +fn extra_product_info() { + // Also checks for handling of CR-only line ends in file label and extra + // product info. + test_sysfile("extra_product_info"); +} + fn test_sysfile(name: &str) { let input_filename = Path::new(env!("CARGO_MANIFEST_DIR")) .join("src/sys/testdata") diff --git a/rust/pspp/src/sys/testdata/extra_product_info.expected b/rust/pspp/src/sys/testdata/extra_product_info.expected new file mode 100644 index 0000000000..63ef54fde9 --- /dev/null +++ b/rust/pspp/src/sys/testdata/extra_product_info.expected @@ -0,0 +1,26 @@ +╭──────────────────────┬────────────────────────╮ +│ Created │ 01-JAN-2011 20:53:52│ +├──────────────────────┼────────────────────────┤ +│Writer Product │PSPP synthetic test file│ +│ Product 2 │Extra product info │ +│ │another line │ +│ │blah │ +├──────────────────────┼────────────────────────┤ +│ Compression │None │ +│ Number of Cases│ 0│ +╰──────────────────────┴────────────────────────╯ + +╭─────────┬──────────────╮ +│Label │PSPP synthetic│ +│ │test file │ +│Variables│ 4│ +╰─────────┴──────────────╯ + +╭─┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮ +│ │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│ +├─┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤ +│a│ 1│ │ │Input│ 8│Right │F8.0 │F8.0 │ │ +│b│ 2│ │ │Input│ 8│Right │F8.0 │F8.0 │ │ +│c│ 3│ │ │Input│ 8│Right │F8.0 │F8.0 │ │ +│d│ 4│ │ │Input│ 8│Right │F8.0 │F8.0 │ │ +╰─┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯ diff --git a/rust/pspp/src/sys/testdata/extra_product_info.sack b/rust/pspp/src/sys/testdata/extra_product_info.sack new file mode 100644 index 0000000000..d9097378d8 --- /dev/null +++ b/rust/pspp/src/sys/testdata/extra_product_info.sack @@ -0,0 +1,25 @@ +# File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; # Layout code +4; # Nominal case size +0; # Not compressed +0; # Not weighted +0; # No cases. +100.0; # Bias. +"01 Jan 11"; "20:53:52"; "PSPP synthetic"; i8 13; s49 "test file"; +i8 0 *3; + +# Numeric variables. +2; 0; 0; 0; 0x050800 *2; s8 "A"; +2; 0; 0; 0; 0x050800 *2; s8 "B"; +2; 0; 0; 0; 0x050800 *2; s8 "C"; +2; 0; 0; 0; 0x050800 *2; s8 "D"; + +# Extra product info. +7; 10; 1; COUNT ("Extra product info"; i8 13; "another line"; i8 13; "blah"); + +# Character encoding record. +7; 20; 1; 12; "windows-1252"; + +# Dictionary termination record. +999; 0; -- 2.30.2