summaryrefslogtreecommitdiffstats
path: root/test/lib_descriptor.lv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-15 00:08:27 +0200
committerDavid Robillard <d@drobilla.net>2020-07-16 11:24:59 +0200
commitdd15498078a58c2fe9f71e1ceef1eb326c82d9e6 (patch)
treeb4c90b5fb1ed63f56156d0ef26d345a1308a69e8 /test/lib_descriptor.lv2
parentf115728a52eab27852af57ef8904419309ca52b4 (diff)
downloadlilv-dd15498078a58c2fe9f71e1ceef1eb326c82d9e6.tar.gz
lilv-dd15498078a58c2fe9f71e1ceef1eb326c82d9e6.tar.bz2
lilv-dd15498078a58c2fe9f71e1ceef1eb326c82d9e6.zip
Use standard assert for test expectations
The old one aborted anyway, and I've been using assert for tests in other projects for a while now, and never really missed having something more complex. The lack of a dependency or repetitive code is nice. Since the unit tests are about to be split up, the abort thing will become less of an issue anyway.
Diffstat (limited to 'test/lib_descriptor.lv2')
-rw-r--r--test/lib_descriptor.lv2/test_lib_descriptor.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c
index 6b6cb02..fc38fdc 100644
--- a/test/lib_descriptor.lv2/test_lib_descriptor.c
+++ b/test/lib_descriptor.lv2/test_lib_descriptor.c
@@ -1,8 +1,11 @@
+#undef NDEBUG
+
#include "../src/lilv_internal.h"
#include "serd/serd.h"
#include "lilv/lilv.h"
+#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -10,13 +13,6 @@
#define PLUGIN_URI "http://example.org/lib-descriptor"
-#define TEST_ASSERT(check) do {\
- if (!(check)) {\
- fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
- return 1;\
- }\
-} while (0)
-
int
main(int argc, char** argv)
{
@@ -40,21 +36,21 @@ main(int argc, char** argv)
LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
- TEST_ASSERT(plugin);
+ assert(plugin);
LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
- TEST_ASSERT(instance);
+ assert(instance);
lilv_instance_free(instance);
LilvNode* eg_blob = lilv_new_uri(world, "http://example.org/blob");
LilvNode* blob = lilv_world_get(world, plugin_uri, eg_blob, NULL);
- TEST_ASSERT(lilv_node_is_literal(blob));
+ assert(lilv_node_is_literal(blob));
lilv_node_free(blob);
lilv_node_free(eg_blob);
LilvNode* eg_junk = lilv_new_uri(world, "http://example.org/junk");
LilvNode* junk = lilv_world_get(world, plugin_uri, eg_junk, NULL);
- TEST_ASSERT(lilv_node_is_literal(junk));
+ assert(lilv_node_is_literal(junk));
lilv_node_free(junk);
lilv_node_free(eg_junk);