aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_read_chunk.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-26 19:23:13 +0100
committerDavid Robillard <d@drobilla.net>2020-12-31 13:25:56 +0100
commitd101d926946a5e8067a90d157b6553aae7bddc19 (patch)
treee997425e9f972e402830d9ab8cb65005068e9619 /test/test_read_chunk.c
parent8a93d0b3be5b6d80a1bef85bc73b2661f5ab4376 (diff)
downloadserd-d101d926946a5e8067a90d157b6553aae7bddc19.tar.gz
serd-d101d926946a5e8067a90d157b6553aae7bddc19.tar.bz2
serd-d101d926946a5e8067a90d157b6553aae7bddc19.zip
Format all code with clang-format
Diffstat (limited to 'test/test_read_chunk.c')
-rw-r--r--test/test_read_chunk.c117
1 files changed, 59 insertions, 58 deletions
diff --git a/test/test_read_chunk.c b/test/test_read_chunk.c
index cc9c2e19..2e7f2b0d 100644
--- a/test/test_read_chunk.c
+++ b/test/test_read_chunk.c
@@ -30,22 +30,22 @@ static size_t n_end = 0;
static SerdStatus
on_base(void* handle, const SerdNode* uri)
{
- (void)handle;
- (void)uri;
+ (void)handle;
+ (void)uri;
- ++n_base;
- return SERD_SUCCESS;
+ ++n_base;
+ return SERD_SUCCESS;
}
static SerdStatus
on_prefix(void* handle, const SerdNode* name, const SerdNode* uri)
{
- (void)handle;
- (void)name;
- (void)uri;
+ (void)handle;
+ (void)name;
+ (void)uri;
- ++n_prefix;
- return SERD_SUCCESS;
+ ++n_prefix;
+ return SERD_SUCCESS;
}
static SerdStatus
@@ -58,64 +58,65 @@ on_statement(void* handle,
const SerdNode* object_datatype,
const SerdNode* object_lang)
{
- (void)handle;
- (void)flags;
- (void)graph;
- (void)subject;
- (void)predicate;
- (void)object;
- (void)object_datatype;
- (void)object_lang;
-
- ++n_statement;
- return SERD_SUCCESS;
+ (void)handle;
+ (void)flags;
+ (void)graph;
+ (void)subject;
+ (void)predicate;
+ (void)object;
+ (void)object_datatype;
+ (void)object_lang;
+
+ ++n_statement;
+ return SERD_SUCCESS;
}
static SerdStatus
on_end(void* handle, const SerdNode* node)
{
- (void)handle;
- (void)node;
+ (void)handle;
+ (void)node;
- ++n_end;
- return SERD_SUCCESS;
+ ++n_end;
+ return SERD_SUCCESS;
}
int
main(void)
{
- FILE* file = tmpfile();
-
- fprintf(file,
- "@prefix eg: <http://example.org/> .\n"
- "@base <http://example.org/base> .\n"
- "eg:s1 eg:p1 eg:o1 ;\n"
- " eg:p2 eg:o2 ,\n"
- " eg:o3 .\n"
- "eg:s2 eg:p1 eg:o1 ;\n"
- " eg:p2 eg:o2 .\n"
- "eg:s3 eg:p1 eg:o1 .\n"
- "eg:s4 eg:p1 [ eg:p3 eg:o1 ] .\n");
-
- fseek(file, 0, SEEK_SET);
-
- SerdReader* reader = serd_reader_new(
- SERD_TURTLE, NULL, NULL, on_base, on_prefix, on_statement, on_end);
- assert(reader);
-
- assert(!serd_reader_start_stream(reader, file, NULL, true));
-
- assert(!serd_reader_read_chunk(reader) && n_prefix == 1);
- assert(!serd_reader_read_chunk(reader) && n_base == 1);
- assert(!serd_reader_read_chunk(reader) && n_statement == 3);
- assert(!serd_reader_read_chunk(reader) && n_statement == 5);
- assert(!serd_reader_read_chunk(reader) && n_statement == 6);
- assert(!serd_reader_read_chunk(reader) && n_statement == 8 && n_end == 1);
- assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
- assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
- assert(!serd_reader_end_stream(reader));
-
- serd_reader_free(reader);
- fclose(file);
- return 0;
+ FILE* file = tmpfile();
+
+ fprintf(file,
+ "@prefix eg: <http://example.org/> .\n"
+ "@base <http://example.org/base> .\n"
+ "eg:s1 eg:p1 eg:o1 ;\n"
+ " eg:p2 eg:o2 ,\n"
+ " eg:o3 .\n"
+ "eg:s2 eg:p1 eg:o1 ;\n"
+ " eg:p2 eg:o2 .\n"
+ "eg:s3 eg:p1 eg:o1 .\n"
+ "eg:s4 eg:p1 [ eg:p3 eg:o1 ] .\n");
+
+ fseek(file, 0, SEEK_SET);
+
+ SerdReader* reader = serd_reader_new(
+ SERD_TURTLE, NULL, NULL, on_base, on_prefix, on_statement, on_end);
+
+ assert(reader);
+ assert(!serd_reader_start_stream(reader, file, NULL, true));
+
+ assert(!serd_reader_read_chunk(reader) && n_prefix == 1);
+ assert(!serd_reader_read_chunk(reader) && n_base == 1);
+ assert(!serd_reader_read_chunk(reader) && n_statement == 3);
+ assert(!serd_reader_read_chunk(reader) && n_statement == 5);
+ assert(!serd_reader_read_chunk(reader) && n_statement == 6);
+ assert(!serd_reader_read_chunk(reader) && n_statement == 8 && n_end == 1);
+ assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
+ assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
+
+ assert(!serd_reader_end_stream(reader));
+ serd_reader_free(reader);
+ fclose(file);
+
+ return 0;
}