# Test Index
A one-line per file index of the 135 `.rs` files in `tests/`.
Grouped by surface (op families, properties, conformance, support
matrix, ROCm/HIP, e2e, regression, specialized, proptest).
## How to run a single test file
Run a single test file with `--test <name>`:
```bash
cargo test --offline --test arithmetic_ops
```
Run all tests under default features:
```bash
cargo test --offline
```
Run only the ROCm/HIP tests (gated on `rocm-hip`):
```bash
cargo test --offline --features rocm-hip --test hip_5step_nano
```
## Op-surface tests (P335-P339)
These tests exercise the 33+ new ops added in P335-P339
(arithmetic, shape, nn, index, reductions). Each file is named
after the op family and has 10-16 tests.
- `arithmetic_ops.rs` — SubOp, DivOp, ScalarAddOp, ScalarMulOp, PowOp, SqrtOp, Exp2Op, Log2Op.
- `shape_ops.rs` — ReshapeOp, TransposeOp, SliceOp, ConcatOp, BroadcastOp, FlattenOp, SqueezeOp, UnsqueezeOp, PermuteOp.
- `nn_ops.rs` — ReluOp, SigmoidOp, TanhOp, GeluOp, SoftmaxOp, LayerNormOp.
- `index_ops.rs` — GatherOp, ScatterOp, IndexSelectOp, IndexAddOp, NonzeroOp.
- `reductions.rs` — ReduceOp variants (sum, mean, max, min, argmax, argmin, prod, any, all).
## Property / theory tests (P347-P348, P204)
These tests exercise the per-theory property checks and the
valuation / sheaf / domain-contract properties.
- `properties.rs` — generic property-based test runner.
- `padic_properties.rs` — p-adic valuation and ultrametric properties.
- `padic_identity_properties.rs` — p-adic identity / equivalence properties.
- `padic_witnesses.rs` — P347 valuation / ultrametric / precision-preservation witnesses.
- `sheaf_properties.rs` — finite-site sheaf properties.
- `sheaf.rs` — sheaf cover / section types and basic operations.
- `cover_glue_inference.rs` — P348 cover-glue inference report.
- `cover_glue_regression.rs` — cover-glue regression checks.
- `finite_field.rs` — P346 finite-field domain (prime and extension).
- `padic.rs` — p-adic digit / value operations.
- `padic_digit_sum.rs` — p-adic digit-sum operations.
- `padic_digits_base_p.rs` — p-adic digit representation.
- `padic_dot.rs` — p-adic dot product.
- `padic_first_nonzero_digit.rs` — first nonzero p-adic digit.
- `padic_lowest_digit.rs` — p-adic lowest digit.
- `padic_pad_fma.rs` — p-adic pad fused-multiply-add.
- `padic_precision_consistency.rs` — p-adic precision consistency.
- `padic_valuation_skip_theorem.rs` — p-adic valuation skip theorem.
- `finite_sheaf_gluing_theorem.rs` — finite sheaf gluing theorem.
- `theorem_binding_registry.rs` — theorem-binding registry.
- `theory_contracts.rs` — theory-aware contract checks.
- `theory_operator_hardening.rs` — per-theory operator hardening.
## Conformance tests
These tests verify that the CPU oracle matches the GPU scaffold
(and the i64 reference matches the f32 reference, etc.).
- `cpu_oracle_conformance.rs` — CPU oracle conformance suite.
- `cross_backend_conformance.rs` — cross-backend (CPU vs GPU) conformance.
- `generic_backend.rs` — generic `Backend` trait conformance.
- `semantic_conformance_report.rs` — semantic conformance report (P204).
## Support matrix / verifier tests (P355-P385)
These tests exercise the verifier surface and the support matrix.
- `support_matrix_coverage.rs` — P359 support-matrix coverage walk.
- `support_matrix_dedup_classify.rs` — P382 irreducible-dup classification.
- `theory_support_matrix.rs` — theory-aware support matrix smoke.
- `theory_release_gate.rs` — theory-engineering release gate (3 checks).
- `audit_traces_example.rs` — `audit_traces` example run as a test.
- `math_bound_audit_traces.rs` — math-bound audit-trace flow.
- `rocm_audit_traces.rs` — ROCm/HIP audit traces (gated).
- `novelty_dossier.rs` — first-of-kind novelty dossier (FOK1-FOK4).
- `witness_proof_replay.rs` — proof-replay witness section (P357).
- `paper_artifacts.rs` — `target/paper-results/*` artifact content checks.
## ROCm/HIP tests (gated on `rocm-hip`)
The 10 HIP pilots. All gated on `--features rocm-hip`.
- `hip_5step_nano.rs` — 5-step nano benchmark (the smallest HIP test).
- `hip_adamw.rs` — AdamW step kernel.
- `hip_embedding.rs` — embedding forward + backward.
- `hip_gelu.rs` — GELU forward.
- `hip_gelu_bw.rs` — GELU backward.
- `hip_gemm_bw.rs` — GEMM backward (largest pilot).
- `hip_layernorm.rs` — LayerNorm forward + backward.
- `hip_padic_codec.rs` — p-adic fp16 codec.
- `hip_sheaf_overlap_check.rs` — sheaf overlap-check.
- `hip_softmax.rs` — softmax + cross-entropy backward.
## ROCm/HIP integration tests (gated on `rocm-hip`)
The larger ROCm/HIP integration tests (combine multiple HIP
kernels and assert on the end-to-end output).
- `rocm_benchmarks.rs` — ROCm/HIP benchmark harness.
- `rocm_capabilities.rs` — ROCm/HIP hardware capabilities.
- `rocm_hip_dense.rs` — dense i32 add pilot (P258).
- `rocm_hip_gemm_f16.rs` — fp16 GEMM forward.
- `rocm_hip_lowering.rs` — ROCm/HIP lowering rules.
- `rocm_padic_stratified_benchmarks.rs` — p-adic stratified benchmark suite.
- `rocm_padic_stratified_matmul.rs` — valuation-stratified matmul pilot.
- `rocm_padic_valuation.rs` — p-adic valuation skip pilot.
- `rocm_paper_gate.rs` — ROCm/HIP paper gate.
- `rocm_sheaf_locality.rs` — finite-site sheaf locality pilot.
## End-to-end smoke tests
These tests run a full end-to-end pipeline (graph -> plan ->
execute -> verify) on a small example.
- `mlp_10k_e2e.rs` — 10K-sample MLP e2e (the largest default e2e).
- `mlp_forward_e2e.rs` — 2-layer MLP forward-only e2e.
- `padic_tensor_sheaf_e2e.rs` — p-adic + tensor + sheaf e2e.
- `gpu_smoke_e2e.rs` — GPU end-to-end smoke (gated).
- `checkpoint_smoke.rs` — checkpoint save/load smoke.
- `dataset_bridge_smoke.rs` — dataset bridge smoke.
- `diagnose_smoke.rs` — diagnose smoke.
- `inference_smoke.rs` — inference session smoke.
- `metrics_smoke.rs` — metrics logger smoke.
- `model_arch_smoke.rs` — model architecture save/load smoke.
- `model_smoke.rs` — Model layer smoke.
- `moe_model_smoke.rs` — MoE model smoke.
- `moe_router_diagnose.rs` — MoE router diagnose reference.
- `synth_data_smoke.rs` — synthetic data smoke.
- `train_runner_smoke.rs` — training runner smoke.
- `training_step_smoke.rs` — training step driver smoke.
## Proptest files (P363, P385)
Property-based tests. The proptest macro honors the
`PROPTEST_CASES` env (default 256; bumped in stress mode).
- `proptest_arithmetic.rs` — Add, Mul, Sub, Div, ScalarAdd, ScalarMul.
- `proptest_shape.rs` — Reshape, Transpose, Flatten, Concat, Broadcast.
- `proptest_nn.rs` — Relu, Sigmoid, Tanh.
- `proptest_index.rs` — Gather.
- `proptest_reductions.rs` — Reduce.
- `proptest_stress.rs` — stress mode (PROPTEST_CASES=10000) for the
post-P353 surface.
- `proptest_*.proptest-regressions` — proptest-regression files
(auto-saved failing inputs; not test files).
## Regression tests
These tests catch specific regressions that the regular test
suite would not detect (the failing case is in the file name).
- `checkpoint_regression.rs` — checkpoint binary-format regression.
- `cover_glue_regression.rs` — cover-glue regression.
- `json_parser_regression.rs` — JSON parser regression (largest test file).
- `kernel_server_crash_recovery.rs` — kernel server crash recovery.
- `sgd_router_regression.rs` — SGD-vs-momentum router regression.
- `tensor_eq_regression.rs` — tensor equality regression.
- `tensor_*.rs` — per-tensor-op micro-regressions. Each file is named
after the tensor method it covers:
- `tensor_abs.rs` — `Tensor::abs`.
- `tensor_clamp.rs` — `Tensor::clamp`.
- `tensor_concat.rs` — `Tensor::concat`.
- `tensor_element_equals.rs` — `Tensor::element_equals`.
- `tensor_fill.rs` — `Tensor::fill`.
- `tensor_first_last_flatten.rs` — `Tensor::{first, last, flatten}`.
- `tensor_helpers.rs` — tensor helper constructors.
- `tensor_iter.rs` — `Tensor` iteration.
- `tensor_min_max.rs` — `Tensor::{min, max}`.
- `tensor_mul_by_two.rs` — `Tensor::mul_by_two`.
- `tensor_neg.rs` — `Tensor::neg`.
- `tensor_square.rs` — `Tensor::square`.
- `tensor_sum_reversed.rs` — `Tensor::sum_reversed`.
- `tensor_truncate.rs` — `Tensor::truncate`.
- `tensor_try_from_vec.rs` — `TryFrom<Vec<T>>` for `Tensor`.
## Specialized tests (one per surface)
Tests for a specific module or surface that does not fit the other
buckets.
- `accelerated_pilot.rs` — accelerated-pilot policy.
- `adaptive_planning.rs` — adaptive planning (cost-model tuning).
- `backend_lowering_cache.rs` — per-backend plan cache.
- `certified_contracts.rs` — certified contracts.
- `device_memory.rs` — device memory model.
- `dim_static_value.rs` — `Dim` static / dynamic / rank-only.
- `dsl_builder.rs` — P343 closure-based DSL.
- `error_variants.rs` — P429 variant-asserted tests for each `Error::*`.
- `facade.rs` — public `Tokitai` facade.
- `fused_elementwise.rs` — fused elementwise ops.
- `gpu_scaffold.rs` — GPU scaffold backend.
- `hardware_abstraction.rs` — hardware abstraction boundary.
- `kernel_server_bench.rs` — kernel server bench.
- `lowering_capabilities.rs` — per-lowering capability checks.
- `nonstandard_cost_model.rs` — non-standard cost model.
- `cost_model_weights.rs` — `CostModelWeights::strict/balanced/permissive` accessor tests.
- `object_display.rs` — `Object` Display impl.
- `operator_registry.rs` — `OperatorRegistry` (largest test file).
- `paper_benchmarks_example.rs` — paper-benchmarks example run as a test.
- `claim_status_report.rs` — P430 test counterpart for `examples/claim_status_report.rs`.
- `schema_guards.rs` — schema guards (release-gate schema check).
- `submission_readiness.rs` — P430 test counterpart for `examples/submission_readiness.rs`.
- `section_table_len.rs` — `SectionTable` length accessor.
- `shape_dim_accessors.rs` — `Shape` dim accessors.
- `shape_ensure_rank.rs` — `Shape` rank enforcement.
- `sheaf_*.rs` — sheaf micro-tests. Each file is named after the
sheaf method it covers:
- `sheaf_contains_all.rs` — `SectionTable::contains_all`.
- `sheaf_cover_union.rs` — `Cover::union` and related set ops.
- `sheaf_get_or_default.rs` — `SectionTable::get_or_default`.
- `sheaf_iterators.rs` — sheaf / cover iterators.
- `sheaf_open_count.rs` — `Cover::open_count` and `FiniteSite::open_count`.
- `sheaf_witness_counting.rs` — sheaf witness counters.
- `synth_data_quickfix.rs` — synth-data quickfix.
- `theorem_binding_registry.rs` — theorem-binding registry.
## How to add a new test file
When adding a new op, a new domain, or a new surface, create a
new `.rs` file in `tests/` that follows the standard pattern:
1. Use `tokitai_operator::facade::Tokitai::cpu_only()` for the
default runtime.
2. Build a small `SemanticGraph` with a few ops.
3. Plan and execute via the facade.
4. Assert on the output and the plan's `audit_report`.
The file name should match the surface: `<surface>_ops.rs` for op
families, `<surface>.rs` for property tests, `proptest_<family>.rs`
for proptest families. The naming convention is enforced by
`tests/support_matrix_coverage.rs` (P359).