Files
alkblobs/tests/conformance/main.rs
T
glm-5.3-flash 327b952e4d feat(tests): the conformance suite's home — conventions, invariant backlog, harness skeleton (wave 1)
- tests/conformance/README.md: the convention doc — row naming (property-
  stated names, engine dimension is the column), the Contract stamp:
  format (the alkstore ADR-017 §4.2 convention adapted), the one-
  normative-owner-per-property rule, the factory contract (fresh
  isolated instance per open, idempotent teardown, safe over an
  abandoned instance), the SKIP posture (SQL-attached columns skip
  cleanly server-less; acceptance requires green against the server),
  the invariant backlog (the seven store-api.md §Invariants registered
  as the rows-to-grow table with pinning citations), and the mem-first
  column plan (mem is the contract-reference engine, ADR-011 §2)
- harness skeleton, compile-able with zero rows: StoreFactory (fresh
  + isolated + idempotent-teardown contract; the Store associated type
  is wave 2's binding point for the facade type), stamp.rs (the
  marker + convention anchor), backlog.rs (in-code registry with a
  traceability gate asserting INV-1..7 mirror §Invariants in order)
- no engine-specific code; no dependencies added

Verification: cargo test (33 passed across lib + 3 targets),
cargo clippy --all-targets -- -D warnings, cargo fmt --check
2026-10-11 18:44:04 +00:00

72 lines
2.2 KiB
Rust

//! `main.rs` — the conformance test target's root.
//!
//! The suite is in-crate by decided point (docs/plans/implementation.md):
//! engines are features of one crate, so the harness is factory-
//! parameterized over engine constructors rather than a sibling suite
//! crate. This target currently carries the **skeleton only** — the
//! factory trait shape, the stamp convention, and the invariant backlog
//! registry (see [`README`](./README.md) for the conventions' normative
//! statement). Rows arrive with wave 2's first column (mem, the
//! contract-reference engine); if binding the `Store` facade type
//! reveals a shape correction, that is wave 2's to make and record.
//!
//! Items beyond the tests below are the wave-2 drivers' surface, hence
//! the scoped `#![allow(dead_code)]` — it shrinks as rows land.
#![allow(dead_code)]
mod backlog;
mod factory;
mod stamp;
use factory::StoreFactory;
/// The harness probe factory: not an engine — a minimal mock proving
/// the [`StoreFactory`] contract is implementable with async methods
/// and reports the identity `name()` carries (the alkstore harness's
/// "exemplar against a trivial in-crate mock" posture, sized down to
/// the skeleton's no-rows state).
struct Probe {
label: &'static str,
}
impl StoreFactory for Probe {
type Store = ();
fn name(&self) -> &'static str {
self.label
}
async fn open(&self) -> Result<Self::Store, alkblobs::Error> {
Ok(())
}
async fn teardown(&self) -> Result<(), alkblobs::Error> {
Ok(())
}
}
#[test]
fn probe_factory_implements_the_contract() {
let factory = Probe { label: "probe" };
assert_eq!(factory.name(), "probe", "factory identity is reportable");
}
#[tokio::test]
async fn probe_factory_open_teardown_lifecycle() {
let factory = Probe { label: "probe" };
factory.open().await.expect("open vends the instance");
factory.teardown().await.expect("teardown is idempotent");
factory.teardown().await.expect("teardown repeats cleanly");
}
#[test]
fn stamp_marker_matches_convention() {
assert_eq!(stamp::STAMP_MARKER, "Contract stamp:");
}
#[test]
fn backlog_registers_the_seven_invariants() {
backlog::assert_traceable();
}