Skip to main content

EquationVerifier

Struct EquationVerifier 

Source
pub struct EquationVerifier { /* private fields */ }
Expand description

Equation verifier for testing physics and game invariants

Implementations§

Source§

impl EquationVerifier

Source

pub fn new(name: &str) -> Self

Create a new equation verifier

Source

pub fn with_tolerance(self, tolerance: f64) -> Self

Set the default tolerance

Source

pub fn name(&self) -> &str

Get the verifier name

Source

pub fn tolerance(&self) -> f64

Get current tolerance

Source

pub fn verify_eq(&mut self, name: &str, expected: f64, actual: f64) -> &mut Self

Verify that two values are approximately equal

Source

pub fn verify_eq_with_tolerance( &mut self, name: &str, expected: f64, actual: f64, tolerance: f64, ) -> &mut Self

Verify with custom tolerance

Source

pub fn verify_in_range( &mut self, name: &str, value: f64, min: f64, max: f64, ) -> &mut Self

Verify a value is within a range

Source

pub fn verify_non_negative(&mut self, name: &str, value: f64) -> &mut Self

Verify that a value is non-negative

Source

pub fn verify_positive(&mut self, name: &str, value: f64) -> &mut Self

Verify that a value is positive

Source

pub fn results(&self) -> &[EquationResult]

Get all results

Source

pub fn all_passed(&self) -> bool

Check if all verifications passed

Source

pub fn failures(&self) -> Vec<&EquationResult>

Get failed verifications

Source

pub fn passed_count(&self) -> usize

Count passed verifications

Source

pub fn failed_count(&self) -> usize

Count failed verifications

Source

pub fn assert_all(&self) -> ProbarResult<()>

Assert all verifications passed

Source

pub fn clear(&mut self)

Clear all results

Trait Implementations§

Source§

impl Debug for EquationVerifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.