move test assets to top-level since they're used by multiple crates now
This commit is contained in:
parent
67bdb76c52
commit
e54bdc600b
|
@ -329,7 +329,7 @@ mod tests {
|
||||||
let dat_save_path = tmp_dir.path().join("quest58.dat");
|
let dat_save_path = tmp_dir.path().join("quest58.dat");
|
||||||
|
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.online.qst".to_string(),
|
"../test-assets/q058-ret-gc.online.qst".to_string(),
|
||||||
"raw_bindat".to_string(),
|
"raw_bindat".to_string(),
|
||||||
bin_save_path.to_string_lossy().into_owned(),
|
bin_save_path.to_string_lossy().into_owned(),
|
||||||
dat_save_path.to_string_lossy().into_owned(),
|
dat_save_path.to_string_lossy().into_owned(),
|
||||||
|
@ -346,7 +346,7 @@ mod tests {
|
||||||
let dat_save_path = tmp_dir.path().join("quest58.dat");
|
let dat_save_path = tmp_dir.path().join("quest58.dat");
|
||||||
|
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.offline.qst".to_string(),
|
"../test-assets/q058-ret-gc.offline.qst".to_string(),
|
||||||
"prs_bindat".to_string(),
|
"prs_bindat".to_string(),
|
||||||
bin_save_path.to_string_lossy().into_owned(),
|
bin_save_path.to_string_lossy().into_owned(),
|
||||||
dat_save_path.to_string_lossy().into_owned(),
|
dat_save_path.to_string_lossy().into_owned(),
|
||||||
|
@ -362,8 +362,8 @@ mod tests {
|
||||||
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
||||||
|
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
|
"../test-assets/q058-ret-gc.bin".to_string(),
|
||||||
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
|
"../test-assets/q058-ret-gc.dat".to_string(),
|
||||||
"online_qst".to_string(),
|
"online_qst".to_string(),
|
||||||
qst_save_path.to_string_lossy().into_owned(),
|
qst_save_path.to_string_lossy().into_owned(),
|
||||||
];
|
];
|
||||||
|
@ -377,8 +377,8 @@ mod tests {
|
||||||
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
||||||
|
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.uncompressed.bin".to_string(),
|
"../test-assets/q058-ret-gc.uncompressed.bin".to_string(),
|
||||||
"../psoutils/test-assets/q058-ret-gc.uncompressed.dat".to_string(),
|
"../test-assets/q058-ret-gc.uncompressed.dat".to_string(),
|
||||||
"offline_qst".to_string(),
|
"offline_qst".to_string(),
|
||||||
qst_save_path.to_string_lossy().into_owned(),
|
qst_save_path.to_string_lossy().into_owned(),
|
||||||
];
|
];
|
||||||
|
|
|
@ -188,15 +188,15 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn succeeds_with_single_file_arg() {
|
pub fn succeeds_with_single_file_arg() {
|
||||||
let args = &["../psoutils/test-assets/q058-ret-gc.online.qst".to_string()];
|
let args = &["../test-assets/q058-ret-gc.online.qst".to_string()];
|
||||||
assert_ok!(quest_info(args));
|
assert_ok!(quest_info(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn succeeds_with_two_file_args() {
|
pub fn succeeds_with_two_file_args() {
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
|
"../test-assets/q058-ret-gc.bin".to_string(),
|
||||||
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
|
"../test-assets/q058-ret-gc.dat".to_string(),
|
||||||
];
|
];
|
||||||
assert_ok!(quest_info(args));
|
assert_ok!(quest_info(args));
|
||||||
}
|
}
|
||||||
|
@ -204,8 +204,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
pub fn fails_when_bin_dat_file_args_in_wrong_order() {
|
pub fn fails_when_bin_dat_file_args_in_wrong_order() {
|
||||||
let args = &[
|
let args = &[
|
||||||
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
|
"../test-assets/q058-ret-gc.dat".to_string(),
|
||||||
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
|
"../test-assets/q058-ret-gc.bin".to_string(),
|
||||||
];
|
];
|
||||||
assert_matches!(quest_info(args), Err(_));
|
assert_matches!(quest_info(args), Err(_));
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,41 +148,41 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_load_from_compressed_bindat_files() {
|
pub fn can_load_from_compressed_bindat_files() {
|
||||||
let bin_path = Path::new("test-assets/q058-ret-gc.bin");
|
let bin_path = Path::new("../test-assets/q058-ret-gc.bin");
|
||||||
let dat_path = Path::new("test-assets/q058-ret-gc.dat");
|
let dat_path = Path::new("../test-assets/q058-ret-gc.dat");
|
||||||
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
|
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_load_from_uncompressed_bindat_files() {
|
pub fn can_load_from_uncompressed_bindat_files() {
|
||||||
let bin_path = Path::new("test-assets/q058-ret-gc.uncompressed.bin");
|
let bin_path = Path::new("../test-assets/q058-ret-gc.uncompressed.bin");
|
||||||
let dat_path = Path::new("test-assets/q058-ret-gc.uncompressed.dat");
|
let dat_path = Path::new("../test-assets/q058-ret-gc.uncompressed.dat");
|
||||||
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
|
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_load_from_offline_qst_file() {
|
pub fn can_load_from_offline_qst_file() {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.offline.qst");
|
let path = Path::new("../test-assets/q058-ret-gc.offline.qst");
|
||||||
assert_ok!(Quest::from_qst_file(path));
|
assert_ok!(Quest::from_qst_file(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_load_from_online_qst_file() {
|
pub fn can_load_from_online_qst_file() {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.online.qst");
|
let path = Path::new("../test-assets/q058-ret-gc.online.qst");
|
||||||
assert_ok!(Quest::from_qst_file(path));
|
assert_ok!(Quest::from_qst_file(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_create_from_qst_struct() {
|
pub fn can_create_from_qst_struct() {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.online.qst")).unwrap();
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.online.qst")).unwrap();
|
||||||
assert_ok!(Quest::from_qst(qst));
|
assert_ok!(Quest::from_qst(qst));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_save_to_compressed_bindat_files() -> Result<(), QuestError> {
|
pub fn can_save_to_compressed_bindat_files() -> Result<(), QuestError> {
|
||||||
let quest = Quest::from_bindat_files(
|
let quest = Quest::from_bindat_files(
|
||||||
Path::new("test-assets/q058-ret-gc.bin"),
|
Path::new("../test-assets/q058-ret-gc.bin"),
|
||||||
Path::new("test-assets/q058-ret-gc.dat"),
|
Path::new("../test-assets/q058-ret-gc.dat"),
|
||||||
)?;
|
)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_save_path = tmp_dir.path().join("quest58.bin");
|
let bin_save_path = tmp_dir.path().join("quest58.bin");
|
||||||
|
@ -196,8 +196,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_save_to_uncompressed_bindat_files() -> Result<(), QuestError> {
|
pub fn can_save_to_uncompressed_bindat_files() -> Result<(), QuestError> {
|
||||||
let quest = Quest::from_bindat_files(
|
let quest = Quest::from_bindat_files(
|
||||||
Path::new("test-assets/q058-ret-gc.bin"),
|
Path::new("../test-assets/q058-ret-gc.bin"),
|
||||||
Path::new("test-assets/q058-ret-gc.dat"),
|
Path::new("../test-assets/q058-ret-gc.dat"),
|
||||||
)?;
|
)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_save_path = tmp_dir.path().join("quest58.bin");
|
let bin_save_path = tmp_dir.path().join("quest58.bin");
|
||||||
|
@ -211,8 +211,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
pub fn can_save_to_qst_file() -> Result<(), QuestError> {
|
pub fn can_save_to_qst_file() -> Result<(), QuestError> {
|
||||||
let quest = Quest::from_bindat_files(
|
let quest = Quest::from_bindat_files(
|
||||||
Path::new("test-assets/q058-ret-gc.bin"),
|
Path::new("../test-assets/q058-ret-gc.bin"),
|
||||||
Path::new("test-assets/q058-ret-gc.dat"),
|
Path::new("../test-assets/q058-ret-gc.dat"),
|
||||||
)?;
|
)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
let qst_save_path = tmp_dir.path().join("quest58.qst");
|
||||||
|
|
|
@ -374,7 +374,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_compressed_quest_58_bin() -> Result<(), QuestBinError> {
|
pub fn read_compressed_quest_58_bin() -> Result<(), QuestBinError> {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.bin");
|
let path = Path::new("../test-assets/q058-ret-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_file(&path)?;
|
let bin = QuestBin::from_compressed_file(&path)?;
|
||||||
validate_quest_58_bin(&bin);
|
validate_quest_58_bin(&bin);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -382,7 +382,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_compressed_quest_58_bin() -> Result<(), QuestBinError> {
|
pub fn write_compressed_quest_58_bin() -> Result<(), QuestBinError> {
|
||||||
let data = include_bytes!("../../test-assets/q058-ret-gc.bin");
|
let data = include_bytes!("../../../test-assets/q058-ret-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_bytes(data)?;
|
let bin = QuestBin::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_path = tmp_dir.path().join("quest58.bin");
|
let bin_path = tmp_dir.path().join("quest58.bin");
|
||||||
|
@ -394,7 +394,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_uncompressed_quest_58_bin() -> Result<(), QuestBinError> {
|
pub fn read_uncompressed_quest_58_bin() -> Result<(), QuestBinError> {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.uncompressed.bin");
|
let path = Path::new("../test-assets/q058-ret-gc.uncompressed.bin");
|
||||||
let bin = QuestBin::from_uncompressed_file(&path)?;
|
let bin = QuestBin::from_uncompressed_file(&path)?;
|
||||||
validate_quest_58_bin(&bin);
|
validate_quest_58_bin(&bin);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -402,7 +402,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_uncompressed_quest_58_bin() -> Result<(), QuestBinError> {
|
pub fn write_uncompressed_quest_58_bin() -> Result<(), QuestBinError> {
|
||||||
let data = include_bytes!("../../test-assets/q058-ret-gc.bin");
|
let data = include_bytes!("../../../test-assets/q058-ret-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_bytes(data)?;
|
let bin = QuestBin::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_path = tmp_dir.path().join("quest58.bin");
|
let bin_path = tmp_dir.path().join("quest58.bin");
|
||||||
|
@ -414,7 +414,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_compressed_quest_118_bin() -> Result<(), QuestBinError> {
|
pub fn read_compressed_quest_118_bin() -> Result<(), QuestBinError> {
|
||||||
let path = Path::new("test-assets/q118-vr-gc.bin");
|
let path = Path::new("../test-assets/q118-vr-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_file(&path)?;
|
let bin = QuestBin::from_compressed_file(&path)?;
|
||||||
validate_quest_118_bin(&bin);
|
validate_quest_118_bin(&bin);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -422,7 +422,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_compressed_quest_118_bin() -> Result<(), QuestBinError> {
|
pub fn write_compressed_quest_118_bin() -> Result<(), QuestBinError> {
|
||||||
let data = include_bytes!("../../test-assets/q118-vr-gc.bin");
|
let data = include_bytes!("../../../test-assets/q118-vr-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_bytes(data)?;
|
let bin = QuestBin::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_path = tmp_dir.path().join("quest118.bin");
|
let bin_path = tmp_dir.path().join("quest118.bin");
|
||||||
|
@ -434,7 +434,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_uncompressed_quest_118_bin() -> Result<(), QuestBinError> {
|
pub fn read_uncompressed_quest_118_bin() -> Result<(), QuestBinError> {
|
||||||
let path = Path::new("test-assets/q118-vr-gc.uncompressed.bin");
|
let path = Path::new("../test-assets/q118-vr-gc.uncompressed.bin");
|
||||||
let bin = QuestBin::from_uncompressed_file(&path)?;
|
let bin = QuestBin::from_uncompressed_file(&path)?;
|
||||||
validate_quest_118_bin(&bin);
|
validate_quest_118_bin(&bin);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -442,7 +442,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_uncompressed_quest_118_bin() -> Result<(), QuestBinError> {
|
pub fn write_uncompressed_quest_118_bin() -> Result<(), QuestBinError> {
|
||||||
let data = include_bytes!("../../test-assets/q118-vr-gc.bin");
|
let data = include_bytes!("../../../test-assets/q118-vr-gc.bin");
|
||||||
let bin = QuestBin::from_compressed_bytes(data)?;
|
let bin = QuestBin::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let bin_path = tmp_dir.path().join("quest118.bin");
|
let bin_path = tmp_dir.path().join("quest118.bin");
|
||||||
|
|
|
@ -572,7 +572,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_compressed_quest_58_dat() -> Result<(), QuestDatError> {
|
pub fn read_compressed_quest_58_dat() -> Result<(), QuestDatError> {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.dat");
|
let path = Path::new("../test-assets/q058-ret-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_file(&path)?;
|
let dat = QuestDat::from_compressed_file(&path)?;
|
||||||
validate_quest_58_dat(&dat);
|
validate_quest_58_dat(&dat);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -580,7 +580,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_compressed_quest_58_dat() -> Result<(), QuestDatError> {
|
pub fn write_compressed_quest_58_dat() -> Result<(), QuestDatError> {
|
||||||
let data = include_bytes!("../../test-assets/q058-ret-gc.dat");
|
let data = include_bytes!("../../../test-assets/q058-ret-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_bytes(data)?;
|
let dat = QuestDat::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let dat_path = tmp_dir.path().join("quest58.dat");
|
let dat_path = tmp_dir.path().join("quest58.dat");
|
||||||
|
@ -592,7 +592,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_uncompressed_quest_58_dat() -> Result<(), QuestDatError> {
|
pub fn read_uncompressed_quest_58_dat() -> Result<(), QuestDatError> {
|
||||||
let path = Path::new("test-assets/q058-ret-gc.uncompressed.dat");
|
let path = Path::new("../test-assets/q058-ret-gc.uncompressed.dat");
|
||||||
let dat = QuestDat::from_uncompressed_file(&path)?;
|
let dat = QuestDat::from_uncompressed_file(&path)?;
|
||||||
validate_quest_58_dat(&dat);
|
validate_quest_58_dat(&dat);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -600,7 +600,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_uncompressed_quest_58_dat() -> Result<(), QuestDatError> {
|
pub fn write_uncompressed_quest_58_dat() -> Result<(), QuestDatError> {
|
||||||
let data = include_bytes!("../../test-assets/q058-ret-gc.dat");
|
let data = include_bytes!("../../../test-assets/q058-ret-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_bytes(data)?;
|
let dat = QuestDat::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let dat_path = tmp_dir.path().join("quest58.dat");
|
let dat_path = tmp_dir.path().join("quest58.dat");
|
||||||
|
@ -612,7 +612,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_compressed_quest_118_dat() -> Result<(), QuestDatError> {
|
pub fn read_compressed_quest_118_dat() -> Result<(), QuestDatError> {
|
||||||
let path = Path::new("test-assets/q118-vr-gc.dat");
|
let path = Path::new("../test-assets/q118-vr-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_file(&path)?;
|
let dat = QuestDat::from_compressed_file(&path)?;
|
||||||
validate_quest_118_dat(&dat);
|
validate_quest_118_dat(&dat);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -620,7 +620,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_compressed_quest_118_dat() -> Result<(), QuestDatError> {
|
pub fn write_compressed_quest_118_dat() -> Result<(), QuestDatError> {
|
||||||
let data = include_bytes!("../../test-assets/q118-vr-gc.dat");
|
let data = include_bytes!("../../../test-assets/q118-vr-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_bytes(data)?;
|
let dat = QuestDat::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let dat_path = tmp_dir.path().join("quest118.dat");
|
let dat_path = tmp_dir.path().join("quest118.dat");
|
||||||
|
@ -632,7 +632,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_uncompressed_quest_118_dat() -> Result<(), QuestDatError> {
|
pub fn read_uncompressed_quest_118_dat() -> Result<(), QuestDatError> {
|
||||||
let path = Path::new("test-assets/q118-vr-gc.uncompressed.dat");
|
let path = Path::new("../test-assets/q118-vr-gc.uncompressed.dat");
|
||||||
let dat = QuestDat::from_uncompressed_file(&path)?;
|
let dat = QuestDat::from_uncompressed_file(&path)?;
|
||||||
validate_quest_118_dat(&dat);
|
validate_quest_118_dat(&dat);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -640,7 +640,7 @@ pub mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_uncompressed_quest_118_dat() -> Result<(), QuestDatError> {
|
pub fn write_uncompressed_quest_118_dat() -> Result<(), QuestDatError> {
|
||||||
let data = include_bytes!("../../test-assets/q118-vr-gc.dat");
|
let data = include_bytes!("../../../test-assets/q118-vr-gc.dat");
|
||||||
let dat = QuestDat::from_compressed_bytes(data)?;
|
let dat = QuestDat::from_compressed_bytes(data)?;
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let dat_path = tmp_dir.path().join("quest118.dat");
|
let dat_path = tmp_dir.path().join("quest118.dat");
|
||||||
|
|
|
@ -546,10 +546,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_quest_58_qst_from_file() -> Result<(), QuestQstError> {
|
pub fn read_quest_58_qst_from_file() -> Result<(), QuestQstError> {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.online.qst"))?;
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.online.qst"))?;
|
||||||
validate_quest_58_qst(&qst, 1438, 15097, true)?;
|
validate_quest_58_qst(&qst, 1438, 15097, true)?;
|
||||||
|
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.offline.qst"))?;
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.offline.qst"))?;
|
||||||
validate_quest_58_qst(&qst, 1571, 15105, false)?;
|
validate_quest_58_qst(&qst, 1571, 15105, false)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -557,8 +557,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_quest_58_qst_to_file() -> Result<(), QuestQstError> {
|
pub fn write_quest_58_qst_to_file() -> Result<(), QuestQstError> {
|
||||||
let online_data = include_bytes!("../../test-assets/q058-ret-gc.online.qst");
|
let online_data = include_bytes!("../../../test-assets/q058-ret-gc.online.qst");
|
||||||
let offline_data = include_bytes!("../../test-assets/q058-ret-gc.offline.qst");
|
let offline_data = include_bytes!("../../../test-assets/q058-ret-gc.offline.qst");
|
||||||
|
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
|
|
||||||
|
@ -581,10 +581,10 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn read_quest_118_qst_from_file() -> Result<(), QuestQstError> {
|
pub fn read_quest_118_qst_from_file() -> Result<(), QuestQstError> {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q118-vr-gc.online.qst"))?;
|
let qst = QuestQst::from_file(Path::new("../test-assets/q118-vr-gc.online.qst"))?;
|
||||||
validate_quest_118_qst(&qst, 14208, 11802, true)?;
|
validate_quest_118_qst(&qst, 14208, 11802, true)?;
|
||||||
|
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q118-vr-gc.offline.qst"))?;
|
let qst = QuestQst::from_file(Path::new("../test-assets/q118-vr-gc.offline.qst"))?;
|
||||||
validate_quest_118_qst(&qst, 14801, 11810, false)?;
|
validate_quest_118_qst(&qst, 14801, 11810, false)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -592,8 +592,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn write_quest_118_qst_to_file() -> Result<(), QuestQstError> {
|
pub fn write_quest_118_qst_to_file() -> Result<(), QuestQstError> {
|
||||||
let online_data = include_bytes!("../../test-assets/q118-vr-gc.online.qst");
|
let online_data = include_bytes!("../../../test-assets/q118-vr-gc.online.qst");
|
||||||
let offline_data = include_bytes!("../../test-assets/q118-vr-gc.offline.qst");
|
let offline_data = include_bytes!("../../../test-assets/q118-vr-gc.offline.qst");
|
||||||
|
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
|
|
||||||
|
@ -616,8 +616,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn create_qst_from_quest_58_bindat_files() -> Result<(), QuestQstError> {
|
pub fn create_qst_from_quest_58_bindat_files() -> Result<(), QuestQstError> {
|
||||||
let mut bin = QuestBin::from_compressed_file(Path::new("test-assets/q058-ret-gc.bin"))?;
|
let mut bin = QuestBin::from_compressed_file(Path::new("../test-assets/q058-ret-gc.bin"))?;
|
||||||
let dat = QuestDat::from_compressed_file(Path::new("test-assets/q058-ret-gc.dat"))?;
|
let dat = QuestDat::from_compressed_file(Path::new("../test-assets/q058-ret-gc.dat"))?;
|
||||||
|
|
||||||
let qst = QuestQst::from_bindat(&bin, &dat)?;
|
let qst = QuestQst::from_bindat(&bin, &dat)?;
|
||||||
validate_quest_58_qst(&qst, 1565, 15507, true)?;
|
validate_quest_58_qst(&qst, 1565, 15507, true)?;
|
||||||
|
@ -631,8 +631,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn create_qst_from_quest_118_bindat_files() -> Result<(), QuestQstError> {
|
pub fn create_qst_from_quest_118_bindat_files() -> Result<(), QuestQstError> {
|
||||||
let mut bin = QuestBin::from_compressed_file(Path::new("test-assets/q118-vr-gc.bin"))?;
|
let mut bin = QuestBin::from_compressed_file(Path::new("../test-assets/q118-vr-gc.bin"))?;
|
||||||
let dat = QuestDat::from_compressed_file(Path::new("test-assets/q118-vr-gc.dat"))?;
|
let dat = QuestDat::from_compressed_file(Path::new("../test-assets/q118-vr-gc.dat"))?;
|
||||||
|
|
||||||
let qst = QuestQst::from_bindat(&bin, &dat)?;
|
let qst = QuestQst::from_bindat(&bin, &dat)?;
|
||||||
validate_quest_118_qst(&qst, 14794, 12277, true)?;
|
validate_quest_118_qst(&qst, 14794, 12277, true)?;
|
||||||
|
@ -938,7 +938,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn error_when_qst_does_not_contain_both_bin_and_dat_packets() {
|
pub fn error_when_qst_does_not_contain_both_bin_and_dat_packets() {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.online.qst")).unwrap();
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.online.qst")).unwrap();
|
||||||
// write only the bin header+data packets into a buffer which we will then read a qst from
|
// write only the bin header+data packets into a buffer which we will then read a qst from
|
||||||
let mut bytes = Cursor::new(Vec::new());
|
let mut bytes = Cursor::new(Vec::new());
|
||||||
qst.bin_header.write_bytes(&mut bytes).unwrap();
|
qst.bin_header.write_bytes(&mut bytes).unwrap();
|
||||||
|
@ -955,7 +955,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn error_when_qst_header_packet_ids_do_not_all_match() {
|
pub fn error_when_qst_header_packet_ids_do_not_all_match() {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.online.qst")).unwrap();
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.online.qst")).unwrap();
|
||||||
let mut bytes = qst.to_bytes().unwrap();
|
let mut bytes = qst.to_bytes().unwrap();
|
||||||
|
|
||||||
// packet id is the very first byte. switch it to the wrong type
|
// packet id is the very first byte. switch it to the wrong type
|
||||||
|
@ -969,7 +969,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn error_when_qst_data_packet_ids_do_not_all_match() {
|
pub fn error_when_qst_data_packet_ids_do_not_all_match() {
|
||||||
let qst = QuestQst::from_file(Path::new("test-assets/q058-ret-gc.online.qst")).unwrap();
|
let qst = QuestQst::from_file(Path::new("../test-assets/q058-ret-gc.online.qst")).unwrap();
|
||||||
let mut bytes = qst.to_bytes().unwrap();
|
let mut bytes = qst.to_bytes().unwrap();
|
||||||
|
|
||||||
// switch packet id of the first data packet to the wrong type
|
// switch packet id of the first data packet to the wrong type
|
||||||
|
|
Loading…
Reference in a new issue