Skip to content

Commit

Permalink
fix tests (#76)
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Walter <clement0walter@gmail.com>
  • Loading branch information
tcoratger and ClementWalter authored Oct 23, 2024
1 parent 2b58f55 commit ba9d1e3
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions crates/exex/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,19 @@ mod tests {
// Setup the KakarotSerde instance
let mut kakarot_serde = setup_kakarot_serde();

// Setup
let output_ptr = Felt252::ZERO;
let range_check_ptr = kakarot_serde.runner.vm.add_memory_segment();
let bitwise_ptr = kakarot_serde.runner.vm.add_memory_segment();

// Insert relocatable values in memory
let base = kakarot_serde
.runner
.vm
.gen_arg(&vec![
MaybeRelocatable::Int(Felt252::ZERO),
MaybeRelocatable::RelocatableValue(Relocatable { segment_index: 10, offset: 11 }),
MaybeRelocatable::RelocatableValue(Relocatable { segment_index: 10, offset: 11 }),
MaybeRelocatable::Int(output_ptr),
MaybeRelocatable::RelocatableValue(range_check_ptr),
MaybeRelocatable::RelocatableValue(bitwise_ptr),
])
.unwrap()
.get_relocatable()
Expand All @@ -341,18 +346,9 @@ mod tests {
("output_ptr".to_string(), None),
(
"range_check_ptr".to_string(),
Some(MaybeRelocatable::RelocatableValue(Relocatable {
segment_index: 10,
offset: 11
}))
),
(
"bitwise_ptr".to_string(),
Some(MaybeRelocatable::RelocatableValue(Relocatable {
segment_index: 10,
offset: 11
}))
Some(MaybeRelocatable::RelocatableValue(range_check_ptr))
),
("bitwise_ptr".to_string(), Some(MaybeRelocatable::RelocatableValue(bitwise_ptr))),
])
);
}
Expand All @@ -362,14 +358,19 @@ mod tests {
// Setup the KakarotSerde instance
let mut kakarot_serde = setup_kakarot_serde();

// Setup
let output_ptr = Relocatable { segment_index: 10, offset: 11 };
let range_check_ptr = Felt252::ZERO;
let bitwise_ptr = Felt252::from(55);

// Insert relocatable values in memory
let base = kakarot_serde
.runner
.vm
.gen_arg(&vec![
MaybeRelocatable::RelocatableValue(Relocatable { segment_index: 10, offset: 11 }),
MaybeRelocatable::Int(Felt252::ZERO),
MaybeRelocatable::Int(Felt252::from(55)),
MaybeRelocatable::RelocatableValue(output_ptr),
MaybeRelocatable::Int(range_check_ptr),
MaybeRelocatable::Int(bitwise_ptr),
])
.unwrap()
.get_relocatable()
Expand All @@ -384,16 +385,10 @@ mod tests {
assert_eq!(
result,
HashMap::from_iter([
(
"output_ptr".to_string(),
Some(MaybeRelocatable::RelocatableValue(Relocatable {
segment_index: 10,
offset: 11
}))
),
("output_ptr".to_string(), Some(MaybeRelocatable::RelocatableValue(output_ptr))),
// Not a pointer so that we shouldn't have a `None`
("range_check_ptr".to_string(), Some(MaybeRelocatable::Int(Felt252::ZERO))),
("bitwise_ptr".to_string(), Some(MaybeRelocatable::Int(Felt252::from(55)))),
("range_check_ptr".to_string(), Some(MaybeRelocatable::Int(range_check_ptr))),
("bitwise_ptr".to_string(), Some(MaybeRelocatable::Int(bitwise_ptr))),
])
);
}
Expand Down

0 comments on commit ba9d1e3

Please sign in to comment.