Commit f1eb5652 authored by Niels Möller's avatar Niels Möller

New test.

Rev: src/nettle/testsuite/buffer-test.c:1.1
parent 1889c7bb
#include "testutils.h"
#include "buffer.h"
int
test_main(void)
{
struct nettle_buffer buffer;
uint8_t s[5];
nettle_buffer_init(&buffer);
ASSERT(nettle_buffer_write(&buffer, LDATA("foo")));
ASSERT(NETTLE_BUFFER_PUTC(&buffer, 'x'));
ASSERT(buffer.size == 4);
ASSERT(buffer.alloc >= 4);
ASSERT(MEMEQ(4, buffer.contents, "foox"));
nettle_buffer_clear(&buffer);
nettle_buffer_init_size(&buffer, sizeof(s), s);
ASSERT(buffer.alloc == sizeof(s));
ASSERT(nettle_buffer_write(&buffer, LDATA("foo")));
ASSERT(buffer.size == 3);
ASSERT(!nettle_buffer_write(&buffer, LDATA("bar")));
SUCCESS();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment