From c4df0038bcfba1676bbaaa98badd241ec7d0b55e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 May 2018 17:56:27 +0200 Subject: Add serd_world_get_blank() --- test/meson.build | 1 + test/test_world.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 test/test_world.c (limited to 'test') 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 + + 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 +#include +#include + +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; +} -- cgit v1.2.1