From 8a363315a8e475b03d2d7535541f45af88b583ad Mon Sep 17 00:00:00 2001 From: Gabriel Barreto Date: Tue, 19 Dec 2023 10:51:25 -0300 Subject: [PATCH 1/3] Expectation tests for eval --- Cargo.toml | 1 + src/lem/tests/eval_tests.rs | 1157 +++++++++++++++++++++++++++-------- 2 files changed, 907 insertions(+), 251 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d550ed0db1..3836ebe7d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,6 +102,7 @@ assert_cmd = "2.0.12" cfg-if = "1.0.0" ascii_table = "4.0.2" criterion = "0.5" +expect-test = "1.4.1" hex = "0.4.3" pprof = { version = "0.13" } structopt = { version = "0.3", default-features = false } diff --git a/src/lem/tests/eval_tests.rs b/src/lem/tests/eval_tests.rs index fbd5d4d9aa..df979eb5f3 100644 --- a/src/lem/tests/eval_tests.rs +++ b/src/lem/tests/eval_tests.rs @@ -1,3 +1,4 @@ +use expect_test::{expect, Expect}; use pasta_curves::pallas::Scalar as Fr; use std::{cell::RefCell, rc::Rc}; @@ -21,7 +22,7 @@ fn test_aux>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: usize, + expected_iterations: Expect, lang: &Option<&Lang>, ) { let ptr = s.read_with_default_state(expr).unwrap(); @@ -45,7 +46,7 @@ fn test_aux_with_state>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: usize, + expected_iterations: Expect, lang: &Option<&Lang>, ) { let ptr = s.read(state, expr).unwrap(); @@ -69,7 +70,7 @@ fn do_test_aux>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: usize, + expected_iterations: Expect, lang: &Option<&Lang>, ) { if let Some(lang) = lang { @@ -105,7 +106,7 @@ fn do_test>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: usize, + expected_iterations: Expect, lang: &Lang, ) { let limit = 100000; @@ -138,7 +139,9 @@ fn do_test>( .zip(emitted) .all(|(a, b)| s.ptr_eq(a, &b))); } - assert_eq!(expected_iterations, iterations); + let data = expected_iterations.data().parse::().unwrap(); + assert!(iterations <= data); + expected_iterations.assert_eq(&iterations.to_string()) } #[test] @@ -176,11 +179,11 @@ fn self_evaluating() { ] .into_iter() .for_each(|(expr, expt)| { - test_aux::>(s, expr, Some(expt), None, None, None, 1, &None); + test_aux::>(s, expr, Some(expt), None, None, None, expect!["1"], &None); }); let fun = s.intern_fun(s.intern_user_symbol("x"), s.list(vec![expt_nil]), expt_nil); - do_test_aux::>(s, &fun, Some(fun), None, None, None, 1, &None); + do_test_aux::>(s, &fun, Some(fun), None, None, None, expect!["1"], &None); } #[test] @@ -199,7 +202,7 @@ fn evaluate_cons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -218,7 +221,7 @@ fn emit_output() { None, Some(terminal), Some(emitted), - 3, + expect!["3"], &None, ); } @@ -237,7 +240,7 @@ fn evaluate_lambda() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -256,7 +259,7 @@ fn evaluate_empty_args_lambda() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -275,7 +278,7 @@ fn evaluate_lambda2() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -294,7 +297,7 @@ fn evaluate_lambda3() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -315,7 +318,7 @@ fn evaluate_lambda4() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -336,7 +339,7 @@ fn evaluate_lambda5() { None, Some(terminal), None, - 13, + expect!["13"], &None, ); } @@ -355,7 +358,7 @@ fn evaluate_sum() { None, Some(terminal), None, - 6, + expect!["6"], &None, ); } @@ -374,7 +377,7 @@ fn evaluate_diff() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -393,7 +396,7 @@ fn evaluate_product() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -412,7 +415,7 @@ fn evaluate_quotient() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -423,7 +426,7 @@ fn evaluate_quotient_divide_by_zero() { let expr = "(/ 21 0)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -442,7 +445,7 @@ fn evaluate_num_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -458,7 +461,7 @@ fn evaluate_num_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -478,7 +481,7 @@ fn evaluate_adder1() { None, Some(terminal), None, - 13, + expect!["13"], &None, ); } @@ -499,7 +502,7 @@ fn evaluate_adder2() { None, Some(terminal), None, - 15, + expect!["15"], &None, ); } @@ -518,7 +521,7 @@ fn evaluate_let_simple() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -537,7 +540,7 @@ fn evaluate_empty_let_bug() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -558,7 +561,7 @@ fn evaluate_let() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -569,7 +572,7 @@ fn evaluate_let_empty_error() { let expr = "(let)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -578,7 +581,7 @@ fn evaluate_let_empty_body_error() { let expr = "(let ((a 1)))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -587,7 +590,7 @@ fn evaluate_letrec_empty_error() { let expr = "(letrec)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -596,7 +599,7 @@ fn evaluate_letrec_empty_body_error() { let expr = "(letrec ((a 1)))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -613,7 +616,7 @@ fn evaluate_letrec_body_nil() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -632,7 +635,7 @@ fn evaluate_let_parallel_binding() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -655,7 +658,7 @@ fn evaluate_arithmetic_let() { Some(new_env), Some(terminal), None, - 18, + expect!["18"], &None, ); } @@ -686,7 +689,7 @@ fn evaluate_fundamental_conditional() { None, Some(terminal), None, - 35, + expect!["35"], &None, ); } @@ -713,7 +716,7 @@ fn evaluate_fundamental_conditional() { None, Some(terminal), None, - 32, + expect!["32"], &None, ); } @@ -734,7 +737,7 @@ fn evaluate_if() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -751,7 +754,7 @@ fn evaluate_if() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -772,7 +775,7 @@ fn evaluate_fully_evaluates() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -797,7 +800,7 @@ fn evaluate_recursion1() { None, Some(terminal), None, - 91, + expect!["91"], &None, ); } @@ -822,7 +825,7 @@ fn evaluate_recursion2() { None, Some(terminal), None, - 201, + expect!["201"], &None, ); } @@ -845,7 +848,7 @@ fn evaluate_recursion_multiarg() { None, Some(terminal), None, - 95, + expect!["95"], &None, ); } @@ -871,7 +874,7 @@ fn evaluate_recursion_optimized() { None, Some(terminal), None, - 75, + expect!["75"], &None, ); } @@ -896,7 +899,7 @@ fn evaluate_tail_recursion() { None, Some(terminal), None, - 129, + expect!["129"], &None, ); } @@ -924,7 +927,7 @@ fn evaluate_tail_recursion_somewhat_optimized() { None, Some(terminal), None, - 110, + expect!["110"], &None, ); } @@ -945,7 +948,7 @@ fn evaluate_multiple_letrec_bindings() { None, Some(terminal), None, - 22, + expect!["22"], &None, ); } @@ -966,7 +969,7 @@ fn evaluate_multiple_letrec_bindings_referencing() { None, Some(terminal), None, - 31, + expect!["31"], &None, ); } @@ -998,7 +1001,7 @@ fn evaluate_multiple_letrec_bindings_recursive() { None, Some(terminal), None, - 242, + expect!["242"], &None, ); } @@ -1022,7 +1025,7 @@ fn nested_let_closure_regression() { None, Some(terminal), None, - 13, + expect!["13"], &None, ); } @@ -1039,7 +1042,7 @@ fn nested_let_closure_regression() { None, Some(terminal), None, - 14, + expect!["14"], &None, ); } @@ -1060,7 +1063,7 @@ fn evaluate_eq() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1077,7 +1080,7 @@ fn evaluate_eq() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1094,7 +1097,7 @@ fn evaluate_eq() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1112,7 +1115,7 @@ fn evaluate_eq() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1133,7 +1136,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1155,7 +1158,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1170,7 +1173,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - 12, + expect!["12"], &None, ); } @@ -1183,14 +1186,14 @@ fn evaluate_zero_arg_lambda_variants() { let expr = "((lambda () 123) 1)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); } { let s = &Store::::default(); let expr = "(123)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } } @@ -1233,7 +1236,7 @@ fn evaluate_make_tree() { None, Some(terminal), None, - 493, + expect!["493"], &None, ); } @@ -1279,7 +1282,7 @@ fn evaluate_map_tree_bug() { None, Some(terminal), None, - 170, + expect!["170"], &None, ); } @@ -1299,7 +1302,16 @@ fn evaluate_map_tree_numequal_bug() { (map-tree (lambda (x) (+ 1 x)) '((1 . 2) . (3 . 4))))"; let expected = s.intern_nil(); let error = s.cont_error(); - test_aux::>(s, expr, Some(expected), None, Some(error), None, 169, &None); + test_aux::>( + s, + expr, + Some(expected), + None, + Some(error), + None, + expect!["169"], + &None, + ); } } @@ -1332,7 +1344,7 @@ fn env_lost_bug() { None, Some(terminal), None, - 25, + expect!["25"], &None, ); } @@ -1357,7 +1369,7 @@ fn dont_discard_rest_env() { None, Some(terminal), None, - 22, + expect!["22"], &None, ); } @@ -1383,7 +1395,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -1393,7 +1405,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -1403,7 +1415,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -1413,7 +1425,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -1423,7 +1435,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); test_aux::>( @@ -1433,7 +1445,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); test_aux::>( @@ -1443,7 +1455,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); test_aux::>( @@ -1453,7 +1465,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); test_aux::>( @@ -1463,17 +1475,35 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], + &None, + ); + test_aux::>( + s, + r#"(strcons)"#, + None, + None, + Some(error), + None, + expect!["1"], &None, ); - test_aux::>(s, r#"(strcons)"#, None, None, Some(error), None, 1, &None); } #[test] fn test_one_arg_cons_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, r#"(cons "")"#, None, None, Some(error), None, 1, &None); + test_aux::>( + s, + r#"(cons "")"#, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] @@ -1488,7 +1518,7 @@ fn test_car_nil() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1505,7 +1535,7 @@ fn test_cdr_nil() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1514,24 +1544,78 @@ fn test_cdr_nil() { fn test_car_cdr_invalid_tag_error_sym() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, r#"(car 'car)"#, None, None, Some(error), None, 2, &None); - test_aux::>(s, r#"(cdr 'car)"#, None, None, Some(error), None, 2, &None); + test_aux::>( + s, + r#"(car 'car)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::>( + s, + r#"(cdr 'car)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] fn test_car_cdr_invalid_tag_error_char() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, r"(car #\a)", None, None, Some(error), None, 2, &None); - test_aux::>(s, r"(cdr #\a)", None, None, Some(error), None, 2, &None); + test_aux::>( + s, + r"(car #\a)", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::>( + s, + r"(cdr #\a)", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] fn test_car_cdr_invalid_tag_error_num() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, r#"(car 42)"#, None, None, Some(error), None, 2, &None); - test_aux::>(s, r#"(cdr 42)"#, None, None, Some(error), None, 2, &None); + test_aux::>( + s, + r#"(car 42)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::>( + s, + r#"(cdr 42)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] @@ -1545,7 +1629,7 @@ fn test_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -1555,7 +1639,7 @@ fn test_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - 2, + expect!["2"], &None, ); } @@ -1591,7 +1675,7 @@ fn go_translate() { None, None, None, - 1114, + expect!["1114"], &None, ); } @@ -1602,7 +1686,16 @@ fn begin_current_env() { let s = &Store::::default(); let expr = "(begin (current-env))"; let expected = s.intern_nil(); - test_aux::>(s, expr, Some(expected), None, None, None, 2, &None); + test_aux::>( + s, + expr, + Some(expected), + None, + None, + None, + expect!["2"], + &None, + ); } } @@ -1612,7 +1705,16 @@ fn begin() { let s = &Store::::default(); let expr = "(car (begin 1 2 '(3 . 4)))"; let expected = s.num_u64(3); - test_aux::>(s, expr, Some(expected), None, None, None, 6, &None); + test_aux::>( + s, + expr, + Some(expected), + None, + None, + None, + expect!["6"], + &None, + ); } } @@ -1626,7 +1728,16 @@ fn begin_current_env1() { let one = s.num_u64(1); let binding = s.cons(a, one); let expected = s.list(vec![binding]); - test_aux::>(s, expr, Some(expected), None, None, None, 5, &None); + test_aux::>( + s, + expr, + Some(expected), + None, + None, + None, + expect!["5"], + &None, + ); } } @@ -1635,7 +1746,7 @@ fn hide_open() { let s = &Store::::default(); let expr = "(open (hide 123 'x))"; let x = s.intern_user_symbol("x"); - test_aux::>(s, expr, Some(x), None, None, None, 5, &None); + test_aux::>(s, expr, Some(x), None, None, None, expect!["5"], &None); } #[test] @@ -1653,21 +1764,21 @@ fn hide_opaque_open_available() { { let expr = s.list(vec![open, comm]); - do_test::>(s, &expr, Some(x), None, None, None, 2, &lang); + do_test::>(s, &expr, Some(x), None, None, None, expect!["2"], &lang); } { let secret = s.intern_lurk_symbol("secret"); let expr = s.list(vec![secret, comm]); let sec = s.num_u64(123); - do_test::>(s, &expr, Some(sec), None, None, None, 2, &lang); + do_test::>(s, &expr, Some(sec), None, None, None, expect!["2"], &lang); } { // We can open a commitment identified by its corresponding `Num`. let comm_num = s.num(c); let expr2 = s.list(vec![open, comm_num]); - do_test::>(s, &expr2, Some(x), None, None, None, 2, &lang); + do_test::>(s, &expr2, Some(x), None, None, None, expect!["2"], &lang); } } @@ -1688,7 +1799,7 @@ fn hide_opaque_open_unavailable() { let expr = s2.list(vec![open, comm]); let lang = Lang::new(); - do_test::>(s2, &expr, Some(x), None, None, None, 2, &lang); + do_test::>(s2, &expr, Some(x), None, None, None, expect!["2"], &lang); } #[test] @@ -1696,7 +1807,7 @@ fn commit_open_sym() { let s = &Store::::default(); let expr = "(open (commit 'x))"; let x = s.intern_user_symbol("x"); - test_aux::>(s, expr, Some(x), None, None, None, 4, &None); + test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); } #[test] @@ -1708,7 +1819,7 @@ fn commitment_value() { "0x2937881eff06c2bcc2c8c1fa0818ae3733c759376f76fc10b7439269e9aaa9bc", ) .unwrap(); - test_aux::>(s, expr, Some(x), None, None, None, 4, &None); + test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); } #[test] @@ -1721,10 +1832,10 @@ fn commit_nil() { .unwrap(); let expr = "(num (commit nil))"; - test_aux::>(s, expr, Some(x), None, None, None, 4, &None); + test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); let expr = "(num (commit '.lurk.nil))"; - test_aux::>(s, expr, Some(x), None, None, None, 4, &None); + test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); } #[test] @@ -1732,7 +1843,7 @@ fn commit_error() { let s = &Store::::default(); let expr = "(commit 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1740,7 +1851,7 @@ fn open_error() { let s = &Store::::default(); let expr = "(open 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1748,7 +1859,7 @@ fn secret_error() { let s = &Store::::default(); let expr = "(secret 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1756,7 +1867,7 @@ fn num_error() { let s = &Store::::default(); let expr = "(num 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1764,7 +1875,7 @@ fn comm_error() { let s = &Store::::default(); let expr = "(comm 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1772,7 +1883,7 @@ fn char_error() { let s = &Store::::default(); let expr = "(char 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -1788,7 +1899,7 @@ fn prove_commit_secret() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -1806,7 +1917,7 @@ fn num() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1824,7 +1935,7 @@ fn num_char() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1842,7 +1953,7 @@ fn char_num() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1860,7 +1971,7 @@ fn char_coercion() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -1870,7 +1981,16 @@ fn commit_num() { let s = &Store::::default(); let expr = "(num (commit 123))"; let terminal = s.cont_terminal(); - test_aux::>(s, expr, None, None, Some(terminal), None, 4, &None); + test_aux::>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["4"], + &None, + ); } #[test] @@ -1886,7 +2006,7 @@ fn hide_open_comm_num() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -1904,7 +2024,7 @@ fn hide_secret_comm_num() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -1922,7 +2042,7 @@ fn commit_open_comm_num() { None, Some(terminal), None, - 8, + expect!["8"], &None, ); } @@ -1940,7 +2060,7 @@ fn commit_secret_comm_num() { None, Some(terminal), None, - 8, + expect!["8"], &None, ); } @@ -1958,7 +2078,7 @@ fn commit_num_open() { None, Some(terminal), None, - 6, + expect!["6"], &None, ); } @@ -1970,9 +2090,9 @@ fn num_invalid_tag() { let expr1 = "(num \"asdf\")"; let expr2 = "(num '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -1982,9 +2102,9 @@ fn comm_invalid_tag() { let expr1 = "(comm \"asdf\")"; let expr2 = "(comm '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -1994,9 +2114,9 @@ fn char_invalid_tag() { let expr1 = "(char \"asdf\")"; let expr2 = "(char '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2005,7 +2125,16 @@ fn terminal_sym() { let expr = "(quote x)"; let x = s.intern_user_symbol("x"); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(x), None, Some(terminal), None, 1, &None); + test_aux::>( + s, + expr, + Some(x), + None, + Some(terminal), + None, + expect!["1"], + &None, + ); } #[test] @@ -2013,7 +2142,7 @@ fn terminal_sym() { fn open_opaque_commit() { let s = &Store::::default(); let expr = "(open 123)"; - test_aux::>(s, expr, None, None, None, None, 2, &None); + test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); } #[test] @@ -2021,7 +2150,7 @@ fn open_wrong_type() { let s = &Store::::default(); let expr = "(open 'asdf)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 2, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2029,7 +2158,7 @@ fn secret_wrong_type() { let s = &Store::::default(); let expr = "(secret 'asdf)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 2, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2037,7 +2166,7 @@ fn secret_wrong_type() { fn secret_invalid_tag() { let s = &Store::::default(); let expr = "(secret 123)"; - test_aux::>(s, expr, None, None, None, None, 2, &None); + test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); } #[test] @@ -2045,7 +2174,7 @@ fn secret_invalid_tag() { fn secret_opaque_commit() { let s = &Store::::default(); let expr = "(secret (comm 123))"; - test_aux::>(s, expr, None, None, None, None, 2, &None); + test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); } #[allow(dead_code)] @@ -2065,7 +2194,7 @@ fn relational_aux(s: &Store, op: &str, a: &str, b: &str, res: bool) { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -2199,7 +2328,16 @@ fn test_relational_edge_case_identity() { (most-negative (+ 1 most-positive))) (< most-negative most-positive))"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 19, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["19"], + &None, + ); } // Regression: comparisons with negative numbers should *not* be exceptions. @@ -2209,7 +2347,16 @@ fn test_relational_edge_case_identity() { (less-negative (+ 1 most-negative))) (< most-negative less-negative)) "; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 24, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["24"], + &None, + ); } } @@ -2224,31 +2371,76 @@ fn test_num_syntax_implications() { (most-negative 1/2)) (< most-negative most-positive))"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 10, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["10"], + &None, + ); } { let expr = "(= (* 6 3/2) 9)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 6, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } { let expr = "(= (* 2/3 3/2) 1)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 6, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } { let expr = "(= (* -2/3 3/2) -1)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 6, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } { let expr = "(= (+ 1/3 1/2) 5/6)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 6, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } // Comparisons of field elements produced by fractional notation don't yield the results @@ -2258,7 +2450,16 @@ fn test_num_syntax_implications() { // but this violates expectations if you consider 1/2 to behave like a rational. let expr = "(< 1/2 1/3)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } { @@ -2266,13 +2467,31 @@ fn test_num_syntax_implications() { // expected if fractional notation yielded true rational numbers. let expr = "(< 3/4 5/8)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } { // It's not that they *can't* compare in the naively expected way, though. let expr = "(< 3/5 3/4)"; - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } } @@ -2285,7 +2504,16 @@ fn test_quoted_symbols() { let res = s.num_u64(81); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 13, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["13"], + &None, + ); } #[test] @@ -2297,8 +2525,26 @@ fn test_eval() { let res2 = s.num_u64(20); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 17, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 9, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["17"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["9"], + &None, + ); } #[test] @@ -2310,8 +2556,17 @@ fn test_eval_env_regression() { let error = s.cont_error(); let terminal = s.cont_terminal(); - test_aux::>(s, expr, None, None, Some(error), None, 5, &None); - test_aux::>(s, expr2, Some(res), None, Some(terminal), None, 6, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["5"], &None); + test_aux::>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } #[test] @@ -2324,39 +2579,111 @@ fn test_u64_mul() { let res = s.u64(18446744073709551614); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 7, &None); - test_aux::>(s, expr2, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, Some(res), None, Some(terminal), None, 6, &None); -} - -#[test] -fn test_u64_add() { - let s = &Store::::default(); - - let expr = "(+ 18446744073709551615u64 2u64)"; - let expr2 = "(+ (- 0u64 1u64) 2u64)"; - let res = s.u64(1); - let terminal = s.cont_terminal(); - - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res), None, Some(terminal), None, 6, &None); -} - -#[test] -fn test_u64_sub() { - let s = &Store::::default(); - - let expr = "(- 2u64 1u64)"; - let expr2 = "(- 0u64 1u64)"; - let expr3 = "(+ 1u64 (- 0u64 1u64))"; - let res = s.u64(1); - let res2 = s.u64(18446744073709551615); - let res3 = s.u64(0); - let terminal = s.cont_terminal(); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["7"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + Some(res), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); +} + +#[test] +fn test_u64_add() { + let s = &Store::::default(); + + let expr = "(+ 18446744073709551615u64 2u64)"; + let expr2 = "(+ (- 0u64 1u64) 2u64)"; + let res = s.u64(1); + let terminal = s.cont_terminal(); + + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); +} - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, Some(res3), None, Some(terminal), None, 6, &None); +#[test] +fn test_u64_sub() { + let s = &Store::::default(); + + let expr = "(- 2u64 1u64)"; + let expr2 = "(- 0u64 1u64)"; + let expr3 = "(+ 1u64 (- 0u64 1u64))"; + let res = s.u64(1); + let res2 = s.u64(18446744073709551615); + let res3 = s.u64(0); + let terminal = s.cont_terminal(); + + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + Some(res3), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } #[test] @@ -2374,9 +2701,27 @@ fn test_u64_div() { let terminal = s.cont_terminal(); let error = s.cont_error(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2394,9 +2739,27 @@ fn test_u64_mod() { let terminal = s.cont_terminal(); let error = s.cont_error(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2409,9 +2772,9 @@ fn test_num_mod() { let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); - test_aux::>(s, expr2, None, None, Some(error), None, 3, &None); - test_aux::>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr2, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2438,21 +2801,129 @@ fn test_u64_comp() { let nil = s.intern_nil(); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr4, Some(nil), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr4, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::>(s, expr5, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr6, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr7, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr8, Some(t), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr5, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr6, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr7, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr8, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::>(s, expr9, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr10, Some(t), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr9, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr10, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::>(s, expr11, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr12, Some(nil), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr11, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr12, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2474,14 +2945,59 @@ fn test_u64_conversion() { let terminal = s.cont_terminal(); let error = s.cont_error(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res), None, Some(terminal), None, 2, &None); - test_aux::>(s, expr3, Some(res2), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["2"], + &None, + ); + test_aux::>( + s, + expr3, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::>(s, expr4, Some(res3), None, Some(terminal), None, 5, &None); - test_aux::>(s, expr5, Some(res5), None, Some(terminal), None, 2, &None); - test_aux::>(s, expr6, None, None, Some(error), None, 1, &None); - test_aux::>(s, expr7, None, None, Some(error), None, 1, &None); + test_aux::>( + s, + expr4, + Some(res3), + None, + Some(terminal), + None, + expect!["5"], + &None, + ); + test_aux::>( + s, + expr5, + Some(res5), + None, + Some(terminal), + None, + expect!["2"], + &None, + ); + test_aux::>(s, expr6, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr7, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -2493,8 +3009,8 @@ fn test_numeric_type_error() { let expr = &format!("({op} 0 'a)"); let expr2 = &format!("({op} 0u64 'a)"); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); - test_aux::>(s, expr2, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr2, None, None, Some(error), None, expect!["3"], &None); }; test("+"); @@ -2519,8 +3035,26 @@ fn test_u64_num_comparison() { let nil = s.intern_nil(); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(t), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(nil), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2533,8 +3067,26 @@ fn test_u64_num_cons() { let res2 = s.read_with_default_state("(1u64 . 1)").unwrap(); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2544,7 +3096,7 @@ fn test_hide_u64_secret() { let expr = "(hide 0u64 123)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2560,9 +3112,36 @@ fn test_keyword() { let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 1, &None); - test_aux::>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::>(s, expr3, Some(res3), None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["1"], + &None, + ); + test_aux::>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + Some(res3), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2635,7 +3214,16 @@ fn test_fold_cons_regression() { let res = s.num_u64(6); let terminal = s.cont_terminal(); - test_aux::>(s, expr, Some(res), None, Some(terminal), None, 152, &None); + test_aux::>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["152"], + &None, + ); } #[test] @@ -2645,7 +3233,16 @@ fn test_lambda_args_regression() { let expr = "(cons (lambda (x y) nil) nil)"; let terminal = s.cont_terminal(); - test_aux::>(s, expr, None, None, Some(terminal), None, 3, &None); + test_aux::>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2654,7 +3251,7 @@ fn test_eval_bad_form() { let expr = "(* 5 (eval '(+ 1 a) '((0 . 3))))"; // two-arg eval, optional second arg is env. let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 8, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["8"], &None); } #[test] @@ -2662,10 +3259,37 @@ fn test_eval_quote_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, "(1)", None, None, Some(error), None, 1, &None); - test_aux::>(s, "(quote . 1)", None, None, Some(error), None, 1, &None); - test_aux::>(s, "(quote 1 . 1)", None, None, Some(error), None, 1, &None); - test_aux::>(s, "(quote 1 1)", None, None, Some(error), None, 1, &None); + test_aux::>(s, "(1)", None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + "(quote . 1)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); + test_aux::>( + s, + "(quote 1 . 1)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); + test_aux::>( + s, + "(quote 1 1)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] @@ -2674,7 +3298,7 @@ fn test_eval_dotted_syntax_error() { let expr = "(let ((a (lambda (x) (+ x 1)))) (a . 1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[allow(dead_code)] @@ -2687,29 +3311,33 @@ fn op_syntax_error() { { let expr = format!("({name} . 1)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } if !op.supports_arity(0) { let expr = format!("({name})"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } if !op.supports_arity(1) { let expr = format!("({name} 123)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } if !op.supports_arity(2) { let expr = format!("({name} 123 456)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } if !op.supports_arity(3) { let expr = format!("({name} 123 456 789)"); tracing::debug!("{}", &expr); - let iterations = if op.supports_arity(2) { 2 } else { 1 }; + let iterations = if op.supports_arity(2) { + expect!["2"] + } else { + expect!["1"] + }; test_aux::>(s, &expr, None, None, Some(error), None, iterations, &None); } }; @@ -2734,7 +3362,16 @@ fn test_eval_lambda_body_syntax() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, "((lambda ()))", None, None, Some(error), None, 2, &None); + test_aux::>( + s, + "((lambda ()))", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); test_aux::>( s, "((lambda () 1 2))", @@ -2742,7 +3379,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - 2, + expect!["2"], &None, ); test_aux::>( @@ -2752,7 +3389,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - 3, + expect!["3"], &None, ); test_aux::>( @@ -2762,7 +3399,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -2777,9 +3414,27 @@ fn test_eval_non_symbol_binding_error() { let expr2 = format!("(letrec (({x} 123)) {x})"); let expr3 = format!("(lambda ({x}) {x})"); - test_aux::>(s, &expr, None, None, Some(error), None, 1, &None); - test_aux::>(s, &expr2, None, None, Some(error), None, 1, &None); - test_aux::>(s, &expr3, None, None, Some(error), None, 1, &None); + test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr2, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); + test_aux::>( + s, + &expr3, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); }; test(":a"); @@ -2835,7 +3490,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 3, + expect!["3"], &Some(&lang), ); test_aux( @@ -2845,7 +3500,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 6, + expect!["6"], &Some(&lang), ); test_aux( @@ -2855,7 +3510,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 9, + expect!["9"], &Some(&lang), ); test_aux( @@ -2865,7 +3520,7 @@ fn test_dumb_lang() { None, Some(error), None, - 4, + expect!["4"], &Some(&lang), ); test_aux( @@ -2875,7 +3530,7 @@ fn test_dumb_lang() { None, Some(error), None, - 2, + expect!["2"], &Some(&lang), ); test_aux( @@ -2885,7 +3540,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(&lang), ); test_aux( @@ -2895,7 +3550,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(&lang), ); test_aux( @@ -2905,7 +3560,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(&lang), ); } @@ -2936,7 +3591,7 @@ fn test_trie_lang() { None, None, None, - 4, + expect!["4"], &Some(&lang), ); @@ -2952,7 +3607,7 @@ fn test_trie_lang() { None, None, None, - 3, + expect!["3"], &Some(&lang), ); @@ -2972,7 +3627,7 @@ fn test_trie_lang() { None, None, None, - 4, + expect!["4"], &Some(&lang), ); @@ -2988,7 +3643,7 @@ fn test_trie_lang() { None, None, None, - 3, + expect!["3"], &Some(&lang), ); @@ -3006,7 +3661,7 @@ fn test_trie_lang() { None, None, None, - 9, + expect!["9"], &Some(&lang), ); @@ -3023,7 +3678,7 @@ fn test_trie_lang() { None, None, None, - 13, + expect!["13"], &Some(&lang), ); } @@ -3051,7 +3706,7 @@ fn test_terminator_lang() { None, Some(terminal), None, - 1, + expect!["1"], &Some(&lang), ); } From 1609d83753f19e8a8dcc2684321b54ad2d2941ea Mon Sep 17 00:00:00 2001 From: Gabriel Barreto Date: Tue, 19 Dec 2023 11:11:16 -0300 Subject: [PATCH 2/3] Expectation test for nova --- src/proof/tests/mod.rs | 18 +- src/proof/tests/nova_tests_lem.rs | 1127 ++++++++++++++++++++++------- 2 files changed, 883 insertions(+), 262 deletions(-) diff --git a/src/proof/tests/mod.rs b/src/proof/tests/mod.rs index d14abbb005..0b0858b99d 100644 --- a/src/proof/tests/mod.rs +++ b/src/proof/tests/mod.rs @@ -3,6 +3,7 @@ mod nova_tests_lem; use abomonation::Abomonation; use bellpepper::util_cs::{metric_cs::MetricCS, witness_cs::WitnessCS, Comparable}; use bellpepper_core::{test_cs::TestConstraintSystem, ConstraintSystem, Delta}; +use expect_test::Expect; use nova::traits::Engine; use std::sync::Arc; @@ -42,7 +43,7 @@ fn test_aux<'a, F: CurveCycleEquipped, C: Coprocessor, M: MultiFrameTrait<'a, expected_env: Option, expected_cont: Option, expected_emitted: Option<&[M::Ptr]>, - expected_iterations: usize, + expected_iterations: Expect, lang: &Option>>, ) // technical bounds that would disappear once associated_type_bounds stabilizes @@ -58,7 +59,7 @@ where expected_env, expected_cont, expected_emitted, - expected_iterations, + &expected_iterations, chunk_size, false, None, @@ -74,7 +75,7 @@ fn nova_test_full_aux<'a, F: CurveCycleEquipped, C: Coprocessor, M: MultiFram expected_env: Option, expected_cont: Option, expected_emitted: Option<&[M::Ptr]>, - expected_iterations: usize, + expected_iterations: &Expect, reduction_count: usize, check_nova: bool, limit: Option, @@ -95,7 +96,7 @@ where expected_env, expected_cont, expected_emitted, - expected_iterations, + &expected_iterations, reduction_count, check_nova, limit, @@ -118,7 +119,7 @@ fn nova_test_full_aux2<'a, F: CurveCycleEquipped, C: Coprocessor, M: MultiFra expected_env: Option, expected_cont: Option, expected_emitted: Option<&[M::Ptr]>, - expected_iterations: usize, + expected_iterations: &Expect, reduction_count: usize, check_nova: bool, limit: Option, @@ -157,7 +158,8 @@ where let multiframes = M::from_frames(&frames, s, folding_config.clone()); let len = multiframes.len(); - let adjusted_iterations = nova_prover.expected_num_steps(expected_iterations); + let expected_iterations_data = expected_iterations.data().parse::().unwrap(); + let adjusted_iterations = nova_prover.expected_num_steps(expected_iterations_data); let mut previous_frame: Option<&M> = None; let mut cs_blank = MetricCS::::new(); @@ -226,6 +228,8 @@ where assert_eq!(&s.get_cont_terminal(), output.cont()); } - assert_eq!(expected_iterations, M::significant_frame_count(&frames)); + let iterations = M::significant_frame_count(&frames); + assert!(iterations <= expected_iterations_data); + expected_iterations.assert_eq(&iterations.to_string()); assert_eq!(adjusted_iterations, len); } diff --git a/src/proof/tests/nova_tests_lem.rs b/src/proof/tests/nova_tests_lem.rs index e15c295f2e..2ff4c780b2 100644 --- a/src/proof/tests/nova_tests_lem.rs +++ b/src/proof/tests/nova_tests_lem.rs @@ -1,3 +1,4 @@ +use expect_test::expect; use pasta_curves::pallas::Scalar as Fr; use std::{cell::RefCell, rc::Rc, sync::Arc}; @@ -50,7 +51,7 @@ fn test_prove_self_evaluating() { ] .into_iter() .for_each(|(expr, expt)| { - test_aux::<_, _, M1<'_, _>>(s, expr, Some(expt), None, None, None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, Some(expt), None, None, None, expect!["1"], &None); }); let fun = s.intern_fun(s.intern_user_symbol("x"), s.list(vec![expt_nil]), expt_nil); @@ -61,7 +62,7 @@ fn test_prove_self_evaluating() { None, None, None, - 1, + &expect!["1"], DEFAULT_REDUCTION_COUNT, false, None, @@ -81,7 +82,7 @@ fn test_prove_binop() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -101,7 +102,7 @@ fn test_prove_binop_fail() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -122,7 +123,7 @@ fn test_prove_arithmetic_let() { None, Some(terminal), None, - 18, + expect!["18"], &None, ); } @@ -140,7 +141,7 @@ fn test_prove_eq() { None, Some(terminal), None, - 3, + &expect!["3"], DEFAULT_REDUCTION_COUNT, true, None, @@ -161,7 +162,7 @@ fn test_prove_num_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); @@ -174,7 +175,7 @@ fn test_prove_num_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -191,7 +192,7 @@ fn test_prove_invalid_num_equal() { None, Some(error), None, - 3, + expect!["3"], &None, ); @@ -203,7 +204,7 @@ fn test_prove_invalid_num_equal() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -222,7 +223,7 @@ fn test_prove_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -232,7 +233,7 @@ fn test_prove_equal() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -242,10 +243,19 @@ fn test_prove_equal() { None, Some(terminal), None, - 3, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + "(eq 5 5)", + Some(t), + None, + Some(terminal), + None, + expect!["3"], &None, ); - test_aux::<_, _, M1<'_, _>>(s, "(eq 5 5)", Some(t), None, Some(terminal), None, 3, &None); } #[test] @@ -259,7 +269,7 @@ fn test_prove_quote_end_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -276,7 +286,7 @@ fn test_prove_if() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); @@ -289,7 +299,7 @@ fn test_prove_if() { None, Some(terminal), None, - 3, + expect!["3"], &None, ) } @@ -306,7 +316,7 @@ fn test_prove_if_end_is_nil_error() { None, Some(error), None, - 2, + expect!["2"], &None, ) } @@ -324,7 +334,7 @@ fn test_prove_if_fully_evaluates() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -347,7 +357,7 @@ fn test_prove_recursion1() { None, Some(terminal), None, - 66, + expect!["66"], &None, ); } @@ -371,7 +381,7 @@ fn test_prove_recursion2() { None, Some(terminal), None, - 93, + expect!["93"], &None, ); } @@ -387,7 +397,7 @@ fn test_prove_unop_regression_aux(chunk_count: usize) { None, Some(terminal), None, - 2, + &expect!["2"], chunk_count, // This needs to be 1 to exercise the bug. false, None, @@ -402,7 +412,7 @@ fn test_prove_unop_regression_aux(chunk_count: usize) { None, Some(terminal), None, - 2, + &expect!["2"], chunk_count, // This needs to be 1 to exercise the bug. false, None, @@ -417,7 +427,7 @@ fn test_prove_unop_regression_aux(chunk_count: usize) { None, Some(terminal), None, - 2, + &expect!["2"], chunk_count, // This needs to be 1 to exercise the bug. false, None, @@ -432,7 +442,7 @@ fn test_prove_unop_regression_aux(chunk_count: usize) { None, Some(terminal), None, - 3, + &expect!["3"], chunk_count, false, None, @@ -463,7 +473,7 @@ fn test_prove_emit_output() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -481,7 +491,7 @@ fn test_prove_evaluate() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -501,7 +511,7 @@ fn test_prove_evaluate2() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -524,7 +534,7 @@ fn test_prove_evaluate3() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -548,7 +558,7 @@ fn test_prove_evaluate4() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -569,7 +579,7 @@ fn test_prove_evaluate5() { None, Some(terminal), None, - 13, + expect!["13"], &None, ); } @@ -587,7 +597,7 @@ fn test_prove_evaluate_sum() { None, Some(terminal), None, - 6, + expect!["6"], &None, ); } @@ -604,7 +614,7 @@ fn test_prove_binop_rest_is_nil() { None, Some(error), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -614,7 +624,7 @@ fn test_prove_binop_rest_is_nil() { None, Some(error), None, - 2, + expect!["2"], &None, ); } @@ -628,23 +638,54 @@ fn op_syntax_error() { if !op.supports_arity(0) { let expr = format!("({name})"); tracing::debug!("{:?}", &expr); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } if !op.supports_arity(1) { let expr = format!("({name} 123)"); tracing::debug!("{:?}", &expr); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } if !op.supports_arity(2) { let expr = format!("({name} 123 456)"); tracing::debug!("{:?}", &expr); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } if !op.supports_arity(3) { let expr = format!("({name} 123 456 789)"); tracing::debug!("{:?}", &expr); - let iterations = if op.supports_arity(2) { 2 } else { 1 }; + let iterations = if op.supports_arity(2) { + expect!["2"] + } else { + expect!["1"] + }; test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, iterations, &None); } }; @@ -678,7 +719,7 @@ fn test_prove_diff() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -696,7 +737,7 @@ fn test_prove_product() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -714,7 +755,7 @@ fn test_prove_quotient() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -731,7 +772,7 @@ fn test_prove_error_div_by_zero() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -748,7 +789,7 @@ fn test_prove_error_invalid_type_and_not_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -770,7 +811,7 @@ fn test_prove_adder() { None, Some(terminal), None, - 13, + expect!["13"], &None, ); } @@ -787,7 +828,7 @@ fn test_prove_current_env_simple() { None, Some(terminal), None, - 1, + expect!["1"], &None, ); } @@ -804,7 +845,7 @@ fn test_prove_current_env_rest_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -823,7 +864,7 @@ fn test_prove_let_simple() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -839,7 +880,7 @@ fn test_prove_let_end_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -855,7 +896,7 @@ fn test_prove_letrec_end_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -871,7 +912,7 @@ fn test_prove_lambda_empty_error() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -880,21 +921,48 @@ fn test_prove_lambda_empty_error() { fn test_prove_let_empty_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(let)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(let)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] fn test_prove_let_empty_body_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(let ((a 1)))", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(let ((a 1)))", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] fn test_prove_letrec_empty_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(letrec)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(letrec)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] @@ -908,7 +976,7 @@ fn test_prove_letrec_empty_body_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -925,7 +993,7 @@ fn test_prove_let_body_nil() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -941,7 +1009,7 @@ fn test_prove_let_rest_body_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -957,7 +1025,7 @@ fn test_prove_letrec_rest_body_is_nil_error() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -975,7 +1043,7 @@ fn test_prove_let_null_bindings() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -992,7 +1060,7 @@ fn test_prove_letrec_null_bindings() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -1013,7 +1081,7 @@ fn test_prove_let() { None, Some(terminal), None, - 18, + expect!["18"], &None, ); } @@ -1038,7 +1106,7 @@ fn test_prove_arithmetic() { None, Some(terminal), None, - 23, + expect!["23"], &None, ); } @@ -1060,7 +1128,7 @@ fn test_prove_comparison() { None, Some(terminal), None, - 21, + expect!["21"], &None, ); } @@ -1089,7 +1157,7 @@ fn test_prove_conditional() { None, Some(terminal), None, - 35, + expect!["35"], &None, ); } @@ -1118,7 +1186,7 @@ fn test_prove_conditional2() { None, Some(terminal), None, - 32, + expect!["32"], &None, ); } @@ -1144,7 +1212,7 @@ fn test_prove_fundamental_conditional_bug() { None, Some(terminal), None, - 32, + expect!["32"], &None, ); } @@ -1162,7 +1230,7 @@ fn test_prove_fully_evaluates() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -1185,7 +1253,7 @@ fn test_prove_recursion() { None, Some(terminal), None, - 66, + expect!["66"], &None, ); } @@ -1207,7 +1275,7 @@ fn test_prove_recursion_multiarg() { None, Some(terminal), None, - 69, + expect!["69"], &None, ); } @@ -1232,7 +1300,7 @@ fn test_prove_recursion_optimized() { None, Some(terminal), None, - 56, + expect!["56"], &None, ); } @@ -1256,7 +1324,7 @@ fn test_prove_tail_recursion() { None, Some(terminal), None, - 93, + expect!["93"], &None, ); } @@ -1282,7 +1350,7 @@ fn test_prove_tail_recursion_somewhat_optimized() { None, Some(terminal), None, - 81, &None + expect!["81"], &None ); } @@ -1307,7 +1375,7 @@ fn test_prove_no_mutual_recursion() { None, Some(terminal), None, - 22, + expect!["22"], &None, ); } @@ -1332,7 +1400,7 @@ fn test_prove_no_mutual_recursion_error() { None, Some(error), None, - 25, + expect!["25"], &None, ); } @@ -1350,7 +1418,7 @@ fn test_prove_cons1() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -1359,28 +1427,64 @@ fn test_prove_cons1() { fn test_prove_car_end_is_nil_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(car (1 2) 3)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(car (1 2) 3)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] fn test_prove_cdr_end_is_nil_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(cdr (1 2) 3)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(cdr (1 2) 3)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] fn test_prove_atom_end_is_nil_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(atom 123 4)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(atom 123 4)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] fn test_prove_emit_end_is_nil_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "(emit 123 4)", None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "(emit 123 4)", + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] @@ -1395,7 +1499,7 @@ fn test_prove_cons2() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -1412,7 +1516,7 @@ fn test_prove_zero_arg_lambda1() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1429,7 +1533,7 @@ fn test_prove_zero_arg_lambda2() { None, Some(terminal), None, - 10, + expect!["10"], &None, ); } @@ -1452,7 +1556,7 @@ fn test_prove_zero_arg_lambda3() { None, Some(terminal), None, - 3, + &expect!["3"], DEFAULT_REDUCTION_COUNT, false, None, @@ -1471,7 +1575,7 @@ fn test_prove_zero_arg_lambda4() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -1488,7 +1592,7 @@ fn test_prove_zero_arg_lambda5() { None, Some(error), None, - 1, + expect!["1"], &None, ); } @@ -1505,7 +1609,7 @@ fn test_prove_zero_arg_lambda6() { None, Some(error), None, - 5, + expect!["5"], &None, ); } @@ -1526,7 +1630,7 @@ fn test_prove_nested_let_closure_regression() { None, Some(terminal), None, - 14, + expect!["14"], &None, ); } @@ -1549,7 +1653,7 @@ fn test_prove_minimal_tail_call() { None, Some(terminal), None, - 50, + expect!["50"], &None, ); } @@ -1571,7 +1675,7 @@ fn test_prove_cons_in_function1() { None, Some(terminal), None, - 15, + expect!["15"], &None, ); } @@ -1593,7 +1697,7 @@ fn test_prove_cons_in_function2() { None, Some(terminal), None, - 15, + expect!["15"], &None, ); } @@ -1611,7 +1715,7 @@ fn test_prove_multiarg_eval_bug() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -1635,7 +1739,7 @@ fn test_prove_multiple_letrec_bindings() { None, Some(terminal), None, - 78, + expect!["78"], &None, ); } @@ -1659,7 +1763,7 @@ fn test_prove_tail_call2() { None, Some(terminal), None, - 84, + expect!["84"], &None, ); } @@ -1679,7 +1783,7 @@ fn test_prove_multiple_letrecstar_bindings() { None, Some(terminal), None, - 22, + expect!["22"], &None, ); } @@ -1699,7 +1803,7 @@ fn test_prove_multiple_letrecstar_bindings_referencing() { None, Some(terminal), None, - 31, + expect!["31"], &None, ); } @@ -1730,7 +1834,7 @@ fn test_prove_multiple_letrecstar_bindings_recursive() { None, Some(terminal), None, - 242, + expect!["242"], &None, ); } @@ -1752,7 +1856,7 @@ fn test_prove_dont_discard_rest_env() { None, Some(terminal), None, - 22, + expect!["22"], &None, ); } @@ -1778,7 +1882,7 @@ fn test_prove_fibonacci() { None, Some(terminal), None, - 89, + &expect!["89"], 5, false, None, @@ -1801,7 +1905,7 @@ fn test_one_folding() { None, Some(terminal), None, - 9, + &expect!["9"], 5, // 9 iterations and rc=5 causes one folding to happen and uses the cached witness true, // generate Nova proof and verify it None, @@ -1821,7 +1925,7 @@ fn test_prove_terminal_continuation_regression() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -1842,7 +1946,7 @@ fn test_prove_chained_functional_commitment() { None, Some(terminal), None, - 39, + expect!["39"], &None, ); } @@ -1859,7 +1963,7 @@ fn test_prove_begin_empty() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1877,7 +1981,7 @@ fn test_prove_begin_emit() { None, None, Some(&expected_emitted), - 13, + expect!["13"], &None, ); } @@ -1894,7 +1998,7 @@ fn test_prove_str_car() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1911,7 +2015,7 @@ fn test_prove_str_cdr() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1928,7 +2032,7 @@ fn test_prove_str_car_empty() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1945,7 +2049,7 @@ fn test_prove_str_cdr_empty() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -1962,7 +2066,7 @@ fn test_prove_strcons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -1978,7 +2082,7 @@ fn test_prove_str_cons_error() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -1987,7 +2091,16 @@ fn test_prove_str_cons_error() { fn test_prove_one_arg_cons_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, r#"(cons "")"#, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + r#"(cons "")"#, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); } #[test] @@ -2002,7 +2115,7 @@ fn test_prove_car_nil() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -2019,7 +2132,7 @@ fn test_prove_cdr_nil() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -2028,24 +2141,78 @@ fn test_prove_cdr_nil() { fn test_prove_car_cdr_invalid_tag_error_sym() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, r#"(car car)"#, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, r#"(cdr car)"#, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>( + s, + r#"(car car)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + r#"(cdr car)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] fn test_prove_car_cdr_invalid_tag_error_char() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, r"(car #\a)", None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, r"(cdr #\a)", None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>( + s, + r"(car #\a)", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + r"(cdr #\a)", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] fn test_prove_car_cdr_invalid_tag_error_num() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, r#"(car 42)"#, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, r#"(cdr 42)"#, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>( + s, + r#"(car 42)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + r#"(cdr 42)"#, + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); } #[test] @@ -2061,7 +2228,7 @@ fn test_prove_car_cdr_of_cons() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2071,7 +2238,7 @@ fn test_prove_car_cdr_of_cons() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -2087,7 +2254,7 @@ fn test_prove_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2097,7 +2264,7 @@ fn test_prove_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - 2, + expect!["2"], &None, ); } @@ -2115,7 +2282,7 @@ fn test_prove_hide_open() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -2125,7 +2292,7 @@ fn test_prove_hide_wrong_secret_type() { let s = &Store::::default(); let expr = "(hide 'x 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2141,7 +2308,7 @@ fn test_prove_hide_secret() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -2152,7 +2319,16 @@ fn test_prove_hide_open_sym() { let expr = "(open (hide 123 'x))"; let x = s.intern_user_symbol("x"); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(x), None, Some(terminal), None, 5, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(x), + None, + Some(terminal), + None, + expect!["5"], + &None, + ); } #[test] @@ -2161,7 +2337,16 @@ fn test_prove_commit_open_sym() { let expr = "(open (commit 'x))"; let x = s.intern_user_symbol("x"); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(x), None, Some(terminal), None, 4, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(x), + None, + Some(terminal), + None, + expect!["4"], + &None, + ); } #[test] @@ -2177,7 +2362,7 @@ fn test_prove_commit_open() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -2187,7 +2372,7 @@ fn test_prove_commit_error() { let s = &Store::::default(); let expr = "(commit 123 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -2195,7 +2380,7 @@ fn test_prove_open_error() { let s = &Store::::default(); let expr = "(open 123 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -2203,7 +2388,7 @@ fn test_prove_open_wrong_type() { let s = &Store::::default(); let expr = "(open 'asdf)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2211,7 +2396,7 @@ fn test_prove_secret_wrong_type() { let s = &Store::::default(); let expr = "(secret 'asdf)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2227,7 +2412,7 @@ fn test_prove_commit_secret() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -2245,7 +2430,7 @@ fn test_prove_num() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -2263,7 +2448,7 @@ fn test_prove_num_char() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -2281,7 +2466,7 @@ fn test_prove_char_num() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); } @@ -2301,7 +2486,7 @@ fn test_prove_char_coercion() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2311,7 +2496,7 @@ fn test_prove_char_coercion() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -2321,7 +2506,16 @@ fn test_prove_commit_num() { let s = &Store::::default(); let expr = "(num (commit 123))"; let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(terminal), None, 4, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["4"], + &None, + ); } #[test] @@ -2337,7 +2531,7 @@ fn test_prove_hide_open_comm_num() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -2355,7 +2549,7 @@ fn test_prove_hide_secret_comm_num() { None, Some(terminal), None, - 9, + expect!["9"], &None, ); } @@ -2373,7 +2567,7 @@ fn test_prove_commit_open_comm_num() { None, Some(terminal), None, - 8, + expect!["8"], &None, ); } @@ -2391,7 +2585,7 @@ fn test_prove_commit_secret_comm_num() { None, Some(terminal), None, - 8, + expect!["8"], &None, ); } @@ -2409,7 +2603,7 @@ fn test_prove_commit_num_open() { None, Some(terminal), None, - 6, + expect!["6"], &None, ); } @@ -2421,9 +2615,9 @@ fn test_prove_num_invalid_tag() { let expr1 = "(num \"asdf\")"; let expr2 = "(num '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2433,9 +2627,9 @@ fn test_prove_comm_invalid_tag() { let expr1 = "(comm \"asdf\")"; let expr2 = "(comm '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2445,9 +2639,9 @@ fn test_prove_char_invalid_tag() { let expr1 = "(char \"asdf\")"; let expr2 = "(char '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); } #[test] @@ -2456,7 +2650,16 @@ fn test_prove_terminal_sym() { let expr = "(quote x)"; let x = s.intern_user_symbol("x"); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(x), None, Some(terminal), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(x), + None, + Some(terminal), + None, + expect!["1"], + &None, + ); } #[test] @@ -2464,7 +2667,7 @@ fn test_prove_terminal_sym() { fn test_prove_open_opaque_commit() { let s = &Store::::default(); let expr = "(open 123)"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); } #[test] @@ -2472,7 +2675,7 @@ fn test_prove_open_opaque_commit() { fn test_prove_secret_invalid_tag() { let s = &Store::::default(); let expr = "(secret 123)"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); } #[test] @@ -2480,7 +2683,7 @@ fn test_prove_secret_invalid_tag() { fn test_prove_secret_opaque_commit() { let s = &Store::::default(); let expr = "(secret (comm 123))"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, 2, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); } #[test] @@ -2502,7 +2705,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2512,7 +2715,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2522,7 +2725,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2532,7 +2735,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2542,7 +2745,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); @@ -2553,7 +2756,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - 3, + expect!["3"], &None, ); @@ -2564,7 +2767,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); @@ -2575,7 +2778,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); @@ -2586,7 +2789,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -2607,7 +2810,7 @@ fn relational_aux(s: &Store, op: &str, a: &str, b: &str, res: bool) { None, Some(terminal), None, - 3, + expect!["3"], &None, ); } @@ -2737,7 +2940,16 @@ fn test_relational_edge_case_identity() { let t = s.intern_lurk_symbol("t"); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(t), None, Some(terminal), None, 19, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["19"], + &None, + ); } #[test] @@ -2749,8 +2961,26 @@ fn test_prove_test_eval() { let res2 = s.num_u64(20); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 17, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 9, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["17"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["9"], + &None, + ); } #[test] @@ -2766,9 +2996,36 @@ fn test_prove_test_keyword() { let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 1, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, Some(res3), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["1"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + Some(res3), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } // The following functional commitment tests were discovered to fail. They are commented out (as tests) for now so @@ -2784,7 +3041,16 @@ fn test_prove_functional_commitment() { let res = s.num_u64(10); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 25, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["25"], + &None, + ); } #[test] @@ -2805,7 +3071,16 @@ fn test_prove_complicated_functional_commitment() { let res = s.num_u64(6); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 108, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["108"], + &None, + ); } #[test] @@ -2819,7 +3094,16 @@ fn test_prove_test_fold_cons_regression() { let res = s.num_u64(6); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 152, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["152"], + &None, + ); } #[test] @@ -2829,7 +3113,16 @@ fn test_prove_test_lambda_args_regression() { let expr = "(cons (lambda (x y) nil) nil)"; let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -2839,7 +3132,7 @@ fn test_prove_reduce_sym_contradiction_regression() { let expr = "(eval 'a '(nil))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 4, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["4"], &None); } #[test] @@ -2854,8 +3147,17 @@ fn test_prove_test_self_eval_env_not_nil() { let expr = "(let ((a 1)) t)"; let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(terminal), None, 3, &None); -} + test_aux::<_, _, M1<'_, _>>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["3"], + &None, + ); +} #[test] fn test_prove_test_self_eval_nil() { @@ -2865,7 +3167,16 @@ fn test_prove_test_self_eval_nil() { let expr = "nil"; let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(terminal), None, 1, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + None, + None, + Some(terminal), + None, + expect!["1"], + &None, + ); } #[test] @@ -2875,7 +3186,7 @@ fn test_prove_test_env_not_nil_and_binding_nil() { let expr = "(let ((a 1) (b 2)) c)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 7, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["7"], &None); } #[test] @@ -2884,7 +3195,7 @@ fn test_prove_test_eval_bad_form() { let expr = "(* 5 (eval '(+ 1 a) '((0 . 3))))"; // two-arg eval, optional second arg is env. This tests for error on malformed env. let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 8, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["8"], &None); } #[test] @@ -2899,10 +3210,46 @@ fn test_prove_test_u64_mul() { let res2 = s.u64(1); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 7, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, Some(res), None, Some(terminal), None, 6, &None); - test_aux::<_, _, M1<'_, _>>(s, expr4, Some(res2), None, Some(terminal), None, 2, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["7"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + Some(res), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr4, + Some(res2), + None, + Some(terminal), + None, + expect!["2"], + &None, + ); } #[test] @@ -2914,8 +3261,26 @@ fn test_prove_test_u64_add() { let res = s.u64(1); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res), None, Some(terminal), None, 6, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } #[test] @@ -2930,9 +3295,36 @@ fn test_prove_test_u64_sub() { let res3 = s.u64(0); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, Some(res3), None, Some(terminal), None, 6, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + Some(res3), + None, + Some(terminal), + None, + expect!["6"], + &None, + ); } #[test] @@ -2950,9 +3342,27 @@ fn test_prove_test_u64_div() { let terminal = s.cont_terminal(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2970,9 +3380,27 @@ fn test_prove_test_u64_mod() { let terminal = s.cont_terminal(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2985,9 +3413,9 @@ fn test_prove_test_num_mod() { let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3011,18 +3439,108 @@ fn test_prove_test_u64_comp() { let nil = s.intern_nil(); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(t), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, Some(t), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr4, Some(nil), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr4, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::<_, _, M1<'_, _>>(s, expr5, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr6, Some(t), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr7, Some(nil), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr8, Some(t), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr5, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr6, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr7, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr8, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); - test_aux::<_, _, M1<'_, _>>(s, expr9, Some(t), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr10, Some(t), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr9, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr10, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -3038,10 +3556,46 @@ fn test_prove_test_u64_conversion() { let res3 = s.u64(2); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res), None, Some(terminal), None, 2, &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, Some(res2), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr4, Some(res3), None, Some(terminal), None, 5, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res), + None, + Some(terminal), + None, + expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr4, + Some(res3), + None, + Some(terminal), + None, + expect!["5"], + &None, + ); } #[test] @@ -3054,8 +3608,26 @@ fn test_prove_test_u64_num_comparison() { let nil = s.intern_nil(); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(t), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(nil), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(t), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(nil), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -3068,8 +3640,26 @@ fn test_prove_test_u64_num_cons() { let res2 = s.read_with_default_state("(1u64 . 1)").unwrap(); let terminal = s.cont_terminal(); - test_aux::<_, _, M1<'_, _>>(s, expr, Some(res), None, Some(terminal), None, 3, &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, Some(res2), None, Some(terminal), None, 3, &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr, + Some(res), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + Some(res2), + None, + Some(terminal), + None, + expect!["3"], + &None, + ); } #[test] @@ -3079,7 +3669,7 @@ fn test_prove_test_hide_u64_secret() { let expr = "(hide 0u64 123)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3089,7 +3679,7 @@ fn test_prove_test_mod_by_zero_error() { let expr = "(% 0 0)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3098,7 +3688,7 @@ fn test_prove_dotted_syntax_error() { let expr = "(let ((a (lambda (x) (+ x 1)))) (a . 1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, 3, &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3121,7 +3711,7 @@ fn test_prove_call_literal_fun() { None, Some(terminal), None, - 7, + &expect!["7"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3134,7 +3724,16 @@ fn test_prove_lambda_body_syntax() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, "((lambda ()))", None, None, Some(error), None, 2, &None); + test_aux::<_, _, M1<'_, _>>( + s, + "((lambda ()))", + None, + None, + Some(error), + None, + expect!["2"], + &None, + ); test_aux::<_, _, M1<'_, _>>( s, "((lambda () 1 2))", @@ -3142,7 +3741,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - 2, + expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3152,7 +3751,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - 3, + expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3162,7 +3761,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - 3, + expect!["3"], &None, ); } @@ -3178,9 +3777,27 @@ fn test_prove_non_symbol_binding_error() { let expr2 = format!("(letrec (({x} 123)) {x})"); let expr3 = format!("(lambda ({x}) {x})"); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); - test_aux::<_, _, M1<'_, _>>(s, &expr2, None, None, Some(error), None, 1, &None); - test_aux::<_, _, M1<'_, _>>(s, &expr3, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr2, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + &expr3, + None, + None, + Some(error), + None, + expect!["1"], + &None, + ); }; test(":a"); @@ -3206,37 +3823,37 @@ fn test_prove_head_with_sym_mimicking_value() { { // binop let expr = format!("({} 1 1)", hash_num(s, state.clone(), "+")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // unop let expr = format!("({} '(1 . 2))", hash_num(s, state.clone(), "car")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // let_or_letrec let expr = format!("({} ((a 1)) a)", hash_num(s, state.clone(), "let")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // current-env let expr = format!("({})", hash_num(s, state.clone(), "current-env")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // lambda let expr = format!("({} (x) 123)", hash_num(s, state.clone(), "lambda")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // quote let expr = format!("({} asdf)", hash_num(s, state.clone(), "quote")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } { // if let expr = format!("({} t 123 456)", hash_num(s, state, "if")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, 1, &None); + test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); } } @@ -3288,7 +3905,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 3, + expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3298,7 +3915,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 6, + expect!["6"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3308,7 +3925,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - 9, + expect!["9"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3318,7 +3935,7 @@ fn test_dumb_lang() { None, Some(error), None, - 4, + expect!["4"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3328,7 +3945,7 @@ fn test_dumb_lang() { None, Some(error), None, - 2, + expect!["2"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3338,7 +3955,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3348,7 +3965,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3358,7 +3975,7 @@ fn test_dumb_lang() { None, Some(error), None, - 3, + expect!["3"], &Some(lang), ); } @@ -3386,7 +4003,7 @@ fn test_terminator_lang() { None, Some(terminal), None, - 1, + expect!["1"], &Some(lang.into()), ); } @@ -3420,7 +4037,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 4, + &expect!["4"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3438,7 +4055,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 3, + &expect!["3"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3460,7 +4077,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 4, + &expect!["4"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3478,7 +4095,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 3, + &expect!["3"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3499,7 +4116,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 9, + &expect!["9"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3518,7 +4135,7 @@ fn test_trie_lang() { None, Some(terminal), None, - 13, + &expect!["13"], DEFAULT_REDUCTION_COUNT, false, None, @@ -3539,7 +4156,7 @@ fn test_prove_lambda_body_nil() { None, Some(terminal), None, - 4, + expect!["4"], &None, ); } @@ -3557,7 +4174,7 @@ fn test_letrec_let_nesting() { None, Some(terminal), None, - 6, + expect!["6"], &None, ); } @@ -3573,7 +4190,7 @@ fn test_let_sequencing() { None, Some(terminal), None, - 5, + expect!["5"], &None, ); } @@ -3589,7 +4206,7 @@ fn test_letrec_sequencing() { None, Some(terminal), None, - 8, + expect!["8"], &None, ); } From abe8594d47684089f972286395fbefbe05208142 Mon Sep 17 00:00:00 2001 From: Arthur Paulino Date: Tue, 19 Dec 2023 11:45:20 -0300 Subject: [PATCH 3/3] clippy --- src/lem/tests/eval_tests.rs | 625 ++++++++++++++++++----------- src/proof/tests/mod.rs | 6 +- src/proof/tests/nova_tests_lem.rs | 640 +++++++++++++++++++----------- 3 files changed, 802 insertions(+), 469 deletions(-) diff --git a/src/lem/tests/eval_tests.rs b/src/lem/tests/eval_tests.rs index df979eb5f3..08dc69b224 100644 --- a/src/lem/tests/eval_tests.rs +++ b/src/lem/tests/eval_tests.rs @@ -22,7 +22,7 @@ fn test_aux>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: Expect, + expected_iterations: &Expect, lang: &Option<&Lang>, ) { let ptr = s.read_with_default_state(expr).unwrap(); @@ -46,7 +46,7 @@ fn test_aux_with_state>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: Expect, + expected_iterations: &Expect, lang: &Option<&Lang>, ) { let ptr = s.read(state, expr).unwrap(); @@ -70,7 +70,7 @@ fn do_test_aux>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: Expect, + expected_iterations: &Expect, lang: &Option<&Lang>, ) { if let Some(lang) = lang { @@ -106,7 +106,7 @@ fn do_test>( expected_env: Option, expected_cont: Option, expected_emitted: Option>, - expected_iterations: Expect, + expected_iterations: &Expect, lang: &Lang, ) { let limit = 100000; @@ -179,11 +179,11 @@ fn self_evaluating() { ] .into_iter() .for_each(|(expr, expt)| { - test_aux::>(s, expr, Some(expt), None, None, None, expect!["1"], &None); + test_aux::>(s, expr, Some(expt), None, None, None, &expect!["1"], &None); }); let fun = s.intern_fun(s.intern_user_symbol("x"), s.list(vec![expt_nil]), expt_nil); - do_test_aux::>(s, &fun, Some(fun), None, None, None, expect!["1"], &None); + do_test_aux::>(s, &fun, Some(fun), None, None, None, &expect!["1"], &None); } #[test] @@ -202,7 +202,7 @@ fn evaluate_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -221,7 +221,7 @@ fn emit_output() { None, Some(terminal), Some(emitted), - expect!["3"], + &expect!["3"], &None, ); } @@ -240,7 +240,7 @@ fn evaluate_lambda() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -259,7 +259,7 @@ fn evaluate_empty_args_lambda() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -278,7 +278,7 @@ fn evaluate_lambda2() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -297,7 +297,7 @@ fn evaluate_lambda3() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -318,7 +318,7 @@ fn evaluate_lambda4() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -339,7 +339,7 @@ fn evaluate_lambda5() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -358,7 +358,7 @@ fn evaluate_sum() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -377,7 +377,7 @@ fn evaluate_diff() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -396,7 +396,7 @@ fn evaluate_product() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -415,7 +415,7 @@ fn evaluate_quotient() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -426,7 +426,7 @@ fn evaluate_quotient_divide_by_zero() { let expr = "(/ 21 0)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -445,7 +445,7 @@ fn evaluate_num_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -461,7 +461,7 @@ fn evaluate_num_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -481,7 +481,7 @@ fn evaluate_adder1() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -502,7 +502,7 @@ fn evaluate_adder2() { None, Some(terminal), None, - expect!["15"], + &expect!["15"], &None, ); } @@ -521,7 +521,7 @@ fn evaluate_let_simple() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -540,7 +540,7 @@ fn evaluate_empty_let_bug() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -561,7 +561,7 @@ fn evaluate_let() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -572,7 +572,7 @@ fn evaluate_let_empty_error() { let expr = "(let)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -581,7 +581,7 @@ fn evaluate_let_empty_body_error() { let expr = "(let ((a 1)))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -590,7 +590,7 @@ fn evaluate_letrec_empty_error() { let expr = "(letrec)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -599,7 +599,7 @@ fn evaluate_letrec_empty_body_error() { let expr = "(letrec ((a 1)))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -616,7 +616,7 @@ fn evaluate_letrec_body_nil() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -635,7 +635,7 @@ fn evaluate_let_parallel_binding() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -658,7 +658,7 @@ fn evaluate_arithmetic_let() { Some(new_env), Some(terminal), None, - expect!["18"], + &expect!["18"], &None, ); } @@ -689,7 +689,7 @@ fn evaluate_fundamental_conditional() { None, Some(terminal), None, - expect!["35"], + &expect!["35"], &None, ); } @@ -716,7 +716,7 @@ fn evaluate_fundamental_conditional() { None, Some(terminal), None, - expect!["32"], + &expect!["32"], &None, ); } @@ -737,7 +737,7 @@ fn evaluate_if() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -754,7 +754,7 @@ fn evaluate_if() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -775,7 +775,7 @@ fn evaluate_fully_evaluates() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -800,7 +800,7 @@ fn evaluate_recursion1() { None, Some(terminal), None, - expect!["91"], + &expect!["91"], &None, ); } @@ -825,7 +825,7 @@ fn evaluate_recursion2() { None, Some(terminal), None, - expect!["201"], + &expect!["201"], &None, ); } @@ -848,7 +848,7 @@ fn evaluate_recursion_multiarg() { None, Some(terminal), None, - expect!["95"], + &expect!["95"], &None, ); } @@ -874,7 +874,7 @@ fn evaluate_recursion_optimized() { None, Some(terminal), None, - expect!["75"], + &expect!["75"], &None, ); } @@ -899,7 +899,7 @@ fn evaluate_tail_recursion() { None, Some(terminal), None, - expect!["129"], + &expect!["129"], &None, ); } @@ -927,7 +927,7 @@ fn evaluate_tail_recursion_somewhat_optimized() { None, Some(terminal), None, - expect!["110"], + &expect!["110"], &None, ); } @@ -948,7 +948,7 @@ fn evaluate_multiple_letrec_bindings() { None, Some(terminal), None, - expect!["22"], + &expect!["22"], &None, ); } @@ -969,7 +969,7 @@ fn evaluate_multiple_letrec_bindings_referencing() { None, Some(terminal), None, - expect!["31"], + &expect!["31"], &None, ); } @@ -1001,7 +1001,7 @@ fn evaluate_multiple_letrec_bindings_recursive() { None, Some(terminal), None, - expect!["242"], + &expect!["242"], &None, ); } @@ -1025,7 +1025,7 @@ fn nested_let_closure_regression() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -1042,7 +1042,7 @@ fn nested_let_closure_regression() { None, Some(terminal), None, - expect!["14"], + &expect!["14"], &None, ); } @@ -1063,7 +1063,7 @@ fn evaluate_eq() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1080,7 +1080,7 @@ fn evaluate_eq() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1097,7 +1097,7 @@ fn evaluate_eq() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1115,7 +1115,7 @@ fn evaluate_eq() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1136,7 +1136,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1158,7 +1158,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1173,7 +1173,7 @@ fn evaluate_zero_arg_lambda() { None, Some(terminal), None, - expect!["12"], + &expect!["12"], &None, ); } @@ -1186,14 +1186,14 @@ fn evaluate_zero_arg_lambda_variants() { let expr = "((lambda () 123) 1)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } { let s = &Store::::default(); let expr = "(123)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } } @@ -1236,7 +1236,7 @@ fn evaluate_make_tree() { None, Some(terminal), None, - expect!["493"], + &expect!["493"], &None, ); } @@ -1282,7 +1282,7 @@ fn evaluate_map_tree_bug() { None, Some(terminal), None, - expect!["170"], + &expect!["170"], &None, ); } @@ -1309,7 +1309,7 @@ fn evaluate_map_tree_numequal_bug() { None, Some(error), None, - expect!["169"], + &expect!["169"], &None, ); } @@ -1344,7 +1344,7 @@ fn env_lost_bug() { None, Some(terminal), None, - expect!["25"], + &expect!["25"], &None, ); } @@ -1369,7 +1369,7 @@ fn dont_discard_rest_env() { None, Some(terminal), None, - expect!["22"], + &expect!["22"], &None, ); } @@ -1395,7 +1395,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1405,7 +1405,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1415,7 +1415,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1425,7 +1425,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1435,7 +1435,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -1445,7 +1445,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -1455,7 +1455,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -1465,7 +1465,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -1475,7 +1475,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -1485,7 +1485,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1501,7 +1501,7 @@ fn test_one_arg_cons_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1518,7 +1518,7 @@ fn test_car_nil() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1535,7 +1535,7 @@ fn test_cdr_nil() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1551,7 +1551,7 @@ fn test_car_cdr_invalid_tag_error_sym() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1561,7 +1561,7 @@ fn test_car_cdr_invalid_tag_error_sym() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1577,7 +1577,7 @@ fn test_car_cdr_invalid_tag_error_char() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1587,7 +1587,7 @@ fn test_car_cdr_invalid_tag_error_char() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1603,7 +1603,7 @@ fn test_car_cdr_invalid_tag_error_num() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1613,7 +1613,7 @@ fn test_car_cdr_invalid_tag_error_num() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1629,7 +1629,7 @@ fn test_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -1639,7 +1639,7 @@ fn test_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1675,7 +1675,7 @@ fn go_translate() { None, None, None, - expect!["1114"], + &expect!["1114"], &None, ); } @@ -1693,7 +1693,7 @@ fn begin_current_env() { None, None, None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1712,7 +1712,7 @@ fn begin() { None, None, None, - expect!["6"], + &expect!["6"], &None, ); } @@ -1735,7 +1735,7 @@ fn begin_current_env1() { None, None, None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1746,7 +1746,7 @@ fn hide_open() { let s = &Store::::default(); let expr = "(open (hide 123 'x))"; let x = s.intern_user_symbol("x"); - test_aux::>(s, expr, Some(x), None, None, None, expect!["5"], &None); + test_aux::>(s, expr, Some(x), None, None, None, &expect!["5"], &None); } #[test] @@ -1764,21 +1764,21 @@ fn hide_opaque_open_available() { { let expr = s.list(vec![open, comm]); - do_test::>(s, &expr, Some(x), None, None, None, expect!["2"], &lang); + do_test::>(s, &expr, Some(x), None, None, None, &expect!["2"], &lang); } { let secret = s.intern_lurk_symbol("secret"); let expr = s.list(vec![secret, comm]); let sec = s.num_u64(123); - do_test::>(s, &expr, Some(sec), None, None, None, expect!["2"], &lang); + do_test::>(s, &expr, Some(sec), None, None, None, &expect!["2"], &lang); } { // We can open a commitment identified by its corresponding `Num`. let comm_num = s.num(c); let expr2 = s.list(vec![open, comm_num]); - do_test::>(s, &expr2, Some(x), None, None, None, expect!["2"], &lang); + do_test::>(s, &expr2, Some(x), None, None, None, &expect!["2"], &lang); } } @@ -1799,7 +1799,7 @@ fn hide_opaque_open_unavailable() { let expr = s2.list(vec![open, comm]); let lang = Lang::new(); - do_test::>(s2, &expr, Some(x), None, None, None, expect!["2"], &lang); + do_test::>(s2, &expr, Some(x), None, None, None, &expect!["2"], &lang); } #[test] @@ -1807,7 +1807,7 @@ fn commit_open_sym() { let s = &Store::::default(); let expr = "(open (commit 'x))"; let x = s.intern_user_symbol("x"); - test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); + test_aux::>(s, expr, Some(x), None, None, None, &expect!["4"], &None); } #[test] @@ -1819,7 +1819,7 @@ fn commitment_value() { "0x2937881eff06c2bcc2c8c1fa0818ae3733c759376f76fc10b7439269e9aaa9bc", ) .unwrap(); - test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); + test_aux::>(s, expr, Some(x), None, None, None, &expect!["4"], &None); } #[test] @@ -1832,10 +1832,10 @@ fn commit_nil() { .unwrap(); let expr = "(num (commit nil))"; - test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); + test_aux::>(s, expr, Some(x), None, None, None, &expect!["4"], &None); let expr = "(num (commit '.lurk.nil))"; - test_aux::>(s, expr, Some(x), None, None, None, expect!["4"], &None); + test_aux::>(s, expr, Some(x), None, None, None, &expect!["4"], &None); } #[test] @@ -1843,7 +1843,7 @@ fn commit_error() { let s = &Store::::default(); let expr = "(commit 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1851,7 +1851,7 @@ fn open_error() { let s = &Store::::default(); let expr = "(open 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1859,7 +1859,7 @@ fn secret_error() { let s = &Store::::default(); let expr = "(secret 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1867,7 +1867,7 @@ fn num_error() { let s = &Store::::default(); let expr = "(num 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1875,7 +1875,7 @@ fn comm_error() { let s = &Store::::default(); let expr = "(comm 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1883,7 +1883,7 @@ fn char_error() { let s = &Store::::default(); let expr = "(char 123 456)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -1899,7 +1899,7 @@ fn prove_commit_secret() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -1917,7 +1917,7 @@ fn num() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1935,7 +1935,7 @@ fn num_char() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1953,7 +1953,7 @@ fn char_num() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1971,7 +1971,7 @@ fn char_coercion() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1988,7 +1988,7 @@ fn commit_num() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -2006,7 +2006,7 @@ fn hide_open_comm_num() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -2024,7 +2024,7 @@ fn hide_secret_comm_num() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -2042,7 +2042,7 @@ fn commit_open_comm_num() { None, Some(terminal), None, - expect!["8"], + &expect!["8"], &None, ); } @@ -2060,7 +2060,7 @@ fn commit_secret_comm_num() { None, Some(terminal), None, - expect!["8"], + &expect!["8"], &None, ); } @@ -2078,7 +2078,7 @@ fn commit_num_open() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2090,9 +2090,27 @@ fn num_invalid_tag() { let expr1 = "(num \"asdf\")"; let expr2 = "(num '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2102,9 +2120,27 @@ fn comm_invalid_tag() { let expr1 = "(comm \"asdf\")"; let expr2 = "(comm '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2114,9 +2150,27 @@ fn char_invalid_tag() { let expr1 = "(char \"asdf\")"; let expr2 = "(char '(1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2132,7 +2186,7 @@ fn terminal_sym() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -2142,7 +2196,7 @@ fn terminal_sym() { fn open_opaque_commit() { let s = &Store::::default(); let expr = "(open 123)"; - test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::>(s, expr, None, None, None, None, &expect!["2"], &None); } #[test] @@ -2150,7 +2204,7 @@ fn open_wrong_type() { let s = &Store::::default(); let expr = "(open 'asdf)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["2"], &None); } #[test] @@ -2158,7 +2212,7 @@ fn secret_wrong_type() { let s = &Store::::default(); let expr = "(secret 'asdf)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["2"], &None); } #[test] @@ -2166,7 +2220,7 @@ fn secret_wrong_type() { fn secret_invalid_tag() { let s = &Store::::default(); let expr = "(secret 123)"; - test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::>(s, expr, None, None, None, None, &expect!["2"], &None); } #[test] @@ -2174,7 +2228,7 @@ fn secret_invalid_tag() { fn secret_opaque_commit() { let s = &Store::::default(); let expr = "(secret (comm 123))"; - test_aux::>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::>(s, expr, None, None, None, None, &expect!["2"], &None); } #[allow(dead_code)] @@ -2194,7 +2248,7 @@ fn relational_aux(s: &Store, op: &str, a: &str, b: &str, res: bool) { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2335,7 +2389,7 @@ fn test_relational_edge_case_identity() { None, Some(terminal), None, - expect!["19"], + &expect!["19"], &None, ); } @@ -2354,7 +2408,7 @@ fn test_relational_edge_case_identity() { None, Some(terminal), None, - expect!["24"], + &expect!["24"], &None, ); } @@ -2378,7 +2432,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -2393,7 +2447,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2408,7 +2462,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2423,7 +2477,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2438,7 +2492,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2457,7 +2511,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2474,7 +2528,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2489,7 +2543,7 @@ fn test_num_syntax_implications() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2511,7 +2565,7 @@ fn test_quoted_symbols() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -2532,7 +2586,7 @@ fn test_eval() { None, Some(terminal), None, - expect!["17"], + &expect!["17"], &None, ); test_aux::>( @@ -2542,7 +2596,7 @@ fn test_eval() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -2556,7 +2610,7 @@ fn test_eval_env_regression() { let error = s.cont_error(); let terminal = s.cont_terminal(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["5"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["5"], &None); test_aux::>( s, expr2, @@ -2564,7 +2618,7 @@ fn test_eval_env_regression() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2586,7 +2640,7 @@ fn test_u64_mul() { None, Some(terminal), None, - expect!["7"], + &expect!["7"], &None, ); test_aux::>( @@ -2596,7 +2650,7 @@ fn test_u64_mul() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2606,7 +2660,7 @@ fn test_u64_mul() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2627,7 +2681,7 @@ fn test_u64_add() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2637,7 +2691,7 @@ fn test_u64_add() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2661,7 +2715,7 @@ fn test_u64_sub() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2671,7 +2725,7 @@ fn test_u64_sub() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2681,7 +2735,7 @@ fn test_u64_sub() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2708,7 +2762,7 @@ fn test_u64_div() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2718,10 +2772,19 @@ fn test_u64_div() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], &None, ); - test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2746,7 +2809,7 @@ fn test_u64_mod() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2756,10 +2819,19 @@ fn test_u64_mod() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], &None, ); - test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -2772,9 +2844,27 @@ fn test_num_mod() { let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); - test_aux::>(s, expr2, None, None, Some(error), None, expect!["3"], &None); - test_aux::>(s, expr3, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); + test_aux::>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["3"], + &None, + ); + test_aux::>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], + &None, + ); } #[test] @@ -2808,7 +2898,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2818,7 +2908,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2828,7 +2918,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2838,7 +2928,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2849,7 +2939,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2859,7 +2949,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2869,7 +2959,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2879,7 +2969,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2890,7 +2980,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2900,7 +2990,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2911,7 +3001,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2921,7 +3011,7 @@ fn test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2952,7 +3042,7 @@ fn test_u64_conversion() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -2962,7 +3052,7 @@ fn test_u64_conversion() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -2972,7 +3062,7 @@ fn test_u64_conversion() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2983,7 +3073,7 @@ fn test_u64_conversion() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); test_aux::>( @@ -2993,11 +3083,29 @@ fn test_u64_conversion() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], + &None, + ); + test_aux::>( + s, + expr6, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); + test_aux::>( + s, + expr7, + None, + None, + Some(error), + None, + &expect!["1"], &None, ); - test_aux::>(s, expr6, None, None, Some(error), None, expect!["1"], &None); - test_aux::>(s, expr7, None, None, Some(error), None, expect!["1"], &None); } #[test] @@ -3009,8 +3117,17 @@ fn test_numeric_type_error() { let expr = &format!("({op} 0 'a)"); let expr2 = &format!("({op} 0u64 'a)"); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); - test_aux::>(s, expr2, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); + test_aux::>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["3"], + &None, + ); }; test("+"); @@ -3042,7 +3159,7 @@ fn test_u64_num_comparison() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -3052,7 +3169,7 @@ fn test_u64_num_comparison() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3074,7 +3191,7 @@ fn test_u64_num_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -3084,7 +3201,7 @@ fn test_u64_num_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3096,7 +3213,7 @@ fn test_hide_u64_secret() { let expr = "(hide 0u64 123)"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -3119,7 +3236,7 @@ fn test_keyword() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::>( @@ -3129,7 +3246,7 @@ fn test_keyword() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -3139,7 +3256,7 @@ fn test_keyword() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3221,7 +3338,7 @@ fn test_fold_cons_regression() { None, Some(terminal), None, - expect!["152"], + &expect!["152"], &None, ); } @@ -3240,7 +3357,7 @@ fn test_lambda_args_regression() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3251,7 +3368,7 @@ fn test_eval_bad_form() { let expr = "(* 5 (eval '(+ 1 a) '((0 . 3))))"; // two-arg eval, optional second arg is env. let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["8"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["8"], &None); } #[test] @@ -3259,7 +3376,16 @@ fn test_eval_quote_error() { let s = &Store::::default(); let error = s.cont_error(); - test_aux::>(s, "(1)", None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + "(1)", + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); test_aux::>( s, "(quote . 1)", @@ -3267,7 +3393,7 @@ fn test_eval_quote_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::>( @@ -3277,7 +3403,7 @@ fn test_eval_quote_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::>( @@ -3287,7 +3413,7 @@ fn test_eval_quote_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -3298,7 +3424,7 @@ fn test_eval_dotted_syntax_error() { let expr = "(let ((a (lambda (x) (+ x 1)))) (a . 1))"; let error = s.cont_error(); - test_aux::>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[allow(dead_code)] @@ -3311,32 +3437,68 @@ fn op_syntax_error() { { let expr = format!("({name} . 1)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } if !op.supports_arity(0) { let expr = format!("({name})"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } if !op.supports_arity(1) { let expr = format!("({name} 123)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } if !op.supports_arity(2) { let expr = format!("({name} 123 456)"); tracing::debug!("{}", &expr); - test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } if !op.supports_arity(3) { let expr = format!("({name} 123 456 789)"); tracing::debug!("{}", &expr); let iterations = if op.supports_arity(2) { - expect!["2"] + &expect!["2"] } else { - expect!["1"] + &expect!["1"] }; test_aux::>(s, &expr, None, None, Some(error), None, iterations, &None); } @@ -3369,7 +3531,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -3379,7 +3541,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::>( @@ -3389,7 +3551,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::>( @@ -3399,7 +3561,7 @@ fn test_eval_lambda_body_syntax() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3414,7 +3576,16 @@ fn test_eval_non_symbol_binding_error() { let expr2 = format!("(letrec (({x} 123)) {x})"); let expr3 = format!("(lambda ({x}) {x})"); - test_aux::>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); test_aux::>( s, &expr2, @@ -3422,7 +3593,7 @@ fn test_eval_non_symbol_binding_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::>( @@ -3432,7 +3603,7 @@ fn test_eval_non_symbol_binding_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); }; @@ -3490,7 +3661,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &Some(&lang), ); test_aux( @@ -3500,7 +3671,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &Some(&lang), ); test_aux( @@ -3510,7 +3681,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &Some(&lang), ); test_aux( @@ -3520,7 +3691,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["4"], + &expect!["4"], &Some(&lang), ); test_aux( @@ -3530,7 +3701,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["2"], + &expect!["2"], &Some(&lang), ); test_aux( @@ -3540,7 +3711,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(&lang), ); test_aux( @@ -3550,7 +3721,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(&lang), ); test_aux( @@ -3560,7 +3731,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(&lang), ); } @@ -3591,7 +3762,7 @@ fn test_trie_lang() { None, None, None, - expect!["4"], + &expect!["4"], &Some(&lang), ); @@ -3607,7 +3778,7 @@ fn test_trie_lang() { None, None, None, - expect!["3"], + &expect!["3"], &Some(&lang), ); @@ -3627,7 +3798,7 @@ fn test_trie_lang() { None, None, None, - expect!["4"], + &expect!["4"], &Some(&lang), ); @@ -3643,7 +3814,7 @@ fn test_trie_lang() { None, None, None, - expect!["3"], + &expect!["3"], &Some(&lang), ); @@ -3661,7 +3832,7 @@ fn test_trie_lang() { None, None, None, - expect!["9"], + &expect!["9"], &Some(&lang), ); @@ -3678,7 +3849,7 @@ fn test_trie_lang() { None, None, None, - expect!["13"], + &expect!["13"], &Some(&lang), ); } @@ -3706,7 +3877,7 @@ fn test_terminator_lang() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &Some(&lang), ); } diff --git a/src/proof/tests/mod.rs b/src/proof/tests/mod.rs index 0b0858b99d..e9ea32fbad 100644 --- a/src/proof/tests/mod.rs +++ b/src/proof/tests/mod.rs @@ -43,7 +43,7 @@ fn test_aux<'a, F: CurveCycleEquipped, C: Coprocessor, M: MultiFrameTrait<'a, expected_env: Option, expected_cont: Option, expected_emitted: Option<&[M::Ptr]>, - expected_iterations: Expect, + expected_iterations: &Expect, lang: &Option>>, ) // technical bounds that would disappear once associated_type_bounds stabilizes @@ -59,7 +59,7 @@ where expected_env, expected_cont, expected_emitted, - &expected_iterations, + expected_iterations, chunk_size, false, None, @@ -96,7 +96,7 @@ where expected_env, expected_cont, expected_emitted, - &expected_iterations, + expected_iterations, reduction_count, check_nova, limit, diff --git a/src/proof/tests/nova_tests_lem.rs b/src/proof/tests/nova_tests_lem.rs index 2ff4c780b2..cd07e17df2 100644 --- a/src/proof/tests/nova_tests_lem.rs +++ b/src/proof/tests/nova_tests_lem.rs @@ -51,7 +51,7 @@ fn test_prove_self_evaluating() { ] .into_iter() .for_each(|(expr, expt)| { - test_aux::<_, _, M1<'_, _>>(s, expr, Some(expt), None, None, None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, Some(expt), None, None, None, &expect!["1"], &None); }); let fun = s.intern_fun(s.intern_user_symbol("x"), s.list(vec![expt_nil]), expt_nil); @@ -82,7 +82,7 @@ fn test_prove_binop() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -102,7 +102,7 @@ fn test_prove_binop_fail() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -123,7 +123,7 @@ fn test_prove_arithmetic_let() { None, Some(terminal), None, - expect!["18"], + &expect!["18"], &None, ); } @@ -162,7 +162,7 @@ fn test_prove_num_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -175,7 +175,7 @@ fn test_prove_num_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -192,7 +192,7 @@ fn test_prove_invalid_num_equal() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); @@ -204,7 +204,7 @@ fn test_prove_invalid_num_equal() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -223,7 +223,7 @@ fn test_prove_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -233,7 +233,7 @@ fn test_prove_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -243,7 +243,7 @@ fn test_prove_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -253,7 +253,7 @@ fn test_prove_equal() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -269,7 +269,7 @@ fn test_prove_quote_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -286,7 +286,7 @@ fn test_prove_if() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -299,7 +299,7 @@ fn test_prove_if() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ) } @@ -316,7 +316,7 @@ fn test_prove_if_end_is_nil_error() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ) } @@ -334,7 +334,7 @@ fn test_prove_if_fully_evaluates() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -357,7 +357,7 @@ fn test_prove_recursion1() { None, Some(terminal), None, - expect!["66"], + &expect!["66"], &None, ); } @@ -381,7 +381,7 @@ fn test_prove_recursion2() { None, Some(terminal), None, - expect!["93"], + &expect!["93"], &None, ); } @@ -473,7 +473,7 @@ fn test_prove_emit_output() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -491,7 +491,7 @@ fn test_prove_evaluate() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -511,7 +511,7 @@ fn test_prove_evaluate2() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -534,7 +534,7 @@ fn test_prove_evaluate3() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -558,7 +558,7 @@ fn test_prove_evaluate4() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -579,7 +579,7 @@ fn test_prove_evaluate5() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -597,7 +597,7 @@ fn test_prove_evaluate_sum() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -614,7 +614,7 @@ fn test_prove_binop_rest_is_nil() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -624,7 +624,7 @@ fn test_prove_binop_rest_is_nil() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -645,7 +645,7 @@ fn op_syntax_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -659,7 +659,7 @@ fn op_syntax_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -673,7 +673,7 @@ fn op_syntax_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -682,9 +682,9 @@ fn op_syntax_error() { let expr = format!("({name} 123 456 789)"); tracing::debug!("{:?}", &expr); let iterations = if op.supports_arity(2) { - expect!["2"] + &expect!["2"] } else { - expect!["1"] + &expect!["1"] }; test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, iterations, &None); } @@ -719,7 +719,7 @@ fn test_prove_diff() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -737,7 +737,7 @@ fn test_prove_product() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -755,7 +755,7 @@ fn test_prove_quotient() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -772,7 +772,7 @@ fn test_prove_error_div_by_zero() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -789,7 +789,7 @@ fn test_prove_error_invalid_type_and_not_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -811,7 +811,7 @@ fn test_prove_adder() { None, Some(terminal), None, - expect!["13"], + &expect!["13"], &None, ); } @@ -828,7 +828,7 @@ fn test_prove_current_env_simple() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -845,7 +845,7 @@ fn test_prove_current_env_rest_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -864,7 +864,7 @@ fn test_prove_let_simple() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -880,7 +880,7 @@ fn test_prove_let_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -896,7 +896,7 @@ fn test_prove_letrec_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -912,7 +912,7 @@ fn test_prove_lambda_empty_error() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -928,7 +928,7 @@ fn test_prove_let_empty_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -944,7 +944,7 @@ fn test_prove_let_empty_body_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -960,7 +960,7 @@ fn test_prove_letrec_empty_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -976,7 +976,7 @@ fn test_prove_letrec_empty_body_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -993,7 +993,7 @@ fn test_prove_let_body_nil() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -1009,7 +1009,7 @@ fn test_prove_let_rest_body_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1025,7 +1025,7 @@ fn test_prove_letrec_rest_body_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1043,7 +1043,7 @@ fn test_prove_let_null_bindings() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -1060,7 +1060,7 @@ fn test_prove_letrec_null_bindings() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -1081,7 +1081,7 @@ fn test_prove_let() { None, Some(terminal), None, - expect!["18"], + &expect!["18"], &None, ); } @@ -1106,7 +1106,7 @@ fn test_prove_arithmetic() { None, Some(terminal), None, - expect!["23"], + &expect!["23"], &None, ); } @@ -1128,7 +1128,7 @@ fn test_prove_comparison() { None, Some(terminal), None, - expect!["21"], + &expect!["21"], &None, ); } @@ -1157,7 +1157,7 @@ fn test_prove_conditional() { None, Some(terminal), None, - expect!["35"], + &expect!["35"], &None, ); } @@ -1186,7 +1186,7 @@ fn test_prove_conditional2() { None, Some(terminal), None, - expect!["32"], + &expect!["32"], &None, ); } @@ -1212,7 +1212,7 @@ fn test_prove_fundamental_conditional_bug() { None, Some(terminal), None, - expect!["32"], + &expect!["32"], &None, ); } @@ -1230,7 +1230,7 @@ fn test_prove_fully_evaluates() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1253,7 +1253,7 @@ fn test_prove_recursion() { None, Some(terminal), None, - expect!["66"], + &expect!["66"], &None, ); } @@ -1275,7 +1275,7 @@ fn test_prove_recursion_multiarg() { None, Some(terminal), None, - expect!["69"], + &expect!["69"], &None, ); } @@ -1300,7 +1300,7 @@ fn test_prove_recursion_optimized() { None, Some(terminal), None, - expect!["56"], + &expect!["56"], &None, ); } @@ -1324,7 +1324,7 @@ fn test_prove_tail_recursion() { None, Some(terminal), None, - expect!["93"], + &expect!["93"], &None, ); } @@ -1350,7 +1350,7 @@ fn test_prove_tail_recursion_somewhat_optimized() { None, Some(terminal), None, - expect!["81"], &None + &expect!["81"], &None ); } @@ -1375,7 +1375,7 @@ fn test_prove_no_mutual_recursion() { None, Some(terminal), None, - expect!["22"], + &expect!["22"], &None, ); } @@ -1400,7 +1400,7 @@ fn test_prove_no_mutual_recursion_error() { None, Some(error), None, - expect!["25"], + &expect!["25"], &None, ); } @@ -1418,7 +1418,7 @@ fn test_prove_cons1() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1434,7 +1434,7 @@ fn test_prove_car_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1450,7 +1450,7 @@ fn test_prove_cdr_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1466,7 +1466,7 @@ fn test_prove_atom_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1482,7 +1482,7 @@ fn test_prove_emit_end_is_nil_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1499,7 +1499,7 @@ fn test_prove_cons2() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1516,7 +1516,7 @@ fn test_prove_zero_arg_lambda1() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1533,7 +1533,7 @@ fn test_prove_zero_arg_lambda2() { None, Some(terminal), None, - expect!["10"], + &expect!["10"], &None, ); } @@ -1575,7 +1575,7 @@ fn test_prove_zero_arg_lambda4() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -1592,7 +1592,7 @@ fn test_prove_zero_arg_lambda5() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -1609,7 +1609,7 @@ fn test_prove_zero_arg_lambda6() { None, Some(error), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -1630,7 +1630,7 @@ fn test_prove_nested_let_closure_regression() { None, Some(terminal), None, - expect!["14"], + &expect!["14"], &None, ); } @@ -1653,7 +1653,7 @@ fn test_prove_minimal_tail_call() { None, Some(terminal), None, - expect!["50"], + &expect!["50"], &None, ); } @@ -1675,7 +1675,7 @@ fn test_prove_cons_in_function1() { None, Some(terminal), None, - expect!["15"], + &expect!["15"], &None, ); } @@ -1697,7 +1697,7 @@ fn test_prove_cons_in_function2() { None, Some(terminal), None, - expect!["15"], + &expect!["15"], &None, ); } @@ -1715,7 +1715,7 @@ fn test_prove_multiarg_eval_bug() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -1739,7 +1739,7 @@ fn test_prove_multiple_letrec_bindings() { None, Some(terminal), None, - expect!["78"], + &expect!["78"], &None, ); } @@ -1763,7 +1763,7 @@ fn test_prove_tail_call2() { None, Some(terminal), None, - expect!["84"], + &expect!["84"], &None, ); } @@ -1783,7 +1783,7 @@ fn test_prove_multiple_letrecstar_bindings() { None, Some(terminal), None, - expect!["22"], + &expect!["22"], &None, ); } @@ -1803,7 +1803,7 @@ fn test_prove_multiple_letrecstar_bindings_referencing() { None, Some(terminal), None, - expect!["31"], + &expect!["31"], &None, ); } @@ -1834,7 +1834,7 @@ fn test_prove_multiple_letrecstar_bindings_recursive() { None, Some(terminal), None, - expect!["242"], + &expect!["242"], &None, ); } @@ -1856,7 +1856,7 @@ fn test_prove_dont_discard_rest_env() { None, Some(terminal), None, - expect!["22"], + &expect!["22"], &None, ); } @@ -1925,7 +1925,7 @@ fn test_prove_terminal_continuation_regression() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -1946,7 +1946,7 @@ fn test_prove_chained_functional_commitment() { None, Some(terminal), None, - expect!["39"], + &expect!["39"], &None, ); } @@ -1963,7 +1963,7 @@ fn test_prove_begin_empty() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -1981,7 +1981,7 @@ fn test_prove_begin_emit() { None, None, Some(&expected_emitted), - expect!["13"], + &expect!["13"], &None, ); } @@ -1998,7 +1998,7 @@ fn test_prove_str_car() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2015,7 +2015,7 @@ fn test_prove_str_cdr() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2032,7 +2032,7 @@ fn test_prove_str_car_empty() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2049,7 +2049,7 @@ fn test_prove_str_cdr_empty() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2066,7 +2066,7 @@ fn test_prove_strcons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2082,7 +2082,7 @@ fn test_prove_str_cons_error() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2098,7 +2098,7 @@ fn test_prove_one_arg_cons_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -2115,7 +2115,7 @@ fn test_prove_car_nil() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2132,7 +2132,7 @@ fn test_prove_cdr_nil() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2148,7 +2148,7 @@ fn test_prove_car_cdr_invalid_tag_error_sym() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2158,7 +2158,7 @@ fn test_prove_car_cdr_invalid_tag_error_sym() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2174,7 +2174,7 @@ fn test_prove_car_cdr_invalid_tag_error_char() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2184,7 +2184,7 @@ fn test_prove_car_cdr_invalid_tag_error_char() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2200,7 +2200,7 @@ fn test_prove_car_cdr_invalid_tag_error_num() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2210,7 +2210,7 @@ fn test_prove_car_cdr_invalid_tag_error_num() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2228,7 +2228,7 @@ fn test_prove_car_cdr_of_cons() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2238,7 +2238,7 @@ fn test_prove_car_cdr_of_cons() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -2254,7 +2254,7 @@ fn test_prove_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2264,7 +2264,7 @@ fn test_prove_car_cdr_invalid_tag_error_lambda() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2282,7 +2282,7 @@ fn test_prove_hide_open() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -2292,7 +2292,7 @@ fn test_prove_hide_wrong_secret_type() { let s = &Store::::default(); let expr = "(hide 'x 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -2308,7 +2308,7 @@ fn test_prove_hide_secret() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -2326,7 +2326,7 @@ fn test_prove_hide_open_sym() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -2344,7 +2344,7 @@ fn test_prove_commit_open_sym() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -2362,7 +2362,7 @@ fn test_prove_commit_open() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -2372,7 +2372,7 @@ fn test_prove_commit_error() { let s = &Store::::default(); let expr = "(commit 123 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -2380,7 +2380,7 @@ fn test_prove_open_error() { let s = &Store::::default(); let expr = "(open 123 456)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["1"], &None); } #[test] @@ -2388,7 +2388,7 @@ fn test_prove_open_wrong_type() { let s = &Store::::default(); let expr = "(open 'asdf)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["2"], &None); } #[test] @@ -2396,7 +2396,7 @@ fn test_prove_secret_wrong_type() { let s = &Store::::default(); let expr = "(secret 'asdf)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["2"], &None); } #[test] @@ -2412,7 +2412,7 @@ fn test_prove_commit_secret() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -2430,7 +2430,7 @@ fn test_prove_num() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2448,7 +2448,7 @@ fn test_prove_num_char() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2466,7 +2466,7 @@ fn test_prove_char_num() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -2486,7 +2486,7 @@ fn test_prove_char_coercion() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2496,7 +2496,7 @@ fn test_prove_char_coercion() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -2513,7 +2513,7 @@ fn test_prove_commit_num() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -2531,7 +2531,7 @@ fn test_prove_hide_open_comm_num() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -2549,7 +2549,7 @@ fn test_prove_hide_secret_comm_num() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -2567,7 +2567,7 @@ fn test_prove_commit_open_comm_num() { None, Some(terminal), None, - expect!["8"], + &expect!["8"], &None, ); } @@ -2585,7 +2585,7 @@ fn test_prove_commit_secret_comm_num() { None, Some(terminal), None, - expect!["8"], + &expect!["8"], &None, ); } @@ -2603,7 +2603,7 @@ fn test_prove_commit_num_open() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -2615,9 +2615,27 @@ fn test_prove_num_invalid_tag() { let expr1 = "(num \"asdf\")"; let expr2 = "(num '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2627,9 +2645,27 @@ fn test_prove_comm_invalid_tag() { let expr1 = "(comm \"asdf\")"; let expr2 = "(comm '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2639,9 +2675,27 @@ fn test_prove_char_invalid_tag() { let expr1 = "(char \"asdf\")"; let expr2 = "(char '(1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr1, None, None, Some(error), None, expect!["2"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr1, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["2"], + &None, + ); } #[test] @@ -2657,7 +2711,7 @@ fn test_prove_terminal_sym() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -2667,7 +2721,7 @@ fn test_prove_terminal_sym() { fn test_prove_open_opaque_commit() { let s = &Store::::default(); let expr = "(open 123)"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, &expect!["2"], &None); } #[test] @@ -2675,7 +2729,7 @@ fn test_prove_open_opaque_commit() { fn test_prove_secret_invalid_tag() { let s = &Store::::default(); let expr = "(secret 123)"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, &expect!["2"], &None); } #[test] @@ -2683,7 +2737,7 @@ fn test_prove_secret_invalid_tag() { fn test_prove_secret_opaque_commit() { let s = &Store::::default(); let expr = "(secret (comm 123))"; - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, expect!["2"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, None, None, &expect!["2"], &None); } #[test] @@ -2705,7 +2759,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2715,7 +2769,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2725,7 +2779,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2735,7 +2789,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2745,7 +2799,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2756,7 +2810,7 @@ fn test_str_car_cdr_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2767,7 +2821,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2778,7 +2832,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); @@ -2789,7 +2843,7 @@ fn test_str_car_cdr_cons() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2810,7 +2864,7 @@ fn relational_aux(s: &Store, op: &str, a: &str, b: &str, res: bool) { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -2947,7 +3001,7 @@ fn test_relational_edge_case_identity() { None, Some(terminal), None, - expect!["19"], + &expect!["19"], &None, ); } @@ -2968,7 +3022,7 @@ fn test_prove_test_eval() { None, Some(terminal), None, - expect!["17"], + &expect!["17"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -2978,7 +3032,7 @@ fn test_prove_test_eval() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &None, ); } @@ -3003,7 +3057,7 @@ fn test_prove_test_keyword() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3013,7 +3067,7 @@ fn test_prove_test_keyword() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3023,7 +3077,7 @@ fn test_prove_test_keyword() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3048,7 +3102,7 @@ fn test_prove_functional_commitment() { None, Some(terminal), None, - expect!["25"], + &expect!["25"], &None, ); } @@ -3078,7 +3132,7 @@ fn test_prove_complicated_functional_commitment() { None, Some(terminal), None, - expect!["108"], + &expect!["108"], &None, ); } @@ -3101,7 +3155,7 @@ fn test_prove_test_fold_cons_regression() { None, Some(terminal), None, - expect!["152"], + &expect!["152"], &None, ); } @@ -3120,7 +3174,7 @@ fn test_prove_test_lambda_args_regression() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3132,7 +3186,7 @@ fn test_prove_reduce_sym_contradiction_regression() { let expr = "(eval 'a '(nil))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["4"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["4"], &None); } #[test] @@ -3154,7 +3208,7 @@ fn test_prove_test_self_eval_env_not_nil() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3174,7 +3228,7 @@ fn test_prove_test_self_eval_nil() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &None, ); } @@ -3186,7 +3240,7 @@ fn test_prove_test_env_not_nil_and_binding_nil() { let expr = "(let ((a 1) (b 2)) c)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["7"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["7"], &None); } #[test] @@ -3195,7 +3249,7 @@ fn test_prove_test_eval_bad_form() { let expr = "(* 5 (eval '(+ 1 a) '((0 . 3))))"; // two-arg eval, optional second arg is env. This tests for error on malformed env. let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["8"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["8"], &None); } #[test] @@ -3217,7 +3271,7 @@ fn test_prove_test_u64_mul() { None, Some(terminal), None, - expect!["7"], + &expect!["7"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3227,7 +3281,7 @@ fn test_prove_test_u64_mul() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3237,7 +3291,7 @@ fn test_prove_test_u64_mul() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3247,7 +3301,7 @@ fn test_prove_test_u64_mul() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); } @@ -3268,7 +3322,7 @@ fn test_prove_test_u64_add() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3278,7 +3332,7 @@ fn test_prove_test_u64_add() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -3302,7 +3356,7 @@ fn test_prove_test_u64_sub() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3312,7 +3366,7 @@ fn test_prove_test_u64_sub() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3322,7 +3376,7 @@ fn test_prove_test_u64_sub() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -3349,7 +3403,7 @@ fn test_prove_test_u64_div() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3359,10 +3413,19 @@ fn test_prove_test_u64_div() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], &None, ); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3387,7 +3450,7 @@ fn test_prove_test_u64_mod() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3397,10 +3460,19 @@ fn test_prove_test_u64_mod() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], &None, ); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); } #[test] @@ -3413,9 +3485,27 @@ fn test_prove_test_num_mod() { let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr2, None, None, Some(error), None, expect!["3"], &None); - test_aux::<_, _, M1<'_, _>>(s, expr3, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + expr2, + None, + None, + Some(error), + None, + &expect!["3"], + &None, + ); + test_aux::<_, _, M1<'_, _>>( + s, + expr3, + None, + None, + Some(error), + None, + &expect!["3"], + &None, + ); } #[test] @@ -3446,7 +3536,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3456,7 +3546,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3466,7 +3556,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3476,7 +3566,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -3487,7 +3577,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3497,7 +3587,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3507,7 +3597,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3517,7 +3607,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); @@ -3528,7 +3618,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3538,7 +3628,7 @@ fn test_prove_test_u64_comp() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3563,7 +3653,7 @@ fn test_prove_test_u64_conversion() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3573,7 +3663,7 @@ fn test_prove_test_u64_conversion() { None, Some(terminal), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3583,7 +3673,7 @@ fn test_prove_test_u64_conversion() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3593,7 +3683,7 @@ fn test_prove_test_u64_conversion() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -3615,7 +3705,7 @@ fn test_prove_test_u64_num_comparison() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3625,7 +3715,7 @@ fn test_prove_test_u64_num_comparison() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3647,7 +3737,7 @@ fn test_prove_test_u64_num_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3657,7 +3747,7 @@ fn test_prove_test_u64_num_cons() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3669,7 +3759,7 @@ fn test_prove_test_hide_u64_secret() { let expr = "(hide 0u64 123)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -3679,7 +3769,7 @@ fn test_prove_test_mod_by_zero_error() { let expr = "(% 0 0)"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -3688,7 +3778,7 @@ fn test_prove_dotted_syntax_error() { let expr = "(let ((a (lambda (x) (+ x 1)))) (a . 1))"; let error = s.cont_error(); - test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, expect!["3"], &None); + test_aux::<_, _, M1<'_, _>>(s, expr, None, None, Some(error), None, &expect!["3"], &None); } #[test] @@ -3731,7 +3821,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3741,7 +3831,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - expect!["2"], + &expect!["2"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3751,7 +3841,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3761,7 +3851,7 @@ fn test_prove_lambda_body_syntax() { None, Some(error), None, - expect!["3"], + &expect!["3"], &None, ); } @@ -3777,7 +3867,16 @@ fn test_prove_non_symbol_binding_error() { let expr2 = format!("(letrec (({x} 123)) {x})"); let expr3 = format!("(lambda ({x}) {x})"); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); test_aux::<_, _, M1<'_, _>>( s, &expr2, @@ -3785,7 +3884,7 @@ fn test_prove_non_symbol_binding_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); test_aux::<_, _, M1<'_, _>>( @@ -3795,7 +3894,7 @@ fn test_prove_non_symbol_binding_error() { None, Some(error), None, - expect!["1"], + &expect!["1"], &None, ); }; @@ -3823,37 +3922,100 @@ fn test_prove_head_with_sym_mimicking_value() { { // binop let expr = format!("({} 1 1)", hash_num(s, state.clone(), "+")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // unop let expr = format!("({} '(1 . 2))", hash_num(s, state.clone(), "car")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // let_or_letrec let expr = format!("({} ((a 1)) a)", hash_num(s, state.clone(), "let")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // current-env let expr = format!("({})", hash_num(s, state.clone(), "current-env")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // lambda let expr = format!("({} (x) 123)", hash_num(s, state.clone(), "lambda")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // quote let expr = format!("({} asdf)", hash_num(s, state.clone(), "quote")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } { // if let expr = format!("({} t 123 456)", hash_num(s, state, "if")); - test_aux::<_, _, M1<'_, _>>(s, &expr, None, None, Some(error), None, expect!["1"], &None); + test_aux::<_, _, M1<'_, _>>( + s, + &expr, + None, + None, + Some(error), + None, + &expect!["1"], + &None, + ); } } @@ -3905,7 +4067,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["3"], + &expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3915,7 +4077,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3925,7 +4087,7 @@ fn test_dumb_lang() { None, Some(terminal), None, - expect!["9"], + &expect!["9"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3935,7 +4097,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["4"], + &expect!["4"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3945,7 +4107,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["2"], + &expect!["2"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3955,7 +4117,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3965,7 +4127,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(lang.clone()), ); test_aux::<_, _, C1LEM<'_, _, DumbCoprocessor<_>>>( @@ -3975,7 +4137,7 @@ fn test_dumb_lang() { None, Some(error), None, - expect!["3"], + &expect!["3"], &Some(lang), ); } @@ -4003,7 +4165,7 @@ fn test_terminator_lang() { None, Some(terminal), None, - expect!["1"], + &expect!["1"], &Some(lang.into()), ); } @@ -4156,7 +4318,7 @@ fn test_prove_lambda_body_nil() { None, Some(terminal), None, - expect!["4"], + &expect!["4"], &None, ); } @@ -4174,7 +4336,7 @@ fn test_letrec_let_nesting() { None, Some(terminal), None, - expect!["6"], + &expect!["6"], &None, ); } @@ -4190,7 +4352,7 @@ fn test_let_sequencing() { None, Some(terminal), None, - expect!["5"], + &expect!["5"], &None, ); } @@ -4206,7 +4368,7 @@ fn test_letrec_sequencing() { None, Some(terminal), None, - expect!["8"], + &expect!["8"], &None, ); }