mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-06-30 11:47:48 +00:00
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#include <gtest/gtest.h>
|
|
#include <gmock/gmock.h>
|
|
#include <string>
|
|
#include <sstream>
|
|
|
|
namespace ck_tile::test {
|
|
|
|
// Returns a string highlighting differences between actual and expected.
|
|
// Differences are enclosed in brackets with actual and expected parts separated by '|'.
|
|
std::string inlineDiff(const std::string& actual, const std::string& expected);
|
|
|
|
// A convenience alias for inlineDiff to improve readability in test assertions.
|
|
std::string formatInlineDiff(const std::string& actual, const std::string& expected);
|
|
|
|
// Gmock matcher for string equality with inline diff output on failure
|
|
class StringEqWithDiffMatcher : public ::testing::MatcherInterface<std::string>
|
|
{
|
|
public:
|
|
explicit StringEqWithDiffMatcher(const std::string& expected);
|
|
|
|
bool MatchAndExplain(std::string actual,
|
|
::testing::MatchResultListener* listener) const override;
|
|
|
|
void DescribeTo(std::ostream* os) const override;
|
|
void DescribeNegationTo(std::ostream* os) const override;
|
|
|
|
private:
|
|
std::string expected_;
|
|
};
|
|
|
|
// Factory function for the StringEqWithDiff matcher
|
|
::testing::Matcher<std::string> StringEqWithDiff(const std::string& expected);
|
|
|
|
} // namespace ck_tile::test
|