From: Ben Pfaff Date: Tue, 17 Jun 2025 20:33:59 +0000 (-0700) Subject: add test X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ce718c7c954728c79190ad513b848fdc681d6f8;p=pspp add test --- diff --git a/rust/pspp/src/sys/test.rs b/rust/pspp/src/sys/test.rs index 3caabc81c9..479f1d623c 100644 --- a/rust/pspp/src/sys/test.rs +++ b/rust/pspp/src/sys/test.rs @@ -217,6 +217,11 @@ fn bad_machine_integer_info_endianness() { test_sysfile("bad_machine_integer_info_endianness"); } +#[test] +fn bad_machine_float_info_size() { + test_sysfile("bad_machine_float_info_size"); +} + /// 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/bad_machine_float_info_size.expected b/rust/pspp/src/sys/testdata/bad_machine_float_info_size.expected new file mode 100644 index 0000000000..973ebaac59 --- /dev/null +++ b/rust/pspp/src/sys/testdata/bad_machine_float_info_size.expected @@ -0,0 +1,20 @@ +At offset 0xe0, floating point record has bad count 4 instead of the expected 3. + +╭──────────────────────┬────────────────────────╮ +│ 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/bad_machine_float_info_size.sack b/rust/pspp/src/sys/testdata/bad_machine_float_info_size.sack new file mode 100644 index 0000000000..ef5a83ced2 --- /dev/null +++ b/rust/pspp/src/sys/testdata/bad_machine_float_info_size.sack @@ -0,0 +1,15 @@ +# 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"; + +# Machine floating-point info record. +7; 4; 8; >>4<<; SYSMIS; HIGHEST; LOWEST; 0.0; + +# Character encoding record. +7; 20; 1; 12; "windows-1252"; + +# End of dictionary. +999; 0;