MySQL 8.0.40
Source Code Documentation
helpers.h File Reference
#include <algorithm>
#include <list>
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include "mysql/harness/loader.h"

Go to the source code of this file.

Macros

#define EXPECT_SETEQ(S1, S2)   EXPECT_PRED_FORMAT2(AssertSetEqual, S1, S2)
 
#define EXPECT_SECTION_AVAILABLE(S, L)    EXPECT_PRED_FORMAT2(AssertLoaderSectionAvailable, L, S)
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &out, const std::vector< T > &v)
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const std::list< T > &v)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &out, const std::pair< A, B > &p)
 
template<typename SeqCont1 , typename SeqCont2 >
::testing::AssertionResult AssertSetEqual (const char *seq1_expr, const char *seq2_expr, const SeqCont1 &seq1, const SeqCont2 &seq2)
 
::testing::AssertionResult AssertLoaderSectionAvailable (const char *loader_expr, const char *section_expr, mysql_harness::Loader *loader, const std::string &section_name)
 
void register_test_logger ()
 Just register logger with DIM for unit tests (unlike init_log(), which also initializes it) More...
 
void init_test_logger (const std::list< std::string > &additional_log_domains={}, const std::string &log_folder="", const std::string &log_filename="")
 Register + init logger for unit tests. More...
 

Macro Definition Documentation

◆ EXPECT_SECTION_AVAILABLE

#define EXPECT_SECTION_AVAILABLE (   S,
  L 
)     EXPECT_PRED_FORMAT2(AssertLoaderSectionAvailable, L, S)

◆ EXPECT_SETEQ

#define EXPECT_SETEQ (   S1,
  S2 
)    EXPECT_PRED_FORMAT2(AssertSetEqual, S1, S2)

Function Documentation

◆ AssertLoaderSectionAvailable()

::testing::AssertionResult AssertLoaderSectionAvailable ( const char *  loader_expr,
const char *  section_expr,
mysql_harness::Loader loader,
const std::string &  section_name 
)

◆ AssertSetEqual()

template<typename SeqCont1 , typename SeqCont2 >
::testing::AssertionResult AssertSetEqual ( const char *  seq1_expr,
const char *  seq2_expr,
const SeqCont1 &  seq1,
const SeqCont2 &  seq2 
)

◆ init_test_logger()

void init_test_logger ( const std::list< std::string > &  additional_log_domains = {},
const std::string &  log_folder = "",
const std::string &  log_filename = "" 
)

Register + init logger for unit tests.

Creates application ("main") logger, which will write all messages to the console. Almost all of our code relies on the fact of "main" logger being initialized, so it is necessary to provide one for unit tests. Also, some unit tests analyze log output, and expect that output to exist on stderr.

◆ operator<<() [1/3]

template<typename T >
std::ostream & operator<< ( std::ostream &  out,
const std::list< T > &  v 
)

◆ operator<<() [2/3]

template<typename A , typename B >
std::ostream & operator<< ( std::ostream &  out,
const std::pair< A, B > &  p 
)

◆ operator<<() [3/3]

template<typename T >
std::ostream & operator<< ( std::ostream &  out,
const std::vector< T > &  v 
)

◆ register_test_logger()

void register_test_logger ( )

Just register logger with DIM for unit tests (unlike init_log(), which also initializes it)