Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* chore: remove duplicate get_integer_from_var_name tests from memcpy_hint_utils [#2250](https://github.com/lambdaclass/cairo-vm/pull/2250)

* opt(breaking): Avoid cloning constants when compiling hints [#2208](https://github.com/lambdaclass/cairo-vm/pull/2208)

* dev(BREAKING): Make blake2s API internal [#2265](https://github.com/lambdaclass/cairo-vm/pull/2265)
Expand Down
60 changes: 0 additions & 60 deletions vm/src/hint_processor/builtin_hint_processor/memcpy_hint_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,63 +40,3 @@ pub fn memcpy_enter_scope(
exec_scopes.enter_scope(HashMap::from([(String::from("n"), len)]));
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

use crate::utils::test_utils::*;
use assert_matches::assert_matches;

use crate::Felt252;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::*;

#[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn get_integer_from_var_name_valid() {
let mut vm = vm!();
// initialize memory segments
vm.segments.add();

// initialize fp
vm.run_context.fp = 1;

let var_name: &str = "variable";

//Create ids_data
let ids_data = ids_data![var_name];

//Insert ids.prev_locs.exp into memory
vm.segments = segments![((1, 0), 10)];

assert_eq!(
get_integer_from_var_name(var_name, &vm, &ids_data, &ApTracking::default())
.unwrap()
.as_ref(),
&Felt252::from(10)
);
}

#[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn get_integer_from_var_name_invalid_expected_integer() {
let mut vm = vm!();

// initialize fp
vm.run_context.fp = 1;

let var_name: &str = "variable";

//Create ids_data
let ids_data = ids_data![var_name];

//Insert ids.variable into memory as a RelocatableValue
vm.segments = segments![((1, 0), (1, 1))];

assert_matches!(
get_integer_from_var_name(var_name, &vm, &ids_data, &ApTracking::default()),
Err(HintError::IdentifierNotInteger(bx)) if bx.as_ref() == var_name
);
}
}
Loading