7 struct nettle_buffer buffer
;
10 nettle_buffer_init(&buffer
);
11 ASSERT(nettle_buffer_write(&buffer
, LDATA("foo")));
13 ASSERT(NETTLE_BUFFER_PUTC(&buffer
, 'x'));
15 ASSERT(buffer
.size
== 4);
16 ASSERT(buffer
.alloc
>= 4);
17 ASSERT(MEMEQ(4, buffer
.contents
, "foox"));
19 nettle_buffer_clear(&buffer
);
21 nettle_buffer_init_size(&buffer
, sizeof(s
), s
);
22 ASSERT(buffer
.alloc
== sizeof(s
));
23 ASSERT(nettle_buffer_write(&buffer
, LDATA("foo")));
24 ASSERT(buffer
.size
== 3);
26 ASSERT(!nettle_buffer_write(&buffer
, LDATA("bar")));