From 7d159b11594db5487ca7da4e4b8821838d6d02f3 Mon Sep 17 00:00:00 2001 From: porcuquine Date: Mon, 8 Jan 2024 10:13:45 -0800 Subject: [PATCH] Use expect_test. --- src/coprocessor/memoset/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/coprocessor/memoset/mod.rs b/src/coprocessor/memoset/mod.rs index e58b6d6921..d925caf14f 100644 --- a/src/coprocessor/memoset/mod.rs +++ b/src/coprocessor/memoset/mod.rs @@ -629,6 +629,7 @@ mod test { use crate::state::State; use bellpepper_core::{test_cs::TestConstraintSystem, Comparable}; + use expect_test::{expect, Expect}; use pasta_curves::pallas::Scalar as F; use std::default::Default; @@ -641,6 +642,10 @@ mod test { let fact_4 = s.read_with_default_state("(factorial 4)").unwrap(); let fact_3 = s.read_with_default_state("(factorial 3)").unwrap(); + let expect_eq = |computed: usize, expected: Expect| { + expected.assert_eq(&computed.to_string()); + }; + { scope.query(s, fact_4); @@ -671,6 +676,9 @@ mod test { .fmt_to_string_dammit(s) ); + expect_eq(cs.num_constraints(), expect!["10826"]); + expect_eq(cs.aux().len(), expect!["10859"]); + assert_eq!(10826, cs.num_constraints()); assert_eq!(10859, cs.aux().len()); @@ -700,8 +708,8 @@ mod test { scope.synthesize(cs, g, s).unwrap(); - assert_eq!(11408, cs.num_constraints()); - assert_eq!(11443, cs.aux().len()); + expect_eq(cs.num_constraints(), expect!["11408"]); + expect_eq(cs.aux().len(), expect!["11443"]); let unsat = cs.which_is_unsatisfied(); if unsat.is_some() {