9 #ifndef LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H 10 #define LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H 16 #include "gmock/gmock-matchers.h" 17 #include "gtest/gtest-printers.h" 24 std::vector<std::shared_ptr<ErrorInfoBase>>
Infos;
26 bool Success()
const {
return Infos.empty(); }
38 OS << (Err.
Success() ?
"succeeded" :
"failed");
40 const char *Delim =
" (";
53 *Out <<
"succeeded with value " << ::testing::PrintToString(*Item.
Exp);
55 PrintTo(static_cast<const ErrorHolder &>(Item), Out);
62 : ValueMatcher(ValueMatcher) {}
65 operator ::testing::Matcher<const llvm::Optional<T> &>()
const {
66 return ::testing::MakeMatcher(
67 new Impl<T>(::testing::SafeMatcherCast<T>(ValueMatcher)));
71 class Impl :
public ::testing::MatcherInterface<const llvm::Optional<T> &> {
73 explicit Impl(const ::testing::Matcher<T> &ValueMatcher)
74 : ValueMatcher(ValueMatcher) {}
77 testing::MatchResultListener *L)
const override {
78 return Input && ValueMatcher.MatchAndExplain(Input.
getValue(), L);
82 *OS <<
"has a value that ";
83 ValueMatcher.DescribeTo(OS);
86 *OS <<
"does not have a value that ";
87 ValueMatcher.DescribeTo(OS);
91 testing::Matcher<T> ValueMatcher;
95 InnerMatcher ValueMatcher;
101 template <
class InnerMatcher>
This class represents lattice values for constants.
raw_os_ostream - A raw_ostream that writes to an std::ostream.
Tagged union holding either a T or a Error.
void PrintTo(const ErrorHolder &Err, std::ostream *Out)
ValueIsMatcher(InnerMatcher ValueMatcher)
const T & getValue() const LLVM_LVALUE_FUNCTION
Analysis containing CSE Info
std::vector< std::shared_ptr< ErrorInfoBase > > Infos
void DescribeTo(std::ostream *OS) const override
SmallString< 128 > getInputFileDirectory(const char *Argv0)
bool MatchAndExplain(const llvm::Optional< T > &Input, testing::MatchResultListener *L) const override
ExpectedHolder(ErrorHolder Err, Expected< T > &Exp)
Impl(const ::testing::Matcher< T > &ValueMatcher)
void DescribeNegationTo(std::ostream *OS) const override
detail::ValueIsMatcher< InnerMatcher > ValueIs(const InnerMatcher &ValueMatcher)
Matches an llvm::Optional<T> with a value that conforms to an inner matcher.