//! Integration tests against the real extracted Project Sylpheed disc. //! //! These are **skipped** (pass as no-ops) when the extracted disc is not present, //! so the suite still runs on machines/CI without the game. Point at the disc via //! the `SYLPHEED_DISC` env var, or drop it at the default dev path below. use std::path::{Path, PathBuf}; use sylpheed_formats::{IdxdObject, PakArchive}; /// Locate the extracted disc root, or `None` to skip. fn disc_root() -> Option { if let Ok(p) = std::env::var("SYLPHEED_DISC") { let p = PathBuf::from(p); if p.join("dat").is_dir() { return Some(p); } } let default = Path::new( "/home/fabi/RE - Project Sylpheed/Project Sylpheed - Arc of Deception (USA, Europe) (En,Ja)", ); if default.join("dat").is_dir() { return Some(default.to_path_buf()); } None } macro_rules! skip_without_disc { ($root:ident) => { let Some($root) = disc_root() else { eprintln!("SKIP: extracted disc not found (set SYLPHEED_DISC to enable)"); return; }; }; } #[test] fn deftables_header_and_first_entry() { skip_without_disc!(root); let arc = PakArchive::open(root.join("hidden/DefTables.pak")).unwrap(); assert_eq!(arc.len(), 1465); assert_eq!(arc.block_size, 0x800); assert_eq!(arc.flags, 0x1000_0000); // TOC is sorted ascending by name_hash. assert!(arc .entries() .windows(2) .all(|w| w[0].name_hash < w[1].name_hash)); // First entries decompress to a known inner format (IDXD or XML). let first = &arc.entries()[0]; let payload = arc.read(first).unwrap(); assert!( payload.starts_with(b"IDXD") || payload.starts_with(b" 0); }