BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslim::TestUtil Struct Reference

#include <bslim_testutil.h>

Static Public Member Functions

static bool compareText (bslstl::StringRef lhs, bslstl::StringRef rhs, bsl::ostream &errorStream=bsl::cout)
 
template<class FUNCTION_PTR >
static FUNCTION_PTR makeFunctionCallNonInline (FUNCTION_PTR functionPtr)
 
template<class T >
static const T & debugRep (const T &arg)
 
static int debugRep (wchar_t arg)
 

Detailed Description

This struct provides a namespace for a suite of utility functions that facilitate the creation of BDE-style test drivers.

Member Function Documentation

◆ compareText()

static bool bslim::TestUtil::compareText ( bslstl::StringRef  lhs,
bslstl::StringRef  rhs,
bsl::ostream &  errorStream = bsl::cout 
)
static

Return true if the specified lhs has the same value as the specified rhs, and false otherwise. Optionally specify an errorStream on which, if lhs and rhs are not the same', a description of how the two strings differ will be written. If errorStream is not supplied, stdout is used.

◆ debugRep() [1/2]

template<class T >
static const T & bslim::TestUtil::debugRep ( const T &  arg)
inlinestatic

◆ debugRep() [2/2]

static int bslim::TestUtil::debugRep ( wchar_t  arg)
inlinestatic

◆ makeFunctionCallNonInline()

template<class FUNCTION_PTR >
FUNCTION_PTR bslim::TestUtil::makeFunctionCallNonInline ( FUNCTION_PTR  functionPtr)
inlinestatic

Return the specified functionPtr (expected to be a static function pointer) without modification. The value of functionPtr is transformed through identityPtr so that if the caller is in a different module, the compiler will have no way of knowing that this is an identity transform and thus no way of inlining the call.

Note: the Windows optimizer is still able to inline the call, it may be comparing the result of this function with the argument and branching to inline on equality and call on inequality, so the Windows optimizer has to be turned off with # pragma optimize("", off).

Also note that even with an optimizer that can't figure out that this is an identity transform, there is still the possibility of chaining the call.


The documentation for this struct was generated from the following file: