Skip to main content

Crate bookspec_checker

Crate bookspec_checker 

Source
Expand description

bookspec’s checker: the example schema, the rule identifiers, and the Engine trait an accounting engine implements (plan/served.md P13, D-34).

bookspec is a specification first: every rule is stated normatively, sourced, and demonstrated by concrete examples (bookspec/examples/). This crate is the machine-readable part: Example is the schema and its parser, rules the catalogue (BS-<area>-<n>), and Engine the only interface a conformance runner needs. The runner lives in bookspec-runner; wanderbooks’ adapter is crates/ledger-core/tests/bookspec.rs.

The crate knows nothing of any engine: no money type, no ledger, no store. That is what lets a second engine (the GnuCash oracle, later) be checked by the same examples.

Re-exports§

pub use derive::Derivation;
pub use derive::Derived;
pub use derive::derive;
pub use engine::Claims;
pub use engine::Engine;
pub use engine::Refusal;
pub use engine::RuleId;
pub use engine::RuleIdError;
pub use engine::fallback_refusal;
pub use files::examples;
pub use files::spec_files;
pub use rules::Area;
pub use rules::Rule;
pub use rules::Status;
pub use rules::covered_rules;
pub use rules::rule;
pub use rules::rule_for_id;
pub use rules::rule_for_refusal;
pub use rules::rules;
pub use schema::*;

Modules§

derive
The specification’s own checker (plan/served.md P13 step 5): every example’s expected figures derived from its rule’s symbolic form, by an engine-free reference model with exact decimals.
engine
The interface an accounting engine implements to be checked against bookspec (plan/served.md P13, D-34).
files
The specification’s own files, carried by the crate: a consumer that depends on this crate (a git checkout carries the whole repository) needs no path to examples/ or spec/.
rules
bookspec’s rule identifiers and their catalogue.
schema
The shape of a bookspec example: the TOML schema, the parser, and the rules a well-formed example follows whatever engine runs it.