diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-03-28 23:59:20 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-03-28 23:59:20 +0000 |
commit | a1c94fece82f2445e538de0c93345d34c4abdf17 (patch) | |
tree | 5e1f771efae1c221db8ecc3efaa4eb00632e19d8 /tests/test_uuid.c | |
parent | 71206544a770eb4004294ed13613a7cde6e0e056 (diff) |
Add uuid wrapper API call ast_uuid_generate_str().
* Updated test_uuid.c to test the new API call.
* Made system use the new API call to eliminate "10's of lines" where
used.
* Fixed untested ast_strdup() return in stasis_subscribe() by eliminating
the need for it. struct stasis_subscription now contains the uniqueid[]
string.
* Fixed some issues in exchangecal_write_event():
Create uid with enough space for a UUID string to avoid a realloc.
Fix off by one error if the calendar event provided a UUID string.
There is no need to check for NULL before calling ast_free().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_uuid.c')
-rw-r--r-- | tests/test_uuid.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test_uuid.c b/tests/test_uuid.c index a76ec8b39..70769ef95 100644 --- a/tests/test_uuid.c +++ b/tests/test_uuid.c @@ -50,7 +50,23 @@ AST_TEST_DEFINE(uuid) break; } - /* First, make sure that we can generate a UUID */ + /* Use method of generating UUID directly as a string. */ + ast_uuid_generate_str(uuid_str, sizeof(uuid_str)); + if (strlen(uuid_str) != (AST_UUID_STR_LEN - 1)) { + ast_test_status_update(test, "Failed to directly generate UUID string\n"); + goto end; + } + ast_test_status_update(test, "Generate UUID direct to string, got %s\n", uuid_str); + + /* Now convert the direct UUID string to a UUID */ + uuid1 = ast_str_to_uuid(uuid_str); + if (!uuid1) { + ast_test_status_update(test, "Unable to convert direct UUID string %s to UUID\n", uuid_str); + goto end; + } + ast_free(uuid1); + + /* Make sure that we can generate a UUID */ uuid1 = ast_uuid_generate(); if (!uuid1) { ast_test_status_update(test, "Unable to generate a UUID\n"); @@ -71,7 +87,7 @@ AST_TEST_DEFINE(uuid) goto end; } - ast_test_status_update(test, "Converted uuid to string, got %s\n", uuid_str); + ast_test_status_update(test, "Second generated UUID converted to string, got %s\n", uuid_str); /* Now convert the string back to a UUID */ uuid2 = ast_str_to_uuid(uuid_str); |