File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,10 @@ namespace Aws
48
48
String UUID::ToString () const
49
49
{
50
50
String uuidStr;
51
- uuidStr.reserve (AWS_UUID_STR_LEN);
52
-
51
+ uuidStr.resize (AWS_UUID_STR_LEN);
53
52
auto outBuf = ByteBufFromEmptyArray (reinterpret_cast <const uint8_t *>(uuidStr.data ()), uuidStr.capacity ());
54
53
aws_uuid_to_str (&m_uuid, &outBuf);
54
+ uuidStr.resize (outBuf.len );
55
55
return uuidStr;
56
56
}
57
57
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ add_test_case(TestProviderDefaultChainGet)
44
44
add_test_case (HttpRequestTestCreateDestroy )
45
45
add_test_case (Sigv4SigningTestCreateDestroy )
46
46
add_test_case (Sigv4SigningTestSimple )
47
+ add_test_case (UUIDToString )
47
48
48
49
generate_cpp_test_driver (${TEST_BINARY_NAME} )
49
50
Original file line number Diff line number Diff line change
1
+
2
+ /*
3
+ * Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License").
6
+ * You may not use this file except in compliance with the License.
7
+ * A copy of the License is located at
8
+ *
9
+ * http://aws.amazon.com/apache2.0
10
+ *
11
+ * or in the "license" file accompanying this file. This file is distributed
12
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
+ * express or implied. See the License for the specific language governing
14
+ * permissions and limitations under the License.
15
+ */
16
+ #include < aws/crt/Api.h>
17
+ #include < aws/crt/UUID.h>
18
+
19
+ #include < aws/testing/aws_test_harness.h>
20
+ #include < iostream>
21
+ #include < utility>
22
+
23
+ static int s_UUIDToString (Aws::Crt::Allocator *allocator, void *ctx)
24
+ {
25
+ (void )ctx;
26
+ Aws::Crt::ApiHandle apiHandle (allocator);
27
+ Aws::Crt::UUID Uuid;
28
+ Aws::Crt::String uuidStr = Uuid.ToString ();
29
+ ASSERT_TRUE (uuidStr.length () != 0 );
30
+ ASSERT_TRUE (Uuid == Aws::Crt::UUID (uuidStr));
31
+
32
+ return AWS_ERROR_SUCCESS;
33
+ }
34
+
35
+ AWS_TEST_CASE (UUIDToString, s_UUIDToString)
You can’t perform that action at this time.
0 commit comments