38 char uuid_str[AST_UUID_STR_LEN];
39 enum ast_test_result_state res = AST_TEST_FAIL;
44 info->category =
"/main/uuid/";
45 info->summary =
"UUID unit test";
47 "This tests basic UUID operations to ensure they work properly";
48 return AST_TEST_NOT_RUN;
55 if (strlen(uuid_str) != (AST_UUID_STR_LEN - 1)) {
56 ast_test_status_update(
test,
"Failed to directly generate UUID string\n");
59 ast_test_status_update(
test,
"Generate UUID direct to string, got %s\n", uuid_str);
64 ast_test_status_update(
test,
"Unable to convert direct UUID string %s to UUID\n", uuid_str);
72 ast_test_status_update(
test,
"Unable to generate a UUID\n");
78 ast_test_status_update(
test,
"We generated a nil UUID. Something is wrong\n");
85 if (strlen(uuid_str) != (AST_UUID_STR_LEN - 1)) {
86 ast_test_status_update(
test,
"Failed to convert the UUID to a string\n");
90 ast_test_status_update(
test,
"Second generated UUID converted to string, got %s\n", uuid_str);
95 ast_test_status_update(
test,
"Unable to convert string %s to UUID\n", uuid_str);
101 ast_test_status_update(
test,
"UUIDs that should be identical are different\n");
108 ast_test_status_update(
test,
"Unable to copy UUID\n");
114 ast_test_status_update(
test,
"UUIDs that should be identical are different\n");
119 ast_test_status_update(
test,
"UUIDs that should be identical are different\n");
127 ast_test_status_update(
test,
"UUID that was cleared does not appear to be nil\n");
140 static int unload_module(
void)
142 AST_TEST_UNREGISTER(uuid);
146 static int load_module(
void)
148 AST_TEST_REGISTER(uuid);
Asterisk main include file. File version handling, generic pbx functions.
struct ast_uuid * ast_uuid_copy(struct ast_uuid *src)
Make a copy of a UUID.
int ast_uuid_is_nil(struct ast_uuid *uuid)
Check if a UUID is a nil UUID (all 0s)
Universally unique identifier support.
void ast_uuid_clear(struct ast_uuid *uuid)
Clear a UUID by setting it to be a nil UUID (all 0s)
struct ast_uuid * ast_str_to_uuid(char *str)
Convert a string to a UUID.
struct ast_uuid * ast_uuid_generate(void)
Generate a UUID.
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
int ast_uuid_compare(struct ast_uuid *left, struct ast_uuid *right)
Compare two UUIDs.
char * ast_uuid_to_str(struct ast_uuid *uuid, char *buf, size_t size)
Convert a UUID to a string.
#define AST_TEST_DEFINE(hdr)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.