aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_model.c8
-rw-r--r--test/test_node.c21
-rw-r--r--test/test_node_syntax.c24
-rw-r--r--test/test_nodes.c26
4 files changed, 17 insertions, 62 deletions
diff --git a/test/test_model.c b/test/test_model.c
index 827bd638..59fbbe2a 100644
--- a/test/test_model.c
+++ b/test/test_model.c
@@ -1300,9 +1300,9 @@ test_write_error_in_list_subject(SerdWorld* world, const unsigned n_quads)
const SerdNode* o = serd_nodes_uri(nodes, SERD_STRING("urn:o"));
const SerdNode* l1 = serd_nodes_blank(nodes, SERD_STRING("l1"));
- const SerdNode* one = serd_nodes_integer(nodes, 1, SERD_EMPTY_STRING());
+ const SerdNode* one = serd_nodes_integer(nodes, 1);
const SerdNode* l2 = serd_nodes_blank(nodes, SERD_STRING("l2"));
- const SerdNode* two = serd_nodes_integer(nodes, 2, SERD_EMPTY_STRING());
+ const SerdNode* two = serd_nodes_integer(nodes, 2);
const SerdNode* rdf_first = serd_nodes_uri(nodes, SERD_STRING(RDF_FIRST));
const SerdNode* rdf_rest = serd_nodes_uri(nodes, SERD_STRING(RDF_REST));
@@ -1356,9 +1356,9 @@ test_write_error_in_list_object(SerdWorld* world, const unsigned n_quads)
const SerdNode* p = serd_nodes_uri(nodes, SERD_STRING("urn:p"));
const SerdNode* l1 = serd_nodes_blank(nodes, SERD_STRING("l1"));
- const SerdNode* one = serd_nodes_integer(nodes, 1, SERD_EMPTY_STRING());
+ const SerdNode* one = serd_nodes_integer(nodes, 1);
const SerdNode* l2 = serd_nodes_blank(nodes, SERD_STRING("l2"));
- const SerdNode* two = serd_nodes_integer(nodes, 2, SERD_EMPTY_STRING());
+ const SerdNode* two = serd_nodes_integer(nodes, 2);
const SerdNode* rdf_first = serd_nodes_uri(nodes, SERD_STRING(RDF_FIRST));
const SerdNode* rdf_rest = serd_nodes_uri(nodes, SERD_STRING(RDF_REST));
diff --git a/test/test_node.c b/test/test_node.c
index 5c053294..c1d39053 100644
--- a/test/test_node.c
+++ b/test/test_node.c
@@ -207,8 +207,7 @@ test_get_double(void)
assert(isnan(serd_get_double(invalid)));
serd_node_free(NULL, invalid);
- SerdNode* const base64 =
- serd_new_base64(NULL, blob, sizeof(blob), SERD_EMPTY_STRING());
+ SerdNode* const base64 = serd_new_base64(NULL, blob, sizeof(blob));
assert(isnan(serd_get_double(base64)));
serd_node_free(NULL, base64);
@@ -288,15 +287,12 @@ test_get_float(void)
static void
test_integer(void)
{
- assert(!serd_new_integer(NULL, 42, SERD_STRING("notauri")));
-
const int64_t test_values[] = {0, -0, -23, 23, -12340, 1000, -1000};
const char* test_strings[] = {
"0", "0", "-23", "23", "-12340", "1000", "-1000"};
for (size_t i = 0; i < sizeof(test_values) / sizeof(double); ++i) {
- SerdNode* node =
- serd_new_integer(NULL, test_values[i], SERD_EMPTY_STRING());
+ SerdNode* node = serd_new_integer(NULL, test_values[i]);
const char* node_str = serd_node_string(node);
assert(!strcmp(node_str, test_strings[i]));
const size_t len = strlen(node_str);
@@ -341,8 +337,7 @@ test_get_integer(void)
static void
test_base64(void)
{
- assert(!serd_new_base64(NULL, &SERD_URI_NULL, 1, SERD_STRING("notauri")));
- assert(!serd_new_base64(NULL, &SERD_URI_NULL, 0, SERD_EMPTY_STRING()));
+ assert(!serd_new_base64(NULL, &SERD_URI_NULL, 0));
// Test valid base64 blobs with a range of sizes
for (size_t size = 1; size < 256; ++size) {
@@ -351,7 +346,7 @@ test_base64(void)
data[i] = (uint8_t)((size + i) % 256);
}
- SerdNode* blob = serd_new_base64(NULL, data, size, SERD_EMPTY_STRING());
+ SerdNode* blob = serd_new_base64(NULL, data, size);
const char* blob_str = serd_node_string(blob);
const size_t max_size = serd_get_base64_size(blob);
uint8_t* out = (uint8_t*)calloc(1, max_size);
@@ -599,10 +594,8 @@ test_compare(void)
SerdNode* hello = serd_new_string(NULL, SERD_STRING("Hello"));
SerdNode* universe = serd_new_string(NULL, SERD_STRING("Universe"));
- SerdNode* integer = serd_new_integer(NULL, 4, SERD_EMPTY_STRING());
- SerdNode* short_integer =
- serd_new_integer(NULL, 4, SERD_STRING(NS_XSD "short"));
- SerdNode* blank = serd_new_token(NULL, SERD_BLANK, SERD_STRING("b1"));
+ SerdNode* integer = serd_new_integer(NULL, 4);
+ SerdNode* blank = serd_new_token(NULL, SERD_BLANK, SERD_STRING("b1"));
SerdNode* uri = serd_new_uri(NULL, SERD_STRING("http://example.org/"));
@@ -627,12 +620,10 @@ test_compare(void)
// If literal strings are the same, languages or datatypes are compared
assert(serd_node_compare(angst, angst_de) < 0);
assert(serd_node_compare(angst_de, angst_en) < 0);
- assert(serd_node_compare(integer, short_integer) < 0);
assert(serd_node_compare(aardvark, badger) < 0);
serd_node_free(NULL, uri);
serd_node_free(NULL, blank);
- serd_node_free(NULL, short_integer);
serd_node_free(NULL, integer);
serd_node_free(NULL, badger);
serd_node_free(NULL, aardvark);
diff --git a/test/test_node_syntax.c b/test/test_node_syntax.c
index 582ba8aa..09037363 100644
--- a/test/test_node_syntax.c
+++ b/test/test_node_syntax.c
@@ -92,9 +92,6 @@ test_common(SerdWorld* const world, const SerdSyntax syntax)
static const SerdStringView datatype =
SERD_STRING("http://example.org/Datatype");
- static const SerdStringView num_type =
- SERD_STRING("http://example.org/Decimal");
-
assert(check(
world, syntax, serd_new_string(NULL, SERD_STRING("node")), "\"node\""));
@@ -141,15 +138,10 @@ test_common(SerdWorld* const world, const SerdSyntax syntax)
serd_new_float(NULL, 1.25),
"\"1.25E0\"^^<http://www.w3.org/2001/XMLSchema#float>"));
- assert(check(world,
- syntax,
- serd_new_integer(NULL, 1234, num_type),
- "\"1234\"^^<http://example.org/Decimal>"));
-
assert(
check(world,
syntax,
- serd_new_base64(NULL, data, sizeof(data), SERD_EMPTY_STRING()),
+ serd_new_base64(NULL, data, sizeof(data)),
"\"BAAAAAIAAAA=\"^^<http://www.w3.org/2001/XMLSchema#base64Binary>"));
}
@@ -189,7 +181,7 @@ test_ntriples(void)
assert(check(world,
SERD_NTRIPLES,
- serd_new_integer(NULL, 1234, SERD_EMPTY_STRING()),
+ serd_new_integer(NULL, 1234),
"\"1234\"^^<http://www.w3.org/2001/XMLSchema#integer>"));
assert(check(world,
@@ -208,9 +200,6 @@ test_ntriples(void)
static void
test_turtle(void)
{
- static const SerdStringView xsd_integer =
- SERD_STRING("http://www.w3.org/2001/XMLSchema#integer");
-
SerdWorld* const world = serd_world_new(NULL);
test_common(world, SERD_TURTLE);
@@ -221,14 +210,7 @@ test_turtle(void)
"<rel/uri>");
assert(check(world, SERD_TURTLE, serd_new_decimal(NULL, 1.25), "1.25"));
-
- assert(check(world,
- SERD_TURTLE,
- serd_new_integer(NULL, 1234, SERD_EMPTY_STRING()),
- "1234"));
-
- assert(check(
- world, SERD_TURTLE, serd_new_integer(NULL, 1234, xsd_integer), "1234"));
+ assert(check(world, SERD_TURTLE, serd_new_integer(NULL, 1234), "1234"));
assert(check(world, SERD_TURTLE, serd_new_boolean(NULL, true), "true"));
assert(check(world, SERD_TURTLE, serd_new_boolean(NULL, false), "false"));
diff --git a/test/test_nodes.c b/test/test_nodes.c
index 2cdfbc3c..19dcee01 100644
--- a/test/test_nodes.c
+++ b/test/test_nodes.c
@@ -321,11 +321,8 @@ test_integer(void)
SerdNodes* const nodes = serd_nodes_new(allocator);
- const SerdNode* const a =
- serd_nodes_integer(nodes, -1234567890, SERD_EMPTY_STRING());
-
- const SerdNode* const b =
- serd_nodes_integer(nodes, -1234567890, SERD_EMPTY_STRING());
+ const SerdNode* const a = serd_nodes_integer(nodes, -1234567890);
+ const SerdNode* const b = serd_nodes_integer(nodes, -1234567890);
assert(a == b);
assert(!strcmp(serd_node_string(a), "-1234567890"));
@@ -348,11 +345,8 @@ test_base64(void)
SerdNodes* const nodes = serd_nodes_new(allocator);
- const SerdNode* const a =
- serd_nodes_base64(nodes, &data, sizeof(data), SERD_EMPTY_STRING());
-
- const SerdNode* const b =
- serd_nodes_base64(nodes, &data, sizeof(data), SERD_EMPTY_STRING());
+ const SerdNode* const a = serd_nodes_base64(nodes, &data, sizeof(data));
+ const SerdNode* const b = serd_nodes_base64(nodes, &data, sizeof(data));
assert(a == b);
assert(!strcmp(serd_node_string(a), "Zm9vYmFy"));
@@ -363,18 +357,6 @@ test_base64(void)
assert(default_datatype);
assert(!strcmp(serd_node_string(default_datatype), NS_XSD "base64Binary"));
- const SerdStringView user_datatype =
- SERD_STRING("http://example.org/UserDatatype");
-
- const SerdNode* const custom =
- serd_nodes_base64(nodes, &data, sizeof(data), user_datatype);
- assert(custom);
- assert(!strcmp(serd_node_string(custom), "Zm9vYmFy"));
-
- const SerdNode* const custom_datatype = serd_node_datatype(custom);
- assert(custom_datatype);
- assert(!strcmp(serd_node_string(custom_datatype), user_datatype.buf));
-
serd_nodes_free(nodes);
}