From 60e70a369588b154f119770efc6ae7cd7f51d30d Mon Sep 17 00:00:00 2001 From: Rick Winter Date: Thu, 17 Dec 2020 18:39:55 -0800 Subject: [PATCH] Fix doxygen comments for Operation (#1210) --- .../azure-core/inc/azure/core/operation.hpp | 4 +- .../inc/azure/core/operation_status.hpp | 37 +++++++++++++------ sdk/core/azure-core/test/ut/CMakeLists.txt | 2 +- sdk/core/azure-core/test/ut/operation.cpp | 2 +- .../azure-core/test/ut/operation_status.cpp | 5 +++ 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/sdk/core/azure-core/inc/azure/core/operation.hpp b/sdk/core/azure-core/inc/azure/core/operation.hpp index 24e76402f..6049809ad 100644 --- a/sdk/core/azure-core/inc/azure/core/operation.hpp +++ b/sdk/core/azure-core/inc/azure/core/operation.hpp @@ -96,9 +96,9 @@ namespace Azure { namespace Core { std::unique_ptr Poll(Context& context) { return PollInternal(context); } /** - * @brief Periodically calls the server till the long-running operation completes; + * @brief Periodically calls the server till the long-running operation completes. * - * @param period Time in milliseconds to wait between polls + * @param period Time in milliseconds to wait between polls. * * @return Response the final result of the long-running operation. */ diff --git a/sdk/core/azure-core/inc/azure/core/operation_status.hpp b/sdk/core/azure-core/inc/azure/core/operation_status.hpp index 1761a9880..342836d69 100644 --- a/sdk/core/azure-core/inc/azure/core/operation_status.hpp +++ b/sdk/core/azure-core/inc/azure/core/operation_status.hpp @@ -3,7 +3,7 @@ /** * @file - * @brief Valid states for long-running Operations. Services can extend upon the default set of + * @brief Valid states for long-running Operations. Services can extend upon the default set of * values. */ @@ -24,28 +24,28 @@ namespace Azure { namespace Core { public: /** - * @brief Construct a #OperationStatus with \p value. + * @brief Construct an #OperationStatus with \p value. * - * @param value A non-absent value to initialize with. + * @param value The value to initialize with. */ explicit OperationStatus(const std::string& value) : m_value(value) {} /** - * @brief Construct a #OperationStatus with \p value. + * @brief Construct an #OperationStatus with \p value. * - * @param value A non-absent value to initialize with. + * @param value The value to initialize with. */ explicit OperationStatus(std::string&& value) : m_value(std::move(value)) {} /** - * @brief Construct a #OperationStatus with \p value. + * @brief Construct an #OperationStatus with \p value. * - * @param value A non-absent value to initialize with. + * @param value The value to initialize with. */ explicit OperationStatus(const char* value) : m_value(value) {} /** - * @brief Compare two #OperationStatus objects + * @brief Compare two #OperationStatus objects for equality. * - * @param other A #OperationStatus to compare with. + * @param other An #OperationStatus to compare with. * * @return `true` if the states have the same string representation. `false` otherwise. */ @@ -55,7 +55,7 @@ namespace Azure { namespace Core { } /** - * @brief Compare two #OperationStatus objects + * @brief Compare two #OperationStatus objects for equality. * * @param other A #OperationStatus to compare with. * @@ -64,14 +64,29 @@ namespace Azure { namespace Core { bool operator!=(const OperationStatus& other) const noexcept { return !(*this == other); } /** - * @brief The std::string representation of the value + * @brief The std::string representation of the operation status. */ const std::string& Get() const noexcept { return m_value; } + /** + * @brief The #Operation is Not Started. + */ static const OperationStatus NotStarted; + /** + * @brief The #Operation is Running. + */ static const OperationStatus Running; + /** + * @brief The #Operation Succeeded. + */ static const OperationStatus Succeeded; + /** + * @brief The #Operation was Cancelled. + */ static const OperationStatus Cancelled; + /** + * @brief The #Operation Failed. + */ static const OperationStatus Failed; }; diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index 03831a70e..f7c414bc4 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -45,7 +45,7 @@ add_executable ( operation.cpp operation_status.cpp pipeline.cpp - policy.cpp + policy.cpp simplified_header.cpp string.cpp telemetry_policy.cpp diff --git a/sdk/core/azure-core/test/ut/operation.cpp b/sdk/core/azure-core/test/ut/operation.cpp index 2341221e5..fc6898c03 100644 --- a/sdk/core/azure-core/test/ut/operation.cpp +++ b/sdk/core/azure-core/test/ut/operation.cpp @@ -34,7 +34,7 @@ TEST(Operation, Poll) EXPECT_TRUE(operation.HasValue()); auto result = operation.Value(); - EXPECT_TRUE(result == "StringOperation-Completed"); + EXPECT_EQ(result, "StringOperation-Completed"); } TEST(Operation, PollUntilDone) diff --git a/sdk/core/azure-core/test/ut/operation_status.cpp b/sdk/core/azure-core/test/ut/operation_status.cpp index 029f1a228..95c7b8e3e 100644 --- a/sdk/core/azure-core/test/ut/operation_status.cpp +++ b/sdk/core/azure-core/test/ut/operation_status.cpp @@ -48,4 +48,9 @@ TEST(OperationStatus, Custom) OperationStatus status4 = OperationStatus(std::string("CustomValue")); EXPECT_EQ(status4.Get(), "CustomValue"); EXPECT_NE(status4, OperationStatus::NotStarted); + + EXPECT_EQ(status1, status2); + EXPECT_EQ(status2, status3); + EXPECT_EQ(status3, status4); + }