BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::FormatterTestUtil_Impl< t_CHAR > Struct Template Reference

#include <bslfmt_formattertestutil.h>

Detailed Description

template<class t_CHAR>
struct bslfmt::FormatterTestUtil_Impl< t_CHAR >

This struct provides a namespace for implementations of test functions that verify the correctness of formatting performed by bslfmt tools, where those implementations are common for all character types. Those implementations were moved to a separate struct to avoid code duplication. Due to the limitations of template argument deduction, it is necessary to explicitly specialize the FormatterTestUtil template for char and wchar_t. This struct contains that part of the implementation.

See bslfmt_formattertestutil

Static Public Member Functions

template<class t_TYPE >
static bool testEvaluateFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value)
 
template<class t_TYPE , class t_ARG >
static bool testEvaluateFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_ONE_ARG fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG) arg)
 
template<class t_TYPE , class t_ARG_1 , class t_ARG_2 >
static bool testEvaluateFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_TWO_ARGS fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_1) arg1, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_2) arg2)
 
template<class t_TYPE >
static bool testEvaluateVFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, bsl::basic_string_view< t_CHAR > fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value)
 
template<class t_TYPE , class t_ARG >
static bool testEvaluateVFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, bsl::basic_string_view< t_CHAR > fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG) arg)
 
template<class t_TYPE , class t_ARG_1 , class t_ARG_2 >
static bool testEvaluateVFormat (bsl::string *message, bsl::basic_string_view< t_CHAR > expectedResult, bool alsoTestOracle, bsl::basic_string_view< t_CHAR > fmtStr, BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE) value, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_1) arg1, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_2) arg2)
 
template<class t_TYPE >
static bool testParseFailure (bsl::string *message, bool alsoTestOracle, bsl::basic_string_view< t_CHAR > fmtStr)
 
template<class t_TYPE >
static BSLS_KEYWORD_CONSTEXPR_CPP20 bool testParseFormat (bsl::string *message, bool alsoTestOracle, BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_P fmtStr)
 
template<class t_TYPE >
static bool testParseVFormat (bsl::string *message, bool alsoTestOracle, bsl::basic_string_view< t_CHAR > fmtStr)
 

Member Function Documentation

◆ testEvaluateFormat() [1/3]

template<class t_CHAR >
template<class t_TYPE >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value 
)
static

Compare the specified expectedResult with the result of formatting the specified value with the specified fmtStr obtained using a bslfmt::formatter specialization for the (template parameter) t_TYPE. If the specified alsoTestOracle is true, also compare the expectedResult with the result of formatting obtained using a standard library implementation. Optionally specify arg, arg1 and arg2 to be passed to the formatter as additional arguments. Return true if these strings are equal, otherwise store a description of the error in the specified output message and return false.

Note
Note that fmtStr is required to be a compile time constant expression.

◆ testEvaluateFormat() [2/3]

template<class t_CHAR >
template<class t_TYPE , class t_ARG >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_ONE_ARG  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)  arg 
)
static

◆ testEvaluateFormat() [3/3]

template<class t_CHAR >
template<class t_TYPE , class t_ARG_1 , class t_ARG_2 >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_TWO_ARGS  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_1)  arg1,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_2)  arg2 
)
static

◆ testEvaluateVFormat() [1/3]

template<class t_CHAR >
template<class t_TYPE >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateVFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
bsl::basic_string_view< t_CHAR >  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value 
)
static

Compare the specified expectedResult with the result of formatting the specified value with the specified fmtStr obtained using a bslfmt::formatter specialization for the (template parameter) t_TYPE. If the specified alsoTestOracle is true, also compare the expectedResult with the result of formatting obtained using a standard library implementation. Optionally specify arg, arg1 and arg2 to be passed to the formatter as additional arguments. Return true if these strings are equal, otherwise store a description of the error in the specified output message and return false.

Note
Note that fmtStr is NOT required to be a compile time constant expression.

◆ testEvaluateVFormat() [2/3]

template<class t_CHAR >
template<class t_TYPE , class t_ARG >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateVFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
bsl::basic_string_view< t_CHAR >  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG)  arg 
)
static

◆ testEvaluateVFormat() [3/3]

template<class t_CHAR >
template<class t_TYPE , class t_ARG_1 , class t_ARG_2 >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testEvaluateVFormat ( bsl::string message,
bsl::basic_string_view< t_CHAR >  expectedResult,
bool  alsoTestOracle,
bsl::basic_string_view< t_CHAR >  fmtStr,
BSLS_COMPILERFEATURES_FORWARD_REF(t_TYPE)  value,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_1)  arg1,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARG_2)  arg2 
)
static

◆ testParseFailure()

template<class t_CHAR >
template<class t_TYPE >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testParseFailure ( bsl::string message,
bool  alsoTestOracle,
bsl::basic_string_view< t_CHAR >  fmtStr 
)
static

Verify that the specified fmtStr has a valid structure and, if so, parse it using a bslfmt::formatter specialization for the (template parameter) t_TYPE. If the specified alsoTestOracle is true, also parse fmtStr using a standard library implementation. Return true if fmtStr is valid and the exception IS thrown during the parsing, and return false otherwise.

◆ testParseFormat()

template<class t_CHAR >
template<class t_TYPE >
BSLS_KEYWORD_CONSTEXPR_CPP20 bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testParseFormat ( bsl::string message,
bool  alsoTestOracle,
BSLFMT_FORMATTER_TEST_UTIL_BASIC_FORMAT_STRING_P  fmtStr 
)
static

Verify that the specified fmtStr has a valid structure and, if so, parse it using a bslfmt::formatter specialization for the (template parameter) t_TYPE. If the specified alsoTestOracle is true, also parse fmtStr using a standard library implementation. Return true if fmtStr is valid and NO exception is thrown during the parsing, and return false otherwise.

Note
Note that fmtStr is required to be a compile time constant expression.

◆ testParseVFormat()

template<class t_CHAR >
template<class t_TYPE >
bool bslfmt::FormatterTestUtil_Impl< t_CHAR >::testParseVFormat ( bsl::string message,
bool  alsoTestOracle,
bsl::basic_string_view< t_CHAR >  fmtStr 
)
static

Verify that the specified fmtStr has a valid structure and, if so, parse it using a bslfmt::formatter specialization for the (template parameter) t_TYPE. If the specified alsoTestOracle is true, also parse fmtStr using a standard library implementation. Return true if fmtStr is valid and NO exception is thrown during the parsing, and return false otherwise.

Note
Note that fmtStr is not required to be a compile time constant expression.

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