static void test_configure_invalid(void) { struct oio_url_s *url; url = oio_url_init(""); g_assert(url == NULL); url = oio_url_init("/"); g_assert(url == NULL); }
static void _dump_cid (const char *s) { static gchar bad[] = { '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', 0 }; char str_id[128]; const char *dst; struct oio_url_s *url = oio_url_init (s); if (url && NULL != oio_url_get_id(url)) { memset(str_id, 0, sizeof(str_id)); oio_str_bin2hex(oio_url_get_id(url), oio_url_get_id_size(url), str_id, sizeof(str_id)); dst = str_id; } else { dst = bad; } g_print("%s %s\n", dst, s); oio_url_clean(url); }
static void test_configure_valid (void) { static struct test_data_s tab[] = { { "/NS/ACCT/JFS", "NS/ACCT/JFS/", "NS", "ACCT", "JFS", OIOURL_DEFAULT_TYPE, NULL, "9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F"}, { "NS/ACCT/JFS//1.", "NS/ACCT/JFS//1.", "NS", "ACCT", "JFS", OIOURL_DEFAULT_TYPE, "1.", "9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F"}, TEST_END }; guint idx = 0; for (struct test_data_s *th=tab; th->url ;th++) { struct oio_url_s *url; url = oio_url_init(th->url); g_assert(url != NULL); _test_url (idx++, url, th); oio_url_pclean (&url); url = _init_url (th); g_assert(url != NULL); _test_url (idx++, url, th); oio_url_pclean (&url); } }