MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / wire

Function wire

atomic-canonical/tests/depth_boundary.rs:31–42  ·  view source on GitHub ↗

The wire bytes of `depth/ .json`, length-checked before anything reads them.

(d: usize)

Source from the content-addressed store, hash-verified

29
30/// The wire bytes of `depth/<d>.json`, length-checked before anything reads them.
31fn wire(d: usize) -> Vec<u8> {
32 let path: PathBuf = Path::new(env!("CARGO_MANIFEST_DIR"))
33 .join("tests/vectors/ingest/depth")
34 .join(format!("{d}.json"));
35 let bytes = fs::read(&path).unwrap_or_else(|e| panic!("read {path:?}: {e}"));
36 assert_eq!(
37 bytes.len(),
38 2 * d + 4,
39 "{path:?} must be {d} open brackets, null, {d} close brackets and nothing else"
40 );
41 bytes
42}
43
44/// The value `depth/<d>.json` denotes, built by a loop rather than by a parse.
45fn nested(d: usize) -> Value {

Calls 1

readFunction · 0.70

Tested by

no test coverage detected