2017-11-06 14:44:10 +00:00
|
|
|
#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');
|
2017-11-27 19:03:34 +00:00
|
|
|
dst_buffer_push_cstring(buffer, " world!");
|
2017-11-06 14:44:10 +00:00
|
|
|
assert(dst_equals(
|
2017-11-27 19:03:34 +00:00
|
|
|
dst_wrap_string(dst_cstring("hello world!")),
|
2017-11-06 14:44:10 +00:00
|
|
|
dst_wrap_string(dst_string(buffer->data, buffer->count))
|
|
|
|
));
|
|
|
|
return 0;
|
|
|
|
}
|