diff options
author | David Robillard <d@drobilla.net> | 2021-07-22 23:39:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-14 19:37:51 -0500 |
commit | a63a8f19c54dfee75e092819d6622b8d36fe1d39 (patch) | |
tree | 3c2fe49c257e27d369365a0c08c1524baaf74a4c /test/test_node_syntax.c | |
parent | 64e81dfd6ec04995fd396269deb6b32fe2d1192d (diff) | |
download | serd-a63a8f19c54dfee75e092819d6622b8d36fe1d39.tar.gz serd-a63a8f19c54dfee75e092819d6622b8d36fe1d39.tar.bz2 serd-a63a8f19c54dfee75e092819d6622b8d36fe1d39.zip |
Expose low-level node construction API
Diffstat (limited to 'test/test_node_syntax.c')
-rw-r--r-- | test/test_node_syntax.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/test/test_node_syntax.c b/test/test_node_syntax.c index 26b57ff1..a9829688 100644 --- a/test/test_node_syntax.c +++ b/test/test_node_syntax.c @@ -47,8 +47,8 @@ test_common(const SerdSyntax syntax) static const SerdStringView datatype = SERD_STRING("http://example.org/Datatype"); - SerdNode* const num_type = - serd_new_uri(SERD_STRING("http://example.org/Decimal")); + static const SerdStringView num_type = + SERD_STRING("http://example.org/Decimal"); assert(test(syntax, serd_new_string(SERD_STRING("node")), "\"node\"")); @@ -61,18 +61,16 @@ test_common(const SerdSyntax syntax) serd_new_literal(SERD_STRING("X"), SERD_HAS_DATATYPE, datatype), "\"X\"^^<http://example.org/Datatype>")); - assert(test(syntax, serd_new_blank(SERD_STRING("blank")), "_:blank")); - assert(test(syntax, serd_new_blank(SERD_STRING("b0")), "_:b0")); + assert( + test(syntax, serd_new_token(SERD_BLANK, SERD_STRING("blank")), "_:blank")); + + assert(test(syntax, serd_new_token(SERD_BLANK, SERD_STRING("b0")), "_:b0")); assert(test(syntax, serd_new_uri(SERD_STRING("http://example.org/")), "<http://example.org/>")); assert(test(syntax, - serd_new_decimal(1.25, num_type), - "\"1.25\"^^<http://example.org/Decimal>")); - - assert(test(syntax, serd_new_double(1.25), "\"1.25E0\"^^<http://www.w3.org/2001/XMLSchema#double>")); @@ -86,10 +84,8 @@ test_common(const SerdSyntax syntax) assert( test(syntax, - serd_new_base64(data, sizeof(data), NULL), + serd_new_base64(data, sizeof(data), SERD_EMPTY_STRING()), "\"BAAAAAIAAAA=\"^^<http://www.w3.org/2001/XMLSchema#base64Binary>")); - - serd_node_free(num_type); } static void @@ -118,11 +114,11 @@ test_ntriples(void) } assert(test(SERD_NTRIPLES, - serd_new_decimal(1.25, NULL), + serd_new_decimal(1.25), "\"1.25\"^^<http://www.w3.org/2001/XMLSchema#decimal>")); assert(test(SERD_NTRIPLES, - serd_new_integer(1234, NULL), + serd_new_integer(1234, SERD_EMPTY_STRING()), "\"1234\"^^<http://www.w3.org/2001/XMLSchema#integer>")); assert(test(SERD_NTRIPLES, @@ -137,10 +133,20 @@ test_ntriples(void) static void test_turtle(void) { + static const SerdStringView xsd_integer = + SERD_STRING("http://www.w3.org/2001/XMLSchema#integer"); + test_common(SERD_TURTLE); + test(SERD_TURTLE, serd_new_uri(SERD_STRING("rel/uri")), "<rel/uri>"); - assert(test(SERD_TURTLE, serd_new_decimal(1.25, NULL), "1.25")); - assert(test(SERD_TURTLE, serd_new_integer(1234, NULL), "1234")); + + assert(test(SERD_TURTLE, serd_new_decimal(1.25), "1.25")); + + assert( + test(SERD_TURTLE, serd_new_integer(1234, SERD_EMPTY_STRING()), "1234")); + + assert(test(SERD_TURTLE, serd_new_integer(1234, xsd_integer), "1234")); + assert(test(SERD_TURTLE, serd_new_boolean(true), "true")); assert(test(SERD_TURTLE, serd_new_boolean(false), "false")); } |