diff --git a/cairo_programs/cairo-1-contracts/felt_252_dict.cairo b/cairo_programs/cairo-1-contracts/felt_252_dict.cairo new file mode 100644 index 0000000000..8dabb27bb2 --- /dev/null +++ b/cairo_programs/cairo-1-contracts/felt_252_dict.cairo @@ -0,0 +1,12 @@ +#[contract] +mod Felt252Dict { + +use dict::{felt252_dict_entry_finalize, Felt252DictTrait}; + /// An external method that requires the `segment_arena` builtin. + #[external] + fn squash_empty_dict() -> bool { + let x = felt252_dict_new::(); + x.squash(); + return true; + } +} diff --git a/src/tests/cairo_1_run_from_entrypoint_tests.rs b/src/tests/cairo_1_run_from_entrypoint_tests.rs index 286fd045a8..35ad3dc2ad 100644 --- a/src/tests/cairo_1_run_from_entrypoint_tests.rs +++ b/src/tests/cairo_1_run_from_entrypoint_tests.rs @@ -467,6 +467,13 @@ fn linear_split() { ); } +#[test] +#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] +fn alloc_felt_252_dict() { + let program_data = include_bytes!("../../cairo_programs/cairo-1-contracts/felt_252_dict.casm"); + run_cairo_1_entrypoint(program_data.as_slice(), 0, &[], &[1.into()]); +} + #[test] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)] fn random_ec_point() {