core: add hash and rope tests

This commit is contained in:
2025-04-11 14:01:47 +01:00
parent f67a55500b
commit aa24becb2f
2 changed files with 102 additions and 0 deletions

28
core-test/ropes.c Normal file
View File

@@ -0,0 +1,28 @@
#include <blue/core/rope.h>
#include <stdio.h>
int main(void)
{
b_rope a = B_ROPE_CHAR('a');
b_rope b = B_ROPE_CSTR_STATIC("Hello, world!");
b_rope c = B_ROPE_INT(-4096);
b_rope d = B_ROPE_UINT(4096);
b_rope str;
const b_rope *ropes[] = {
&a,
&b,
&c,
&d,
};
b_rope_join(&str, ropes, sizeof ropes / sizeof ropes[0]);
char cstr[1024];
b_rope_to_cstr(&str, cstr, sizeof cstr);
b_rope_destroy(&str);
printf("%s\n", cstr);
return 0;
}