From ed67de4c9e7170b95b6bc798044c37be31b375f1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 6 Mar 2012 21:37:14 +0000 Subject: Add lilv_state_new_from_string(). git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4024 a436a847-0d15-0410-975c-d299462d15a1 --- test/lilv_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/lilv_test.c b/test/lilv_test.c index db2dca5..1031685 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -1206,6 +1206,16 @@ test_state(void) // Ensure they are equal TEST_ASSERT(lilv_state_equals(state, state2)); + // Save state to a string + char* state1_str = lilv_state_to_string( + world, &map, &unmap, state, "http://example.org/state1"); + + // Restore from string + LilvState* from_str = lilv_state_new_from_string(world, &map, state1_str); + + // Ensure they are equal + TEST_ASSERT(lilv_state_equals(state, from_str)); + const LilvNode* state_plugin_uri = lilv_state_get_plugin_uri(state); TEST_ASSERT(lilv_node_equals(state_plugin_uri, plugin_uri)); @@ -1367,6 +1377,7 @@ test_state(void) lilv_node_free(num); lilv_state_free(state); + lilv_state_free(from_str); lilv_state_free(state2); lilv_state_free(state3); lilv_state_free(state4); -- cgit v1.2.1