diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 1 | ||||
-rw-r--r-- | test/test_world.c | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index 978bc779..05701f42 100644 --- a/test/meson.build +++ b/test/meson.build @@ -14,6 +14,7 @@ unit_tests = [ 'sink', 'string', 'uri', + 'world', 'writer', ] diff --git a/test/test_world.c b/test/test_world.c new file mode 100644 index 00000000..a7728037 --- /dev/null +++ b/test/test_world.c @@ -0,0 +1,47 @@ +/* + Copyright 2011-2020 David Robillard <d@drobilla.net> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#undef NDEBUG + +#include "serd/serd.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; +} |