Add support for address replacement

This commit is contained in:
Omar Abdulla
2025-07-21 18:54:09 +03:00
parent d7136d9a3d
commit b6db597a57
9 changed files with 531 additions and 130 deletions
+16
View File
@@ -3,6 +3,7 @@ use serde::Deserialize;
use crate::{
define_wrapper_type,
input::{Expected, Input},
metadata::AddressReplacementMap,
mode::Mode,
};
@@ -16,6 +17,21 @@ pub struct Case {
pub expected: Option<Expected>,
}
impl Case {
pub fn handle_address_replacement(
&mut self,
old_to_new_mapping: &mut AddressReplacementMap,
) -> anyhow::Result<()> {
for input in self.inputs.iter_mut() {
input.handle_address_replacement(old_to_new_mapping)?;
}
if let Some(ref mut expected) = self.expected {
expected.handle_address_replacement(old_to_new_mapping)?;
}
Ok(())
}
}
define_wrapper_type!(
/// A wrapper type for the index of test cases found in metadata file.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]