diff options
author | David Robillard <d@drobilla.net> | 2017-07-09 20:35:04 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-07-10 12:06:56 +0200 |
commit | 58f153dcdf1c5424ed3cefb3ce59e63b30f68f27 (patch) | |
tree | b89aa4845c399669cf2512bb139f19366945c67f /tests/serd_test.c | |
parent | 9c29938c172e2423f67925274a18b4f1c1bb42cf (diff) | |
download | serd-58f153dcdf1c5424ed3cefb3ce59e63b30f68f27.tar.gz serd-58f153dcdf1c5424ed3cefb3ce59e63b30f68f27.tar.bz2 serd-58f153dcdf1c5424ed3cefb3ce59e63b30f68f27.zip |
Reduce test code length
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r-- | tests/serd_test.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index 1eace3fd..6c854241 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -509,17 +509,11 @@ main(void) if (!serd_writer_set_base_uri(writer, &lit)) { return failure("Set base URI to %s\n", lit.buf); - } - - if (!serd_writer_set_prefix(writer, &lit, &lit)) { + } else if (!serd_writer_set_prefix(writer, &lit, &lit)) { return failure("Set prefix %s to %s\n", lit.buf, lit.buf); - } - - if (!serd_writer_end_anon(writer, NULL)) { + } else if (!serd_writer_end_anon(writer, NULL)) { return failure("Ended non-existent anonymous node\n"); - } - - if (serd_writer_get_env(writer) != env) { + } else if (serd_writer_get_env(writer) != env) { return failure("Writer has incorrect env\n"); } @@ -621,19 +615,16 @@ main(void) if (!serd_reader_read_file(reader, USTR("http://notafile"))) { return failure("Apparently read an http URI\n"); - } - if (!serd_reader_read_file(reader, USTR("file:///better/not/exist"))) { + } else if (!serd_reader_read_file(reader, USTR("file:///better/not/exist"))) { return failure("Apparently read a non-existent file\n"); - } - if (!serd_reader_read_file(reader, USTR("file://"))) { + } else if (!serd_reader_read_file(reader, USTR("file://"))) { return failure("Apparently read a file with no path\n"); } - SerdStatus st = serd_reader_read_file(reader, USTR(path)); + + const SerdStatus st = serd_reader_read_file(reader, USTR(path)); if (st) { return failure("Error reading file (%s)\n", serd_strerror(st)); - } - - if (rt->n_statements != 12) { + } else if (rt->n_statements != 12) { return failure("Bad statement count %d\n", rt->n_statements); } else if (!rt->graph || !rt->graph->buf || strcmp((const char*)rt->graph->buf, "http://example.org/")) { |