MySQL 9.6.0
Source Code Documentation
unittest_assertions.h File Reference

Experimental API header. More...

#include <gtest/gtest.h>
#include "mysql/debugging/my_scoped_trace.h"
#include "mysql/utils/return_status.h"

Go to the source code of this file.

Namespaces

namespace  mysql
 
namespace  mysql::debugging
 

Macros

#define ASSERT_OK(EXPRESSION)    ASSERT_EQ((EXPRESSION), mysql::utils::Return_status::ok)
 Equivalent to ASSERT_EQ(EXPRESSION, Return_status::ok) More...
 
#define ASSERT_ERROR(EXPRESSION)    ASSERT_EQ((EXPRESSION), mysql::utils::Return_status::error)
 Equivalent to ASSERT_EQ(EXPRESSION, Return_status::error) More...
 
#define ASSERT_VOID(EXPRESSION)
 Assert that the result type of the given expression is void, and invoke it. More...
 

Functions

void mysql::debugging::test_eq_one_way (const auto &left, const auto &right, bool equal=true)
 Assert that both (left==right) and !(left!=right) have the same truth values as equal. More...
 
void mysql::debugging::test_eq (const auto &left, const auto &right, bool equal=true)
 Assert that (left==right), (right==left), !(left!=right), and !(right!=left) all have the same truth values as equal. More...
 
void mysql::debugging::test_cmp_one_way (const auto &left, const auto &right, auto cmp)
 For all 7 comparison operators, assert that (left OP right) == (cmp OP 0). More...
 
void mysql::debugging::test_cmp (const auto &left, const auto &right, std::strong_ordering cmp)
 For all 7 comparison operators, assert that (left OP right) == (cmp OP 0), and that (right OP left) == (0 OP cmp). More...
 
void mysql::debugging::test_cmp (const auto &left, const auto &right, int cmp)
 For all 7 comparison operators, assert that (left OP right) == (cmp OP 0), and that (right OP left) == (0 OP cmp). More...
 

Detailed Description

Experimental API header.

Macro Definition Documentation

◆ ASSERT_ERROR

#define ASSERT_ERROR (   EXPRESSION)     ASSERT_EQ((EXPRESSION), mysql::utils::Return_status::error)

Equivalent to ASSERT_EQ(EXPRESSION, Return_status::error)

◆ ASSERT_OK

#define ASSERT_OK (   EXPRESSION)     ASSERT_EQ((EXPRESSION), mysql::utils::Return_status::ok)

Equivalent to ASSERT_EQ(EXPRESSION, Return_status::ok)

◆ ASSERT_VOID

#define ASSERT_VOID (   EXPRESSION)
Value:
do { \
static_assert(std::same_as<decltype(EXPRESSION), void>); \
(EXPRESSION); \
} while (false)

Assert that the result type of the given expression is void, and invoke it.