@@ -16,6 +16,7 @@ use crate::tests::ffi::{
16
16
type_inference:: simplicity_mallocTypeInference,
17
17
SimplicityErr ,
18
18
} ;
19
+ use crate :: CElementsTxEnv ;
19
20
20
21
/// The result of parsing, typechecking, and running a Simplicity program
21
22
/// through the C FFI
@@ -107,13 +108,22 @@ impl Drop for FreeOnDrop {
107
108
}
108
109
}
109
110
111
+ pub fn run_program (
112
+ program : & [ u8 ] ,
113
+ witness : & [ u8 ] ,
114
+ test_up_to : TestUpTo ,
115
+ ) -> Result < TestOutput , SimplicityErr > {
116
+ run_program_with_env ( program, witness, test_up_to, ptr:: null ( ) )
117
+ }
118
+
110
119
/// Run a program and return data about it
111
120
///
112
121
/// This is mostly a direct port of `run_program` in C `tests.c`.
113
- pub fn run_program (
122
+ pub fn run_program_with_env (
114
123
program : & [ u8 ] ,
115
124
witness : & [ u8 ] ,
116
125
test_up_to : TestUpTo ,
126
+ env : * const CElementsTxEnv ,
117
127
) -> Result < TestOutput , SimplicityErr > {
118
128
let mut result = TestOutput {
119
129
amr : CSha256Midstate :: default ( ) ,
@@ -266,8 +276,7 @@ pub fn run_program(
266
276
}
267
277
268
278
// 9. Run the program
269
- result. eval_result =
270
- simplicity_evalTCOProgram ( dag, type_dag, len, ptr:: null ( ) , ptr:: null ( ) ) ;
279
+ result. eval_result = simplicity_evalTCOProgram ( dag, type_dag, len, ptr:: null ( ) , env) ;
271
280
}
272
281
273
282
Ok ( result)
0 commit comments