Skip to content

Commit

Permalink
add simple test for SingleSegmnetAllocator
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Oct 23, 2023
1 parent 8d8f0cc commit 7940dd6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions capnp/tests/single_segment_allocator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use capnp::message;

#[test]
pub fn single_segment_allocator() {
let mut buffer = capnp::Word::allocate_zeroed_vec(200);
let allocator =
message::SingleSegmentAllocator::new(capnp::Word::words_to_bytes_mut(&mut buffer[..]));
let mut msg = message::Builder::new(allocator);
msg.set_root("hello world!").unwrap();

let s: capnp::text::Reader = msg.get_root_as_reader().unwrap();
assert_eq!("hello world!", s);
}

0 comments on commit 7940dd6

Please sign in to comment.