aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/test_node.c4
-rw-r--r--test/test_reader.c71
-rw-r--r--test/test_uri.c102
3 files changed, 76 insertions, 101 deletions
diff --git a/test/test_node.c b/test/test_node.c
index af14171b..09e9dfff 100644
--- a/test/test_node.c
+++ b/test/test_node.c
@@ -24,7 +24,7 @@
#endif
static void
-test_strtod(double dbl, double max_delta)
+check_strtod(double dbl, double max_delta)
{
char buf[1024];
snprintf(buf, sizeof(buf), "%f", dbl);
@@ -56,7 +56,7 @@ test_string_to_double(void)
const double delta = fabs(num - expt_test_nums[i]);
assert(delta <= DBL_EPSILON);
- test_strtod(expt_test_nums[i], DBL_EPSILON);
+ check_strtod(expt_test_nums[i], DBL_EPSILON);
}
}
diff --git a/test/test_reader.c b/test/test_reader.c
index 18794f9e..9e2edd17 100644
--- a/test/test_reader.c
+++ b/test/test_reader.c
@@ -26,7 +26,7 @@ typedef struct {
} ReaderTest;
static SerdStatus
-test_base_sink(void* const handle, const SerdNode* const uri)
+base_sink(void* const handle, const SerdNode* const uri)
{
(void)uri;
@@ -36,9 +36,9 @@ test_base_sink(void* const handle, const SerdNode* const uri)
}
static SerdStatus
-test_prefix_sink(void* const handle,
- const SerdNode* const name,
- const SerdNode* const uri)
+prefix_sink(void* const handle,
+ const SerdNode* const name,
+ const SerdNode* const uri)
{
(void)name;
(void)uri;
@@ -49,14 +49,14 @@ test_prefix_sink(void* const handle,
}
static SerdStatus
-test_statement_sink(void* const handle,
- SerdStatementFlags flags,
- const SerdNode* const graph,
- const SerdNode* const subject,
- const SerdNode* const predicate,
- const SerdNode* const object,
- const SerdNode* const object_datatype,
- const SerdNode* const object_lang)
+statement_sink(void* const handle,
+ SerdStatementFlags flags,
+ const SerdNode* const graph,
+ const SerdNode* const subject,
+ const SerdNode* const predicate,
+ const SerdNode* const object,
+ const SerdNode* const object_datatype,
+ const SerdNode* const object_lang)
{
(void)flags;
(void)graph;
@@ -72,7 +72,7 @@ test_statement_sink(void* const handle,
}
static SerdStatus
-test_end_sink(void* const handle, const SerdNode* const node)
+end_sink(void* const handle, const SerdNode* const node)
{
(void)node;
@@ -85,13 +85,8 @@ static void
test_read_string(void)
{
ReaderTest rt = {0, 0, 0, 0};
- SerdReader* const reader = serd_reader_new(SERD_TURTLE,
- &rt,
- NULL,
- test_base_sink,
- test_prefix_sink,
- test_statement_sink,
- test_end_sink);
+ SerdReader* const reader = serd_reader_new(
+ SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
assert(reader);
assert(serd_reader_get_handle(reader) == &rt);
@@ -167,13 +162,8 @@ test_read_eof_file(const char* const path)
fseek(f, 0L, SEEK_SET);
ReaderTest rt = {0, 0, 0, 0};
- SerdReader* const reader = serd_reader_new(SERD_TURTLE,
- &rt,
- NULL,
- test_base_sink,
- test_prefix_sink,
- test_statement_sink,
- test_end_sink);
+ SerdReader* const reader = serd_reader_new(
+ SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
fseek(f, 0L, SEEK_SET);
serd_reader_start_stream(reader, f, (const uint8_t*)"test", true);
@@ -198,13 +188,8 @@ static void
test_read_eof_by_byte(void)
{
ReaderTest rt = {0, 0, 0, 0};
- SerdReader* const reader = serd_reader_new(SERD_TURTLE,
- &rt,
- NULL,
- test_base_sink,
- test_prefix_sink,
- test_statement_sink,
- test_end_sink);
+ SerdReader* const reader = serd_reader_new(
+ SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
size_t n_reads = 0U;
serd_reader_start_source_stream(reader,
@@ -249,13 +234,8 @@ test_read_nquads_chunks(const char* const path)
fseek(f, 0, SEEK_SET);
ReaderTest rt = {0, 0, 0, 0};
- SerdReader* const reader = serd_reader_new(SERD_NQUADS,
- &rt,
- NULL,
- test_base_sink,
- test_prefix_sink,
- test_statement_sink,
- test_end_sink);
+ SerdReader* const reader = serd_reader_new(
+ SERD_NQUADS, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
assert(reader);
assert(serd_reader_get_handle(reader) == &rt);
@@ -330,13 +310,8 @@ test_read_turtle_chunks(const char* const path)
fseek(f, 0, SEEK_SET);
ReaderTest rt = {0, 0, 0, 0};
- SerdReader* const reader = serd_reader_new(SERD_TURTLE,
- &rt,
- NULL,
- test_base_sink,
- test_prefix_sink,
- test_statement_sink,
- test_end_sink);
+ SerdReader* const reader = serd_reader_new(
+ SERD_TURTLE, &rt, NULL, base_sink, prefix_sink, statement_sink, end_sink);
assert(reader);
assert(serd_reader_get_handle(reader) == &rt);
diff --git a/test/test_uri.c b/test/test_uri.c
index fc5eab71..94669ad5 100644
--- a/test/test_uri.c
+++ b/test/test_uri.c
@@ -37,11 +37,11 @@ test_uri_string_has_scheme(void)
}
static void
-test_file_uri(const char* const hostname,
- const char* const path,
- const bool escape,
- const char* const expected_uri,
- const char* expected_path)
+check_file_uri(const char* const hostname,
+ const char* const path,
+ const bool escape,
+ const char* const expected_uri,
+ const char* expected_path)
{
if (!expected_path) {
expected_path = path;
@@ -112,62 +112,62 @@ test_uri_to_path(void)
static void
test_uri_parsing(void)
{
- test_file_uri(NULL, "C:/My 100%", true, "file:///C:/My%20100%%", NULL);
- test_file_uri(NULL, "/foo/bar", true, "file:///foo/bar", NULL);
- test_file_uri("bhost", "/foo/bar", true, "file://bhost/foo/bar", NULL);
- test_file_uri(NULL, "a/relative path", false, "a/relative path", NULL);
- test_file_uri(
+ check_file_uri(NULL, "C:/My 100%", true, "file:///C:/My%20100%%", NULL);
+ check_file_uri(NULL, "/foo/bar", true, "file:///foo/bar", NULL);
+ check_file_uri("bhost", "/foo/bar", true, "file://bhost/foo/bar", NULL);
+ check_file_uri(NULL, "a/relative path", false, "a/relative path", NULL);
+ check_file_uri(
NULL, "a/relative <path>", true, "a/relative%20%3Cpath%3E", NULL);
#ifdef _WIN32
- test_file_uri(
+ check_file_uri(
NULL, "C:\\My 100%", true, "file:///C:/My%20100%%", "C:/My 100%");
- test_file_uri(NULL,
- "\\drive\\relative",
- true,
- "file:///drive/relative",
- "/drive/relative");
-
- test_file_uri(NULL,
- "C:\\Program Files\\Serd",
- true,
- "file:///C:/Program%20Files/Serd",
- "C:/Program Files/Serd");
-
- test_file_uri("ahost",
- "C:\\Pointless Space",
- true,
- "file://ahost/C:/Pointless%20Space",
- "C:/Pointless Space");
+ check_file_uri(NULL,
+ "\\drive\\relative",
+ true,
+ "file:///drive/relative",
+ "/drive/relative");
+
+ check_file_uri(NULL,
+ "C:\\Program Files\\Serd",
+ true,
+ "file:///C:/Program%20Files/Serd",
+ "C:/Program Files/Serd");
+
+ check_file_uri("ahost",
+ "C:\\Pointless Space",
+ true,
+ "file://ahost/C:/Pointless%20Space",
+ "C:/Pointless Space");
#else
/* What happens with Windows paths on other platforms is a bit weird, but
more or less unavoidable. It doesn't work to interpret backslashes as
path separators on any other platform. */
- test_file_uri("ahost",
- "C:\\Pointless Space",
- true,
- "file://ahost/C:%5CPointless%20Space",
- "/C:\\Pointless Space");
-
- test_file_uri(NULL,
- "\\drive\\relative",
- true,
- "%5Cdrive%5Crelative",
- "\\drive\\relative");
-
- test_file_uri(NULL,
- "C:\\Program Files\\Serd",
- true,
- "file:///C:%5CProgram%20Files%5CSerd",
- "/C:\\Program Files\\Serd");
-
- test_file_uri("ahost",
- "C:\\Pointless Space",
- true,
- "file://ahost/C:%5CPointless%20Space",
- "/C:\\Pointless Space");
+ check_file_uri("ahost",
+ "C:\\Pointless Space",
+ true,
+ "file://ahost/C:%5CPointless%20Space",
+ "/C:\\Pointless Space");
+
+ check_file_uri(NULL,
+ "\\drive\\relative",
+ true,
+ "%5Cdrive%5Crelative",
+ "\\drive\\relative");
+
+ check_file_uri(NULL,
+ "C:\\Program Files\\Serd",
+ true,
+ "file:///C:%5CProgram%20Files%5CSerd",
+ "/C:\\Program Files\\Serd");
+
+ check_file_uri("ahost",
+ "C:\\Pointless Space",
+ true,
+ "file://ahost/C:%5CPointless%20Space",
+ "/C:\\Pointless Space");
#endif
// Test tolerance of NULL hostname parameter