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

Feature: Improved UUID testing

parent 4f733cba
......@@ -30,6 +30,19 @@
static igloo_ro_t g_instance;
static void check_uuid(const char *ref)
{
size_t len = strlen(ref);
igloo_tap_test("strlen(ref) == 36", len == 36);
igloo_tap_diagnostic("Ref is:");
igloo_tap_diagnostic(ref);
if (len == 36) {
igloo_tap_test("ref[8] == '-' && ref[13] == '-' && ref[18] == '-' && ref[23] == '-'", ref[8] == '-' && ref[13] == '-' && ref[18] == '-' && ref[23] == '-');
}
}
static void group_sp(void)
{
const char *ref = NULL;
......@@ -37,7 +50,7 @@ static void group_sp(void)
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);
check_uuid(ref);
igloo_tap_test_success("igloo_sp_unref", igloo_sp_unref(&ref, g_instance));
igloo_tap_test("ref == NULL", ref == NULL);
}
......@@ -50,7 +63,7 @@ static void group_cstr(void)
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);
check_uuid(ref);
free(ref);
}
}
......
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