diff options
author | David Robillard <d@drobilla.net> | 2020-12-26 19:22:03 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-31 14:15:00 +0100 |
commit | 31cc05d5ef6e840ebe2b4c265f374f913f4758cc (patch) | |
tree | 87302811f8df1f16e0bd4785ff405906a993b7d0 /test/test_reload_bundle.c | |
parent | 7a51f0b8e95d29b5e053db97bf72094e847ee7ef (diff) | |
download | lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.tar.gz lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.tar.bz2 lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.zip |
Format all code with clang-format
Diffstat (limited to 'test/test_reload_bundle.c')
-rw-r--r-- | test/test_reload_bundle.c | 125 |
1 files changed, 62 insertions, 63 deletions
diff --git a/test/test_reload_bundle.c b/test/test_reload_bundle.c index 19644ff..888f601 100644 --- a/test/test_reload_bundle.c +++ b/test/test_reload_bundle.c @@ -26,67 +26,66 @@ int main(void) { - LilvTestEnv* const env = lilv_test_env_new(); - LilvWorld* const world = env->world; - - // Create a simple plugin bundle - create_bundle(env, - ":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT - "> ; rdfs:seeAlso <plugin.ttl> .\n", - ":plug a lv2:Plugin ; " - "doap:name \"First name\" ."); - - lilv_world_load_specifications(world); - - // Load bundle - LilvNode* bundle_uri = lilv_new_uri(world, env->test_bundle_uri); - lilv_world_load_bundle(world, bundle_uri); - - // Check that plugin is present - const LilvPlugins* plugins = lilv_world_get_all_plugins(world); - const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri); - assert(plug); - - // Check that plugin name is correct - LilvNode* name = lilv_plugin_get_name(plug); - assert(!strcmp(lilv_node_as_string(name), "First name")); - lilv_node_free(name); - - // Unload bundle from world and delete it - lilv_world_unload_bundle(world, bundle_uri); - delete_bundle(env); - - // Create a new version of the same bundle, but with a different name - create_bundle(env, - ":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT - "> ; rdfs:seeAlso <plugin.ttl> .\n", - ":plug a lv2:Plugin ; " - "doap:name \"Second name\" ."); - - // Check that plugin is no longer in the world's plugin list - assert(lilv_plugins_size(plugins) == 0); - - // Load new bundle - lilv_world_load_bundle(world, bundle_uri); - - // Check that plugin is present again and is the same LilvPlugin - const LilvPlugin* plug2 = - lilv_plugins_get_by_uri(plugins, env->plugin1_uri); - assert(plug2); - assert(plug2 == plug); - - // Check that plugin now has new name - LilvNode* name2 = lilv_plugin_get_name(plug2); - assert(name2); - assert(!strcmp(lilv_node_as_string(name2), "Second name")); - lilv_node_free(name2); - - // Load new bundle again (noop) - lilv_world_load_bundle(world, bundle_uri); - - lilv_node_free(bundle_uri); - delete_bundle(env); - lilv_test_env_free(env); - - return 0; + LilvTestEnv* const env = lilv_test_env_new(); + LilvWorld* const world = env->world; + + // Create a simple plugin bundle + create_bundle(env, + ":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT + "> ; rdfs:seeAlso <plugin.ttl> .\n", + ":plug a lv2:Plugin ; " + "doap:name \"First name\" ."); + + lilv_world_load_specifications(world); + + // Load bundle + LilvNode* bundle_uri = lilv_new_uri(world, env->test_bundle_uri); + lilv_world_load_bundle(world, bundle_uri); + + // Check that plugin is present + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri); + assert(plug); + + // Check that plugin name is correct + LilvNode* name = lilv_plugin_get_name(plug); + assert(!strcmp(lilv_node_as_string(name), "First name")); + lilv_node_free(name); + + // Unload bundle from world and delete it + lilv_world_unload_bundle(world, bundle_uri); + delete_bundle(env); + + // Create a new version of the same bundle, but with a different name + create_bundle(env, + ":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT + "> ; rdfs:seeAlso <plugin.ttl> .\n", + ":plug a lv2:Plugin ; " + "doap:name \"Second name\" ."); + + // Check that plugin is no longer in the world's plugin list + assert(lilv_plugins_size(plugins) == 0); + + // Load new bundle + lilv_world_load_bundle(world, bundle_uri); + + // Check that plugin is present again and is the same LilvPlugin + const LilvPlugin* plug2 = lilv_plugins_get_by_uri(plugins, env->plugin1_uri); + assert(plug2); + assert(plug2 == plug); + + // Check that plugin now has new name + LilvNode* name2 = lilv_plugin_get_name(plug2); + assert(name2); + assert(!strcmp(lilv_node_as_string(name2), "Second name")); + lilv_node_free(name2); + + // Load new bundle again (noop) + lilv_world_load_bundle(world, bundle_uri); + + lilv_node_free(bundle_uri); + delete_bundle(env); + lilv_test_env_free(env); + + return 0; } |