File tree Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ file(GLOB UTILS_XML_SRC "${CMAKE_CURRENT_SOURCE_DIR}/utils/memory/*.cpp")
22
22
23
23
file (GLOB AWS_CPP_SDK_CORE_TESTS_SRC
24
24
"${CMAKE_CURRENT_SOURCE_DIR} /RunTests.cpp"
25
+ "${CMAKE_CURRENT_SOURCE_DIR} /VersionTests.cpp"
25
26
${AWS_SRC}
26
27
${AWS_AUTH_SRC}
27
28
${AWS_CONFIG_SRC}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License").
5
+ * You may not use this file except in compliance with the License.
6
+ * A copy of the License is located at
7
+ *
8
+ * http://aws.amazon.com/apache2.0
9
+ *
10
+ * or in the "license" file accompanying this file. This file is distributed
11
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
+ * express or implied. See the License for the specific language governing
13
+ * permissions and limitations under the License.
14
+ */
15
+
16
+ #include < aws/external/gtest.h>
17
+ #include < aws/core/utils/StringUtils.h>
18
+ #include < aws/core/Version.h>
19
+
20
+ using namespace Aws ::Version;
21
+
22
+ TEST (VersionTest, TestMajorMinorPatch)
23
+ {
24
+ auto major = GetVersionMajor ();
25
+ auto minor = GetVersionMinor ();
26
+ auto patch = GetVersionPatch ();
27
+ Aws::String version;
28
+ version += Aws::Utils::StringUtils::to_string (major);
29
+ version += " ." ;
30
+ version += Aws::Utils::StringUtils::to_string (minor);
31
+ version += " ." ;
32
+ version += Aws::Utils::StringUtils::to_string (patch);
33
+ auto versionString = GetVersionString ();
34
+ ASSERT_STREQ (versionString, version.c_str ());
35
+ }
Original file line number Diff line number Diff line change @@ -316,6 +316,10 @@ endif(MSVC)
316
316
add_library (${PROJECT_NAME} ${LIBTYPE} ${AWS_NATIVE_SDK_SRC} )
317
317
add_library (AWS::${PROJECT_NAME} ALIAS ${PROJECT_NAME} )
318
318
319
+ target_compile_definitions (${PROJECT_NAME} PUBLIC "AWS_SDK_VERSION_MAJOR=${AWSSDK_VERSION_MAJOR} " )
320
+ target_compile_definitions (${PROJECT_NAME} PUBLIC "AWS_SDK_VERSION_MINOR=${AWSSDK_VERSION_MINOR} " )
321
+ target_compile_definitions (${PROJECT_NAME} PUBLIC "AWS_SDK_VERSION_PATCH=${AWSSDK_VERSION_PATCH} " )
322
+
319
323
set (Core_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR} /include/" )
320
324
321
325
if (PLATFORM_CUSTOM )
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ namespace Aws
19
19
{
20
20
namespace Version
21
21
{
22
- AWS_CORE_API const char * GetVersionString ();
22
+ AWS_CORE_API const char * GetVersionString ();
23
+ AWS_CORE_API unsigned GetVersionMajor ();
24
+ AWS_CORE_API unsigned GetVersionMinor ();
25
+ AWS_CORE_API unsigned GetVersionPatch ();
23
26
} // namespace Version
24
27
} // namespace Aws
Original file line number Diff line number Diff line change 14
14
*/
15
15
16
16
#define AWS_SDK_VERSION_STRING "@AWSSDK_VERSION_STRING@"
17
- #define AWS_SDK_VERSION_MAJOR @AWSSDK_VERSION_MAJOR@
18
- #define AWS_SDK_VERSION_MINOR @AWSSDK_VERSION_MINOR@
19
- #define AWS_SDK_VERSION_PATCH @AWSSDK_VERSION_PATCH@
Original file line number Diff line number Diff line change @@ -24,6 +24,21 @@ namespace Version
24
24
{
25
25
return AWS_SDK_VERSION_STRING;
26
26
}
27
+
28
+ unsigned GetVersionMajor ()
29
+ {
30
+ return AWS_SDK_VERSION_MAJOR;
31
+ }
32
+
33
+ unsigned GetVersionMinor ()
34
+ {
35
+ return AWS_SDK_VERSION_MINOR;
36
+ }
37
+
38
+ unsigned GetVersionPatch ()
39
+ {
40
+ return AWS_SDK_VERSION_PATCH;
41
+ }
27
42
} // namespace Version
28
43
} // namespace Aws
29
44
You can’t perform that action at this time.
0 commit comments