aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_nodes.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-08-30 20:43:05 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d (patch)
treed7be35c7b4b3d466049352f2975e2c88c298f4b8 /test/test_nodes.c
parentb13ad41a4d65b577b4db67660a9edf3056bdf7af (diff)
downloadserd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.tar.gz
serd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.tar.bz2
serd-258ea2ff59bbd2127ea446cf4b9676ad3d7fe53d.zip
Use ZixStringView directly
Diffstat (limited to 'test/test_nodes.c')
-rw-r--r--test/test_nodes.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/test/test_nodes.c b/test/test_nodes.c
index 7c2c8508..b220f6d7 100644
--- a/test/test_nodes.c
+++ b/test/test_nodes.c
@@ -8,15 +8,16 @@
#include "serd/memory.h"
#include "serd/node.h"
#include "serd/nodes.h"
-#include "serd/string_view.h"
#include "serd/uri.h"
#include "serd/value.h"
+#include "zix/string_view.h"
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
+#define NS_EG "http://example.org/"
#define NS_XSD "http://www.w3.org/2001/XMLSchema#"
static void
@@ -98,7 +99,7 @@ test_intern(void)
static void
test_string(void)
{
- const SerdStringView string = serd_string("string");
+ static const ZixStringView string = ZIX_STATIC_STRING("string");
SerdAllocator* const allocator = serd_default_allocator();
@@ -115,7 +116,7 @@ test_string(void)
assert(!strcmp(serd_node_string(node), string.data));
const SerdNode* const long_node = serd_nodes_get(
- nodes, serd_a_literal(string, SERD_IS_LONG, serd_empty_string()));
+ nodes, serd_a_literal(string, SERD_IS_LONG, zix_empty_string()));
assert(long_node);
assert(long_node != node);
@@ -137,19 +138,19 @@ test_invalid_literal(void)
SerdNodes* const nodes = serd_nodes_new(allocator);
assert(!serd_nodes_get(nodes,
- serd_a_literal(serd_string("double meta"),
+ serd_a_literal(zix_string("double meta"),
SERD_HAS_LANGUAGE | SERD_HAS_DATATYPE,
- serd_string("What am I?"))));
+ zix_string("What am I?"))));
assert(!serd_nodes_get(nodes,
- serd_a_literal(serd_string("empty language"),
+ serd_a_literal(zix_string("empty language"),
SERD_HAS_LANGUAGE,
- serd_empty_string())));
+ zix_empty_string())));
assert(!serd_nodes_get(nodes,
- serd_a_literal(serd_string("empty datatype"),
+ serd_a_literal(zix_string("empty datatype"),
SERD_HAS_DATATYPE,
- serd_empty_string())));
+ zix_empty_string())));
serd_nodes_free(nodes);
}
@@ -157,8 +158,8 @@ test_invalid_literal(void)
static void
test_plain_literal(void)
{
- const SerdStringView string = serd_string("string");
- const SerdStringView language = serd_string("en");
+ static const ZixStringView string = ZIX_STATIC_STRING("string");
+ static const ZixStringView language = ZIX_STATIC_STRING("en");
SerdAllocator* const allocator = serd_default_allocator();
@@ -191,7 +192,7 @@ test_plain_literal(void)
assert(long_version != node);
const SerdNode* const other =
- serd_nodes_get(nodes, serd_a_plain_literal(string, serd_string("de")));
+ serd_nodes_get(nodes, serd_a_plain_literal(string, zix_string("de")));
assert(other != node);
@@ -210,8 +211,8 @@ test_plain_literal(void)
static void
test_typed_literal(void)
{
- const SerdStringView string = serd_string("string");
- const SerdStringView datatype = serd_string("http://example.org/Type");
+ static const ZixStringView string = ZIX_STATIC_STRING("string");
+ static const ZixStringView datatype = ZIX_STATIC_STRING(NS_EG "Type");
SerdAllocator* const allocator = serd_default_allocator();
@@ -395,7 +396,7 @@ test_base64(void)
static void
test_uri(void)
{
- const SerdStringView string = serd_string("http://example.org/");
+ static const ZixStringView string = ZIX_STATIC_STRING("http://example.org/");
SerdAllocator* const allocator = serd_default_allocator();
SerdNodes* const nodes = serd_nodes_new(allocator);
@@ -416,7 +417,7 @@ test_uri(void)
static void
test_parsed_uri(void)
{
- const SerdStringView string = serd_string("http://example.org/");
+ static const ZixStringView string = ZIX_STATIC_STRING("http://example.org/");
SerdAllocator* const allocator = serd_default_allocator();
@@ -436,8 +437,8 @@ test_parsed_uri(void)
assert(alias == node);
- const SerdNode* const other = serd_nodes_get(
- nodes, serd_a_parsed_uri(serd_parse_uri("http://example.org/x")));
+ const SerdNode* const other =
+ serd_nodes_get(nodes, serd_a_parsed_uri(serd_parse_uri(NS_EG "x")));
assert(other != node);
@@ -449,17 +450,19 @@ test_file_uri(void)
{
SerdAllocator* const allocator = serd_default_allocator();
- const SerdStringView local_string = serd_string("file:///d/f.txt");
- const SerdStringView local_path = serd_string("/d/f.txt");
- const SerdStringView remote_host = serd_string("server");
- const SerdStringView remote_string = serd_string("file://server/d/f.txt");
+ static const ZixStringView local_string =
+ ZIX_STATIC_STRING("file:///d/f.txt");
+ static const ZixStringView local_path = ZIX_STATIC_STRING("/d/f.txt");
+ static const ZixStringView remote_host = ZIX_STATIC_STRING("s");
+ static const ZixStringView remote_string =
+ ZIX_STATIC_STRING("file://s/d/f.txt");
SerdNodes* const nodes = serd_nodes_new(allocator);
const SerdNode* const local_uri =
serd_nodes_get(nodes, serd_a_uri(local_string));
const SerdNode* const local_file_uri =
- serd_nodes_get(nodes, serd_a_file_uri(local_path, serd_empty_string()));
+ serd_nodes_get(nodes, serd_a_file_uri(local_path, zix_empty_string()));
assert(local_uri);
assert(local_file_uri);
@@ -492,7 +495,7 @@ test_file_uri(void)
static void
test_blank(void)
{
- const SerdStringView string = serd_string("b42");
+ static const ZixStringView string = ZIX_STATIC_STRING("b42");
SerdAllocator* const allocator = serd_default_allocator();