diff options
author | David Robillard <d@drobilla.net> | 2022-10-02 18:19:49 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:07 -0500 |
commit | 8c4e3097517e95c8c6ff67f0a972525bfeb3bb1d (patch) | |
tree | 57f574d68cf73add1fa3eda2c1a6551f8b310957 /test | |
parent | 9c00583bd37522a4f1703bf289587b4546edcf53 (diff) | |
download | serd-8c4e3097517e95c8c6ff67f0a972525bfeb3bb1d.tar.gz serd-8c4e3097517e95c8c6ff67f0a972525bfeb3bb1d.tar.bz2 serd-8c4e3097517e95c8c6ff67f0a972525bfeb3bb1d.zip |
Add serd_world_get_blank()
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 1 | ||||
-rw-r--r-- | test/test_world.c | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index 0ee7cd23..efcb00f0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -128,6 +128,7 @@ unit_tests = [ 'string', 'syntax', 'uri', + 'world', 'writer', ] diff --git a/test/test_world.c b/test/test_world.c new file mode 100644 index 00000000..3f7f6ea6 --- /dev/null +++ b/test/test_world.c @@ -0,0 +1,35 @@ +// Copyright 2011-2020 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#undef NDEBUG + +#include "serd/node.h" +#include "serd/world.h" + +#include <assert.h> +#include <stdio.h> +#include <string.h> + +static void +test_get_blank(void) +{ + SerdWorld* world = serd_world_new(); + char expected[12]; + + for (unsigned i = 0; i < 32; ++i) { + const SerdNode* blank = serd_world_get_blank(world); + + snprintf(expected, sizeof(expected), "b%u", i + 1); + assert(!strcmp(serd_node_string(blank), expected)); + } + + serd_world_free(world); +} + +int +main(void) +{ + test_get_blank(); + + return 0; +} |