Skip to main content

Crate unityrs_testkit

Crate unityrs_testkit 

Source
Expand description

Synthetic Unity files built in code, for unityrs tests.

Everything here is made from scratch by the builders: never game data, never bytes copied from a real file. The builders return Vec<u8> and know nothing of unityrs-core, so core’s own tests can use them (but for core_counters, under the test-counters feature alone).

Owners (docs/plans/core.md section 7): writer, rng, public_types (the Send + Sync source scan the crates’ tests share) and waits (the no-thread, no-wait source scan) are the scaffold’s (implemented); blob, serialized and bundle are package C’s; env is package D’s; depth (the deep values of plan section 3.10), counted (the counting global allocator, and the thread it counts), guard (the deadlock guard of every test that hands work between threads), stack (the child-process probes that measure a stack, and tell an overflow from every other failure) and child (how every test runs a child process: a SIGKILL from outside is no result) and scratch (how every test’s scratch is removed, whatever happens to the test or its child) are package B’s; ledger (one coherent observation of a counted engine’s heap and charges) and search (a limit’s need, its monotonicity checked) are the memory gates’ (docs/plans/extract.md X12, X13); address_space (the cap that makes the C allocator refuse, for the tests of liblzma’s own allocations) is package C’s; mutate (G3b’s mutator) is the integration’s; fuzz (the fuzz targets’ input layouts, which examples/fuzz_seeds.rs writes the seeds in) is the fuzz package’s; ngui (the NGUI-shaped atlases the cutter’s reference, tools/parity/ngui_cutter.py, is tested and recorded on) is P1b’s.

Re-exports§

pub use rng::Rng;
pub use writer::ByteWriter;

Modules§

address_space
A cap on the process’s address space: how a test makes the C allocator refuse.
blob
Typetree node lists, written in the blob format (format 10 and 12 up) or the old recursive format (below 10, and 11).
bundle
UnityFS bundles (formats 6 to 8) and UnityWeb/UnityRaw (P3), built from a spec, with every block codec the core reads.
child
Child processes a test runs to their end, and the one rule every such test keeps: a child the system kills from outside is no result.
counted
The counting #[global_allocator] of the memory tests (plan section 7.3), and the thread it counts: only the thread under test.
depth
Deep values (plan section 3.10, “Bounds”): the shapes of tools/fixtures/walk.py’s depth.json, built the same way.
env
Multi-file scenes for the Environment tests: bundles whose objects point into each other, resources in sibling entries and in other bundles.
fsb5
Synthetic FSB5 banks and hostile inputs, shared by fuzz seeds and tests. Format facts only: 60/64-byte headers, 32-byte data offsets, packed records.
fuzz
The fuzz targets’ input layouts (fuzz/, the fuzz plan of docs/plans/core.md section 6), in one place: the targets read their inputs through these, and the seed command (examples/fuzz_seeds.rs) writes the builders’ files, trees, objects and blocks through them, so the two cannot drift.
guard
Deadlock guards: how a test that hands work between threads turns a hang into a failure without timing the code it tests.
ledger
One coherent, allocation-free observation of a counted engine’s heap and its held charges (docs/plans/extract.md X12, X13). The engine’s counting allocator and official thread-registration/account hooks feed this test-only ledger (docs/plans/batch.md 2.11’s tally row).
mutate
G3b’s seeded mutator (plan section 6): every builder output, mutated by three operators, and both dumpers read every mutant.
ngui
NGUI-shaped atlases for the cutter’s reference (tools/parity/ngui_cutter.py, docs/BATCH_SPEC.md section 5): the atlas MonoBehaviour with a typetree, the MonoScript its m_Script names, its Material and the Texture2D sheets, inline or streamed from a .resS, in bundles whose views join them.
public_types
The source scan behind plan section 3.16’s rule: every public struct, enum, union, trait and type alias of a crate is asserted Send + Sync (an alias too: pub type Shared = Rc<u8> is a public type a caller holds, and round 5 found the scan blind to it).
rng
A tiny deterministic generator (SplitMix64) for “no panic on garbage” tests: every package mutates the builders’ output with it, seeded, so a failure reproduces from its seed. No dependency, no global state.
scene3d
Synthetic 3D objects, built from public format facts and typed values.
scratch
Scratch folders: the rule every Rust test in the workspace keeps for what it writes outside its own memory. Its scratch is removed whatever happens: when it passes, fails or panics, and when a child it runs ends, aborts, overflows its stack or is killed. (Review round 9: a stack probe’s folder, made in a child its bisection overflows by design, outlived every such child; a test whose own process a mutant aborted left a chain of 996 folders; two tests removed their files only after their asserts.)
search
A limit’s need (docs/plans/extract.md X13): the least value at which a run meets no refusal of it. least brackets and bisects a refusal predicate, then checks it is monotone where the bisection assumed it: at the need’s adjacent values and at sampled values on both sides, besides every value the bisection itself tried. A run’s allocation path adapts (a growth retried smaller, an eviction), so monotonicity is checked, not assumed; a Counterexample is no need, and comes back for a spec ruling instead of a squeeze result.
serialized
SerializedFiles, every format from 1 to 22 (below 9 the header’s endian byte sits at file_size - metadata_size), built from a spec, with overrides for the fields a parser test needs to get wrong.
stack
Stack probes: how a test finds the least stack a path needs, and tells a stack overflow from every other way a run can fail.
waits
The source scans behind plan section 4.1’s rules that the core never waits and never starts a thread, and that it computes no lazy value inside its cell.
web
Synthetic legacy bundles and WebFile containers, including stored compression streams.
writer
An endian-aware byte writer, the builders’ only primitive.
zip
Synthetic single-disk ZIPs. Deflate uses a final uncompressed block, so fixture creation needs no compressor dependency.