Rust crate conventions
Coding conventions
- •Colocated tests:
foo.rshasfoo_test.rsin the same directory. Submodule tests use#[path = "foo_test.rs"]. - •A source file may have multiple test files (e.g.
foo_math_test.rs,foo_test.rs) - •Functional programming style
- •Types encode mathematical invariants, validated at construction
- •nalgebra for linear algebra, proptest for property-based testing
Mathematical documentation
- •Definitions, lemmas, and proofs live as doc comments on the corresponding types/functions
- •Long proofs are outsourced to colocated
*_proof.mdfiles - •The Rust crates are self-contained mathematically — no dependency on thesis/. The thesis is downstream
- •Quality bar: specific, correct, detailed, clearly written enough that (1) Jörn can verify with low effort and (2) agents can rely on them when implementing
Testing philosophy
Two classes of tests, both applied excessively:
- •Math proposition tests (due diligence falsification): proptest generators approximate mathematical quantifiers ("∀ polytopes K", "∀ A ∈ Sp(4)", etc.). Properties under test are mathematical propositions (e.g. J^2 = -I, symplectomorphisms preserve capacity).
- •Standard correctness tests: Rust best practices for correctness-critical code — edge cases, invariant checking, regression tests.