Skip to content

Commit

Permalink
Support for fixed sized arrays in models dojoengine#2785: Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bengineer42 committed Dec 31, 2024
1 parent 24ef8f3 commit 54fbacd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/dojo/core-cairo-test/src/tests/meta/introspect.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ struct WithArray {
arr: Array<u8>
}

#[derive(Drop, Introspect)]
struct WithFixedArray {
value: u32,
arr: [u8; 3]
}


#[derive(Drop, Introspect)]
struct WithByteArray {
value: u32,
Expand Down Expand Up @@ -166,6 +173,12 @@ fn test_size_with_array() {
assert!(Introspect::<WithArray>::size().is_none());
}

fn test_size_with_fixed_array() {
let size = Introspect::<WithFixedArray>::size();
assert!(size.is_some());
assert!(size.unwrap() == 4);
}

#[test]
fn test_size_with_byte_array() {
assert!(Introspect::<WithByteArray>::size().is_none());
Expand Down

0 comments on commit 54fbacd

Please sign in to comment.