@@ -42,6 +42,8 @@ fn main() {
4242 generate_compile_success_with_bug_tests ( & mut test_file, & test_dir) ;
4343 generate_compile_failure_tests ( & mut test_file, & test_dir) ;
4444
45+ generate_interpret_execution_success_tests ( & mut test_file, & test_dir) ;
46+
4547 generate_fuzzing_failure_tests ( & mut test_file, & test_dir) ;
4648
4749 generate_nargo_expand_execution_success_tests ( & mut test_file, & test_dir) ;
@@ -115,6 +117,81 @@ const TESTS_WITH_EXPECTED_WARNINGS: [&str; 5] = [
115117 "brillig_continue_break" ,
116118] ;
117119
120+ /// `nargo interpret` ignored tests, either because they don't currently work or
121+ /// becuase they are too slow to run.
122+ const IGNORED_INTERPRET_EXECUTION_TESTS : [ & str ; 35 ] = [
123+ // slow
124+ "regression_4709" ,
125+ // panic: index out of bounds
126+ "array_dynamic_nested_blackbox_input" ,
127+ // gives a different result with `--force-brillig`
128+ "array_oob_regression_7965" ,
129+ // gives a different result with `--force-brillig`
130+ "array_oob_regression_7975" ,
131+ // panic: FunctionReturnedIncorrectArgCount
132+ "as_witness" ,
133+ // wrong result
134+ "brillig_block_parameter_liveness" ,
135+ // panic: BlockArgumentCountMismatch
136+ "brillig_cow_regression" ,
137+ // wrong result
138+ "databus" ,
139+ // panic: index out of bounds
140+ "databus_composite_calldata" ,
141+ // wrong result
142+ "databus_two_calldata" ,
143+ // wrong result
144+ "databus_two_calldata_simple" ,
145+ // panic: IntrinsicArgumentCountMismatch
146+ "fold_numeric_generic_poseidon" ,
147+ // gives a different result with `--force-brillig`
148+ "global_array_rc_regression_8259" ,
149+ // panic: IntrinsicArgumentCountMismatch
150+ "hash_to_field" ,
151+ // panic: Internal(TypeError)
152+ "inline_decompose_hint_brillig_call" ,
153+ // panic: Internal(TypeError)
154+ "multi_scalar_mul" ,
155+ // gives a different result with `--force-brillig`
156+ "nested_if_then_block_same_cond" ,
157+ // panic: IntrinsicArgumentCountMismatch
158+ "no_predicates_numeric_generic_poseidon" ,
159+ // panic: IntrinsicArgumentCountMismatch
160+ "ram_blowup_regression" ,
161+ // panic: index out of bounds
162+ "regression_11294" ,
163+ // panic: Internal(TypeError)
164+ "regression_3889" ,
165+ // panic: IntrinsicArgumentCountMismatch
166+ "regression_5252" ,
167+ // panic: IntrinsicArgumentCountMismatch
168+ "regression_7128" ,
169+ // panic: index out of bounds
170+ "regression_7612" ,
171+ // gives a wrong result
172+ "regression_7744" ,
173+ // gives a wrong result
174+ "regression_8174" ,
175+ // panic: index out of bounds
176+ "regression_struct_array_conditional" ,
177+ // panic Internal(TypeError)
178+ "simple_shield" ,
179+ // panic: index out of bounds
180+ "slice_loop" ,
181+ // panic: index out of bounds
182+ "struct_array_inputs" ,
183+ // panic: BlockArgumentCountMismatch
184+ "struct_inputs" ,
185+ // panic: IntrinsicArgumentCountMismatch
186+ "to_be_bytes" ,
187+ // panic: IntrinsicArgumentCountMismatch
188+ "to_le_bytes" ,
189+ // panic: BlockArgumentCountMismatch
190+ "tuple_inputs" ,
191+ // panic: IntrinsicArgumentCountMismatch
192+ "unrolling_regression_8333" ,
193+ ] ;
194+
118195/// These tests are ignored because making them work involves a more complex test code that
119196/// might not be worth it.
120197/// Others are ignored because of existing bugs in `nargo expand`.
@@ -381,6 +458,7 @@ fn test_{test_name}() {{
381458 )
382459 . expect ( "Could not write templated test file." ) ;
383460}
461+
384462fn generate_execution_success_tests ( test_file : & mut File , test_data_dir : & Path ) {
385463 let test_type = "execution_success" ;
386464 let test_cases = read_test_cases ( test_data_dir, test_type) ;
@@ -699,6 +777,41 @@ fn generate_compile_failure_tests(test_file: &mut File, test_data_dir: &Path) {
699777 writeln ! ( test_file, "}}" ) . unwrap ( ) ;
700778}
701779
780+ fn generate_interpret_execution_success_tests ( test_file : & mut File , test_data_dir : & Path ) {
781+ let test_type = "execution_success" ;
782+ let test_cases = read_test_cases ( test_data_dir, test_type) ;
783+
784+ writeln ! (
785+ test_file,
786+ "mod interpret_{test_type} {{
787+ use super::*;
788+ "
789+ )
790+ . unwrap ( ) ;
791+ for ( test_name, test_dir) in test_cases {
792+ if IGNORED_INTERPRET_EXECUTION_TESTS . contains ( & test_name. as_str ( ) ) {
793+ continue ;
794+ }
795+
796+ let test_dir = test_dir. display ( ) ;
797+
798+ generate_test_cases (
799+ test_file,
800+ & test_name,
801+ & test_dir,
802+ "interpret" ,
803+ "interpret_execution_success(nargo);" ,
804+ & MatrixConfig {
805+ vary_brillig : !IGNORED_BRILLIG_TESTS . contains ( & test_name. as_str ( ) ) ,
806+ vary_inliner : true ,
807+ min_inliner : min_inliner ( & test_name) ,
808+ max_inliner : max_inliner ( & test_name) ,
809+ } ,
810+ ) ;
811+ }
812+ writeln ! ( test_file, "}}" ) . unwrap ( ) ;
813+ }
814+
702815/// Here we check, for every program in `test_programs/exeuction_success`, that:
703816/// 1. `nargo expand` works on it
704817/// 2. That the output of the original program is the same as the output of the expanded program
0 commit comments