1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-24 07:20:27 +00:00
janet/junkyard/buffer_test.c
bakpakin 2771171658 Much work on compiler. Fixing bugs and gradually cleaning
up code. Generalized some vector code.
2018-01-05 16:17:55 -05:00

21 lines
578 B
C

#include "unit.h"
#include <dst/dst.h>
int main() {
dst_init();
DstBuffer *buffer = dst_buffer(100);
assert(buffer->count == 0);
assert(buffer->capacity == 100);
dst_buffer_push_u8(buffer, 'h');
dst_buffer_push_u8(buffer, 'e');
dst_buffer_push_u8(buffer, 'l');
dst_buffer_push_u8(buffer, 'l');
dst_buffer_push_u8(buffer, 'o');
dst_buffer_push_cstring(buffer, " world!");
assert(dst_equals(
dst_wrap_string(dst_cstring("hello world!")),
dst_wrap_string(dst_string(buffer->data, buffer->count))
));
return 0;
}