1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/external/gtest.h>
7 #include <aws/core/utils/StringUtils.h>
8 #include <aws/core/Version.h>
9 
10 using namespace Aws::Version;
11 
TEST(VersionTest,TestMajorMinorPatch)12 TEST(VersionTest, TestMajorMinorPatch)
13 {
14     auto major = GetVersionMajor();
15     auto minor = GetVersionMinor();
16     auto patch = GetVersionPatch();
17     Aws::String version;
18     version += Aws::Utils::StringUtils::to_string(major);
19     version += ".";
20     version += Aws::Utils::StringUtils::to_string(minor);
21     version += ".";
22     version += Aws::Utils::StringUtils::to_string(patch);
23     Aws::String versionString = GetVersionString();
24     versionString = versionString.substr(0,versionString.find('-'));
25     std::cout << versionString << std::endl;
26     ASSERT_STREQ(versionString.c_str(), version.c_str());
27 }
28 
TEST(VersionTest,TestCompilerVersionString)29 TEST(VersionTest, TestCompilerVersionString)
30 {
31     Aws::String compiler = GetCompilerVersionString();
32 #if defined(_MSC_VER)
33     const auto expected = "MSVC";
34 #elif defined(__clang__)
35     const auto expected = "Clang";
36 #elif defined(__GNUC__)
37     const auto expected = "GCC";
38 #else
39     const auto expected = "Unknown";
40 #endif
41     ASSERT_EQ(0u, compiler.find(expected));
42 }
43