summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-12-13 19:50:44 +0000
committerDavid Robillard <d@drobilla.net>2008-12-13 19:50:44 +0000
commitc8a89182621aebc9ce5cf65d72a64d08f118fc1b (patch)
treee7386392c6adec4d41fe2dec9c16ee7567fd37d3 /test
parent295faf6ffa2df8adc0a78f12906d2f9e1595641e (diff)
downloadlilv-c8a89182621aebc9ce5cf65d72a64d08f118fc1b.tar.gz
lilv-c8a89182621aebc9ce5cf65d72a64d08f118fc1b.tar.bz2
lilv-c8a89182621aebc9ce5cf65d72a64d08f118fc1b.zip
Test querying for float values.
Fix slv2_plugin_get_value_for_subject test. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@1868 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/slv2_test.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/slv2_test.c b/test/slv2_test.c
index 8484961..7a2abc6 100644
--- a/test/slv2_test.c
+++ b/test/slv2_test.c
@@ -574,6 +574,7 @@ test_plugin()
LICENSE_GPL " ; "
"lv2:optionalFeature lv2:hardRtCapable ; "
"lv2:requiredFeature <http://lv2plug.in/ns/ext/event> ; "
+ ":foo 1.6180 ; "
"doap:maintainer [ foaf:name \"David Robillard\" ; "
" foaf:homepage <http://drobilla.net> ; foaf:mbox <mailto:dave@drobilla.net> ] ; "
"lv2:port [ "
@@ -669,6 +670,13 @@ test_plugin()
TEST_ASSERT(slv2_values_size(supported) == 2);
TEST_ASSERT(slv2_values_size(required) == 1);
TEST_ASSERT(slv2_values_size(optional) == 1);
+
+ SLV2Value foo_p = slv2_value_new_uri(world, "http://example.org/foo");
+ SLV2Values foos = slv2_plugin_get_value(plug, foo_p);
+ TEST_ASSERT(slv2_values_size(foos) == 1);
+ TEST_ASSERT(fabs(slv2_value_as_float(slv2_values_get_at(foos, 0)) - 1.6180) < FLT_EPSILON);
+ slv2_value_free(foo_p);
+ slv2_values_free(foos);
SLV2Value author_name = slv2_plugin_get_author_name(plug);
TEST_ASSERT(!strcmp(slv2_value_as_string(author_name), "David Robillard"));
@@ -684,12 +692,15 @@ test_plugin()
SLV2Value thing_uri = slv2_value_new_uri(world, "http://example.org/thing");
SLV2Value name_p = slv2_value_new_uri(world, "http://usefulinc.com/ns/doap#name");
- SLV2Value thing_name = slv2_plugin_get_value_for_subject(plug, thing_uri, name_p);
- //TEST_ASSERT(!strcmp(slv2_value_as_string(thing_name), "Something else"));
+ SLV2Values thing_names = slv2_plugin_get_value_for_subject(plug, thing_uri, name_p);
+ TEST_ASSERT(slv2_values_size(thing_names) == 1);
+ SLV2Value thing_name = slv2_values_get_at(thing_names, 0);
+ TEST_ASSERT(thing_name);
+ TEST_ASSERT(slv2_value_is_string(thing_name));
+ TEST_ASSERT(!strcmp(slv2_value_as_string(thing_name), "Something else"));
slv2_value_free(thing_uri);
slv2_value_free(name_p);
- //slv2_value_free(thing_name);
slv2_value_free(control_class);
slv2_value_free(audio_class);
slv2_value_free(in_class);