diff options
author | David Robillard <d@drobilla.net> | 2012-03-03 21:13:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-03 21:13:53 +0000 |
commit | d0d2c13f9a86238cdb6235ac858e51a2469d0ed3 (patch) | |
tree | 4e659c65d7df331808e2a7d824013ba1265eaa70 /test | |
parent | ccca9167f350ab62e0b8adb529a238f61a0ec499 (diff) | |
download | lilv-d0d2c13f9a86238cdb6235ac858e51a2469d0ed3.tar.gz lilv-d0d2c13f9a86238cdb6235ac858e51a2469d0ed3.tar.bz2 lilv-d0d2c13f9a86238cdb6235ac858e51a2469d0ed3.zip |
Use a fully-fledged Atom serialisation API for state saving.
Add lilv_state_to_string().
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4018 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r-- | test/lilv_test.c | 37 | ||||
-rw-r--r-- | test/test_plugin.c | 4 |
2 files changed, 24 insertions, 17 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c index 43769a6..2352150 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -1180,11 +1180,15 @@ test_state(void) // Get instance state state LilvState* state = lilv_state_new_from_instance( - plugin, instance, &map, file_dir, copy_dir, link_dir, save_dir, get_port_value, world, 0, NULL); + plugin, instance, &map, + file_dir, copy_dir, link_dir, save_dir, + get_port_value, world, 0, NULL); // Get another instance state LilvState* state2 = lilv_state_new_from_instance( - plugin, instance, &map, file_dir, copy_dir, link_dir, save_dir, get_port_value, world, 0, NULL); + plugin, instance, &map, + file_dir, copy_dir, link_dir, save_dir, + get_port_value, world, 0, NULL); // Ensure they are equal TEST_ASSERT(lilv_state_equals(state, state2)); @@ -1204,7 +1208,9 @@ test_state(void) // Run and get a new instance state (which should now differ) lilv_instance_run(instance, 1); LilvState* state3 = lilv_state_new_from_instance( - plugin, instance, &map, file_dir, copy_dir, link_dir, save_dir, get_port_value, world, 0, NULL); + plugin, instance, &map, + file_dir, copy_dir, link_dir, save_dir, + get_port_value, world, 0, NULL); TEST_ASSERT(!lilv_state_equals(state2, state3)); // num_runs changed // Restore instance state to original state @@ -1212,23 +1218,26 @@ test_state(void) // Take a new snapshot and ensure it matches the set state LilvState* state4 = lilv_state_new_from_instance( - plugin, instance, &map, file_dir, copy_dir, link_dir, save_dir, get_port_value, world, 0, NULL); + plugin, instance, &map, + file_dir, copy_dir, link_dir, save_dir, + get_port_value, world, 0, NULL); TEST_ASSERT(lilv_state_equals(state2, state4)); // Save state to a directory - int ret = lilv_state_save(world, &unmap, state, NULL, - "./state.lv2", "state.ttl", NULL); + int ret = lilv_state_save(world, &map, &unmap, state, NULL, + "./state.lv2", "state.ttl"); TEST_ASSERT(!ret); // Load state from directory LilvState* state5 = lilv_state_new_from_file(world, &map, NULL, "./state.lv2/state.ttl"); + TEST_ASSERT(lilv_state_equals(state, state5)); // Round trip accuracy // Save state with URI to a directory const char* state_uri = "http://example.org/state"; - ret = lilv_state_save(world, &unmap, state, state_uri, - "./state6.lv2", "state6.ttl", NULL); + ret = lilv_state_save(world, &map, &unmap, state, state_uri, + "./state6.lv2", "state6.ttl"); TEST_ASSERT(!ret); // Load default bundle into world and load state from it @@ -1289,8 +1298,8 @@ test_state(void) TEST_ASSERT(!lilv_state_equals(fstate, fstate3)); // Save state to a directory - ret = lilv_state_save(world, &unmap, fstate, NULL, - "fstate.lv2", "fstate.ttl", ffeatures); + ret = lilv_state_save(world, &map, &unmap, fstate, NULL, + "fstate.lv2", "fstate.ttl"); TEST_ASSERT(!ret); // Load state from directory @@ -1309,8 +1318,8 @@ test_state(void) TEST_ASSERT(lilv_state_equals(fstate3, fstate5)); // Save state to a (different) directory again - ret = lilv_state_save(world, &unmap, fstate, NULL, - "./fstate6.lv2", "fstate6.ttl", ffeatures); + ret = lilv_state_save(world, &map, &unmap, fstate, NULL, + "./fstate6.lv2", "fstate6.ttl"); TEST_ASSERT(!ret); // Reload it and ensure it's identical to the other loaded version @@ -1329,8 +1338,8 @@ test_state(void) TEST_ASSERT(!lilv_state_equals(fstate6, fstate7)); // Save the changed state to a (different) directory again - ret = lilv_state_save(world, &unmap, fstate7, NULL, - "./fstate7.lv2", "fstate7.ttl", ffeatures); + ret = lilv_state_save(world, &map, &unmap, fstate7, NULL, + "./fstate7.lv2", "fstate7.ttl"); TEST_ASSERT(!ret); // Reload it and ensure it's changed diff --git a/test/test_plugin.c b/test/test_plugin.c index ea6d154..d125a7f 100644 --- a/test/test_plugin.c +++ b/test/test_plugin.c @@ -222,9 +222,7 @@ save(LV2_Handle instance, map_uri(plugin, NS_ATOM "Bool"), LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - const uint8_t blob[] = "This is a bunch of data that happens to be text" - " but could really be anything at all, lest you feel like cramming" - " all sorts of ridiculous binary stuff in Turtle"; + const uint8_t blob[] = "I am a blob of arbitrary data."; store(callback_data, map_uri(plugin, "http://example.org/blob"), blob, |