pub struct InvariantVerifier { /* private fields */ }Expand description
Game-specific invariant verifier
Implementations§
Source§impl InvariantVerifier
impl InvariantVerifier
Sourcepub fn with_tolerance(self, tolerance: f64) -> Self
pub fn with_tolerance(self, tolerance: f64) -> Self
With custom tolerance
Sourcepub fn verify_score_non_negative(&mut self, score: f64) -> &mut Self
pub fn verify_score_non_negative(&mut self, score: f64) -> &mut Self
Verify score is non-negative
Sourcepub fn verify_health(&mut self, health: f64, max_health: f64) -> &mut Self
pub fn verify_health(&mut self, health: f64, max_health: f64) -> &mut Self
Verify health is in valid range [0, max_health]
Sourcepub fn verify_position_bounds(
&mut self,
x: f64,
y: f64,
min_x: f64,
max_x: f64,
min_y: f64,
max_y: f64,
) -> &mut Self
pub fn verify_position_bounds( &mut self, x: f64, y: f64, min_x: f64, max_x: f64, min_y: f64, max_y: f64, ) -> &mut Self
Verify position is within bounds
Sourcepub fn verify_speed_limit(
&mut self,
vx: f64,
vy: f64,
max_speed: f64,
) -> &mut Self
pub fn verify_speed_limit( &mut self, vx: f64, vy: f64, max_speed: f64, ) -> &mut Self
Verify velocity is within speed limit
Sourcepub fn verify_entity_count(
&mut self,
count: usize,
expected: usize,
) -> &mut Self
pub fn verify_entity_count( &mut self, count: usize, expected: usize, ) -> &mut Self
Verify entity count invariant
Sourcepub fn verify_custom(
&mut self,
name: &str,
expected: f64,
actual: f64,
) -> &mut Self
pub fn verify_custom( &mut self, name: &str, expected: f64, actual: f64, ) -> &mut Self
Custom invariant check
Sourcepub fn verifier(&self) -> &EquationVerifier
pub fn verifier(&self) -> &EquationVerifier
Get the underlying verifier
Sourcepub fn assert_all(&self) -> ProbarResult<()>
pub fn assert_all(&self) -> ProbarResult<()>
Assert all invariants hold
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InvariantVerifier
impl RefUnwindSafe for InvariantVerifier
impl Send for InvariantVerifier
impl Sync for InvariantVerifier
impl Unpin for InvariantVerifier
impl UnsafeUnpin for InvariantVerifier
impl UnwindSafe for InvariantVerifier
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