Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
namespace fs = std::filesystem;
using namespace nx::core;

namespace nx::core
{
// Concept that checks if T is an instance of Result<T>
template <class T>
concept IsResult = requires(T x) {

Check failure on line 47 in test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]
{ Result{x} } -> std::same_as<T>;

Check failure on line 48 in test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]

Check failure on line 48 in test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]

Check failure on line 48 in test/UnitTestCommon/include/simplnx/UnitTest/UnitTestCommon.hpp

View workflow job for this annotation

GitHub Actions / clang_format_pr

code should be clang-formatted [-Wclang-format-violations]
};
Comment on lines +48 to +49

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
{ Result{x} } -> std::same_as<T>;
};
{
Result{x}
} -> std::same_as<T>;
};

} // namespace nx::core

#define SIMPLNX_RESULT_CATCH_PRINT(result) \
for(const auto& warning : (result).warnings()) \
{ \
Expand All @@ -54,12 +63,20 @@
}

#define SIMPLNX_RESULT_REQUIRE_VALID(result) \
SIMPLNX_RESULT_CATCH_PRINT(result); \
REQUIRE((result).valid());
do \
{ \
const IsResult auto NX_TEST_RESULT = (result); \
SIMPLNX_RESULT_CATCH_PRINT(NX_TEST_RESULT); \
REQUIRE(NX_TEST_RESULT.valid()); \
} while(false);

#define SIMPLNX_RESULT_REQUIRE_INVALID(result) \
SIMPLNX_RESULT_CATCH_PRINT(result); \
REQUIRE((result).invalid());
do \
{ \
const IsResult auto NX_TEST_RESULT = (result); \
SIMPLNX_RESULT_CATCH_PRINT(NX_TEST_RESULT); \
REQUIRE(NX_TEST_RESULT.invalid()); \
} while(false);

namespace nx::core
{
Expand Down
Loading