Skip to main content

Crate cliffy_test

Crate cliffy_test 

Source
Expand description

§Cliffy Test - Algebraic Testing Framework

Tests are geometric invariants. Failures are geometric distances. Test composition uses geometric product.

§Philosophy

Traditional testing asks: “Does this assertion pass?” Cliffy testing asks: “Does this state lie on the expected manifold?”

By integrating with amari-flynn, we categorize test events into three types:

CategoryProbabilityMeaning
ImpossibleP = 0Formally proven to never occur
Rare0 < P << 1Statistically bounded failure rate
EmergentP > 0Valid but unpredicted behaviors

§Quick Start

use cliffy_test::prelude::*;

// Define an impossible invariant - must NEVER fail
let inv = invariant_impossible! {
    name: "Magnitude is non-negative",
    check: || {
        let v = vector(1.0, 2.0, 3.0);
        if v.magnitude() >= 0.0 {
            TestResult::Pass
        } else {
            TestResult::fail_with_distance(v.magnitude(), "Negative magnitude")
        }
    }
};

Re-exports§

pub use amari_flynn;

Modules§

error
Geometric error types for test failures
generators
Generators for property-based testing with QuickCheck
invariants
Invariant types for algebraic testing
macros
Declarative macros for algebraic testing
manifold
Manifold testing - verify states lie on expected geometric manifolds
prelude
Prelude module for common imports
result
Test result types with geometric information

Macros§

emergent
Track emergent behavior - valid but unpredicted (P > 0)
geometric_test
Run a test with geometric invariant checking
invariant_impossible
Define an impossible invariant - must NEVER fail (P = 0)
invariant_rare
Define a rare invariant - bounded failure probability (0 < P << 1)
verify_invariant
Verify an invariant and panic with geometric error info on failure

Structs§

Bivector
Bivector type - wrapper around Multivector with only grade 2
Multivector
A multivector in a Clifford algebra Cl(P,Q,R)
Vector
Vector type - wrapper around Multivector with only grade 1

Functions§

bivector
Convenience function to create a GA3 bivector from components
from_coeffs
Convenience function to create a GA3 from coefficient array
sandwich
Sandwich product: r * v * r.reverse()
vector
Convenience function to create a GA3 vector from components

Type Aliases§

Biv3
Type alias for 3D Bivector
GA3
Type alias for 3D Euclidean geometric algebra
Vec3
Type alias for 3D Vector