summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-03 20:57:48 +0000
committerDavid Robillard <d@drobilla.net>2012-01-03 20:57:48 +0000
commitd1e9dbbba3b4bb91506ad0dab1f7a0e833ac8d36 (patch)
tree2ca1f5a370c63890f9a2110389350da3f89335a5 /test
parent01a8e74e7803f85932026b7214f3d4dc7ceb66cb (diff)
downloadlilv-d1e9dbbba3b4bb91506ad0dab1f7a0e833ac8d36.tar.gz
lilv-d1e9dbbba3b4bb91506ad0dab1f7a0e833ac8d36.tar.bz2
lilv-d1e9dbbba3b4bb91506ad0dab1f7a0e833ac8d36.zip
Improved coverage for plugin.c.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3911 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/lilv_test.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/lilv_test.c b/test/lilv_test.c
index 092029b..6751be4 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1151,6 +1151,70 @@ test_state(void)
lilv_node_free(bundle_uri);
lilv_world_free(world);
+
+ cleanup_uris();
+ return 1;
+}
+
+/*****************************************************************************/
+
+int
+test_bad_port_symbol(void)
+{
+ if (!start_bundle(MANIFEST_PREFIXES
+ ":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
+ BUNDLE_PREFIXES PREFIX_LV2EV
+ ":plug a lv2:Plugin ; "
+ PLUGIN_NAME("Test plugin") " ; "
+ LICENSE_GPL " ; "
+ "doap:homepage <http://example.org/someplug> ; "
+ "lv2:port [ "
+ " a lv2:ControlPort ; a lv2:InputPort ; "
+ " lv2:index 0 ; lv2:symbol \"0invalid\" ;"
+ " lv2:name \"Invalid\" ; "
+ "] ."))
+ return 0;
+
+ init_uris();
+
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+
+ uint32_t n_ports = lilv_plugin_get_num_ports(plug);
+ TEST_ASSERT(n_ports == 0);
+
+ cleanup_uris();
+ return 1;
+}
+
+/*****************************************************************************/
+
+int
+test_bad_port_index(void)
+{
+ if (!start_bundle(MANIFEST_PREFIXES
+ ":plug a lv2:Plugin ; lv2:binary <foo.so> ; rdfs:seeAlso <plugin.ttl> .\n",
+ BUNDLE_PREFIXES PREFIX_LV2EV
+ ":plug a lv2:Plugin ; "
+ PLUGIN_NAME("Test plugin") " ; "
+ LICENSE_GPL " ; "
+ "doap:homepage <http://example.org/someplug> ; "
+ "lv2:port [ "
+ " a lv2:ControlPort ; a lv2:InputPort ; "
+ " lv2:index \"notaninteger\" ; lv2:symbol \"invalid\" ;"
+ " lv2:name \"Invalid\" ; "
+ "] ."))
+ return 0;
+
+ init_uris();
+
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
+
+ uint32_t n_ports = lilv_plugin_get_num_ports(plug);
+ TEST_ASSERT(n_ports == 0);
+
+ cleanup_uris();
return 1;
}
@@ -1168,6 +1232,8 @@ static struct TestCase tests[] = {
TEST_CASE(port),
TEST_CASE(ui),
TEST_CASE(state),
+ TEST_CASE(bad_port_symbol),
+ TEST_CASE(bad_port_index),
{ NULL, NULL }
};