Skip to content

Commit

Permalink
Add CairoRunner.get_program (lambdaclass#1123)
Browse files Browse the repository at this point in the history
* Add CairoRunner.get_program

* Update CHANGELOG.md
  • Loading branch information
pefontana authored and kariy committed Jun 23, 2023
1 parent a8078e0 commit 0ca05b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* Add `CairoRunner::get_program method` [#1123](https://github.com/lambdaclass/cairo-rs/pull/1123):

* Use to_signed_felt as function for felt252 as BigInt within [-P/2, P/2] range and use to_bigint as function for representation as BigInt. [#1100](https://github.com/lambdaclass/cairo-rs/pull/1100)

* Implement hint on field_arithmetic lib [#1090](https://github.com/lambdaclass/cairo-rs/pull/1090)
Expand Down
16 changes: 16 additions & 0 deletions src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,11 @@ impl CairoRunner {
}
Ok(stack_ptr)
}

/// Return CairoRunner.program
pub fn get_program(&self) -> &Program {
&self.program
}
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -4826,4 +4831,15 @@ mod tests {
}
);
}

#[test]
fn test_get_program() {
let program = program!(
builtins = vec![BuiltinName::output],
data = vec_data!((4), (6)),
);
let runner = cairo_runner!(program);

assert_eq!(runner.get_program().data_len(), 2)
}
}

0 comments on commit 0ca05b4

Please sign in to comment.