BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls::BslTestUtil Struct Reference

#include <bsls_bsltestutil.h>

Static Public Member Functions

static void flush ()
 Write any unwritten text in the output buffer to stdout.
 
static void printStringNoFlush (const char *s)
 
static void printTab ()
 
template<class TYPE >
static void callDebugprint (const TYPE &object, const char *leadingString=0, const char *trailingString=0)
 
template<class FUNCTION_PTR >
static FUNCTION_PTR makeFunctionCallNonInline (FUNCTION_PTR functionPtr)
 

Detailed Description

This class provides a namespace for utilities that are useful when writing a test driver that is not permitted to use the standard C++ iostream facilities, which is typical of test drivers in the bsl package group.

Member Function Documentation

◆ callDebugprint()

template<class TYPE >
void bsls::BslTestUtil::callDebugprint ( const TYPE &  object,
const char *  leadingString = 0,
const char *  trailingString = 0 
)
static

Print the value of the specified object of the parameterized TYPE to the console. Optionally specify a leadingString, which will be printed before object, and a trailingString, which will be printed after object. If leadingString is 0, then nothing will be printed before object. If trailingString is 0, then nothing will be printed after object.

◆ flush()

static void bsls::BslTestUtil::flush ( )
static

◆ makeFunctionCallNonInline()

template<class FUNCTION_PTR >
FUNCTION_PTR bsls::BslTestUtil::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.

◆ printStringNoFlush()

static void bsls::BslTestUtil::printStringNoFlush ( const char *  s)
static

Print to the console the specified string, s. Note that the underlying stream is not flushed.

◆ printTab()

static void bsls::BslTestUtil::printTab ( )
static

Print to the console a tab character, and then flush the underlying stream to ensure the text is written.


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