From 994fb58c3380949c8c63bbf647e2ad936ba6b906 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 11 Jul 2016 11:04:12 -0400 Subject: Improve test coverage --- src/sord_test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/sord_test.c b/src/sord_test.c index c6e6a5b..5eeb6d6 100644 --- a/src/sord_test.c +++ b/src/sord_test.c @@ -403,6 +403,13 @@ main(int argc, char** argv) sord_node_free(world, badns); serd_env_free(env); + // Attempt to create node from garbage + SerdNode junk = SERD_NODE_NULL; + junk.type = 1234; + if (sord_node_from_serd_node(world, env, &junk, NULL, NULL)) { + return test_fail("Successfully created node from garbage serd node\n"); + } + // Attempt to create NULL node SordNode* nil_node = sord_node_from_serd_node( world, NULL, &SERD_NODE_NULL, NULL, NULL); @@ -656,6 +663,9 @@ main(int argc, char** argv) } sord_iter_free(iter); + // Test double remove (silent success) + sord_remove(sord, tup); + // Load a couple graphs SordNode* graph42 = uri(world, 42); SordNode* graph43 = uri(world, 43); @@ -674,6 +684,11 @@ main(int argc, char** argv) } sord_iter_free(iter); + iter = sord_begin(sord); + if (!sord_erase(sord, iter)) { + return test_fail("Succesfully erased iterator on empty model\n"); + } + // Ensure only the other graph is left SordQuad quad; SordQuad pat = { 0, 0, 0, graph42 }; -- cgit v1.2.1