Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Apr 25, 2024
1 parent bd5b551 commit f26c383
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ mod tests {
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotRelocatable(bx))
if *bx == ("output".to_string(), (1,0).into())
if *bx == "output".to_string()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ mod tests {
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx))
if *bx == ("len".to_string(), (1,1).into())
if bx.as_ref() == "len"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ mod tests {
let ids_data = ids_data!["array_ptr", "elm_size", "n_elms", "index", "key"];
assert_matches!(
run_hint!(vm, ids_data, hint_code::FIND_ELEMENT),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("key".to_string(), (1,4).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "key".to_string()
);
}

Expand All @@ -283,7 +283,7 @@ mod tests {
)]));
assert_matches!(
run_hint!(vm, ids_data, hint_code::FIND_ELEMENT),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("elm_size".to_string(), (1,1).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "elm_size".to_string()
);
}

Expand Down Expand Up @@ -321,7 +321,7 @@ mod tests {
init_vm_ids_data(HashMap::from([("n_elms".to_string(), relocatable)]));
assert_matches!(
run_hint!(vm, ids_data, hint_code::FIND_ELEMENT),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("n_elms".to_string(), (1,2).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "n_elms".to_string()
);
}

Expand Down Expand Up @@ -364,7 +364,7 @@ mod tests {
init_vm_ids_data(HashMap::from([("key".to_string(), relocatable)]));
assert_matches!(
run_hint!(vm, ids_data, hint_code::FIND_ELEMENT),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("key".to_string(), (1,4).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "key".to_string()
);
}

Expand Down Expand Up @@ -403,7 +403,7 @@ mod tests {
)]));
assert_matches!(
run_hint!(vm, ids_data, hint_code::SEARCH_SORTED_LOWER),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("elm_size".to_string(), (1,1).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "elm_size".to_string()
);
}

Expand All @@ -429,7 +429,7 @@ mod tests {
)]));
assert_matches!(
run_hint!(vm, ids_data, hint_code::SEARCH_SORTED_LOWER),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("n_elms".to_string(), (1,2).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "n_elms".to_string()
);
}

Expand Down
22 changes: 11 additions & 11 deletions vm/src/hint_processor/builtin_hint_processor/math_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,4).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "a".to_string()
);
}

Expand All @@ -912,7 +912,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,4).into())
Err(HintError::IdentifierNotInteger(bx)) if bx.as_ref() == "a"
);
}

Expand Down Expand Up @@ -1068,7 +1068,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,3).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "a".to_string()
);
}

Expand Down Expand Up @@ -1103,7 +1103,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,3).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "a".to_string()
);
}

Expand Down Expand Up @@ -1156,7 +1156,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code::ASSERT_LE_FELT, &mut exec_scopes, &constants),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,0).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "a".to_string()
);
}

Expand All @@ -1182,7 +1182,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code::ASSERT_LE_FELT, &mut exec_scopes, &constants),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("b".to_string(), (1,1).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "b".to_string()
);
}

Expand Down Expand Up @@ -1412,7 +1412,7 @@ mod tests {
let ids_data = ids_data!["value"];
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("value".to_string(), (1,4).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "value".to_string()
);
}

Expand Down Expand Up @@ -2234,7 +2234,7 @@ mod tests {
)
])
),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("value".to_string(), (1,3).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "value".to_string()
);
}

Expand Down Expand Up @@ -2404,7 +2404,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("a".to_string(), (1,1).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "a".to_string()
);
}

Expand All @@ -2421,7 +2421,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("b".to_string(), (1,2).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "b".to_string()
);
}

Expand All @@ -2439,7 +2439,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("b".to_string(), (1,2).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "b".to_string()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests {

assert_matches!(
get_integer_from_var_name(var_name, &vm, &ids_data, &ApTracking::default()),
Err(HintError::IdentifierNotInteger(bx)) if *bx == (var_name.to_string(), (1,0).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == var_name.to_string()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod tests {
let ids_data = ids_data!["n"];
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("n".to_string(), (1,1).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "n".to_string()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code, &mut exec_scopes),
Err(HintError::IdentifierNotInteger(bx)) if *bx == ("n_used_accesses".to_string(), (1,0).into())
Err(HintError::IdentifierNotInteger(bx)) if *bx == "n_used_accesses".to_string()
);
}

Expand Down
8 changes: 4 additions & 4 deletions vm/src/hint_processor/hint_processor_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ pub fn get_maybe_relocatable_from_reference(
vm,
&hint_reference.offset1,
&hint_reference.ap_tracking_data,
&ap_tracking,
ap_tracking,
)?;
let offset2 = get_offset_value(
vm,
&hint_reference.offset2,
&hint_reference.ap_tracking_data,
&ap_tracking,
ap_tracking,
)?;
let mut val = offset1.add(&offset2).ok()?;
if hint_reference.inner_dereference && hint_reference.outer_dereference {
Expand All @@ -91,13 +91,13 @@ pub fn compute_addr_from_reference(
vm,
&hint_reference.offset1,
&hint_reference.ap_tracking_data,
&ap_tracking,
ap_tracking,
)?;
let offset2 = get_offset_value(
vm,
&hint_reference.offset2,
&hint_reference.ap_tracking_data,
&ap_tracking,
ap_tracking,
)?;
let mut val = offset1.add(&offset2).ok()?;
if hint_reference.inner_dereference {
Expand Down

0 comments on commit f26c383

Please sign in to comment.