Skip to content

Commit

Permalink
some more tests from array.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoGiachetta committed Feb 6, 2025
1 parent 7f8d7cb commit 39786fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
28 changes: 11 additions & 17 deletions src/libfuncs/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2085,9 +2085,7 @@ mod test {
use cairo_lang_sierra::{
extensions::{
array::{
ArrayAppendLibfunc, ArrayGetLibfunc, ArrayLenLibfunc, ArrayNewLibfunc,
ArrayPopFrontLibfunc, ArraySliceLibfunc, ArraySnapshotMultiPopBackLibfunc,
ArraySnapshotMultiPopFrontLibfunc, ArraySnapshotPopBackLibfunc,
ArrayAppendLibfunc, ArrayGetLibfunc, ArrayLenLibfunc, ArrayNewLibfunc, ArrayPopFrontConsumeLibfunc, ArrayPopFrontLibfunc, ArraySliceLibfunc, ArraySnapshotMultiPopBackLibfunc, ArraySnapshotMultiPopFrontLibfunc, ArraySnapshotPopBackLibfunc
},
felt252::Felt252Type,
int::unsigned::Uint32Type,
Expand Down Expand Up @@ -2328,22 +2326,18 @@ mod test {

#[test]
fn run_pop_front_consume() {
let program = load_cairo!(
use array::ArrayTrait;
let program_pop = {
let mut generator = SierraGenerator::<ArrayPopFrontConsumeLibfunc>::default();

fn run_test() -> u32 {
let mut numbers = ArrayTrait::new();
numbers.append(4_u32);
numbers.append(3_u32);
match numbers.pop_front_consume() {
Option::Some((_, x)) => x,
Option::None(()) => 0_u32,
}
}
);
let result = run_program(&program, "run_test", &[]).return_value;
let u32_ty = generator.push_type_declaration::<Uint32Type>(&[]).clone();

generator.build(&[GenericArg::Type(u32_ty)])
};
let array = [4u32, 3u32].into();

let result = run_sierra_program(&program_pop, &[array]).return_value;

assert_eq!(result, 4u32.into());
assert_eq!(result, jit_enum!(0, 4u32.into()));
}

#[test]
Expand Down
8 changes: 0 additions & 8 deletions src/libfuncs/uint512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,6 @@ mod test {

generator.build(&[])
};
// load_cairo! {
// use core::integer::{u512, u512_safe_divmod_by_u256};

// fn run_test(lhs: u512, rhs: NonZero<u256>) -> (u512, u256) {
// let (lhs, rhs, _, _, _, _, _) = u512_safe_divmod_by_u256(lhs, rhs);
// (lhs, rhs)
// }
// };
}

#[test]
Expand Down

0 comments on commit 39786fe

Please sign in to comment.