1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use Any;
use HashMap;
use get_integer_from_var_name;
use HintReference;
use ApTracking;
use ExecutionScopes;
use HintError;
use VirtualMachine;
use cratevars;
/// Implements
/// %{ vm_enter_scope({'n_selected_builtins': ids.n_selected_builtins}) %}
// TODO(Idan): Understand and fix these tests. some unavailable macros are used.
// #[cfg(test)]
// mod tests {
// use std::any::Any;
// use std::collections::HashMap;
// use cairo_vm::hint_processor::builtin_hint_processor::hint_utils::get_integer_from_var_name;
// use cairo_vm::hint_processor::hint_processor_definition::HintReference;
// use cairo_vm::serde::deserialize_program::ApTracking;
// use cairo_vm::types::exec_scope::ExecutionScopes;
// use cairo_vm::vm::errors::hint_errors::HintError;
// use cairo_vm::vm::vm_core::VirtualMachine;
// use num_traits::ToPrimitive;
// use serde::Serialize;
// use super::*;
// #[test]
// fn test_select_builtins_enter_scope() {
// let mut vm = vm!();
// // Set n_selected_builtins to 7
// vm.run_context.fp = 1;
// vm.segments = segments![((1, 0), 7)];
// let ids_data = ids_data![vars::N_SELECTED_BUILTINS];
// let n_selected_builtins = 7usize;
// let ap_tracking = ApTracking::default();
// let mut exec_scopes = ExecutionScopes::new();
// select_builtins_enter_scope(&mut vm, &mut exec_scopes, &ids_data, &ap_tracking)
// .expect("Hint failed unexpectedly");
// // Check that we entered a new scope
// assert_eq!(exec_scopes.data.len(), 2);
// assert_eq!(exec_scopes.data[1].len(), 1);
// let n_selected_builtins_var: usize = exec_scopes.get(vars::N_SELECTED_BUILTINS).unwrap();
// assert_eq!(n_selected_builtins_var, n_selected_builtins);
// }
// }