Skip to content

Commit 06f4c19

Browse files
authored
Add CairoRunner.get_program (#1123)
* Add CairoRunner.get_program * Update CHANGELOG.md
1 parent 913aa49 commit 06f4c19

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Upcoming Changes
44

5+
* Add `CairoRunner::get_program method` [#1123](https://github.com/lambdaclass/cairo-rs/pull/1123):
6+
57
* 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)
68

79
* Implement hint on field_arithmetic lib [#1090](https://github.com/lambdaclass/cairo-rs/pull/1090)

src/vm/runners/cairo_runner.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,11 @@ impl CairoRunner {
10611061
}
10621062
Ok(stack_ptr)
10631063
}
1064+
1065+
/// Return CairoRunner.program
1066+
pub fn get_program(&self) -> &Program {
1067+
&self.program
1068+
}
10641069
}
10651070

10661071
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -4826,4 +4831,15 @@ mod tests {
48264831
}
48274832
);
48284833
}
4834+
4835+
#[test]
4836+
fn test_get_program() {
4837+
let program = program!(
4838+
builtins = vec![BuiltinName::output],
4839+
data = vec_data!((4), (6)),
4840+
);
4841+
let runner = cairo_runner!(program);
4842+
4843+
assert_eq!(runner.get_program().data_len(), 2)
4844+
}
48294845
}

0 commit comments

Comments
 (0)