pub struct TrellisHarness<G, C = (), O = ()> { /* private fields */ }Expand description
Scenario runner for deterministic transaction scripts.
Implementations§
Source§impl<G, C, O> TrellisHarness<G, C, O>
impl<G, C, O> TrellisHarness<G, C, O>
Sourcepub fn new(build: impl FnOnce() -> G) -> Self
pub fn new(build: impl FnOnce() -> G) -> Self
Builds a harness from an application-supplied constructor.
Sourcepub fn from_target(target: G) -> Self
pub fn from_target(target: G) -> Self
Builds a harness around an already-constructed target.
Sourcepub fn resource_ledger(&self) -> &ResourceLedger<C>
pub fn resource_ledger(&self) -> &ResourceLedger<C>
Returns the resource ledger updated after each committed step.
Sourcepub fn output_ledger(&self) -> &OutputLedger<O>
pub fn output_ledger(&self) -> &OutputLedger<O>
Returns the output ledger updated after each committed step.
Sourcepub fn step(&mut self, name: impl Into<String>) -> HarnessStep<'_, G, C, O>
pub fn step(&mut self, name: impl Into<String>) -> HarnessStep<'_, G, C, O>
Starts a named single-transaction step.
Sourcepub fn run_script(
&mut self,
script: &TransactionScript<C, O>,
) -> Result<(), ScenarioError>
pub fn run_script( &mut self, script: &TransactionScript<C, O>, ) -> Result<(), ScenarioError>
Runs every step in a replayable transaction script.
Sourcepub fn replay(
build: impl FnOnce() -> G,
script: &TransactionScript<C, O>,
) -> Result<Self, ScenarioError>
pub fn replay( build: impl FnOnce() -> G, script: &TransactionScript<C, O>, ) -> Result<Self, ScenarioError>
Replays a transaction script against a fresh application graph.
Sourcepub fn assert_replay_matches(&self, other: &Self) -> Result<(), ScenarioError>
pub fn assert_replay_matches(&self, other: &Self) -> Result<(), ScenarioError>
Compares replay traces and final graph state.
Sourcepub fn final_state_debug_dump(&self) -> String
pub fn final_state_debug_dump(&self) -> String
Returns a deterministic graph metadata dump for final-state comparison.
Sourcepub fn assert_oracle<Oracle>(
&self,
inputs: &Oracle::CanonicalInputs,
) -> Result<OracleCheck<Oracle::ExpectedState>, OracleMismatch<Oracle::ExpectedState>>where
Oracle: FullRecomputeOracle<G>,
pub fn assert_oracle<Oracle>(
&self,
inputs: &Oracle::CanonicalInputs,
) -> Result<OracleCheck<Oracle::ExpectedState>, OracleMismatch<Oracle::ExpectedState>>where
Oracle: FullRecomputeOracle<G>,
Runs an app-owned full-recompute oracle against the wrapped target.
Auto Trait Implementations§
impl<G, C, O> Freeze for TrellisHarness<G, C, O>where
G: Freeze,
impl<G, C, O> RefUnwindSafe for TrellisHarness<G, C, O>
impl<G, C, O> Send for TrellisHarness<G, C, O>
impl<G, C, O> Sync for TrellisHarness<G, C, O>
impl<G, C, O> Unpin for TrellisHarness<G, C, O>
impl<G, C, O> UnsafeUnpin for TrellisHarness<G, C, O>where
G: UnsafeUnpin,
impl<G, C, O> UnwindSafe for TrellisHarness<G, C, O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more