BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlt::FormatTestUtil Struct Reference

#include <bdlt_formattestutil.h>

Detailed Description

This struct serves as a namespace for static functions to facilitate testing of formatting of bdlt value types – used in the implementation of the above macros, and for conversion between bsl::string and bsl::wstring.

See bdlt_formattestutil

Static Public Member Functions

static bsl::string narrow (const bsl::wstring_view &viewIn)
 
template<class t_VALUE_TYPE >
static bool testFormat (bsl::string *message, const bsl::string_view &exp, const bsl::string_view &format, const t_VALUE_TYPE &value)
 
template<class t_VALUE_TYPE , class t_ARG_TYPE >
static bool testFormatArg (bsl::string *message, const bsl::string_view &exp, const bsl::string_view &format, const t_VALUE_TYPE &value, const t_ARG_TYPE &arg)
 
static void widen (bsl::wstring *result, const bsl::string_view &viewIn)
 

Member Function Documentation

◆ narrow()

static bsl::string bdlt::FormatTestUtil::narrow ( const bsl::wstring_view viewIn)
static

Convert the string referred to by the specified viewIn from wchar_t to char and return the resulting bsl::string by value.

Precondition
The behavior is undefined unless all of the wchar_t values in viewIn are ascii.

◆ testFormat()

template<class t_VALUE_TYPE >
bool bdlt::FormatTestUtil::testFormat ( bsl::string message,
const bsl::string_view exp,
const bsl::string_view format,
const t_VALUE_TYPE &  value 
)
static

Compare the specified exp to the string result of calling bsl::format with the specified format and value, and return true if they match and false otherwise. If they do not match, load into the specified message a value describing the inputs and result of the failed test. Perform these tests for both char-based and wchar_t-based strings.

◆ testFormatArg()

template<class t_VALUE_TYPE , class t_ARG_TYPE >
bool bdlt::FormatTestUtil::testFormatArg ( bsl::string message,
const bsl::string_view exp,
const bsl::string_view format,
const t_VALUE_TYPE &  value,
const t_ARG_TYPE &  arg 
)
static

Compare the specified exp to the string result of calling bsl::format with the specified format, value, and arg, and return true if they match and false otherwise. If they do not match, load into the specified message a value describing the inputs and result of the failed test. Perform these tests for both char-based and wchar_t-based strings.

◆ widen()

void bdlt::FormatTestUtil::widen ( bsl::wstring result,
const bsl::string_view viewIn 
)
inlinestatic

Load the wstring version of the specified char-based string view viewIn into the specified result.

Precondition
The behavior is undefined unless all of the char values in viewIn are ascii.

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