BloombergLP::bdlt::FormatTestUtil::testFormatArg

Compare bsl::format output of value and arg to an expected string.

Synopsis

Declared in <bdlt_formattestutil.h>

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

Description

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.

Return Value

true if the formatted result matches exp, and false otherwise

Parameters

NameDescription
messageloaded with a failure description when the comparison fails
expexpected formatted result
formatformat string passed to bsl::format
valuevalue to format
argadditional argument passed to bsl::format