diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:53:36 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | d7fce849783d54c15658431552e1bd2eeec54378 (patch) | |
tree | e80bfd113c7ce4f5a8d43bf138c6e71aff5e1327 | |
parent | 1f937eeed6fb02d10bec9751936e9aa7119d98c2 (diff) | |
download | lilv-d7fce849783d54c15658431552e1bd2eeec54378.tar.gz lilv-d7fce849783d54c15658431552e1bd2eeec54378.tar.bz2 lilv-d7fce849783d54c15658431552e1bd2eeec54378.zip |
Simplify test setup code
-rw-r--r-- | test/bad_syntax.lv2/test_bad_syntax.c | 12 | ||||
-rw-r--r-- | test/failed_instantiation.lv2/test_failed_instantiation.c | 12 | ||||
-rw-r--r-- | test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c | 12 | ||||
-rw-r--r-- | test/lib_descriptor.lv2/test_lib_descriptor.c | 12 | ||||
-rw-r--r-- | test/missing_descriptor.lv2/test_missing_descriptor.c | 12 | ||||
-rw-r--r-- | test/missing_name.lv2/test_missing_name.c | 12 | ||||
-rw-r--r-- | test/missing_plugin.lv2/test_missing_plugin.c | 12 | ||||
-rw-r--r-- | test/missing_port.lv2/test_missing_port.c | 12 | ||||
-rw-r--r-- | test/missing_port_name.lv2/test_missing_port_name.c | 12 | ||||
-rw-r--r-- | test/test_state.c | 6 |
10 files changed, 10 insertions, 104 deletions
diff --git a/test/bad_syntax.lv2/test_bad_syntax.c b/test/bad_syntax.lv2/test_bad_syntax.c index b8d62c4..39729d4 100644 --- a/test/bad_syntax.lv2/test_bad_syntax.c +++ b/test/bad_syntax.lv2/test_bad_syntax.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/bad-syntax" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/failed_instantiation.lv2/test_failed_instantiation.c b/test/failed_instantiation.lv2/test_failed_instantiation.c index bcd889d..ed46d5a 100644 --- a/test/failed_instantiation.lv2/test_failed_instantiation.c +++ b/test/failed_instantiation.lv2/test_failed_instantiation.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/failed-instantiation" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c index fbc85dc..9a9641b 100644 --- a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c +++ b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/failed-lib-descriptor" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c index 1608ae9..e971662 100644 --- a/test/lib_descriptor.lv2/test_lib_descriptor.c +++ b/test/lib_descriptor.lv2/test_lib_descriptor.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/lib-descriptor" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c index dd912db..b737048 100644 --- a/test/missing_descriptor.lv2/test_missing_descriptor.c +++ b/test/missing_descriptor.lv2/test_missing_descriptor.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/missing-descriptor" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/missing_name.lv2/test_missing_name.c b/test/missing_name.lv2/test_missing_name.c index e657961..a8df1ab 100644 --- a/test/missing_name.lv2/test_missing_name.c +++ b/test/missing_name.lv2/test_missing_name.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/missing-name" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c index 2c9cc78..6eb1705 100644 --- a/test/missing_plugin.lv2/test_missing_plugin.c +++ b/test/missing_plugin.lv2/test_missing_plugin.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/missing-plugin" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/missing_port.lv2/test_missing_port.c b/test/missing_port.lv2/test_missing_port.c index f94747f..463fd63 100644 --- a/test/missing_port.lv2/test_missing_port.c +++ b/test/missing_port.lv2/test_missing_port.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/missing-port" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/missing_port_name.lv2/test_missing_port_name.c b/test/missing_port_name.lv2/test_missing_port_name.c index 108ba70..58e8120 100644 --- a/test/missing_port_name.lv2/test_missing_port_name.c +++ b/test/missing_port_name.lv2/test_missing_port_name.c @@ -3,16 +3,10 @@ #undef NDEBUG -#include "../src/filesystem.h" - #include "lilv/lilv.h" -#include "serd/serd.h" #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/missing-port-name" @@ -28,12 +22,8 @@ main(int argc, char** argv) LilvWorld* world = lilv_world_new(); // Load test plugin bundle - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); diff --git a/test/test_state.c b/test/test_state.c index 8477e69..d0ccdfe 100644 --- a/test/test_state.c +++ b/test/test_state.c @@ -233,9 +233,7 @@ static const LilvPlugin* load_test_plugin(const TestContext* const ctx) { LilvWorld* world = ctx->env->world; - uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(LILV_TEST_BUNDLE); - SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); - LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, LILV_TEST_BUNDLE); LilvNode* plugin_uri = lilv_new_uri(world, TEST_PLUGIN_URI); lilv_world_load_bundle(world, bundle_uri); @@ -245,8 +243,6 @@ load_test_plugin(const TestContext* const ctx) lilv_node_free(plugin_uri); lilv_node_free(bundle_uri); - serd_node_free(&bundle); - free(abs_bundle); assert(plugin); return plugin; |