move test assets to top-level since they're used by multiple crates now

This commit is contained in:
Gered 2021-05-25 16:12:56 -04:00
parent 67bdb76c52
commit e54bdc600b
18 changed files with 55 additions and 55 deletions

View file

@ -329,7 +329,7 @@ mod tests {
let dat_save_path = tmp_dir.path().join("quest58.dat");
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(),
bin_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 args = &[
"../psoutils/test-assets/q058-ret-gc.offline.qst".to_string(),
"../test-assets/q058-ret-gc.offline.qst".to_string(),
"prs_bindat".to_string(),
bin_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 args = &[
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
"../test-assets/q058-ret-gc.bin".to_string(),
"../test-assets/q058-ret-gc.dat".to_string(),
"online_qst".to_string(),
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 args = &[
"../psoutils/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.bin".to_string(),
"../test-assets/q058-ret-gc.uncompressed.dat".to_string(),
"offline_qst".to_string(),
qst_save_path.to_string_lossy().into_owned(),
];

View file

@ -188,15 +188,15 @@ mod tests {
#[test]
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));
}
#[test]
pub fn succeeds_with_two_file_args() {
let args = &[
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
"../test-assets/q058-ret-gc.bin".to_string(),
"../test-assets/q058-ret-gc.dat".to_string(),
];
assert_ok!(quest_info(args));
}
@ -204,8 +204,8 @@ mod tests {
#[test]
pub fn fails_when_bin_dat_file_args_in_wrong_order() {
let args = &[
"../psoutils/test-assets/q058-ret-gc.dat".to_string(),
"../psoutils/test-assets/q058-ret-gc.bin".to_string(),
"../test-assets/q058-ret-gc.dat".to_string(),
"../test-assets/q058-ret-gc.bin".to_string(),
];
assert_matches!(quest_info(args), Err(_));
}

View file

@ -148,41 +148,41 @@ mod tests {
#[test]
pub fn can_load_from_compressed_bindat_files() {
let bin_path = Path::new("test-assets/q058-ret-gc.bin");
let dat_path = Path::new("test-assets/q058-ret-gc.dat");
let bin_path = Path::new("../test-assets/q058-ret-gc.bin");
let dat_path = Path::new("../test-assets/q058-ret-gc.dat");
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
}
#[test]
pub fn can_load_from_uncompressed_bindat_files() {
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 bin_path = Path::new("../test-assets/q058-ret-gc.uncompressed.bin");
let dat_path = Path::new("../test-assets/q058-ret-gc.uncompressed.dat");
assert_ok!(Quest::from_bindat_files(bin_path, dat_path));
}
#[test]
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));
}
#[test]
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));
}
#[test]
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));
}
#[test]
pub fn can_save_to_compressed_bindat_files() -> Result<(), QuestError> {
let quest = Quest::from_bindat_files(
Path::new("test-assets/q058-ret-gc.bin"),
Path::new("test-assets/q058-ret-gc.dat"),
Path::new("../test-assets/q058-ret-gc.bin"),
Path::new("../test-assets/q058-ret-gc.dat"),
)?;
let tmp_dir = TempDir::new()?;
let bin_save_path = tmp_dir.path().join("quest58.bin");
@ -196,8 +196,8 @@ mod tests {
#[test]
pub fn can_save_to_uncompressed_bindat_files() -> Result<(), QuestError> {
let quest = Quest::from_bindat_files(
Path::new("test-assets/q058-ret-gc.bin"),
Path::new("test-assets/q058-ret-gc.dat"),
Path::new("../test-assets/q058-ret-gc.bin"),
Path::new("../test-assets/q058-ret-gc.dat"),
)?;
let tmp_dir = TempDir::new()?;
let bin_save_path = tmp_dir.path().join("quest58.bin");
@ -211,8 +211,8 @@ mod tests {
#[test]
pub fn can_save_to_qst_file() -> Result<(), QuestError> {
let quest = Quest::from_bindat_files(
Path::new("test-assets/q058-ret-gc.bin"),
Path::new("test-assets/q058-ret-gc.dat"),
Path::new("../test-assets/q058-ret-gc.bin"),
Path::new("../test-assets/q058-ret-gc.dat"),
)?;
let tmp_dir = TempDir::new()?;
let qst_save_path = tmp_dir.path().join("quest58.qst");

View file

@ -374,7 +374,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_58_bin(&bin);
Ok(())
@ -382,7 +382,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let bin_path = tmp_dir.path().join("quest58.bin");
@ -394,7 +394,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_58_bin(&bin);
Ok(())
@ -402,7 +402,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let bin_path = tmp_dir.path().join("quest58.bin");
@ -414,7 +414,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_118_bin(&bin);
Ok(())
@ -422,7 +422,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let bin_path = tmp_dir.path().join("quest118.bin");
@ -434,7 +434,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_118_bin(&bin);
Ok(())
@ -442,7 +442,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let bin_path = tmp_dir.path().join("quest118.bin");

View file

@ -572,7 +572,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_58_dat(&dat);
Ok(())
@ -580,7 +580,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let dat_path = tmp_dir.path().join("quest58.dat");
@ -592,7 +592,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_58_dat(&dat);
Ok(())
@ -600,7 +600,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let dat_path = tmp_dir.path().join("quest58.dat");
@ -612,7 +612,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_118_dat(&dat);
Ok(())
@ -620,7 +620,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let dat_path = tmp_dir.path().join("quest118.dat");
@ -632,7 +632,7 @@ pub mod tests {
#[test]
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)?;
validate_quest_118_dat(&dat);
Ok(())
@ -640,7 +640,7 @@ pub mod tests {
#[test]
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 tmp_dir = TempDir::new()?;
let dat_path = tmp_dir.path().join("quest118.dat");

View file

@ -546,10 +546,10 @@ mod tests {
#[test]
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)?;
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)?;
Ok(())
@ -557,8 +557,8 @@ mod tests {
#[test]
pub fn write_quest_58_qst_to_file() -> Result<(), QuestQstError> {
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 online_data = include_bytes!("../../../test-assets/q058-ret-gc.online.qst");
let offline_data = include_bytes!("../../../test-assets/q058-ret-gc.offline.qst");
let tmp_dir = TempDir::new()?;
@ -581,10 +581,10 @@ mod tests {
#[test]
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)?;
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)?;
Ok(())
@ -592,8 +592,8 @@ mod tests {
#[test]
pub fn write_quest_118_qst_to_file() -> Result<(), QuestQstError> {
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 online_data = include_bytes!("../../../test-assets/q118-vr-gc.online.qst");
let offline_data = include_bytes!("../../../test-assets/q118-vr-gc.offline.qst");
let tmp_dir = TempDir::new()?;
@ -616,8 +616,8 @@ mod tests {
#[test]
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 dat = QuestDat::from_compressed_file(Path::new("test-assets/q058-ret-gc.dat"))?;
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 qst = QuestQst::from_bindat(&bin, &dat)?;
validate_quest_58_qst(&qst, 1565, 15507, true)?;
@ -631,8 +631,8 @@ mod tests {
#[test]
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 dat = QuestDat::from_compressed_file(Path::new("test-assets/q118-vr-gc.dat"))?;
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 qst = QuestQst::from_bindat(&bin, &dat)?;
validate_quest_118_qst(&qst, 14794, 12277, true)?;
@ -938,7 +938,7 @@ mod tests {
#[test]
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
let mut bytes = Cursor::new(Vec::new());
qst.bin_header.write_bytes(&mut bytes).unwrap();
@ -955,7 +955,7 @@ mod tests {
#[test]
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();
// packet id is the very first byte. switch it to the wrong type
@ -969,7 +969,7 @@ mod tests {
#[test]
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();
// switch packet id of the first data packet to the wrong type