summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-03-07 08:42:56 +0000
committerDavid Robillard <d@drobilla.net>2015-03-07 08:42:56 +0000
commit1b420b15b3c88ebbcd6789f78b69bd284e0a98f7 (patch)
tree2871ea66f0651b2a43ff98c6f107e1654ee3aeed /test
parentcd320a7ccd392a5da2df31ec5edc9b07db5befab (diff)
downloadlilv-1b420b15b3c88ebbcd6789f78b69bd284e0a98f7.tar.gz
lilv-1b420b15b3c88ebbcd6789f78b69bd284e0a98f7.tar.bz2
lilv-1b420b15b3c88ebbcd6789f78b69bd284e0a98f7.zip
Add support for state deletion.
Add lilv_node_get_path(). Add lilv_state_get_uri(). Add lilv_state_delete(). Fix creation of duplicate manifest entries when saving state. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5617 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/lilv_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index a1b8f04..c40dc76 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -245,6 +245,7 @@ test_value(void)
TEST_ASSERT(lilv_node_is_literal(sval));
TEST_ASSERT(lilv_node_is_literal(ival));
TEST_ASSERT(lilv_node_is_literal(fval));
+ TEST_ASSERT(!lilv_node_get_path(fval, NULL));
TEST_ASSERT(!strcmp(lilv_node_as_uri(uval), "http://example.org"));
TEST_ASSERT(!strcmp(lilv_node_as_string(sval), "Foo"));
@@ -1523,6 +1524,12 @@ test_state(void)
// Ensure they are equal
TEST_ASSERT(lilv_state_equals(state, state2));
+ // Check that we can't delete unsaved state
+ TEST_ASSERT(lilv_state_delete(world, state));
+
+ // Check that state has no URI
+ TEST_ASSERT(!lilv_state_get_uri(state));
+
// Check that we can't save a state with no URI
char* bad_state_str = lilv_state_to_string(
world, &map, &unmap, state, NULL, NULL);
@@ -1603,6 +1610,11 @@ test_state(void)
LilvState* state6 = lilv_state_new_from_world(world, &map, test_state_node);
TEST_ASSERT(lilv_state_equals(state, state6)); // Round trip accuracy
+ // Check that loaded state has correct URI
+ TEST_ASSERT(lilv_state_get_uri(state6));
+ TEST_ASSERT(!strcmp(lilv_node_as_string(lilv_state_get_uri(state6)),
+ state_uri));
+
lilv_world_unload_resource(world, test_state_node);
lilv_world_unload_bundle(world, test_state_bundle);
@@ -1712,6 +1724,9 @@ test_state(void)
TEST_ASSERT(lilv_state_equals(fstate72, fstate7));
TEST_ASSERT(!lilv_state_equals(fstate6, fstate72));
+ // Delete saved state
+ lilv_state_delete(world, fstate7);
+
lilv_instance_deactivate(instance);
lilv_instance_free(instance);