mirror of
https://github.com/zap-proto/rust.git
synced 2026-10-30 15:04:23 +00:00
Two pre-existing CI failures (unrelated to codegen/install-zap): - minrust 1.81: quickcheck 1.1.0 pulls rand 0.10 -> rand_core 0.10.1, whose Cargo.toml requires the edition2024 feature (unstable on Cargo 1.81). Pin quickcheck to =1.0.3 (last version on rand 0.8 / rand_core 0.6.4) — within MSRV, no major bump. Fresh-resolve verified: rand_core 0.10.1 leaves the graph. - formatting: ran 'cargo +nightly fmt --all'; the CI check (--check --unstable-features --error-on-unformatted, nightly) now passes.
22 lines
592 B
Rust
22 lines
592 B
Rust
#![cfg(feature = "alloc")]
|
|
|
|
use zap::message;
|
|
|
|
#[test]
|
|
pub fn scratch_space_heap_allocator() {
|
|
let mut buffer = zap::Word::allocate_zeroed_vec(200);
|
|
{
|
|
let allocator =
|
|
message::ScratchSpaceHeapAllocator::new(zap::Word::words_to_bytes_mut(&mut buffer[..]));
|
|
let mut msg = message::Builder::new(allocator);
|
|
msg.set_root("hello world!").unwrap();
|
|
|
|
let s: zap::text::Reader = msg.get_root_as_reader().unwrap();
|
|
assert_eq!("hello world!", s);
|
|
}
|
|
|
|
for w in buffer {
|
|
assert_eq!(w, zap::word(0, 0, 0, 0, 0, 0, 0, 0));
|
|
}
|
|
}
|