Commit d4a96a95 authored by Philipp Schafft's avatar Philipp Schafft 🦁
Browse files

Feature: Added tests for igloo_uuid_new_random_sp(), and igloo_uuid_new_random_cstr()

parent fb41b41b
......@@ -21,6 +21,7 @@
#endif
#include <stdlib.h>
#include <string.h>
#include <igloo/tap.h>
#include <igloo/igloo.h>
......@@ -29,11 +30,38 @@
static igloo_ro_t g_instance;
static void group_sp(void)
{
const char *ref = NULL;
igloo_tap_test_success("igloo_uuid_new_random_sp", igloo_uuid_new_random_sp(&ref, g_instance));
igloo_tap_test("ref != NULL", ref != NULL);
if (ref) {
igloo_tap_test("strlen(ref) == 36", strlen(ref) == 36);
igloo_tap_test_success("igloo_sp_unref", igloo_sp_unref(&ref, g_instance));
igloo_tap_test("ref == NULL", ref == NULL);
}
}
static void group_cstr(void)
{
char *ref = NULL;
igloo_tap_test_success("igloo_uuid_new_random_cstr", igloo_uuid_new_random_cstr(&ref, g_instance));
igloo_tap_test("ref != NULL", ref != NULL);
if (ref) {
igloo_tap_test("strlen(ref) == 36", strlen(ref) == 36);
free(ref);
}
}
int main (void)
{
igloo_tap_init();
igloo_tap_exit_on(igloo_TAP_EXIT_ON_FIN, NULL);
igloo_tap_test_success("igloo_initialize", igloo_initialize(&g_instance));
igloo_tap_group_run("sp", group_sp);
igloo_tap_group_run("cstr", group_cstr);
igloo_tap_test_success("unref instance", igloo_ro_unref(&g_instance));
igloo_tap_fin();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment