Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
status_matchers.h File Reference
#include <memory>
#include <ostream>
#include <string>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "gmock/gmock-matchers.h"

Go to the source code of this file.

Classes

class  testing::status::internal::IsOkAndHoldsMatcherImpl< StatusOrType >
 
class  testing::status::internal::IsOkAndHoldsMatcher< InnerMatcher >
 Implements IsOkAndHolds(m) as a polymorphic matcher. More...
 
class  testing::status::internal::MonoIsOkMatcherImpl< T >
 
class  testing::status::internal::IsOkMatcher
 Implements IsOk() as a polymorphic matcher. More...
 
class  testing::status::internal::StatusIsMatcherCommonImpl
 
class  testing::status::internal::MonoStatusIsMatcherImpl< T >
 
class  testing::status::internal::StatusIsMatcher
 Implements StatusIs() as a polymorphic matcher. More...
 

Namespaces

namespace  testing
 
namespace  testing::status
 
namespace  testing::status::internal
 Implementation of IsOk().
 

Macros

#define EXPECT_OK(expression)
 
#define ASSERT_OK(expression)
 
#define STATUS_MATCHERS_IMPL_CONCAT_INNER_(x, y)
 
#define STATUS_MATCHERS_IMPL_CONCAT_(x, y)
 
#define ASSERT_OK_AND_ASSIGN(lhs, rexpr)
 
#define ASSERT_OK_AND_ASSIGN_IMPL_(statusor, lhs, rexpr)
 

Functions

const ::absl::Status & testing::status::GetStatus (const ::absl::Status &status)
 
template<typename T >
const ::absl::Status & testing::status::GetStatus (const ::absl::StatusOr< T > &status)
 
template<typename InnerMatcher >
internal::IsOkAndHoldsMatcher< typename std::decay< InnerMatcher >::type > testing::status::IsOkAndHolds (InnerMatcher &&inner_matcher)
 
internal::IsOkMatcher testing::status::IsOk ()
 Returns a gMock matcher that matches a Status or StatusOr<> which is OK.
 
template<typename CodeMatcher , typename MessageMatcher >
internal::StatusIsMatcher testing::status::StatusIs (CodeMatcher code_matcher, MessageMatcher message_matcher)
 
template<typename CodeMatcher >
internal::StatusIsMatcher testing::status::StatusIs (CodeMatcher code_matcher)
 

Macro Definition Documentation

◆ ASSERT_OK

#define ASSERT_OK ( expression)
Value:
ASSERT_THAT(expression, ::testing::status::IsOk())
internal::IsOkMatcher IsOk()
Returns a gMock matcher that matches a Status or StatusOr<> which is OK.

Definition at line 277 of file status_matchers.h.

◆ ASSERT_OK_AND_ASSIGN

#define ASSERT_OK_AND_ASSIGN ( lhs,
rexpr )
Value:
STATUS_MATCHERS_IMPL_CONCAT_(_status_or_value, __COUNTER__), lhs, rexpr)
#define STATUS_MATCHERS_IMPL_CONCAT_(x, y)
#define ASSERT_OK_AND_ASSIGN_IMPL_(statusor, lhs, rexpr)

Definition at line 284 of file status_matchers.h.

◆ ASSERT_OK_AND_ASSIGN_IMPL_

#define ASSERT_OK_AND_ASSIGN_IMPL_ ( statusor,
lhs,
rexpr )
Value:
auto statusor = (rexpr); \
ASSERT_TRUE(statusor.ok()) << statusor.status(); \
lhs = std::move(statusor.value())

Definition at line 288 of file status_matchers.h.

◆ EXPECT_OK

#define EXPECT_OK ( expression)
Value:
EXPECT_THAT(expression, ::testing::status::IsOk())

Macros for testing the results of functions that return absl::Status or absl::StatusOr<T> (for any type T).

Definition at line 276 of file status_matchers.h.

◆ STATUS_MATCHERS_IMPL_CONCAT_

#define STATUS_MATCHERS_IMPL_CONCAT_ ( x,
y )
Value:
IntegerValue y
const Variable x
Definition qp_tests.cc:127
#define STATUS_MATCHERS_IMPL_CONCAT_INNER_(x, y)

Definition at line 280 of file status_matchers.h.

◆ STATUS_MATCHERS_IMPL_CONCAT_INNER_

#define STATUS_MATCHERS_IMPL_CONCAT_INNER_ ( x,
y )
Value:
x##y

Definition at line 279 of file status_matchers.h.