Commit 53193734 by Enkelmann Committed by Enkelmann

cargo fmt

parent c1e142eb
...@@ -204,7 +204,6 @@ impl Blk { ...@@ -204,7 +204,6 @@ impl Blk {
fn add_load_defs_for_implicit_ram_access(&mut self) { fn add_load_defs_for_implicit_ram_access(&mut self) {
let mut refactored_defs = Vec::new(); let mut refactored_defs = Vec::new();
for def in self.defs.iter() { for def in self.defs.iter() {
let mut cleaned_def = def.clone(); let mut cleaned_def = def.clone();
if let Some(input) = &def.term.rhs.input0 { if let Some(input) = &def.term.rhs.input0 {
if input.address.is_some() { if input.address.is_some() {
...@@ -673,8 +672,13 @@ mod tests { ...@@ -673,8 +672,13 @@ mod tests {
#[test] #[test]
fn add_load_defs_for_implicit_ram_access() { fn add_load_defs_for_implicit_ram_access() {
let mut blk: Blk = Blk { defs: Vec::new(), jmps: Vec::new()}; let mut blk: Blk = Blk {
blk.defs.push(serde_json::from_str(r#" defs: Vec::new(),
jmps: Vec::new(),
};
blk.defs.push(
serde_json::from_str(
r#"
{ {
"tid": { "tid": {
"id": "instr_001053f8_0", "id": "instr_001053f8_0",
...@@ -702,10 +706,34 @@ mod tests { ...@@ -702,10 +706,34 @@ mod tests {
} }
} }
} }
"#).unwrap()); "#,
)
.unwrap(),
);
blk.add_load_defs_for_implicit_ram_access(); blk.add_load_defs_for_implicit_ram_access();
assert_eq!(blk.defs[0].term.lhs.as_ref().unwrap().name.as_ref().unwrap(), "$load_temp0"); assert_eq!(
assert_eq!(blk.defs[1].term.rhs.input0.as_ref().unwrap().name.as_ref().unwrap(), "$load_temp0"); blk.defs[0]
.term
.lhs
.as_ref()
.unwrap()
.name
.as_ref()
.unwrap(),
"$load_temp0"
);
assert_eq!(
blk.defs[1]
.term
.rhs
.input0
.as_ref()
.unwrap()
.name
.as_ref()
.unwrap(),
"$load_temp0"
);
assert_eq!(blk.defs.len(), 2); assert_eq!(blk.defs.len(), 2);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment