Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Feb 17, 2023
1 parent d732995 commit 18e8fe0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/hint_processor/builtin_hint_processor/blake2s_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((2, 0))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,9 @@ mod tests {
let ids_data = non_continuous_ids_data![("keccak_state", -7), ("high", -3), ("low", -2)];
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::NoneInMemoryRange))
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
_
)))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mod tests {
let ids_data = ids_data!["array_ptr", "elm_size", "n_elms", "index", "key"];
assert_matches!(
run_hint!(vm, ids_data, hint_code::FIND_ELEMENT),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 4))
);
Expand Down
8 changes: 4 additions & 4 deletions src/hint_processor/builtin_hint_processor/math_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 4))
);
Expand Down Expand Up @@ -840,7 +840,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 3))
);
Expand Down Expand Up @@ -875,7 +875,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 3))
);
Expand Down Expand Up @@ -1892,7 +1892,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 2))
);
Expand Down
2 changes: 1 addition & 1 deletion src/hint_processor/builtin_hint_processor/pow_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
//Execute the hint
assert_matches!(
run_hint!(vm, ids_data, hint_code),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 10))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ mod tests {
.map(|(k, v)| (k.to_string(), v))
.collect()
),
Err(HintError::Internal(VirtualMachineError::ExpectedInteger(
Err(HintError::Internal(VirtualMachineError::UnknownMemoryCell(
x
))) if x == Relocatable::from((1, 10))
);
Expand Down
4 changes: 2 additions & 2 deletions src/vm/vm_memory/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,12 @@ mod memory_tests {
let mut builtin = RangeCheckBuiltinRunner::new(8, 8, true);
let mut segments = MemorySegmentManager::new();
builtin.initialize_segments(&mut segments);
segments.memory = memory![((0, 7), (0, 4))];
segments.memory = memory![((0, 0), (0, 4))];
builtin.add_validation_rule(&mut segments.memory);
let error = segments.memory.validate_existing_memory();
assert_eq!(
error,
Err(MemoryError::RangeCheckFoundNonInt(relocatable!(0, 7)))
Err(MemoryError::RangeCheckFoundNonInt(relocatable!(0, 0)))
);
}

Expand Down

1 comment on commit 18e8fe0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 18e8fe0 Previous: 0b35d27 Ratio
cairo_run(cairo_programs/benchmarks/secp_integration_benchmark.json) 2102490190 ns/iter (± 54229398) 1572660825 ns/iter (± 7943330) 1.34
cairo_run(cairo_programs/benchmarks/math_cmp_and_pow_integration_benchmark.json) 25287234 ns/iter (± 1151331) 19384362 ns/iter (± 104758) 1.30
cairo_run(cairo_programs/benchmarks/set_integration_benchmark.json) 207546522 ns/iter (± 7257334) 145906763 ns/iter (± 378784) 1.42

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.