diff options
author | David Robillard <d@drobilla.net> | 2016-07-31 03:22:58 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-31 03:24:29 -0400 |
commit | b0339e5350f4b9f41f534a7f17e4bec4947fcd5f (patch) | |
tree | a0745c0dba3078c751e2d985342194619a23525e /tests | |
parent | 34547e1405b12b0f3ec8ce82e69e05ac11495ce8 (diff) | |
download | sratom-b0339e5350f4b9f41f534a7f17e4bec4947fcd5f.tar.gz sratom-b0339e5350f4b9f41f534a7f17e4bec4947fcd5f.tar.bz2 sratom-b0339e5350f4b9f41f534a7f17e4bec4947fcd5f.zip |
Add sratom_set_env() for setting prefixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sratom_test.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/tests/sratom_test.c b/tests/sratom_test.c index a093462..c869224 100644 --- a/tests/sratom_test.c +++ b/tests/sratom_test.c @@ -76,7 +76,7 @@ test_fail(const char* fmt, ...) } static int -test(bool top_level, bool pretty_numbers) +test(SerdEnv* env, bool top_level, bool pretty_numbers) { LV2_URID_Map map = { NULL, urid_map }; LV2_URID_Unmap unmap = { NULL, urid_unmap }; @@ -84,6 +84,7 @@ test(bool top_level, bool pretty_numbers) lv2_atom_forge_init(&forge, &map); Sratom* sratom = sratom_new(&map); + sratom_set_env(sratom, env); sratom_set_pretty_numbers(sratom, pretty_numbers); sratom_set_object_mode( sratom, @@ -357,18 +358,36 @@ test(bool top_level, bool pretty_numbers) return 0; } -int -main(void) +static int +test_env(SerdEnv* env) { - if (test(false, false)) { + if (test(env, false, false)) { return 1; - } else if (test(true, false)) { + } else if (test(env, true, false)) { return 1; - } else if (test(false, true)) { + } else if (test(env, false, true)) { return 1; - } else if (test(true, true)) { + } else if (test(env, true, true)) { return 1; } return 0; } + +int +main(void) +{ + // Test with no environment + if (test_env(NULL)) { + return 1; + } + + // Test with a prefix defined + SerdEnv* env = serd_env_new(NULL); + serd_env_set_prefix_from_strings( + env, (const uint8_t*)"eg", (const uint8_t*)"http://example.org/"); + test_env(env); + serd_env_free(env); + + return 0; +} |