diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:42:50 +0000 |
commit | 8cb83eee5a58b1fad74c34094ce3afb9e430b5a4 (patch) | |
tree | a9b2e7baeca1be40eb734371e3c8b11b02294497 /tests/helpers/test_uuid_namespace.c | |
parent | Initial commit. (diff) | |
download | util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.tar.xz util-linux-8cb83eee5a58b1fad74c34094ce3afb9e430b5a4.zip |
Adding upstream version 2.33.1.upstream/2.33.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/helpers/test_uuid_namespace.c')
-rw-r--r-- | tests/helpers/test_uuid_namespace.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/helpers/test_uuid_namespace.c b/tests/helpers/test_uuid_namespace.c new file mode 100644 index 0000000..1522ed2 --- /dev/null +++ b/tests/helpers/test_uuid_namespace.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../libuuid/src/uuid.h" + +static void get_template(const char *ns) +{ + const uuid_t *uuidptr; + char buf[UUID_STR_LEN]; + + uuidptr = uuid_get_template(ns); + if (uuidptr == NULL) + strcpy(buf, "NULL"); + else + uuid_unparse_lower(*uuidptr, buf); + + printf("uuid_get_template %s returns %s\n", (ns ? ns : "NULL"), buf); +} + +int main(void) +{ + get_template("dns"); + + get_template("url"); + + get_template("oid"); + + get_template("x500"); + + get_template(NULL); + get_template(""); + get_template("unknown"); + + exit(0); +} + |